User: d_jencks
Date: 01/09/14 20:26:06
Modified: src/main/org/jboss/test/jrmp/test
CustomSocketsUnitTestCase.java
DynLoadingUnitTestCase.java
Log:
Fixed jrmp test cases and converted to JBossTestCase and logging
Revision Changes Path
1.2 +85 -59
jbosstest/src/main/org/jboss/test/jrmp/test/CustomSocketsUnitTestCase.java
Index: CustomSocketsUnitTestCase.java
===================================================================
RCS file:
/cvsroot/jboss/jbosstest/src/main/org/jboss/test/jrmp/test/CustomSocketsUnitTestCase.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CustomSocketsUnitTestCase.java 2001/09/12 04:55:39 1.1
+++ CustomSocketsUnitTestCase.java 2001/09/15 03:26:06 1.2
@@ -1,3 +1,9 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
package org.jboss.test.jrmp.test;
import java.io.IOException;
@@ -10,72 +16,92 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.jboss.test.JBossTestCase;
+
import org.jboss.test.jrmp.interfaces.StatelessSession;
import org.jboss.test.jrmp.interfaces.StatelessSessionHome;
-import org.jboss.test.util.Deploy;
-
-/** Test of using custom RMI socket factories with the JRMP ejb
-container invoker.
-@author [EMAIL PROTECTED]
-@version $Revision: 1.1 $
-*/
-public class CustomSocketsUnitTestCase extends junit.framework.TestCase
+/**
+ * Test of using custom RMI socket factories with the JRMP ejb container
+ * invoker.
+ *
+ * @author [EMAIL PROTECTED]
+ * @author david jencks [EMAIL PROTECTED]
+ * @version $Revision: 1.2 $
+ */
+public class CustomSocketsUnitTestCase extends JBossTestCase
{
- public CustomSocketsUnitTestCase(String name)
- {
- super(name);
- }
-
- protected void setUp() throws Exception
- {
- // Deploy.deploy("jrmp-comp.jar");
- }
-
- public void testCustomAccess() throws Exception
- {
- InitialContext jndiContext = new InitialContext();
- System.out.println("Lookup StatelessSession");
- Object obj = jndiContext.lookup("StatelessSession");
- StatelessSessionHome home = (StatelessSessionHome) obj;
- System.out.println("Found StatelessSession Home");
- StatelessSession bean = home.create();
- System.out.println("Created StatelessSession");
- // Test that the Entity bean sees username as its principal
- String echo = bean.echo("jrmp-comp");
- System.out.println("bean.echo(jrmp-comp) = "+echo);
- bean.remove();
- }
- public void testAccess() throws Exception
- {
- InitialContext jndiContext = new InitialContext();
- System.out.println("Lookup StatefulSession");
- Object obj = jndiContext.lookup("StatefulSession");
- StatelessSessionHome home = (StatelessSessionHome) obj;
- System.out.println("Found StatefulSession Home");
- StatelessSession bean = home.create();
- System.out.println("Created StatefulSession");
- // Test that the Entity bean sees username as its principal
- String echo = bean.echo("jrmp");
- System.out.println("bean.echo(jrmp) = "+echo);
- bean.remove();
- }
+ /**
+ * Constructor for the CustomSocketsUnitTestCase object
+ *
+ * @param name Description of Parameter
+ */
+ public CustomSocketsUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+
+ /**
+ * A unit test for JUnit
+ *
+ * @exception Exception Description of Exception
+ */
+ public void testCustomAccess() throws Exception
+ {
+ InitialContext jndiContext = new InitialContext();
+ getLog().debug("Lookup StatelessSession");
+ Object obj = jndiContext.lookup("StatelessSession");
+ StatelessSessionHome home = (StatelessSessionHome)obj;
+ getLog().debug("Found StatelessSession Home");
+ StatelessSession bean = home.create();
+ getLog().debug("Created StatelessSession");
+ // Test that the Entity bean sees username as its principal
+ String echo = bean.echo("jrmp-comp");
+ getLog().debug("bean.echo(jrmp-comp) = " + echo);
+ bean.remove();
+ }
/**
- * Setup the test suite.
+ * A unit test for JUnit
+ *
+ * @exception Exception Description of Exception
*/
- public static Test suite() {
- TestSuite suite = new TestSuite();
-
- // add a test case to deploy our support applications
- String filename = "jrmp-comp.jar";
- suite.addTest(new Deploy.Deployer(filename));
-
- suite.addTest(new TestSuite(CustomSocketsUnitTestCase.class));
-
- // add a test case to undeploy our support applications
- suite.addTest(new Deploy.Undeployer(filename));
+ public void testAccess() throws Exception
+ {
+ InitialContext jndiContext = new InitialContext();
+ getLog().debug("Lookup StatefulSession");
+ Object obj = jndiContext.lookup("StatefulSession");
+ StatelessSessionHome home = (StatelessSessionHome)obj;
+ getLog().debug("Found StatefulSession Home");
+ StatelessSession bean = home.create();
+ getLog().debug("Created StatefulSession");
+ // Test that the Entity bean sees username as its principal
+ String echo = bean.echo("jrmp");
+ getLog().debug("bean.echo(jrmp) = " + echo);
+ bean.remove();
+ }
- return suite;
+ /**
+ * The JUnit setup method
+ *
+ * @exception Exception Description of Exception
+ */
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ deployJ2ee("jrmp-comp.jar");
}
+
+ /**
+ * The teardown method for JUnit
+ *
+ * @exception Exception Description of Exception
+ */
+ protected void tearDown() throws Exception
+ {
+ undeployJ2ee("jrmp-comp.jar");
+ super.tearDown();
+ }
+
}
1.2 +56 -40
jbosstest/src/main/org/jboss/test/jrmp/test/DynLoadingUnitTestCase.java
Index: DynLoadingUnitTestCase.java
===================================================================
RCS file:
/cvsroot/jboss/jbosstest/src/main/org/jboss/test/jrmp/test/DynLoadingUnitTestCase.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DynLoadingUnitTestCase.java 2001/09/12 04:55:39 1.1
+++ DynLoadingUnitTestCase.java 2001/09/15 03:26:06 1.2
@@ -1,3 +1,9 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
package org.jboss.test.jrmp.test;
import java.io.File;
@@ -12,74 +18,84 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.jboss.test.JBossTestCase;
+
import org.jboss.test.jrmp.interfaces.IString;
import org.jboss.test.jrmp.interfaces.StatelessSession;
import org.jboss.test.jrmp.interfaces.StatelessSessionHome;
-
-import org.jboss.test.util.Deploy;
-/** Test of RMI dynamic class loading.
-
-@author [EMAIL PROTECTED]
-@version $Revision: 1.1 $
-*/
+/**
+ * Test of RMI dynamic class loading.
+ *
+ * @author [EMAIL PROTECTED]
+ * @author Author: david jencks [EMAIL PROTECTED]
+ * @version $Revision: 1.2 $
+ */
public class DynLoadingUnitTestCase
- extends TestCase
+ extends JBossTestCase
{
+ /**
+ * Constructor for the DynLoadingUnitTestCase object
+ *
+ * @param name Description of Parameter
+ */
public DynLoadingUnitTestCase(String name)
{
super(name);
- System.out.println("DynLoadingUnitTestCase");
}
- /** Remove any local IString implementation so that we test RMI class loading.
+ /**
+ * A unit test for JUnit
+ *
+ * @exception Exception Description of Exception
*/
- protected void setUp() throws Exception
- {
- URL istringImpl =
getClass().getResource("/org/jboss/test/jrmp/ejb/AString.class");
- if( istringImpl != null )
- {
- System.out.println("Found IString impl at: "+istringImpl);
- File implFile = new File(istringImpl.getFile());
- System.out.println("Removed: "+implFile.delete());
- }
- }
-
public void testAccess() throws Exception
{
InitialContext jndiContext = new InitialContext();
- System.out.println("Lookup StatefulSession");
+ getLog().debug("Lookup StatefulSession");
Object obj = jndiContext.lookup("StatefulSession");
- StatelessSessionHome home = (StatelessSessionHome) obj;
- System.out.println("Found StatefulSession Home");
+ StatelessSessionHome home = (StatelessSessionHome)obj;
+ getLog().debug("Found StatefulSession Home");
StatelessSession bean = home.create();
- System.out.println("Created StatefulSession");
+ getLog().debug("Created StatefulSession");
IString echo = bean.copy("jrmp-dl");
- System.out.println("bean.copy(jrmp-dl) = "+echo);
+ getLog().debug("bean.copy(jrmp-dl) = " + echo);
Class clazz = echo.getClass();
CodeSource cs = clazz.getProtectionDomain().getCodeSource();
URL location = cs.getLocation();
- System.out.println("IString.class = "+clazz);
- System.out.println("IString.class location = "+location);
+ getLog().debug("IString.class = " + clazz);
+ getLog().debug("IString.class location = " + location);
assertTrue("CodeSource URL.protocol != file",
location.getProtocol().equals("file") == false);
bean.remove();
}
/**
- * Setup the test suite.
+ * Remove any local IString implementation so that we test RMI class loading.
+ *
+ * @exception Exception Description of Exception
*/
- public static Test suite()
+ protected void setUp() throws Exception
{
- TestSuite suite = new TestSuite();
- // add a test case to deploy our support applications
- String filename = "jrmp-dl.jar";
- suite.addTest(new Deploy.Deployer(filename));
-
- suite.addTest(new TestSuite(DynLoadingUnitTestCase.class));
-
- // add a test case to undeploy our support applications
- suite.addTest(new Deploy.Undeployer(filename));
+ super.setUp();
+ URL istringImpl =
getClass().getResource("/org/jboss/test/jrmp/ejb/AString.class");
+ if (istringImpl != null)
+ {
+ getLog().debug("Found IString impl at: " + istringImpl);
+ File implFile = new File(istringImpl.getFile());
+ getLog().debug("Removed: " + implFile.delete());
+ }
+ deployJ2ee("jrmp-dl.jar");
+ }
- return suite;
+ /**
+ * The teardown method for JUnit
+ *
+ * @exception Exception Description of Exception
+ */
+ protected void tearDown() throws Exception
+ {
+ undeployJ2ee("jrmp-dl.jar");
+ super.tearDown();
}
+
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development