1 25 package org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.invocationcontext; 26 27 import static org.objectweb.easybeans.tests.common.helper.EJBHelper.getBeanLocalInstance; 28 import static org.objectweb.easybeans.tests.common.helper.InvocationContextHelper.INT_VALUE_0; 29 import static org.objectweb.easybeans.tests.common.helper.InvocationContextHelper.INT_VALUE_1; 30 import static org.objectweb.easybeans.tests.common.helper.InvocationContextHelper.INT_VALUE_2; 31 import static org.objectweb.easybeans.tests.common.helper.InvocationContextHelper.STR_VALUE_0; 32 import static org.objectweb.easybeans.tests.common.helper.InvocationContextHelper.STR_VALUE_1; 33 import static org.objectweb.easybeans.tests.common.helper.InvocationContextHelper.STR_VALUE_2; 34 import static org.testng.Assert.assertEquals; 35 import static org.testng.Assert.assertNull; 36 import static org.testng.Assert.assertTrue; 37 38 import java.util.List ; 39 40 import javax.ejb.Remote ; 41 import javax.ejb.Stateless ; 42 43 import org.objectweb.easybeans.log.JLog; 44 import org.objectweb.easybeans.log.JLogFactory; 45 import org.objectweb.easybeans.tests.common.ejbs.base.invocationcontext.ItfInvocationParameter00; 46 import org.objectweb.easybeans.tests.common.ejbs.base.invocationcontext.ItfInvocationParameterTest; 47 import org.objectweb.easybeans.tests.common.interceptors.invocationcontext.BeanDescriptor; 48 import org.objectweb.easybeans.tests.common.interceptors.invocationcontext.ComplexObject00; 49 50 56 @Stateless 57 @Remote 58 public class SLSBInvocationParameterTest implements ItfInvocationParameterTest { 59 60 63 private JLog logger = JLogFactory.getLog(SLSBInvocationParameterTest.class); 64 65 71 public void testNull(final Class beanClass) throws Exception { 72 ItfInvocationParameter00 icBean = getBeanLocalInstance(beanClass, ItfInvocationParameter00.class); 73 74 ComplexObject00 cmpObj = new ComplexObject00(); 75 76 Object [] arResult = icBean.getObjects00(cmpObj); 77 78 assertNull(arResult[0], "[0]The object should be null."); 79 } 80 81 87 public void testWithoutModification(final Class beanClass) throws Exception { 88 ItfInvocationParameter00 icBean = getBeanLocalInstance(beanClass, ItfInvocationParameter00.class); 89 90 ComplexObject00 cmpObj = new ComplexObject00(); 91 92 logger.debug("before bean method call, parameter: {0}", cmpObj); 93 94 Object [] arResult = icBean.getObjects01(cmpObj); 95 96 logger.debug("after bean method call, parameter: {0}", arResult[0]); 97 98 assertEquals(arResult[0], cmpObj, "[0]The object should be the same. "); 99 } 100 101 107 public void testWithModification(final Class beanClass) throws Exception { 108 ItfInvocationParameter00 icBean = getBeanLocalInstance(beanClass, ItfInvocationParameter00.class); 109 110 ComplexObject00 cmpObj = new ComplexObject00(); 111 112 Object [] arObjResult = icBean.getObjects02(cmpObj); 113 114 ComplexObject00 cmpResult = (ComplexObject00) arObjResult[0]; 115 116 assertTrue(cmpResult.getHashCode() == INT_VALUE_0.intValue(), "[0]The returned object is not the expected. "); 118 assertEquals(cmpResult.getInterceptedMethod(), STR_VALUE_0, "[1]The returned object is not the expected. "); 119 120 List <BeanDescriptor> lstDescs = cmpResult.getDescriptors().get(0); 121 assertTrue(lstDescs.get(0).getHashCode() == INT_VALUE_1.intValue(), 123 "[2]The returned object is not the expected. "); 124 assertEquals(lstDescs.get(0).getInterceptedMethod(), STR_VALUE_1, 125 "[3]The returned object is not the expected. "); 126 127 assertTrue(lstDescs.get(1).getHashCode() == INT_VALUE_2.intValue(), 128 "[4]The returned object is not the expected. "); 129 assertEquals(lstDescs.get(1).getInterceptedMethod(), STR_VALUE_2, 130 "[5]The returned object is not the expected. "); 131 } 132 133 } 134 | Popular Tags |