Package org.jboss.metadata.javaee.spec

Examples of org.jboss.metadata.javaee.spec.LifecycleCallbacksMetaData


*/
public class OrderCallbacksUnitTestCase extends TestCase
{
   public void testOrder() throws Exception
   {
      LifecycleCallbacksMetaData callbacks = new LifecycleCallbacksMetaData();     
      LifecycleCallbackMetaData callback;

      callback = new LifecycleCallbackMetaData();
      callback.setClassName(DefaultSuperSuperClass.class.getName());
      callback.setMethodName("superSuperClassCallback");
      callbacks.add(callback);

      callback = new LifecycleCallbackMetaData();
      callback.setClassName(DefaultSuperClass.class.getName());
      callback.setMethodName("superClassCallback");
      callbacks.add(callback);
     
      callback = new LifecycleCallbackMetaData();
      callback.setMethodName("callback");
      callbacks.add(callback);

      callback = new LifecycleCallbackMetaData();
      callback.setClassName(DefaultSubclass.class.getName());
      callback.setMethodName("subclassCallback");
      callbacks.add(callback);

      callback = new LifecycleCallbackMetaData();
      callback.setClassName(DefaultSubsubclass.class.getName());
      callback.setMethodName("subsubclassCallback");
      callbacks.add(callback);

      callback = new LifecycleCallbackMetaData();
      callback.setClassName(CallbackInterceptorSuperClass.class.getName());
      callback.setMethodName("superClassCallback");
      callbacks.add(callback);

      callback = new LifecycleCallbackMetaData();
      callback.setClassName(CallbackInterceptorClass1.class.getName());
      callback.setMethodName("callback");
      callbacks.add(callback);

      callback = new LifecycleCallbackMetaData();
      callback.setClassName(CallbackInterceptorClass2.class.getName());
      callback.setMethodName("callback");
      callbacks.add(callback);

      // test it a few times
      for(int i = 0; i < 10; ++i)
         shuffleAndOrder(callbacks);
   }
View Full Code Here


   }
  
   @XmlTransient
   public LifecycleCallbacksMetaData getPostConstructs()
   {
      LifecycleCallbacksMetaData lcs = null;
      if(jndiEnvironmentRefsGroup != null)
         lcs = jndiEnvironmentRefsGroup.getPostConstructs();
      return lcs;
   }
View Full Code Here

   }

   @XmlTransient
   public LifecycleCallbacksMetaData getPreDestroys()
   {
      LifecycleCallbacksMetaData lcs = null;
      if(jndiEnvironmentRefsGroup != null)
         lcs = jndiEnvironmentRefsGroup.getPreDestroys();
      return lcs;
   }
View Full Code Here

      merged.merge(dd, metaData);
      //AnnotationMergedView.merge(merged, specMetaData, metaData);

      JBossSessionBeanMetaData sessionBean = (JBossSessionBeanMetaData) merged.getEnterpriseBean("MetaDataStatelessBean");
      assertNotNull(sessionBean);
      LifecycleCallbacksMetaData lifecycleCallbacks = sessionBean.getPostConstructs();
      assertNotNull(lifecycleCallbacks);
      assertEquals(1, lifecycleCallbacks.size());
      LifecycleCallbackMetaData lifecycleCallback = lifecycleCallbacks.get(0);
      assertEquals("postConstruct", lifecycleCallback.getMethodName());
   }
View Full Code Here

      assertEquals("ejb/local2", local2.getEjbRefName());
      assertEquals("local.jar#MyLocalSession1", local2.getLink());
      assertEquals("A reference to MyLocalSession2", local2.getDescriptions().value()[0].value());
      assertEquals(MyStatelessLocal.class, local2.getBeanInterface());
      // @PostConstruct
      LifecycleCallbacksMetaData postConstructs = bean.getPostConstructs();
      assertNotNull(postConstructs);
      assertEquals(1, postConstructs.size());
      LifecycleCallbackMetaData postConstruct = postConstructs.get(0);
      assertEquals("setUp", postConstruct.getMethodName());
      assertEquals(MyStatefulBean.class.getName(), postConstruct.getClassName());
      // @PreDestroy
      LifecycleCallbacksMetaData preDestroys = bean.getPreDestroys();
      assertNotNull(preDestroys);
      assertEquals(1, preDestroys.size());
      LifecycleCallbackMetaData preDestroy = preDestroys.get(0);
      assertEquals("tearDown", preDestroy.getMethodName());
      assertEquals(MyStatefulBean.class.getName(), preDestroy.getClassName());
      // @Init
      InitMethodsMetaData initMethods = bean.getInitMethods();
      assertNotNull(initMethods);
      assertEquals(1, initMethods.size());
      InitMethodMetaData initMethod = initMethods.get(0);
      assertEquals("init", initMethod.getBeanMethod().getMethodName());
      // @PostActivate
      LifecycleCallbacksMetaData postActivates = bean.getPostActivates();
      assertNotNull(postActivates);
      assertEquals(1, postActivates.size());
      LifecycleCallbackMetaData postActivate = postActivates.get(0);
      assertEquals("activate", postActivate.getMethodName());
      assertEquals(MyStatefulBean.class.getName(), postActivate.getClassName());
      // @PrePassivate
      LifecycleCallbacksMetaData prePassivates = bean.getPrePassivates();
      assertNotNull(prePassivates);
      assertEquals(1, prePassivates.size());
      LifecycleCallbackMetaData prePassivate = prePassivates.get(0);
      assertEquals("passivate", prePassivate.getMethodName());
      assertEquals(MyStatefulBean.class.getName(), prePassivate.getClassName());
      // @Remove
      RemoveMethodsMetaData removeMethods = bean.getRemoveMethods();
      assertNotNull(removeMethods);
View Full Code Here

      assertEquals(MyStatelessLocal.class, injectedField.getBeanInterface());
      AnnotatedEJBReferenceMetaData injectedFieldWithOverridenName = ejbRefs.get("overrideName");
      assertNotNull(injectedFieldWithOverridenName);
      assertEquals(MyStatelessLocal.class, injectedFieldWithOverridenName.getBeanInterface());
      // @PostConstruct
      LifecycleCallbacksMetaData postConstructs = bean.getPostConstructs();
      assertNotNull(postConstructs);
      assertEquals(1, postConstructs.size());
      LifecycleCallbackMetaData postConstruct = postConstructs.get(0);
      assertEquals("setUp", postConstruct.getMethodName());
      assertEquals(MyStatelessBean.class.getName(), postConstruct.getClassName());
      // @PreDestroy
      LifecycleCallbacksMetaData preDestroys = bean.getPreDestroys();
      assertNotNull(preDestroys);
      assertEquals(1, preDestroys.size());
      LifecycleCallbackMetaData preDestroy = preDestroys.get(0);
      assertEquals("tearDown", preDestroy.getMethodName());
      assertEquals(MyStatelessBean.class.getName(), preDestroy.getClassName());

      // @RunAs
      SecurityIdentityMetaData identity = bean.getSecurityIdentity();
View Full Code Here

      assertEquals(MyStatelessLocal.class, injectedField.getBeanInterface());
      AnnotatedEJBReferenceMetaData injectedFieldWithOverridenName = ejbRefs.get("overrideName");
      assertNotNull(injectedFieldWithOverridenName);
      assertEquals(MyStatelessLocal.class, injectedFieldWithOverridenName.getBeanInterface());
      // @PostConstruct
      LifecycleCallbacksMetaData postConstructs = bean.getPostConstructs();
      assertNotNull(postConstructs);
      assertEquals(1, postConstructs.size());
      LifecycleCallbackMetaData postConstruct = postConstructs.get(0);
      assertEquals("setUp", postConstruct.getMethodName());
      assertEquals(MyServiceBean.class.getName(), postConstruct.getClassName());
      // @PreDestroy
      LifecycleCallbacksMetaData preDestroys = bean.getPreDestroys();
      assertNotNull(preDestroys);
      assertEquals(1, preDestroys.size());
      LifecycleCallbackMetaData preDestroy = preDestroys.get(0);
      assertEquals("tearDown", preDestroy.getMethodName());
      assertEquals(MyServiceBean.class.getName(), preDestroy.getClassName());

      // @RunAs
      SecurityIdentityMetaData identity = bean.getSecurityIdentity();
View Full Code Here

      assertEquals(Client.class.getName(), queueNameEntryField.getInjectionTargetClass());
      assertEquals("queueName", queueNameEntryField.getInjectionTargetName());
      // Float
      // int

      LifecycleCallbacksMetaData postConstructs = clientMD.getPostConstructs();
      assertNotNull(postConstructs);
      assertEquals(1, postConstructs.size());
      LifecycleCallbackMetaData pc = postConstructs.get(0);
      assertEquals(Client.class.getName(), pc.getClassName());
      assertEquals("postConstruct", pc.getMethodName());
     
      LifecycleCallbacksMetaData preDestroys = clientMD.getPreDestroys();
      assertNotNull(preDestroys);
      assertEquals(1, preDestroys.size());
      LifecycleCallbackMetaData pd = preDestroys.get(0);
      assertEquals(Client.class.getName(), pd.getClassName());
      assertEquals("destroy", pd.getMethodName());

      // @WebServiceRef
      ServiceReferenceMetaData wsRef = clientMD.getServiceReferenceByName("service/somewebservice");
View Full Code Here

      msg = merged.getEnvironmentEntryByName("msg");
      assertNotNull(msg);
      assertEquals("java.lang.String", msg.getType());
      assertEquals("how are you?", msg.getValue());

      LifecycleCallbacksMetaData postConstructs = merged.getPostConstructs();
      assertNotNull(postConstructs);
      // 2 because of the null class name in the xml
      assertEquals(2, postConstructs.size());
      LifecycleCallbackMetaData pc0 = postConstructs.get(0);
      assertEquals("postConstruct", pc0.getMethodName());

      LifecycleCallbacksMetaData preDestroys = merged.getPreDestroys();
      assertNotNull(preDestroys);
      // 2 because of the null class name in the xml
      assertEquals(2, preDestroys.size());
      LifecycleCallbackMetaData pd0 = preDestroys.get(0);
      assertEquals("preDestroy", pd0.getMethodName());

      assertEquals("org.jboss.ejb3.test.applicationclient.client.TestCallbackHandler", merged.getCallbackHandler());

      // ORB maps to a resource-env-ref
View Full Code Here

         EnvironmentEntryMetaData msg = mergedMetaData.getEnvironmentEntryByName("msg");
         assertNotNull(msg);
         assertEquals("java.lang.String", msg.getType());
         assertEquals("how are you?", msg.getValue());

         LifecycleCallbacksMetaData postConstructs = mergedMetaData.getPostConstructs();
         assertNotNull(postConstructs);
         // 2 because of the null class name in the xml
         assertEquals(2, postConstructs.size());
         LifecycleCallbackMetaData pc0 = postConstructs.get(0);
         assertEquals("postConstruct", pc0.getMethodName());

         LifecycleCallbacksMetaData preDestroys = mergedMetaData.getPreDestroys();
         assertNotNull(preDestroys);
         // 2 because of the null class name in the xml
         assertEquals(2, preDestroys.size());
         LifecycleCallbackMetaData pd0 = preDestroys.get(0);
         assertEquals("preDestroy", pd0.getMethodName());

         assertEquals("org.jboss.ejb3.test.applicationclient.client.TestCallbackHandler", mergedMetaData.getCallbackHandler());

         // jms Queue maps to message-destination-refs
View Full Code Here

TOP

Related Classes of org.jboss.metadata.javaee.spec.LifecycleCallbacksMetaData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.