1 22 package org.jboss.test.cts.test; 23 24 import javax.naming.InitialContext ; 25 26 import org.jboss.test.cts.jms.ContainerMBox; 27 import org.jboss.test.cts.interfaces.CtsCmp2Session; 28 import org.jboss.test.cts.interfaces.CtsCmp2SessionHome; 29 30 import junit.framework.Test; 31 import junit.framework.TestSuite; 32 33 import org.jboss.test.JBossTestCase; 34 35 39 public class CtsCmp2UnitTestCase extends JBossTestCase 40 { 41 public CtsCmp2UnitTestCase(String name) 42 { 43 super(name); 44 } 45 46 protected void setUp() throws Exception 47 { 48 } 49 50 public void testV1() throws Exception 51 { 52 try 53 { 54 deploy("cts-v1cmp.ear"); 55 InitialContext ctx = new InitialContext (); 56 CtsCmp2SessionHome home = (CtsCmp2SessionHome) ctx.lookup("v1/CtsCmp2SessionBean"); 57 CtsCmp2Session session = home.create(); 58 session.testV1(); 59 } 60 finally 61 { 62 undeploy("cts-v1cmp.ear"); 63 } } 65 66 public void testV2() throws Exception 67 { 68 try 69 { 70 deploy("cts-v1cmp.ear"); 71 try 72 { 73 deploy("cts-v2cmp.ear"); 74 InitialContext ctx = new InitialContext (); 75 CtsCmp2SessionHome home = (CtsCmp2SessionHome) ctx.lookup("v2/CtsCmp2SessionBean"); 76 CtsCmp2Session session = home.create(); 77 session.testV2(); 78 } 79 finally 80 { 81 undeploy("cts-v2cmp.ear"); 82 } } 84 finally 85 { 86 undeploy("cts-v1cmp.ear"); 87 } } 89 90 public void testV1Sar() throws Exception 91 { 92 try 93 { 94 deploy("cts-v1cmp-sar.ear"); 95 InitialContext ctx = new InitialContext (); 96 CtsCmp2SessionHome home = (CtsCmp2SessionHome) ctx.lookup("v1/CtsCmp2SessionBean"); 97 CtsCmp2Session session = home.create(); 98 session.testV1(); 99 } 100 finally 101 { 102 undeploy("cts-v1cmp-sar.ear"); 103 } } 105 106 public void testV2Sar() throws Exception 107 { 108 try 109 { 110 getLog().debug("Deploying cts-v1cmp-sar.ear"); 111 deploy("cts-v1cmp-sar.ear"); 112 getLog().debug("Deployed cts-v1cmp-sar.ear"); 113 try 114 { 115 getLog().debug("Deploying cts-v2cmp-sar.ear"); 116 deploy("cts-v2cmp-sar.ear"); 117 getLog().debug("Deployed cts-v2cmp-sar.ear"); 118 InitialContext ctx = new InitialContext (); 119 CtsCmp2SessionHome home = (CtsCmp2SessionHome) ctx.lookup("v2/CtsCmp2SessionBean"); 120 getLog().debug("Found CtsCmp2SessionHome"); 121 CtsCmp2Session session = home.create(); 122 getLog().debug("Created CtsCmp2Session"); 123 session.testV2(); 124 getLog().debug("Invoked CtsCmp2Session.testV2()"); 125 } 126 finally 127 { 128 undeploy("cts-v2cmp-sar.ear"); 129 } } 131 finally 132 { 133 undeploy("cts-v1cmp-sar.ear"); 134 } } 136 137 public static Test suite() throws Exception 138 { 139 TestSuite suite = new TestSuite(); 140 suite.addTest(new CtsCmp2UnitTestCase("testV1")); 141 suite.addTest(new CtsCmp2UnitTestCase("testV2")); 142 suite.addTest(new CtsCmp2UnitTestCase("testV1Sar")); 143 suite.addTest(new CtsCmp2UnitTestCase("testV2Sar")); 144 return suite; 145 } 146 } 147 | Popular Tags |