[jboss-svn-commits] JBL Code SVN: r27698 - in labs/jbosstm/trunk/ArjunaJTS/orbportability: tests/classes/com/hp/mwtests/orbportability/initialisation and 6 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Jul 7 09:42:30 EDT 2009
Author: jhalliday
Date: 2009-07-07 09:42:30 -0400 (Tue, 07 Jul 2009)
New Revision: 27698
Removed:
labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/orbspecific/hporb/
labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/orbspecific/orbix2000/
Modified:
labs/jbosstm/trunk/ArjunaJTS/orbportability/build.xml
labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/ORBInitialisationTest.java
labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/PostSetTest.java
labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/PropertyInitTest.java
labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/PropertyInitTest2.java
labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/PropertyInitTest3.java
labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/PropertyInitTest4.java
labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/orbinfo/ORBInfoTest.java
labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/orbinstance/MultipleORBInstances.java
labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/orbspecific/orbinstance/SimpleServer.java
labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/services/ServiceTestSetup.java
labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/shutdown/OAPrePostShutdownTest.java
labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/shutdown/ORBPrePostShutdownTest.java
Log:
Update unit tests. JBTM-576
Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/build.xml
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/build.xml 2009-07-07 13:09:56 UTC (rev 27697)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/build.xml 2009-07-07 13:42:30 UTC (rev 27698)
@@ -22,7 +22,7 @@
<property name="modulename" value="orbportability"/>
- <property name="global.ext.test.libs" value="TestingFramework.jar"/>
+ <property name="global.ext.test.libs" value="junit-4.6.jar"/>
<import file="../sharedbuild.xml"/>
@@ -80,6 +80,31 @@
</propertyfile>
</target>
+ <target name="run.tests">
+ <run.tests.macro>
+ <additional.classpath>
+ <path refid="jacorb.classpath"/>
+ </additional.classpath>
+ <tests>
+ <fileset dir="tests/classes">
+ <exclude name="**/initialisation/postinit/**"/>
+ <exclude name="**/initialisation/postset/**"/>
+ <exclude name="**/initialisation/preinit/**"/>
+ <exclude name="**/initialisation/TestAttributeCallback.java"/>
+ <exclude name="**/SimpleObjectImpl.java"/>
+ <exclude name="**/TestAttributeCallback.java"/>
+ <exclude name="**/PrePostTestCallback.java"/>
+
+
+ <!-- these ones need fixing -->
+ <exclude name="**/PropertyInitTest.java"/>
+ <exclude name="**/PropertyInitTest3.java"/>
+
+ </fileset>
+ </tests>
+ </run.tests.macro>
+ </target>
+
</project>
Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/ORBInitialisationTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/ORBInitialisationTest.java 2009-07-07 13:09:56 UTC (rev 27697)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/ORBInitialisationTest.java 2009-07-07 13:42:30 UTC (rev 27698)
@@ -31,17 +31,17 @@
package com.hp.mwtests.orbportability.initialisation;
-import org.jboss.dtf.testframework.unittest.Test;
-
import com.arjuna.orbportability.orb.*;
import com.arjuna.orbportability.*;
-import com.arjuna.orbportability.OA;
import com.arjuna.orbportability.ORB;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
/**
* @author Richard Begg
*/
-public class ORBInitialisationTest extends Test implements TestAttributeCallback
+public class ORBInitialisationTest implements TestAttributeCallback
{
public final static int NONE = 0, PREINIT = 1, POSTINIT = 2, INVALID = 3;
private final static String[] STATE_TEXT = { "NONE","PREINIT","POSTINIT","INVALID" };
@@ -50,133 +50,119 @@
public static String getStateText(int value)
{
- return(STATE_TEXT[value]);
+ return(STATE_TEXT[value]);
}
public void preInitAttributeCalled()
{
- logInformation("Previous State: " + getStateText(_currentState));
+ System.out.println("Previous State: " + getStateText(_currentState));
- switch (_currentState)
- {
- case NONE:
- case POSTINIT:
- _currentState = PREINIT;
- break;
- default:
- case PREINIT :
- _currentState = INVALID;
- break;
- }
+ switch (_currentState)
+ {
+ case NONE:
+ case POSTINIT:
+ _currentState = PREINIT;
+ break;
+ default:
+ case PREINIT :
+ _currentState = INVALID;
+ break;
+ }
- logInformation(" Current State: " + getStateText(_currentState));
+ System.out.println(" Current State: " + getStateText(_currentState));
}
public void postInitAttributeCalled()
{
- logInformation("Previous State: " + getStateText(_currentState));
+ System.out.println("Previous State: " + getStateText(_currentState));
- switch (_currentState)
- {
- case NONE:
- case PREINIT:
- _currentState = POSTINIT;
- break;
- default:
- case POSTINIT :
- _currentState = INVALID;
- break;
- }
+ switch (_currentState)
+ {
+ case NONE:
+ case PREINIT:
+ _currentState = POSTINIT;
+ break;
+ default:
+ case POSTINIT :
+ _currentState = INVALID;
+ break;
+ }
- logInformation(" Current State: " + getStateText(_currentState));
+ System.out.println(" Current State: " + getStateText(_currentState));
}
- public void run(String[] args)
+ @Test
+ public void test()
{
ORB orb = ORB.getInstance("main_orb");
RootOA oa = RootOA.getRootOA(orb);
- try
- {
- _currentState = NONE;
+ try {
+ _currentState = NONE;
- /*
- * Registering attributes with ORB
- */
- orb.addAttribute( new PreTestAttribute( this ) );
- orb.addAttribute( new PostTestAttribute( this ) );
+ /*
+ * Registering attributes with ORB
+ */
+ orb.addAttribute( new PreTestAttribute( this ) );
+ orb.addAttribute( new PostTestAttribute( this ) );
/*
- * Initialise the ORB and OA
- */
- logInformation("Initialising ORB and OA");
+ * Initialise the ORB and OA
+ */
+ System.out.println("Initialising ORB and OA");
- orb.initORB(args, null);
- oa.initOA();
+ orb.initORB(new String[] {}, null);
+ oa.initOA();
- if (_currentState == POSTINIT)
- assertSuccess();
- else
- assertFailure();
- }
- catch (Exception e)
- {
- logInformation("Initialisation failed: "+e);
- e.printStackTrace();
- assertFailure();
- }
+ assertEquals(POSTINIT, _currentState);
+ }
+ catch (Exception e)
+ {
+ fail("Initialisation failed: "+e);
+ }
- oa.destroy();
- orb.shutdown();
+ oa.destroy();
+ orb.shutdown();
}
public class PreTestAttribute extends Attribute
{
- protected TestAttributeCallback _callback = null;
+ protected TestAttributeCallback _callback = null;
- public PreTestAttribute( TestAttributeCallback callback )
- {
- _callback = callback;
- }
+ public PreTestAttribute( TestAttributeCallback callback )
+ {
+ _callback = callback;
+ }
- public void initialise (String[] params)
- {
- _callback.preInitAttributeCalled();
- }
+ public void initialise (String[] params)
+ {
+ _callback.preInitAttributeCalled();
+ }
- public boolean postORBInit ()
- {
- return(false);
- }
+ public boolean postORBInit ()
+ {
+ return(false);
+ }
}
public class PostTestAttribute extends Attribute
{
- protected TestAttributeCallback _callback = null;
+ protected TestAttributeCallback _callback = null;
- public PostTestAttribute( TestAttributeCallback callback )
- {
- _callback = callback;
- }
+ public PostTestAttribute( TestAttributeCallback callback )
+ {
+ _callback = callback;
+ }
- public void initialise (String[] params)
- {
- _callback.postInitAttributeCalled();
- }
+ public void initialise (String[] params)
+ {
+ _callback.postInitAttributeCalled();
+ }
- public boolean postORBInit ()
- {
- return(true);
- }
+ public boolean postORBInit ()
+ {
+ return(true);
+ }
}
- public static void main(String[] args)
- {
- ORBInitialisationTest test = new ORBInitialisationTest();
-
- test.initialise(null, null, args, new org.jboss.dtf.testframework.unittest.LocalHarness());
-
- test.runTest();
- }
-
}
Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/PostSetTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/PostSetTest.java 2009-07-07 13:09:56 UTC (rev 27697)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/PostSetTest.java 2009-07-07 13:42:30 UTC (rev 27698)
@@ -31,8 +31,6 @@
package com.hp.mwtests.orbportability.initialisation;
-import org.jboss.dtf.testframework.unittest.Test;
-import org.jboss.dtf.testframework.unittest.LocalHarness;
import com.arjuna.orbportability.internal.utils.PostSetLoader;
import com.arjuna.orbportability.ORB;
import com.hp.mwtests.orbportability.initialisation.postset.AllPostSet;
@@ -40,71 +38,42 @@
import java.util.Properties;
-public class PostSetTest extends Test
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class PostSetTest
{
- private final static String ORB_INSTANCE_NAME = "PostSetTestORB";
+ private final static String ORB_INSTANCE_NAME = "PostSetTestORB";
private final static String ORB_INSTANCE_NAME2 = "PostSetTestORB2";
- public void run(String[] args)
- {
- Properties testProps = System.getProperties();
+ @Test
+ public void test()
+ {
+ Properties testProps = System.getProperties();
- testProps.setProperty(PostSetLoader.generateORBPropertyName("com.arjuna.orbportability.orb"),
- "com.hp.mwtests.orbportability.initialisation.postset.AllPostSet");
- testProps.setProperty(PostSetLoader.generateORBPropertyName("com.arjuna.orbportability.orb", ORB_INSTANCE_NAME2),
- "com.hp.mwtests.orbportability.initialisation.postset.SinglePostSetUsingInterface");
+ testProps.setProperty(PostSetLoader.generateORBPropertyName("com.arjuna.orbportability.orb"),
+ "com.hp.mwtests.orbportability.initialisation.postset.AllPostSet");
+ testProps.setProperty(PostSetLoader.generateORBPropertyName("com.arjuna.orbportability.orb", ORB_INSTANCE_NAME2),
+ "com.hp.mwtests.orbportability.initialisation.postset.SinglePostSetUsingInterface");
- System.setProperties(testProps);
+ System.setProperties(testProps);
- ORB orb = null;
+ ORB orb = null;
ORB orb2 = null;
- try
- {
- orb = ORB.getInstance(ORB_INSTANCE_NAME);
- orb.initORB(args, null);
+ orb = ORB.getInstance(ORB_INSTANCE_NAME);
+ orb.initORB(new String[] {}, null);
- orb2 = ORB.getInstance(ORB_INSTANCE_NAME2);
+ orb2 = ORB.getInstance(ORB_INSTANCE_NAME2);
- orb2.setOrb(orb.orb());
- }
- catch (Exception e)
- {
- logInformation("ERROR - "+e);
- e.printStackTrace(System.err);
- assertFailure();
- }
+ orb2.setOrb(orb.orb());
- if ( !AllPostSet._called )
- {
- logInformation("Failed to call AllPostSet initialisation routine");
- assertFailure();
- }
- else
- {
- logInformation("AllPostSet called succeesfully");
- }
+ assertTrue( AllPostSet._called );
- if ( ( !SinglePostSetUsingInterface._called ) && ( SinglePostSetUsingInterface._passedObj == orb2 ) )
- {
- logInformation("Failed to call SinglePostSetUsingInterface initialisation routine");
- assertFailure();
- }
- else
- {
- logInformation("SinglePostSetUsingInterface called succeesfully");
- }
+ assertTrue( SinglePostSetUsingInterface._called );
- orb.destroy();
+ assertEquals(orb2, SinglePostSetUsingInterface._passedObj );
- assertSuccess();
- }
-
- public static void main(String[] args)
- {
- PostSetTest pst = new PostSetTest();
- pst.initialise(null, null, args, new LocalHarness());
- pst.runTest();
- }
-
+ orb.destroy();
+ }
}
Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/PropertyInitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/PropertyInitTest.java 2009-07-07 13:09:56 UTC (rev 27697)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/PropertyInitTest.java 2009-07-07 13:42:30 UTC (rev 27698)
@@ -30,7 +30,6 @@
*/
package com.hp.mwtests.orbportability.initialisation;
-import org.jboss.dtf.testframework.unittest.Test;
import com.arjuna.orbportability.internal.utils.PreInitLoader;
import com.arjuna.orbportability.internal.utils.PostInitLoader;
import com.arjuna.orbportability.ORB;
@@ -43,22 +42,19 @@
import java.util.Properties;
-public class PropertyInitTest extends Test
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class PropertyInitTest
{
private static String ORB_INSTANCE_NAME = "orb_instance_1";
private static String ORB_INSTANCE_NAME_2 = "orb_instance_2";
- public void run(String[] args)
+ @Test
+ public void test()
{
Properties testProps = System.getProperties();
- logInformation("Registering All ORB instance pre-initialisation object");
- logInformation("Registering All ORB instance post-initialisation object");
- logInformation("Registering First ORB instance pre-initialisation object");
- logInformation("Registering First ORB instance post-initialisation object");
- logInformation("Registering Second ORB instance pre-initialisation object");
- logInformation("Registering Second ORB instance post-initialisation object");
-
testProps.setProperty(PreInitLoader.generateORBPropertyName("com.arjuna.orbportability.orb"),
"com.hp.mwtests.orbportability.initialisation.preinit.AllPreInitialisation");
testProps.setProperty(PostInitLoader.generateORBPropertyName("com.arjuna.orbportability.orb"),
@@ -74,81 +70,21 @@
System.setProperties(testProps);
- ORB orb = null;
+ ORB orb = ORB.getInstance(ORB_INSTANCE_NAME);
+ orb.initORB(new String[] {}, null);
- try
- {
- orb = ORB.getInstance(ORB_INSTANCE_NAME);
- logInformation("Initialising First ORB Instance");
- orb.initORB(args, null);
- }
- catch (Exception e)
- {
- logInformation("ERROR - "+e);
- e.printStackTrace(System.err);
- assertFailure();
- }
+ assertTrue(PreInitialisation._called);
- if (!PreInitialisation._called)
- {
- logInformation("FAILED: First ORB instance pre-initialisation not called");
- assertFailure();
- }
- else
- {
- logInformation("First ORB instance pre-initialisation called");
- }
+ assertTrue(PostInitialisation._called);
- if (!PostInitialisation._called)
- {
- logInformation("FAILED: First ORB instance post-initialisation not called");
- assertFailure();
- }
- else
- {
- logInformation("First ORB instance post-initialisation called");
- }
+ assertTrue(PreInitialisation2._called);
- if (!PreInitialisation2._called)
- {
- logInformation("Second ORB instance pre-initialisation not called");
- }
- else
- {
- logInformation("FAILED: Second ORB instance pre-initialisation called");
- assertFailure();
- }
+ assertTrue(PostInitialisation2._called);
- if (!PostInitialisation2._called)
- {
- logInformation("Second ORB instance post-initialisation not called");
- }
- else
- {
- logInformation("FAILED: Second ORB instance post-initialisation called");
- assertFailure();
- }
+ assertTrue(AllPreInitialisation._called);
- if (!AllPreInitialisation._called)
- {
- logInformation("FAILED: All ORB instances pre-initialisation not called");
- assertFailure();
- }
- else
- {
- logInformation("All ORB instances pre-initialisation called");
- }
-
- if (!AllPostInitialisation._called)
- {
- logInformation("FAILED: All ORB instances post-initialisation not called");
- assertFailure();
- }
- else
- {
- logInformation("All ORB instances post-initialisation called");
- }
-
+ assertTrue(AllPostInitialisation._called);
+
try
{
/**
@@ -157,55 +93,22 @@
AllPreInitialisation._called = false;
AllPostInitialisation._called = false;
orb = ORB.getInstance(ORB_INSTANCE_NAME_2);
- logInformation("Initialising Second ORB Instance");
- orb.initORB(args, null);
+ System.out.println("Initialising Second ORB Instance");
+ orb.initORB(new String[] {}, null);
}
catch (Exception e)
{
- logInformation("ERROR - "+e);
e.printStackTrace(System.err);
- assertFailure();
+ fail("ERROR - "+e);
}
- if (!PreInitialisation2._called)
- {
- logInformation("FAILED: Second ORB instance pre-initialisation not called");
- assertFailure();
- }
- else
- {
- logInformation("Second ORB instance pre-initialisation called");
- }
+ assertTrue(PreInitialisation2._called);
- if (!PostInitialisation2._called)
- {
- logInformation("FAILED: Second ORB instance post-initialisation not called");
- assertFailure();
- }
- else
- {
- logInformation("Second ORB instance post-initialisation called");
- }
+ assertTrue(PostInitialisation2._called);
- if (!AllPreInitialisation._called)
- {
- logInformation("FAILED: All ORB instances pre-initialisation not called");
- assertFailure();
- }
- else
- {
- logInformation("All ORB instances pre-initialisation called");
- }
+ assertTrue(AllPreInitialisation._called);
- if (!AllPostInitialisation._called)
- {
- logInformation("FAILED: All ORB instances post-initialisation not called");
- assertFailure();
- }
- else
- {
- logInformation("All ORB instances post-initialisation called");
- }
+ assertTrue(AllPostInitialisation._called);
try
{
@@ -213,20 +116,8 @@
}
catch (Exception e)
{
- logInformation("ERROR - "+e);
+ fail("ERROR - "+e);
e.printStackTrace(System.err);
- assertFailure();
}
-
- assertSuccess();
}
-
- public static void main(String[] args)
- {
- PropertyInitTest test = new PropertyInitTest();
-
- test.initialise(null, null, args, new org.jboss.dtf.testframework.unittest.LocalHarness());
-
- test.runTest();
- }
}
Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/PropertyInitTest2.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/PropertyInitTest2.java 2009-07-07 13:09:56 UTC (rev 27697)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/PropertyInitTest2.java 2009-07-07 13:42:30 UTC (rev 27698)
@@ -30,29 +30,28 @@
*/
package com.hp.mwtests.orbportability.initialisation;
-import org.jboss.dtf.testframework.unittest.Test;
import com.arjuna.orbportability.internal.utils.PreInitLoader;
import com.arjuna.orbportability.ORB;
import com.arjuna.orbportability.OA;
import com.arjuna.orbportability.RootOA;
import com.hp.mwtests.orbportability.initialisation.preinit.PreInitialisation;
-import com.hp.mwtests.orbportability.initialisation.preinit.AllPreInitialisation;
import com.hp.mwtests.orbportability.initialisation.preinit.PreInitialisation2;
-import com.hp.mwtests.orbportability.initialisation.postinit.PostInitialisation2;
-import com.hp.mwtests.orbportability.initialisation.postinit.PostInitialisation;
-import com.hp.mwtests.orbportability.initialisation.postinit.AllPostInitialisation;
import java.util.Properties;
import org.omg.PortableServer.ImplicitActivationPolicyValue;
import org.omg.CORBA.Policy;
-public class PropertyInitTest2 extends Test
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class PropertyInitTest2
{
private static String ORB_INSTANCE_NAME = "orb_instance_";
private static String OA_INSTANCE_NAME = "oa_instance_";
- public void run(String[] args)
+ @Test
+ public void test()
{
int numberOfORBs = 1;
int numberOfOAsPerORB = 3;
@@ -64,14 +63,14 @@
*/
for (int orbCount=0;orbCount<numberOfORBs;orbCount++)
{
- logInformation("Registering pre-initialisation property '"+PreInitLoader.generateORBPropertyName("com.arjuna.orbportability.orb",ORB_INSTANCE_NAME+orbCount)+"'");
+ System.out.println("Registering pre-initialisation property '"+PreInitLoader.generateORBPropertyName("com.arjuna.orbportability.orb",ORB_INSTANCE_NAME+orbCount)+"'");
testProps.setProperty(PreInitLoader.generateORBPropertyName("com.arjuna.orbportability.orb",ORB_INSTANCE_NAME+orbCount, "preinitmyorb"),
"com.hp.mwtests.orbportability.initialisation.preinit.PreInitialisation");
for (int oaCount=0;oaCount<numberOfOAsPerORB;oaCount++)
{
- logInformation("Registering pre-initialisation property '"+PreInitLoader.generateOAPropertyName("com.arjuna.orbportability.orb", ORB_INSTANCE_NAME+orbCount, OA_INSTANCE_NAME+oaCount)+"'");
- logInformation("Registering pre-initialisation property '"+PreInitLoader.generateOAPropertyName("com.arjuna.orbportability.orb", ORB_INSTANCE_NAME+orbCount, OA_INSTANCE_NAME+oaCount, "mypoainit")+"'");
+ System.out.println("Registering pre-initialisation property '"+PreInitLoader.generateOAPropertyName("com.arjuna.orbportability.orb", ORB_INSTANCE_NAME+orbCount, OA_INSTANCE_NAME+oaCount)+"'");
+ System.out.println("Registering pre-initialisation property '"+PreInitLoader.generateOAPropertyName("com.arjuna.orbportability.orb", ORB_INSTANCE_NAME+orbCount, OA_INSTANCE_NAME+oaCount, "mypoainit")+"'");
testProps.setProperty(PreInitLoader.generateOAPropertyName("com.arjuna.orbportability.orb", ORB_INSTANCE_NAME+orbCount, OA_INSTANCE_NAME+oaCount),
"com.hp.mwtests.orbportability.initialisation.preinit.PreInitialisation");
@@ -91,26 +90,18 @@
{
String orbId = ORB_INSTANCE_NAME+orbCount;
ORB orb = ORB.getInstance(orbId);
- logInformation("Initialising ORB Instance '"+orbId+"'");
- orb.initORB(args, null);
+ System.out.println("Initialising ORB Instance '"+orbId+"'");
+ orb.initORB(new String[] {}, null);
RootOA rootOA = RootOA.getRootOA(orb);
- rootOA.initPOA(args);
+ rootOA.initPOA(new String[] {});
preInitExpectedValue++;
- if (PreInitialisation._count != preInitExpectedValue)
- {
- logInformation("Checking: Failed, Pre-initialisation class not called as expected");
- assertFailure();
- }
- else
- {
- logInformation("Checking: Correct ("+preInitExpectedValue+")");
- }
+ assertEquals(preInitExpectedValue, PreInitialisation._count);
for (int oaCount=0;oaCount<numberOfOAsPerORB;oaCount++)
{
String oaId = OA_INSTANCE_NAME+oaCount;
- logInformation("Initialising OA instance '"+oaId+"' for ORB Instance '"+orbId+"'");
+ System.out.println("Initialising OA instance '"+oaId+"' for ORB Instance '"+orbId+"'");
Policy p[] = new Policy[1];
p[0] = rootOA.rootPoa().create_implicit_activation_policy(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION);
@@ -119,33 +110,15 @@
myPoaExceptedValue++;
}
- if (PreInitialisation2._count != myPoaExceptedValue)
- {
- logInformation("Checking: Failed, Pre-initialisation of mypoa class not called as expected");
- assertFailure();
- }
- else
- {
- logInformation("Checking: myPOA Correct ("+myPoaExceptedValue+")");
- }
+ assertEquals(myPoaExceptedValue, PreInitialisation2._count);
-
- if (PreInitialisation._count != preInitExpectedValue)
- {
- logInformation("Checking: Failed, Pre-initialisation class not called as expected");
- assertFailure();
- }
- else
- {
- logInformation("Checking: Correct ("+preInitExpectedValue+")");
- }
+ assertEquals(preInitExpectedValue, PreInitialisation._count);
}
}
catch (Exception e)
{
- logInformation("ERROR - "+e);
e.printStackTrace(System.err);
- assertFailure();
+ fail("ERROR - "+e);
}
for (int orbCount=0;orbCount<numberOfORBs;orbCount++)
@@ -161,21 +134,9 @@
}
catch (Exception e)
{
- logInformation("ERROR - While destroying ORB instance '"+ORB_INSTANCE_NAME+orbCount+"' ("+e+")");
+ fail("ERROR - While destroying ORB instance '"+ORB_INSTANCE_NAME+orbCount+"' ("+e+")");
e.printStackTrace(System.err);
- assertFailure();
}
}
-
- assertSuccess();
}
-
- public static void main(String[] args)
- {
- PropertyInitTest2 test = new PropertyInitTest2();
-
- test.initialise(null, null, args, new org.jboss.dtf.testframework.unittest.LocalHarness());
-
- test.runTest();
- }
}
Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/PropertyInitTest3.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/PropertyInitTest3.java 2009-07-07 13:09:56 UTC (rev 27697)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/PropertyInitTest3.java 2009-07-07 13:42:30 UTC (rev 27698)
@@ -31,7 +31,6 @@
package com.hp.mwtests.orbportability.initialisation;
-import org.jboss.dtf.testframework.unittest.Test;
import com.arjuna.orbportability.internal.utils.PreInitLoader;
import com.arjuna.orbportability.internal.utils.PostInitLoader;
import com.arjuna.orbportability.ORB;
@@ -44,28 +43,25 @@
import java.util.Properties;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
/**
* This test tests the use of the pre/post-initialisation properties when
* passed to the ORB initialisation routine.
*
* @author Richard Begg (richard_begg at hp.com)
*/
-public class PropertyInitTest3 extends Test
+public class PropertyInitTest3
{
private static String ORB_INSTANCE_NAME = "orb_instance_1";
private static String ORB_INSTANCE_NAME_2 = "orb_instance_2";
- public void run( String[] args )
+ @Test
+ public void test()
{
Properties testProps = new Properties();
- logInformation("Registering All ORB instance pre-initialisation object");
- logInformation("Registering All ORB instance post-initialisation object");
- logInformation("Registering First ORB instance pre-initialisation object");
- logInformation("Registering First ORB instance post-initialisation object");
- logInformation("Registering Second ORB instance pre-initialisation object");
- logInformation("Registering Second ORB instance post-initialisation object");
-
testProps.setProperty(PreInitLoader.generateORBPropertyName("com.arjuna.orbportability.orb"),
"com.hp.mwtests.orbportability.initialisation.preinit.AllPreInitialisation");
testProps.setProperty(PostInitLoader.generateORBPropertyName("com.arjuna.orbportability.orb"),
@@ -79,80 +75,22 @@
testProps.setProperty(PostInitLoader.generateORBPropertyName("com.arjuna.orbportability.orb",ORB_INSTANCE_NAME_2),
"com.hp.mwtests.orbportability.initialisation.postinit.PostInitialisation2");
- ORB orb = null;
+ ORB orb = ORB.getInstance(ORB_INSTANCE_NAME);
+ System.out.println("Initialising First ORB Instance");
+ orb.initORB(new String[] {}, testProps);
- try
- {
- orb = ORB.getInstance(ORB_INSTANCE_NAME);
- logInformation("Initialising First ORB Instance");
- orb.initORB(args, testProps);
- }
- catch (Exception e)
- {
- logInformation("ERROR - "+e);
- assertFailure();
- }
+ assertTrue( PreInitialisation._called );
- if (!PreInitialisation._called)
- {
- logInformation("FAILED: First ORB instance pre-initialisation not called");
- assertFailure();
- }
- else
- {
- logInformation("First ORB instance pre-initialisation called");
- }
+ assertTrue( PostInitialisation._called );
- if (!PostInitialisation._called)
- {
- logInformation("FAILED: First ORB instance post-initialisation not called");
- assertFailure();
- }
- else
- {
- logInformation("First ORB instance post-initialisation called");
- }
+ assertTrue( PreInitialisation2._called );
- if (!PreInitialisation2._called)
- {
- logInformation("Second ORB instance pre-initialisation not called");
- }
- else
- {
- logInformation("FAILED: Second ORB instance pre-initialisation called");
- assertFailure();
- }
+ assertTrue( PostInitialisation2._called );
- if (!PostInitialisation2._called)
- {
- logInformation("Second ORB instance post-initialisation not called");
- }
- else
- {
- logInformation("FAILED: Second ORB instance post-initialisation called");
- assertFailure();
- }
+ assertTrue( AllPreInitialisation._called );
- if (!AllPreInitialisation._called)
- {
- logInformation("FAILED: All ORB instances pre-initialisation not called");
- assertFailure();
- }
- else
- {
- logInformation("All ORB instances pre-initialisation called");
- }
+ assertTrue( AllPostInitialisation._called );
- if (!AllPostInitialisation._called)
- {
- logInformation("FAILED: All ORB instances post-initialisation not called");
- assertFailure();
- }
- else
- {
- logInformation("All ORB instances post-initialisation called");
- }
-
try
{
/**
@@ -161,54 +99,21 @@
AllPreInitialisation._called = false;
AllPostInitialisation._called = false;
orb = ORB.getInstance(ORB_INSTANCE_NAME_2);
- logInformation("Initialising Second ORB Instance");
- orb.initORB(args, testProps);
+ System.out.println("Initialising Second ORB Instance");
+ orb.initORB(new String[] {}, testProps);
}
catch (Exception e)
{
- logInformation("ERROR - "+e);
- assertFailure();
+ fail("ERROR - "+e);
}
- if (!PreInitialisation2._called)
- {
- logInformation("FAILED: Second ORB instance pre-initialisation not called");
- assertFailure();
- }
- else
- {
- logInformation("Second ORB instance pre-initialisation called");
- }
+ assertTrue( PreInitialisation2._called );
- if (!PostInitialisation2._called)
- {
- logInformation("FAILED: Second ORB instance post-initialisation not called");
- assertFailure();
- }
- else
- {
- logInformation("Second ORB instance post-initialisation called");
- }
+ assertTrue( PostInitialisation2._called );
- if (!AllPreInitialisation._called)
- {
- logInformation("FAILED: All ORB instances pre-initialisation not called");
- assertFailure();
- }
- else
- {
- logInformation("All ORB instances pre-initialisation called");
- }
+ assertTrue( AllPreInitialisation._called );
- if (!AllPostInitialisation._called)
- {
- logInformation("FAILED: All ORB instances post-initialisation not called");
- assertFailure();
- }
- else
- {
- logInformation("All ORB instances post-initialisation called");
- }
+ assertTrue( AllPostInitialisation._called );
try
{
@@ -216,19 +121,7 @@
}
catch (Exception e)
{
- logInformation("ERROR - "+e);
- assertFailure();
+ fail("ERROR - "+e);
}
-
- assertSuccess();
}
-
- public static void main(String[] args)
- {
- PropertyInitTest3 test = new PropertyInitTest3();
-
- test.initialise(null, null, args, new org.jboss.dtf.testframework.unittest.LocalHarness());
-
- test.runTest();
- }
}
Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/PropertyInitTest4.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/PropertyInitTest4.java 2009-07-07 13:09:56 UTC (rev 27697)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/initialisation/PropertyInitTest4.java 2009-07-07 13:42:30 UTC (rev 27698)
@@ -31,25 +31,24 @@
package com.hp.mwtests.orbportability.initialisation;
-import org.jboss.dtf.testframework.unittest.Test;
-import org.jboss.dtf.testframework.unittest.LocalHarness;
import com.arjuna.orbportability.internal.utils.PreInitLoader;
import com.arjuna.orbportability.internal.utils.PostInitLoader;
import com.arjuna.orbportability.ORB;
import com.hp.mwtests.orbportability.initialisation.preinit.PreInitialisationUsingInterface;
import com.hp.mwtests.orbportability.initialisation.postinit.PostInitialisationUsingInterface;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
import java.util.Properties;
-public class PropertyInitTest4 extends Test
+public class PropertyInitTest4
{
public final static String ORB_INSTANCE_NAME = "testorb";
public final static String ORB_INSTANCE_NAME_2 = "testorb2";
- /**
- * The main test method which must assert either a pass or a fail.
- */
- public void run(String[] args)
+ @Test
+ public void test()
{
ORB orb = null,
orb2 = null;
@@ -67,62 +66,26 @@
try
{
orb = ORB.getInstance(ORB_INSTANCE_NAME);
- logInformation("Initialising ORB("+ORB_INSTANCE_NAME+")");
- orb.initORB(args, null);
+ System.out.println("Initialising ORB("+ORB_INSTANCE_NAME+")");
+ orb.initORB(new String[] {}, null);
- if ( PreInitialisationUsingInterface.getObject() == orb )
- {
- logInformation("PreInitialisationUsingInterface returned ORB("+ORB_INSTANCE_NAME+")");
- assertSuccess();
- }
- else
- {
- logInformation("PreInitialisationUsingInterface failed to return ORB("+ORB_INSTANCE_NAME+")");
- assertFailure();
- }
+ assertEquals(orb, PreInitialisationUsingInterface.getObject());
- if ( PostInitialisationUsingInterface.getObject() == orb )
- {
- logInformation("PostInitialisationUsingInterface returned ORB("+ORB_INSTANCE_NAME+")");
- assertSuccess();
- }
- else
- {
- logInformation("PostInitialisationUsingInterface failed to return ORB("+ORB_INSTANCE_NAME+")");
- assertFailure();
- }
+ assertEquals(orb, PostInitialisationUsingInterface.getObject());
orb2 = ORB.getInstance(ORB_INSTANCE_NAME_2);
- logInformation("Initialising ORB("+ORB_INSTANCE_NAME_2+")");
- orb2.initORB(args, null);
+ System.out.println("Initialising ORB("+ORB_INSTANCE_NAME_2+")");
+ orb2.initORB(new String[] {}, null);
- if ( PreInitialisationUsingInterface.getObject() == orb2 )
- {
- logInformation("PreInitialisationUsingInterface returned ORB("+ORB_INSTANCE_NAME_2+")");
- assertSuccess();
- }
- else
- {
- logInformation("PreInitialisationUsingInterface failed to return ORB("+ORB_INSTANCE_NAME_2+")");
- assertFailure();
- }
+ assertEquals(orb2, PreInitialisationUsingInterface.getObject());
- if ( PostInitialisationUsingInterface.getObject() == orb2 )
- {
- logInformation("PostInitialisationUsingInterface returned ORB("+ORB_INSTANCE_NAME_2+")");
- assertSuccess();
- }
- else
- {
- logInformation("PostInitialisationUsingInterface failed to return ORB("+ORB_INSTANCE_NAME_2+")");
- assertFailure();
- }
+ assertEquals(orb2, PostInitialisationUsingInterface.getObject());
+
}
catch (Exception e)
{
- logInformation("ERROR - "+e);
+ fail("ERROR - "+e);
e.printStackTrace(System.err);
- assertFailure();
}
try
@@ -132,17 +95,8 @@
}
catch (Exception e)
{
- logInformation("ERROR - "+e);
+ fail("ERROR - "+e);
e.printStackTrace(System.err);
- assertFailure();
}
}
-
- public static void main(String[] args)
- {
- PropertyInitTest4 test = new PropertyInitTest4();
-
- test.initialise( null, null, args, new LocalHarness() );
- test.runTest();
- }
}
Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/orbinfo/ORBInfoTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/orbinfo/ORBInfoTest.java 2009-07-07 13:09:56 UTC (rev 27697)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/orbinfo/ORBInfoTest.java 2009-07-07 13:42:30 UTC (rev 27698)
@@ -20,52 +20,32 @@
*/
package com.hp.mwtests.orbportability.orbinfo;
-import org.jboss.dtf.testframework.unittest.Test;
-import org.jboss.dtf.testframework.unittest.LocalHarness;
import com.arjuna.orbportability.ORB;
import com.arjuna.orbportability.OA;
import com.arjuna.orbportability.ORBInfo;
-public class ORBInfoTest extends Test
-{
- private final static String ORB_NAME = "test.orb";
+import org.junit.Test;
+import static org.junit.Assert.*;
- /**
- * The main test method which must assert either a pass or a fail.
- */
- public void run(String[] args)
+public class ORBInfoTest
+{
+ @Test
+ public void test() throws Exception
{
- try
- {
- ORB orb = ORB.getInstance( ORB_NAME );
- OA oa = OA.getRootOA( orb );
+ ORB orb = ORB.getInstance( "test.orb" );
+ OA oa = OA.getRootOA( orb );
- orb.initORB(args, null);
- oa.initOA(args);
+ orb.initORB(new String[] {}, null);
+ oa.initOA(new String[] {});
- logInformation(" ORBInfo.getOrbName: "+ORBInfo.getOrbName());
- logInformation(" ORBInfo.getOrbMajorVersion: "+ORBInfo.getOrbMajorVersion());
- logInformation(" ORBInfo.getOrbMinorVersion: "+ORBInfo.getOrbMinorVersion());
- logInformation("ORBInfo.getCorbaMajorVersion: "+ORBInfo.getCorbaMajorVersion());
- logInformation("ORBInfo.getCorbaMinorVersion: "+ORBInfo.getCorbaMinorVersion());
- logInformation(" ORBInfo.getOrbEnumValue: "+ORBInfo.getOrbEnumValue());
+ System.out.println(" ORBInfo.getOrbName: "+ORBInfo.getOrbName());
+ System.out.println(" ORBInfo.getOrbMajorVersion: "+ORBInfo.getOrbMajorVersion());
+ System.out.println(" ORBInfo.getOrbMinorVersion: "+ORBInfo.getOrbMinorVersion());
+ System.out.println("ORBInfo.getCorbaMajorVersion: "+ORBInfo.getCorbaMajorVersion());
+ System.out.println("ORBInfo.getCorbaMinorVersion: "+ORBInfo.getCorbaMinorVersion());
+ System.out.println(" ORBInfo.getOrbEnumValue: "+ORBInfo.getOrbEnumValue());
- oa.destroy();
- orb.destroy();
-
- assertSuccess();
- }
- catch (Exception e)
- {
- e.printStackTrace(System.err);
- assertFailure();
- }
+ oa.destroy();
+ orb.destroy();
}
-
- public static void main(String[] args)
- {
- ORBInfoTest test = new ORBInfoTest();
- test.initialise(null,null,args,new LocalHarness());
- test.runTest();
- }
}
Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/orbinstance/MultipleORBInstances.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/orbinstance/MultipleORBInstances.java 2009-07-07 13:09:56 UTC (rev 27697)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/orbinstance/MultipleORBInstances.java 2009-07-07 13:42:30 UTC (rev 27698)
@@ -30,17 +30,16 @@
package com.hp.mwtests.orbportability.orbinstance;
-import org.jboss.dtf.testframework.unittest.Test;
import com.arjuna.orbportability.ORB;
import com.arjuna.orbportability.OA;
import com.arjuna.orbportability.RootOA;
import java.util.HashSet;
-import org.omg.CORBA.Policy;
-import org.omg.PortableServer.ImplicitActivationPolicyValue;
+import org.junit.Test;
+import static org.junit.Assert.*;
-public class MultipleORBInstances extends Test
+public class MultipleORBInstances
{
public static final int NUMBER_OF_ORBOAS = 10;
@@ -58,7 +57,7 @@
}
else
{
- logInformation("Failure - unqiue ORB instance not created!");
+ System.out.println("Failure - unqiue ORB instance not created!");
success = false;
}
}
@@ -72,21 +71,21 @@
if (orbInstance == null)
{
- logInformation("Could not create ORB instance");
+ System.out.println("Could not create ORB instance");
returnValue = false;
}
else
{
- logInformation("Successfully created ORB instance");
+ System.out.println("Successfully created ORB instance");
if (oaInstance == null)
{
- logInformation("Could not create OA instance");
+ System.out.println("Could not create OA instance");
returnValue = false;
}
else
{
- logInformation("Successfully created OA instance");
+ System.out.println("Successfully created OA instance");
try
{
@@ -95,7 +94,7 @@
}
catch (Exception e)
{
- logInformation("Unexpected Exception while initialising the orb instance - "+e);
+ System.out.println("Unexpected Exception while initialising the orb instance - "+e);
e.printStackTrace(System.err);
returnValue = false;
}
@@ -105,68 +104,42 @@
return(returnValue);
}
- public void run(String[] args)
+ @Test
+ public void test()
{
ORB orbInstance[] = new ORB[NUMBER_OF_ORBOAS];
RootOA oaInstance[] = new RootOA[NUMBER_OF_ORBOAS];
for (int count=0;count<NUMBER_OF_ORBOAS;count++)
{
- logInformation("Creating ORB and OA #"+count);
+ System.out.println("Creating ORB and OA #"+count);
orbInstance[count] = ORB.getInstance("orb_"+count);
oaInstance[count] = RootOA.getRootOA(orbInstance[count]);
- if (!initialiseORBandOA(args,orbInstance[count],oaInstance[count]))
- {
- logInformation("Failed to create ORB and OA #"+count);
- assertFailure();
- }
+ assertTrue( initialiseORBandOA(new String[] {},orbInstance[count],oaInstance[count]) );
}
- if (!ensureAllORBReferencesAreUnique(orbInstance, oaInstance))
- {
- assertFailure();
- }
+ assertTrue( ensureAllORBReferencesAreUnique(orbInstance, oaInstance) );
- logInformation("Retrieving all ORBs and OAs");
+ System.out.println("Retrieving all ORBs and OAs");
for (int count=0;count<NUMBER_OF_ORBOAS;count++)
{
- logInformation("Retrieving ORB and OA #"+count);
+ System.out.println("Retrieving ORB and OA #"+count);
ORB orb = ORB.getInstance("orb_"+count);
- if ( orb == null)
- {
- logInformation("Failed to retrieve ORB #"+count);
- assertFailure();
- }
+ assertNotNull(orb);
- if ( OA.getRootOA(orb) == null )
- {
- logInformation("Failed to retrieve OA #"+count);
- assertFailure();
- }
+ assertNotNull( OA.getRootOA(orb) );
}
- logInformation("Destroying all ORBs and OAs");
+ System.out.println("Destroying all ORBs and OAs");
for (int count=0;count<NUMBER_OF_ORBOAS;count++)
{
orbInstance[count].destroy();
oaInstance[count].destroy();
}
-
- assertSuccess();
}
-
- public static void main(String[] args)
- {
- MultipleORBInstances test = new MultipleORBInstances();
-
- test.initialise(null, null, args, new org.jboss.dtf.testframework.unittest.LocalHarness());
-
- test.runTest();
- }
-
}
Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/orbspecific/orbinstance/SimpleServer.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/orbspecific/orbinstance/SimpleServer.java 2009-07-07 13:09:56 UTC (rev 27697)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/orbspecific/orbinstance/SimpleServer.java 2009-07-07 13:42:30 UTC (rev 27698)
@@ -20,79 +20,37 @@
*/
package com.hp.mwtests.orbportability.orbspecific.orbinstance;
-import org.jboss.dtf.testframework.unittest.Test;
import com.arjuna.orbportability.ORB;
import com.arjuna.orbportability.RootOA;
-public class SimpleServer extends Test
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class SimpleServer
{
- public void run(String[] args)
+ @Test
+ public void test() throws Exception
{
ORB orb = ORB.getInstance("main_orb");
ORB orb2 = ORB.getInstance("main_orb_2");
RootOA oa = RootOA.getRootOA(orb);
RootOA oa2 = RootOA.getRootOA(orb2);
- try
- {
- orb.initORB(args,null);
- oa.initOA(args);
+ orb.initORB(new String[] {},null);
+ oa.initOA(new String[] {});
- orb2.initORB(args,null);
- oa2.initOA(args);
- }
- catch (Exception e)
- {
- logInformation("ERROR - During ORB and OA initialisation ("+e+")");
- e.printStackTrace(System.err);
- assertFailure();
- }
+ orb2.initORB(new String[] {},null);
+ oa2.initOA(new String[] {});
- try
- {
- SimpleObjectImpl obj = new SimpleObjectImpl();
+ SimpleObjectImpl obj = new SimpleObjectImpl();
- oa.objectIsReady(obj);
+ assertTrue( oa.objectIsReady(obj) );
- if (oa.objectIsReady(obj))
- {
- logInformation("Manage to activate a servant on the same OA twice - this is incorrect");
- assertFailure();
- }
- else
- {
- logInformation("Didn't managed to activate a servant on the same OA twice - correct");
- }
+ assertTrue( oa2.objectIsReady(obj) );
- if (oa2.objectIsReady(obj))
- {
- logInformation("OA2 did not contain the servant registered on OA - correct");
- oa2.shutdownObject(obj);
- }
- else
- {
- logInformation("OA2 already contained the servant registered on OA - this is incorrect");
- assertFailure();
- }
- assertSuccess();
- }
- catch (Exception e)
- {
- logInformation("ERROR - During object initialisation ("+e+")");
- e.printStackTrace(System.err);
- assertFailure();
- }
oa.destroy();
- orb.shutdown();
+ orb.shutdown();
oa2.destroy();
- orb2.shutdown();
+ orb2.shutdown();
}
-
- public static void main(String[] args)
- {
- SimpleServer server = new SimpleServer();
-
- server.initialise(null, null, args, new org.jboss.dtf.testframework.unittest.LocalHarness());
- server.runTest();
- }
}
Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/services/ServiceTestSetup.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/services/ServiceTestSetup.java 2009-07-07 13:09:56 UTC (rev 27697)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/services/ServiceTestSetup.java 2009-07-07 13:42:30 UTC (rev 27698)
@@ -30,32 +30,29 @@
*/
package com.hp.mwtests.orbportability.services;
-import org.jboss.dtf.testframework.unittest.Test;
-import org.jboss.dtf.testframework.unittest.LocalHarness;
import com.arjuna.orbportability.Services;
import com.arjuna.orbportability.ORB;
import com.arjuna.orbportability.OA;
import com.hp.mwtests.orbportability.orbspecific.orbinstance.SimpleObjectImpl;
-public class ServiceTestSetup extends Test
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class ServiceTestSetup
{
private final static String ORB_INSTANCE_NAME = "servicetest-orb";
private final static String TEST_SERVICE_NAME = "com.mwtests.orbportability.services.ServiceTestSetup.TestService";
- /**
- * The main test method which must assert either a pass or a fail.
- */
- public void run(String[] args)
+ @Test
+ public void test() throws Exception
{
- try
- {
/** Create ORB and OA **/
ORB testORB = ORB.getInstance( ORB_INSTANCE_NAME );
OA testOA = OA.getRootOA( testORB );
/** Initialise ORB and OA **/
- testORB.initORB(args, null);
- testOA.initPOA(args);
+ testORB.initORB(new String[] {}, null);
+ testOA.initPOA(new String[] {});
/** Create services object **/
Services testServ = new Services(testORB);
@@ -71,22 +68,6 @@
* Register using the default mechanism.
*/
testServ.registerService(com.hp.mwtests.orbportability.orbspecific.orbtests.SimpleObjectHelper.narrow(testOA.corbaReference(servant)), TEST_SERVICE_NAME, params, Services.CONFIGURATION_FILE);
-
- assertSuccess();
- }
- catch (Exception e)
- {
- System.err.println("An unexpected exception occurred - "+e);
- e.printStackTrace(System.err);
-
- assertFailure();
- }
}
-
- public static void main(String[] args)
- {
- ServiceTestSetup test = new ServiceTestSetup();
- test.initialise(null, null, args, new LocalHarness());
- test.runTest();
- }
}
+
Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/shutdown/OAPrePostShutdownTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/shutdown/OAPrePostShutdownTest.java 2009-07-07 13:09:56 UTC (rev 27697)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/shutdown/OAPrePostShutdownTest.java 2009-07-07 13:42:30 UTC (rev 27698)
@@ -31,16 +31,16 @@
package com.hp.mwtests.orbportability.shutdown;
-import org.jboss.dtf.testframework.unittest.Test;
-
import com.arjuna.orbportability.*;
-import com.arjuna.orbportability.OA;
import com.arjuna.orbportability.ORB;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
/**
* @author Richard Begg
*/
-public class OAPrePostShutdownTest extends Test implements PrePostTestCallback
+public class OAPrePostShutdownTest implements PrePostTestCallback
{
public static final int NONE = 0, PRESHUTDOWN = 1, POSTSHUTDOWN = 2, INVALID = 3;
private static final String[] STATE_STRING = {"NONE", "PRESHUTDOWN", "POSTSHUTDOWN", "INVALID" };
@@ -68,7 +68,7 @@
*/
public void preShutdownCalled(String name)
{
- logInformation( "Previous State : "+ PrettyPrintState( _currentState ) );
+ System.out.println( "Previous State : "+ PrettyPrintState( _currentState ) );
switch ( _currentState )
{
@@ -83,7 +83,7 @@
break;
}
- logInformation( " Current State : "+ PrettyPrintState( _currentState ) );
+ System.out.println( " Current State : "+ PrettyPrintState( _currentState ) );
}
/**
@@ -93,7 +93,7 @@
*/
public void postShutdownCalled(String name)
{
- logInformation( "Previous State : "+ PrettyPrintState( _currentState ) );
+ System.out.println( "Previous State : "+ PrettyPrintState( _currentState ) );
switch ( _currentState )
{
@@ -108,56 +108,39 @@
break;
}
- logInformation( " Current State : "+ PrettyPrintState( _currentState ) );
+ System.out.println( " Current State : "+ PrettyPrintState( _currentState ) );
}
- public void run(String[] args)
+ @Test
+ public void test() throws Exception
{
ORB orb = ORB.getInstance("main_orb");
RootOA oa = RootOA.getRootOA(orb);
- try
- {
-/*
- * Initialise the ORB and OA
- */
- logInformation("Initialising ORB and OA");
- orb.initORB(args, null);
- oa.initOA();
+ System.out.println("Initialising ORB and OA");
- _currentState = NONE;
- }
- catch (Exception e)
- {
- logInformation("Initialisation failed: "+e);
- e.printStackTrace();
- assertFailure();
- }
+ orb.initORB(new String[] {}, null);
+ oa.initOA();
- /**
- * Register pre and post shutdown handlers
- */
- oa.addPreShutdown( new TestPreShutdown( "PreShutdown", this ) );
- oa.addPostShutdown( new TestPostShutdown( "PostShutdown", this ) );
+ _currentState = NONE;
- /*
- * Shutdown ORB and OA
- */
- logInformation("Shutting down ORB and OA");
- oa.destroy();
- orb.shutdown();
+ /**
+ * Register pre and post shutdown handlers
+ */
+ oa.addPreShutdown( new TestPreShutdown( "PreShutdown", this ) );
+ oa.addPostShutdown( new TestPostShutdown( "PostShutdown", this ) );
- /*
- * Ensure final state is correct
- */
- logInformation("Final state: " + PrettyPrintState(_currentState) );
+ System.out.println("Shutting down ORB and OA");
+ oa.destroy();
+ orb.shutdown();
- if ( _currentState == POSTSHUTDOWN )
- assertSuccess();
- else
- assertFailure();
- }
+ /*
+ * Ensure final state is correct
+ */
+ System.out.println("Final state: " + PrettyPrintState(_currentState) );
+ assertEquals(POSTSHUTDOWN, _currentState);
+ }
/**
*
*/
@@ -203,14 +186,4 @@
_callback.postShutdownCalled(name());
}
}
-
-
- public static void main(String[] args)
- {
- OAPrePostShutdownTest test = new OAPrePostShutdownTest();
-
- test.initialise(null, null, args, new org.jboss.dtf.testframework.unittest.LocalHarness());
-
- test.runTest();
- }
}
Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/shutdown/ORBPrePostShutdownTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/shutdown/ORBPrePostShutdownTest.java 2009-07-07 13:09:56 UTC (rev 27697)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/tests/classes/com/hp/mwtests/orbportability/shutdown/ORBPrePostShutdownTest.java 2009-07-07 13:42:30 UTC (rev 27698)
@@ -31,17 +31,16 @@
package com.hp.mwtests.orbportability.shutdown;
-import org.jboss.dtf.testframework.unittest.Test;
-
import com.arjuna.orbportability.*;
-import com.arjuna.orbportability.OA;
import com.arjuna.orbportability.ORB;
-import com.arjuna.orbportability.orb.*;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
/**
* @author Richard Begg
*/
-public class ORBPrePostShutdownTest extends Test implements PrePostTestCallback
+public class ORBPrePostShutdownTest implements PrePostTestCallback
{
public static final int NONE = 0, PRESHUTDOWN = 1, POSTSHUTDOWN = 2, INVALID = 3;
private static final String[] STATE_STRING = {"NONE", "PRESHUTDOWN", "POSTSHUTDOWN", "INVALID" };
@@ -69,7 +68,7 @@
*/
public void preShutdownCalled(String name)
{
- logInformation( "Previous State : "+ PrettyPrintState( _currentState ) );
+ System.out.println( "Previous State : "+ PrettyPrintState( _currentState ) );
switch ( _currentState )
{
@@ -84,7 +83,7 @@
break;
}
- logInformation( " Current State : "+ PrettyPrintState( _currentState ) );
+ System.out.println( " Current State : "+ PrettyPrintState( _currentState ) );
}
/**
@@ -94,7 +93,7 @@
*/
public void postShutdownCalled(String name)
{
- logInformation( "Previous State : "+ PrettyPrintState( _currentState ) );
+ System.out.println( "Previous State : "+ PrettyPrintState( _currentState ) );
switch ( _currentState )
{
@@ -109,55 +108,32 @@
break;
}
- logInformation( " Current State : "+ PrettyPrintState( _currentState ) );
+ System.out.println( " Current State : "+ PrettyPrintState( _currentState ) );
}
- public void run(String[] args)
+ @Test
+ public void test() throws Exception
{
ORB orb = ORB.getInstance("main_orb");
RootOA oa = RootOA.getRootOA(orb);
- try
- {
-/*
- * Initialise the ORB and OA
- */
- logInformation("Initialising ORB and OA");
+ System.out.println("Initialising ORB and OA");
- orb.initORB(args, null);
- oa.initOA();
+ orb.initORB(new String[] {}, null);
+ oa.initOA();
- _currentState = NONE;
- }
- catch (Exception e)
- {
- logInformation("Initialisation failed: "+e);
- e.printStackTrace();
- assertFailure();
- }
+ _currentState = NONE;
- /**
- * Register pre and post shutdown handlers
- */
- orb.addPreShutdown( new TestPreShutdown( "PreShutdown", this ) );
- orb.addPostShutdown( new TestPostShutdown( "PostShutdown", this ) );
+ orb.addPreShutdown( new TestPreShutdown( "PreShutdown", this ) );
+ orb.addPostShutdown( new TestPostShutdown( "PostShutdown", this ) );
-/*
- * Shutdown ORB and OA
- */
- logInformation("Shutting down ORB and OA");
- oa.destroy();
- orb.shutdown();
+ System.out.println("Shutting down ORB and OA");
+ oa.destroy();
+ orb.shutdown();
- /*
- * Ensure final state is correct
- */
- logInformation("Final state: " + PrettyPrintState(_currentState) );
+ System.out.println("Final state: " + PrettyPrintState(_currentState) );
- if ( _currentState == POSTSHUTDOWN )
- assertSuccess();
- else
- assertFailure();
+ assertEquals(POSTSHUTDOWN, _currentState);
}
/**
@@ -205,14 +181,4 @@
_callback.postShutdownCalled(name());
}
}
-
-
- public static void main(String[] args)
- {
- OAPrePostShutdownTest test = new OAPrePostShutdownTest();
-
- test.initialise(null, null, args, new org.jboss.dtf.testframework.unittest.LocalHarness());
-
- test.runTest();
- }
}
More information about the jboss-svn-commits
mailing list