Package org.jboss.metadata.javaee.spec

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


     
      Collection<Class<?>> classes = PackageScanner.loadClasses();
     
      JBoss50MetaData metaData = creator.create(classes);
     
      AnnotatedEJBReferenceMetaData reference = metaData.getEnterpriseBean("JaxWS1822Bean").getAnnotatedEjbReferences().iterator().next();
     
      assertEquals(JaxWS1822Bean.class.getName() + "/bean", reference.getName());
   }
View Full Code Here


   private void assertEnv(EnvironmentRefsGroupMetaData env) throws Exception
   {
      // @EJB
      AnnotatedEJBReferencesMetaData ejbRefs = env.getAnnotatedEjbReferences();
      assertEquals(4, ejbRefs.size());
      AnnotatedEJBReferenceMetaData injectedField = ejbRefs.get(MyServlet.class.getName() + "/injectedField");
      assertNotNull(injectedField);
      assertEquals(MyStatelessLocal.class, injectedField.getBeanInterface());
      AnnotatedEJBReferenceMetaData injectedFieldWithOverridenName = ejbRefs.get("overrideName");
      assertNotNull(injectedFieldWithOverridenName);
      assertEquals(MyStatelessLocal.class, injectedFieldWithOverridenName.getBeanInterface());
      AnnotatedEJBReferenceMetaData local1 = ejbRefs.get("ejb/local1");
      assertNotNull(local1);
      assertEquals("java:/MyLocalSession1", local1.getMappedName());
      assertEquals("ejb/local1", local1.getEjbRefName());
      assertEquals("MyLocalSession1", local1.getLink());
      assertEquals("A reference to MyLocalSession1", local1.getDescriptions().value()[0].value());
      assertEquals(MyStatelessLocal.class, local1.getBeanInterface());
      AnnotatedEJBReferenceMetaData local2 = ejbRefs.get("ejb/local2");
      assertNotNull(local2);
      assertEquals("java:/MyLocalSession2", local2.getMappedName());
      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());

      ResourceReferencesMetaData resRefs = env.getResourceReferences();
      //
      assertEquals(3, resRefs.size());
      ResourceReferenceMetaData homePageRef = resRefs.get(MyServlet.class.getName() + "/homePage");
View Full Code Here

      Collection<Class<?>> classes = PackageScanner.loadClasses();
      ApplicationClient5MetaDataCreator creator = new ApplicationClient5MetaDataCreator(finder, classMainName);
      ApplicationClient5MetaData clientMD = creator.create(classes);
      assertEquals(3, clientMD.getAnnotatedEjbReferences().size());

      AnnotatedEJBReferenceMetaData resourceMethodBean = clientMD.getAnnotatedEjbReferences().get(classMainName + "/resourceMethodBean");
      assertNotNull(resourceMethodBean);
      assertEquals(ResourceIF.class, resourceMethodBean.getBeanInterface());
      assertEquals("ResourceOnMethodBean", resourceMethodBean.getLink());
      Set<ResourceInjectionTargetMetaData> resourceMethodBeanTargets = resourceMethodBean.getInjectionTargets();
      assertNotNull(resourceMethodBeanTargets);
      assertEquals(1, resourceMethodBeanTargets.size());
      ResourceInjectionTargetMetaData method = resourceMethodBeanTargets.iterator().next();
      assertEquals(Client.class.getName(), method.getInjectionTargetClass());
      assertEquals("setResourceMethodBean", method.getInjectionTargetName());

      AnnotatedEJBReferenceMetaData resourceFieldBean = clientMD.getAnnotatedEjbReferences().get(classMainName + "/resourceFieldBean");
      assertNotNull(resourceFieldBean);
      assertEquals("ResourceOnFieldBean", resourceFieldBean.getLink());
      Set<ResourceInjectionTargetMetaData> resourceFieldBeanTargets = resourceFieldBean.getInjectionTargets();
      assertNotNull(resourceFieldBeanTargets);
      assertEquals(1, resourceFieldBeanTargets.size());
      ResourceInjectionTargetMetaData field = resourceFieldBeanTargets.iterator().next();
      assertEquals(Client.class.getName(), field.getInjectionTargetClass());
      assertEquals("resourceFieldBean", field.getInjectionTargetName());

      AnnotatedEJBReferenceMetaData resourceClassBean = clientMD.getAnnotatedEjbReferences().get("ejb/resourceClassBean");
      assertNotNull(resourceClassBean);
      assertEquals("ResourcesOnClassBean", resourceClassBean.getLink());
      assertEquals("refs/resources/ResourcesOnClassBean", resourceClassBean.getMappedName());
      assertEquals("refs/resources/ResourcesOnClassBean", resourceClassBean.getJndiName());

      // jms Queue maps to message-destination-refs
      MessageDestinationReferencesMetaData msgRefs = clientMD.getMessageDestinationReferences();
      assertNotNull(msgRefs);
      MessageDestinationReferenceMetaData sendQueue = clientMD.getMessageDestinationReferenceByName("sendQueue");
View Full Code Here

      mergedMetaData.merge(metaData, specMetaData, false);
     
      assertNotNull(mergedMetaData);
      AnnotatedEJBReferencesMetaData annotatedRefs = mergedMetaData.getAnnotatedEjbReferences();
      assertNotNull(annotatedRefs);
      AnnotatedEJBReferenceMetaData annotatedRef = annotatedRefs.get("ejb/resourceClassBean");
      assertNotNull(annotatedRef);
      assertNotNull(annotatedRef.getIgnoreDependency());
      // The same name for jndi / mappedname
      assertEquals("test_resourceClasJndiName", annotatedRef.getJndiName());
      assertEquals("test_resourceClasJndiName", annotatedRef.getMappedName());
   }
View Full Code Here

      assertEquals(SessionType.Stateless, sbeanMD.getSessionType());
      AnnotatedEJBReferencesMetaData aejbRefs = sbeanMD.getAnnotatedEjbReferences();
      assertNotNull(aejbRefs);
      assertEquals(2, aejbRefs.size());
      getLog().debug(aejbRefs);
      AnnotatedEJBReferenceMetaData injectedField = aejbRefs.get("injectedField");
      assertNotNull(injectedField);
      assertEquals(MyStatelessLocal.class, injectedField.getBeanInterface());

      ResourceReferencesMetaData resRefs = sbeanMD.getResourceReferences();
      //
      assertEquals(3, resRefs.size());
      ResourceReferenceMetaData homePageRef = resRefs.get(MyStatelessBean.class.getName() + "/homePage");
View Full Code Here

     
      // EJBTHREE-1289: find a resolved jndi name
      AnnotatedEJBReferencesMetaData amds = container.getEnvironmentRefGroup().getAnnotatedEjbReferences();
      if(amds != null)
      {
         AnnotatedEJBReferenceMetaData amd = amds.get(lookupName);
         if (amd == null && fieldName != null)
         {
            lookupName = fieldName;
            amd = amds.get(lookupName);
         }
         if (amd != null)
         {
            mappedName = amd.getMappedName();
            if (mappedName == null)
               mappedName = amd.getResolvedJndiName();
         }
      }
     
      // The MappedDeploymentEndpointResolver should have put resolvedJndiName everywhere.
      // If no mappedName is known by now, we have a bug.
View Full Code Here

      {
         //
         AnnotatedEJBReferencesMetaData amds = container.getEnvironmentRefGroup().getAnnotatedEjbReferences();
         if(amds != null)
         {
            AnnotatedEJBReferenceMetaData amd = amds.get(lookupName);
            if (amd == null && fieldName != null)
            {
               lookupName = fieldName;
               amd = amds.get(lookupName);
            }
            if (amd != null)
            {
               mappedName = amd.getMappedName();
               if (mappedName == null)
                  mappedName = amd.getResolvedJndiName();
            }
         }
      }

      // The MappedDeploymentEndpointResolver should have put resolvedJndiName everywhere.
View Full Code Here

     
      // EJBTHREE-1289: find a resolved jndi name
      AnnotatedEJBReferencesMetaData amds = container.getEnvironmentRefGroup().getAnnotatedEjbReferences();
      if(amds != null)
      {
         AnnotatedEJBReferenceMetaData amd = amds.get(lookupName);
         if (amd == null && fieldName != null)
         {
            lookupName = fieldName;
            amd = amds.get(lookupName);
         }
         if (amd != null)
         {
            mappedName = amd.getMappedName();
            if (mappedName == null)
               mappedName = amd.getResolvedJndiName();
         }
      }
     
      // The MappedDeploymentEndpointResolver should have put resolvedJndiName everywhere.
      // If no mappedName is known by now, we have a bug.
View Full Code Here

/*  55 */     process(refs, element, annotation);
/*     */   }
/*     */
/*     */   protected void process(AnnotatedEJBReferencesMetaData refs, E element, EJB annotation)
/*     */   {
/*  60 */     AnnotatedEJBReferenceMetaData ref = createEJB(annotation, element);
/*  61 */     refs.add(ref);
/*     */   }
View Full Code Here

/*     */
/*     */   protected abstract Class getType(E paramE);
/*     */
/*     */   protected AnnotatedEJBReferenceMetaData createEJB(EJB annotation, E element)
/*     */   {
/*  79 */     AnnotatedEJBReferenceMetaData ref = new AnnotatedEJBReferenceMetaData();
/*  80 */     if (annotation.name().length() > 0)
/*  81 */       ref.setEjbRefName(annotation.name());
/*     */     else
/*  83 */       ref.setEjbRefName(getName(element));
/*  84 */     if (annotation.beanInterface() != Object.class)
/*  85 */       ref.setBeanInterface(annotation.beanInterface());
/*     */     else
/*  87 */       ref.setBeanInterface(getType(element));
/*  88 */     if (annotation.description().length() > 0)
/*     */     {
/*  90 */       DescriptionImpl description = new DescriptionImpl();
/*  91 */       description.setDescription(annotation.description());
/*  92 */       DescriptionsImpl descriptions = new DescriptionsImpl();
/*  93 */       descriptions.add(description);
/*  94 */       ref.setDescriptions(descriptions);
/*     */     }
/*  96 */     if (annotation.beanName().length() > 0)
/*  97 */       ref.setLink(annotation.beanName());
/*  98 */     if (annotation.mappedName().length() > 0) {
/*  99 */       ref.setMappedName(annotation.mappedName());
/*     */     }
/* 101 */     return ref;
/*     */   }
View Full Code Here

TOP

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

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.