Skip to content
Snippets Groups Projects
Commit d4a300c2 authored by srosse's avatar srosse
Browse files

no-jira: remove unused classes

parent e8cabd7f
No related branches found
No related tags found
No related merge requests found
/*
* ch/ethz/pfplms/scorm/cmi/FormatChecker.java
* This file is part of the PfPLMS SCORM-1.2 API-adapter core
* A class to handle SCORM-1.2 cmi value formats
*
* Copyright (C) 2004 Matthai Kurian
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package ch.ethz.pfplms.scorm.cmi.components;
import gnu.regexp.RE;
import java.util.Hashtable;
public class FormatChecker {
private static Hashtable<String, RE> regexp = new Hashtable<String, RE>();
private static RE RE_Feedback = null;
private static Hashtable<String, RE> regexpFeedback = new Hashtable<String, RE>();
private static RE RE_CMIBlank;
private static RE RE_CMIBoolean;
private static RE RE_CMIDecimal;
private static RE RE_CMIIdentifier;
private static RE RE_CMIInteger;
private static RE RE_CMISInteger;
private static RE RE_CMIString255;
private static RE RE_CMIString4096;
private static RE RE_CMITime;
private static RE RE_CMITimespan;
private static RE RE_choice;
private static RE RE_fill_in;
private static RE RE_likert;
private static RE RE_matching;
private static RE RE_numeric;
private static RE RE_performance;
private static RE RE_sequencing;
private static RE RE_true_false;
private static RE RE_Credit;
private static RE RE_Entry;
private static RE RE_Exit;
private static RE RE_Interaction;
private static RE RE_Mode;
private static RE RE_Result;
private static RE RE_Status;
private static RE RE_TimeLimitAction;
public FormatChecker () {
try {
RE_CMIBlank = new RE ("", RE.REG_NOTEOL);
RE_CMIBoolean = new RE ("^(true|false)$", RE.REG_NOTEOL);
RE_CMIDecimal = new RE ("^[-+]??(\\d+)??(\\.)??(\\d)+$", RE.REG_NOTEOL);
RE_CMIIdentifier = new RE ("^\\S{1,255}$", RE.REG_NOTEOL);
RE_CMIInteger = new RE ("^\\d{1,5}$", RE.REG_NOTEOL);
RE_CMISInteger = new RE ("^[-+]??\\d{1,5}$", RE.REG_NOTEOL);
RE_CMIString255 = new RE ("^[\\S\\s]{0,255}$", RE.REG_NOTEOL);
RE_CMIString4096 = new RE ("^[\\S\\s]{0,4096}$", RE.REG_NOTEOL);
RE_CMITime = new RE ("^(0[0-9]|1[0-9]|2[1-3]):[0-5]\\d:[0-5]\\d(\\.((\\d)|(\\d\\d)))*$", RE.REG_NOTEOL);
RE_CMITimespan = new RE ("^(\\d){2,4}:(\\d\\d)\\:(\\d\\d)((\\.)((\\d)|(\\d\\d)))*$", RE.REG_NOTEOL);
RE_choice = new RE ("^([a-z\\d])?((,)([a-z\\d]))*$|^{([a-z\\d])??((,)([a-z\\d]))*}$", RE.REG_NOTEOL);
RE_fill_in = new RE ("^[\\S\\s]{0,255}$", RE.REG_NOTEOL);
RE_likert = new RE ("^[a-z0-9]?$", RE.REG_NOTEOL);
//RE_matching = new RE ("^([a-z\\d]\\.[a-z\\d])??(,([a-z\\d]\\.[a-z\\d]))*$|^{([a-z\\d]\\.[a-z\\d])??(,([a-z\\d]\\.[a-z\\d]))*}$", RE.REG_NOTEOL);
RE_matching = new RE ("^([a-zA-Z\\d]+\\.[a-zA-Z\\d])??(,([a-zA-Z\\d]+\\.[a-zA-Z\\d]))*$|^{([a-zA-Z\\d]+\\.[a-zA-Z\\d])??(,([a-zA-Z\\d]+\\.[a-zA-Z\\d]))*}$", RE.REG_NOTEOL);
RE_numeric = new RE ("^[-+]??(\\d+)??(\\.)??(\\d)+$", RE.REG_NOTEOL);
RE_performance = new RE ("^[\\S\\s]{0,255}$", RE.REG_NOTEOL);
RE_sequencing = new RE ("^([a-z\\d])??(,[a-z\\d])*$", RE.REG_NOTEOL);
RE_true_false = new RE ("^(t|f|0|1)$", RE.REG_NOTEOL);
RE_Credit = new RE ("^(credit|no-credit)$", RE.REG_NOTEOL);
RE_Entry = new RE ("^(ab-initio|resume)??$", RE.REG_NOTEOL);
RE_Exit = new RE ("^(time-out|suspend|logout)??$", RE.REG_NOTEOL);
RE_Interaction = new RE ("^(true-false|choice|fill-in|matching|performance|likert|sequencing|numeric)$", RE.REG_NOTEOL);
RE_Mode = new RE ("^(normal|review|browse)$", RE.REG_NOTEOL);
RE_Result = new RE ("^(correct|wrong|unanticipated|neutral|([+-]?\\d+)\\.?\\d*)$", RE.REG_NOTEOL);
RE_Status = new RE ("^(passed|completed|failed|incomplete|browsed|not attempted)$", RE.REG_NOTEOL);
RE_TimeLimitAction = new RE ("^(exit,message|exit,no message|continue,message|continue,no message)$", RE.REG_NOTEOL);
} catch (Exception e) {/**/}
regexpFeedback.put ("choice", RE_choice);
regexpFeedback.put ("fill-in", RE_fill_in);
regexpFeedback.put ("likert", RE_likert);
regexpFeedback.put ("matching", RE_matching);
regexpFeedback.put ("numeric", RE_numeric);
regexpFeedback.put ("performance", RE_performance);
regexpFeedback.put ("sequencing", RE_sequencing);
regexpFeedback.put ("true-false", RE_true_false);
regexp.put ("cmi.core.student_id", RE_CMIIdentifier);
regexp.put ("cmi.core.student_name", RE_CMIString255);
regexp.put ("cmi.core.lesson_location", RE_CMIString255);
regexp.put ("cmi.core.credit", RE_Credit);
regexp.put ("cmi.core.lesson_status", RE_Status);
regexp.put ("cmi.core.entry", RE_Entry);
regexp.put ("cmi.core.score.raw", RE_CMIDecimal);
regexp.put ("cmi.core.score.max", RE_CMIDecimal);
regexp.put ("cmi.core.score.min", RE_CMIDecimal);
regexp.put ("cmi.core.total_time", RE_CMITimespan);
regexp.put ("cmi.core.lesson_mode", RE_Mode);
regexp.put ("cmi.core.exit", RE_Exit);
regexp.put ("cmi.core.session_time", RE_CMITimespan);
regexp.put ("cmi.suspend_data", RE_CMIString4096);
regexp.put ("cmi.launch_data", RE_CMIString4096);
regexp.put ("cmi.comments", RE_CMIString4096);
regexp.put ("cmi.comments_from_lms", RE_CMIString4096);
regexp.put ("cmi.objectives.n.id", RE_CMIIdentifier);
regexp.put ("cmi.objectives.n.score.raw", RE_CMIDecimal);
regexp.put ("cmi.objectives.n.score.max", RE_CMIDecimal);
regexp.put ("cmi.objectives.n.score.min", RE_CMIDecimal);
regexp.put ("cmi.objectives.n.status", RE_Status);
regexp.put ("cmi.student_data.mastery_score", RE_CMIDecimal);
regexp.put ("cmi.student_data.max_time_allowed", RE_CMITimespan);
regexp.put ("cmi.student_data.time_limit_action", RE_TimeLimitAction);
regexp.put ("cmi.student_preference.audio", RE_CMISInteger);
regexp.put ("cmi.student_preference.language", RE_CMIString255);
regexp.put ("cmi.student_preference.speed", RE_CMISInteger);
regexp.put ("cmi.student_preference.text", RE_CMISInteger);
regexp.put ("cmi.interactions.n.id", RE_CMIIdentifier);
regexp.put ("cmi.interactions.n.objectives.n.id", RE_CMIIdentifier);
regexp.put ("cmi.interactions.n.time", RE_CMITime);
regexp.put ("cmi.interactions.n.type", RE_Interaction);
regexp.put ("cmi.interactions.n.weighting", RE_CMIDecimal);
regexp.put ("cmi.interactions.n.result", RE_Result);
regexp.put ("cmi.interactions.n.latency", RE_CMITimespan);
}
public void setFeedbackType (String fb) {
RE_Feedback = null;
if (!fb.equals("")) {
RE o = regexpFeedback.get (fb);
if (o != null) {
RE_Feedback = o;
}
}
}
public boolean check (String el, String val) {
RE tr;
if (el.equals("cmi.interactions.n.correct_responses.n.pattern") ||
el.equals("cmi.interactions.n.student_response") ){
tr = RE_Feedback;
} else {
tr = regexp.get (el);
}
if (tr == null) return false;
if (tr.getMatch (val) != null) return true;
return false;
}
}
Contains patches to libraries (JARs).
\ No newline at end of file
Assorted Tips and Tricks for TestNG:
====================================
* If you specify a method as @Test in the following way:
@Test
public void xy() {}
and don't specify the class as a whole as @Test - then only
that method is invoked - no other @BeforeXXX or @AfterXXX
Therefore make sure to mark the whole class as @Test when you
have @BeforeXXX or @AfterXXX in that class!
* Alternative, if you have a class which is not defined as @Test
(this can include a base class for example where it is not
feasible to mark it as @Test - esp you dont want to add
any group to base classes thus the @Test wouldnt even have
an effect):
you can always mark a method with alwaysRun:
@AfterMethod(alwaysRun=true)
public void tearDown() {}
This makes sure that this method is run, when a test method
in this or a subclass is run
* Running a single class and a group of classes can have sideeffects
on @BeforeXXX/@AfterXXX:
When explicitly running a class as a TestNG Test (in Eclipse),
then all @BeforeXXX/@AfterXXX methods are executed, irrespective
of the alwaysRun - that is what you would normally expect.
BUT WATCH OUT! When you run the same test as part of a group
or package, then @BeforeXXX/@AfterXXX is ONLY RUN when
the whole class is marked as @Test:
@Test
public class MyTestClass { }
\ No newline at end of file
/**
* OLAT - Online Learning and Training<br>
* http://www.olat.org
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br>
* University of Zurich, Switzerland.
*/
package org.olat.test.tutorial.testng.dependencies;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
@Test(groups = {"dependencies"} )
public class ClassA {
@BeforeSuite
void beforeSuite() {
System.out.println("Before Suite");
}
@AfterSuite
void afterSuite() {
System.out.println("After Suite");
}
@BeforeTest
void beforeTest() {
System.out.println("Before Test");
}
@AfterTest
void afterTest() {
System.out.println("After Test");
}
@BeforeClass
void beforeClass() {
System.out.println("Before Class");
}
@AfterClass
void afterClass() {
System.out.println("After Class");
}
@BeforeMethod
void beforeMethod() {
System.out.println("Before Method");
}
@AfterMethod
void afterMethod() {
System.out.println("After Method");
}
}
/**
* OLAT - Online Learning and Training<br>
* http://www.olat.org
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br>
* University of Zurich, Switzerland.
*/
package org.olat.test.tutorial.testng.dependencies;
import org.testng.annotations.Test;
public class ClassB {
@Test(groups = {"dependencies"} )
public void methodB() {
System.out.println("MethodB");
}
}
/**
* OLAT - Online Learning and Training<br>
* http://www.olat.org
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br>
* University of Zurich, Switzerland.
*/
package org.olat.test.tutorial.testng.dependencies;
import org.testng.annotations.Test;
public class ClassC {
@Test(groups = {"dependencies"} )
public void methodC() {
System.out.println("methodC");
}
}
/**
* OLAT - Online Learning and Training<br>
* http://www.olat.org
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br>
* University of Zurich, Switzerland.
*/
package org.olat.test.tutorial.testng.parallel;
import junit.framework.TestCase;
import org.testng.annotations.Test;
public class TestParallel extends TestCase {
@Test
public void testMethod1() throws Exception {
System.out.println("method1...");
Thread.sleep(5000);
System.out.println("end method1.");
}
@Test
public void testMethod2() throws Exception {
System.out.println("method2...");
Thread.sleep(5000);
System.out.println("end method2.");
}
@Test
public void testMethod3() throws Exception {
System.out.println("method3...");
Thread.sleep(5000);
System.out.println("end method3.");
}
@Test
public void testMethod4() throws Exception {
System.out.println("method4...");
Thread.sleep(5000);
System.out.println("end method4.");
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment