1 25 package org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.basic; 26 27 import static org.testng.Assert.assertFalse; 28 import static org.testng.Assert.assertTrue; 29 30 import javax.ejb.EJB ; 31 import javax.ejb.Remote ; 32 import javax.ejb.Stateless ; 33 34 import org.objectweb.easybeans.tests.common.ejbs.base.ItfSimplePrintMessage; 35 import org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.basic.SFSBDeployTest; 36 import org.objectweb.easybeans.tests.common.helper.EJBHelper; 37 38 39 45 @Stateless 46 @Remote 47 public class SLSBSessionObjectIdentity implements ItfSessionObjectIdentity { 48 49 52 @EJB (beanName = "SLSBDeployTest") 53 private ItfSimplePrintMessage slsbBean1; 54 55 58 @EJB (beanName = "SLSBDeployTest") 59 private ItfSimplePrintMessage slsbBean2; 60 61 64 @EJB (beanName = "SFSBDeployTest") 65 private ItfSimplePrintMessage sfsbBean1; 66 67 70 @EJB (beanName = "SFSBDeployTest") 71 private ItfSimplePrintMessage sfsbBean2; 72 73 78 public void testSLSameInstanceIdentityInjected() { 79 assertTrue(slsbBean1.equals(slsbBean1), "The stateless bean is not equal to itself."); 80 } 81 82 87 public void testSLDifferentInstanceIdentityInjected() { 88 assertTrue(slsbBean1.equals(slsbBean2), 89 "The stateless bean is not equal to other stateless with the same name."); 90 } 91 92 97 public void testSFSameInstanceIdentityInjected() { 98 assertTrue(sfsbBean1.equals(sfsbBean1), "The stateful bean is not equal to itself."); 99 } 100 101 106 public void testSFDifferentInstanceIdentityInjected() { 107 assertFalse(sfsbBean1.equals(sfsbBean2), "The stateful bean is equal to other stateful with the same name."); 108 } 109 110 116 public void testSLSameInstanceIdentityLookup() throws Exception { 117 ItfSimplePrintMessage bean1 = EJBHelper 118 .getBeanRemoteInstance(SLSBDeployTest.class, ItfSimplePrintMessage.class); 119 assertTrue(bean1.equals(bean1), "The stateless bean is not equal to itself."); 120 } 121 122 128 public void testSLDifferentInstanceIdentityLookup() throws Exception { 129 ItfSimplePrintMessage bean1 = EJBHelper 130 .getBeanRemoteInstance(SLSBDeployTest.class, ItfSimplePrintMessage.class); 131 ItfSimplePrintMessage bean2 = EJBHelper 132 .getBeanRemoteInstance(SLSBDeployTest.class, ItfSimplePrintMessage.class); 133 assertTrue(bean1.equals(bean2), "The stateless bean is not equal to other stateless with the same name."); 134 } 135 136 142 public void testSFSameInstanceIdentityLookup() throws Exception { 143 ItfSimplePrintMessage bean1 = EJBHelper 144 .getBeanRemoteInstance(SFSBDeployTest.class, ItfSimplePrintMessage.class); 145 assertTrue(bean1.equals(bean1), "The stateful bean is not equal to itself."); 146 } 147 148 154 public void testSFDifferentInstanceIdentityLookup() throws Exception { 155 ItfSimplePrintMessage bean1 = EJBHelper 156 .getBeanRemoteInstance(SFSBDeployTest.class, ItfSimplePrintMessage.class); 157 ItfSimplePrintMessage bean2 = EJBHelper 158 .getBeanRemoteInstance(SFSBDeployTest.class, ItfSimplePrintMessage.class); 159 assertFalse(bean1.equals(bean2), "The stateful bean is equal to other stateful with the same name."); 160 } 161 162 } 163 | Popular Tags |