Package org.jboss.metadata.ejb.spec

Examples of org.jboss.metadata.ejb.spec.RemoveMethodMetaData


  
   public void testRemoveMethods()
   {
      // Override
      RemoveMethodsMetaData overrideRemoveMethods = new RemoveMethodsMetaData();
      RemoveMethodMetaData overrideRemoveMethod = new RemoveMethodMetaData();
      overrideRemoveMethod.setId("overrideId");
      overrideRemoveMethod.setRetainIfException(true);
      NamedMethodMetaData overrideNamedMethod = new NamedMethodMetaData();
      overrideNamedMethod.setMethodName("overrideMethodName");
      overrideRemoveMethod.setBeanMethod(overrideNamedMethod);
      overrideRemoveMethods.add(overrideRemoveMethod);

      JBossSessionBeanMetaData override = new JBossSessionBeanMetaData();
      override.setRemoveMethods(overrideRemoveMethods);
      override.setName("overrideName");

      // Original
      RemoveMethodsMetaData originalRemoveMethods = new RemoveMethodsMetaData();
      RemoveMethodMetaData originalRemoveMethod = new RemoveMethodMetaData();
      originalRemoveMethod.setId("originalId");
      originalRemoveMethod.setRetainIfException(false);
      NamedMethodMetaData originalNamedMethod = new NamedMethodMetaData();
      originalNamedMethod.setId("originalId");
      originalRemoveMethod.setBeanMethod(originalNamedMethod);
      originalRemoveMethods.add(originalRemoveMethod);
     
      JBossSessionBeanMetaData original = new JBossSessionBeanMetaData();
      original.setRemoveMethods(originalRemoveMethods);
     
      // Merged
      JBossSessionBeanMetaData merged = new JBossSessionBeanMetaData();
      merged.merge(override, original);
      RemoveMethodsMetaData removeMethods = merged.getRemoveMethods();
      assertNotNull(removeMethods);
      RemoveMethodMetaData removeMethod = removeMethods.get(1);
      assertNotNull(removeMethod);
      assertEquals("overrideId", removeMethod.getId());
      assertTrue(removeMethod.isRetainIfException());
      NamedMethodMetaData namedMethod = removeMethod.getBeanMethod();
      assertNotNull(namedMethod);
      assertEquals("overrideMethodName", namedMethod.getMethodName());
     
   }
View Full Code Here


  
   public void testRemoveMethodsRetainOverrideIsNull()
   {
      // Override
      RemoveMethodsMetaData overrideRemoveMethods = new RemoveMethodsMetaData();
      RemoveMethodMetaData overrideRemoveMethod = new RemoveMethodMetaData();
      overrideRemoveMethod.setId("overrideId");
      NamedMethodMetaData overrideNamedMethod = new NamedMethodMetaData();
      overrideNamedMethod.setMethodName("overrideMethodName");
      overrideRemoveMethod.setBeanMethod(overrideNamedMethod);
      overrideRemoveMethods.add(overrideRemoveMethod);

      JBossSessionBeanMetaData override = new JBossSessionBeanMetaData();
      override.setRemoveMethods(overrideRemoveMethods);
      override.setName("overrideName");

      // Original
      RemoveMethodsMetaData originalRemoveMethods = new RemoveMethodsMetaData();
      RemoveMethodMetaData originalRemoveMethod = new RemoveMethodMetaData();
      originalRemoveMethod.setId("originalId");
      originalRemoveMethod.setRetainIfException(true);
      NamedMethodMetaData originalNamedMethod = new NamedMethodMetaData();
      originalNamedMethod.setMethodName("overrideMethodName");
      originalNamedMethod.setId("originalId");
      originalRemoveMethod.setBeanMethod(originalNamedMethod);
      originalRemoveMethods.add(originalRemoveMethod);
     
      JBossSessionBeanMetaData original = new JBossSessionBeanMetaData();
      original.setRemoveMethods(originalRemoveMethods);
     
      // Merged
      JBossSessionBeanMetaData merged = new JBossSessionBeanMetaData();
      merged.merge(override, original);
      RemoveMethodsMetaData removeMethods = merged.getRemoveMethods();
      assertNotNull(removeMethods);
      RemoveMethodMetaData removeMethod = removeMethods.get(0);
      assertNotNull(removeMethod);
      assertEquals("overrideId", removeMethod.getId());
      assertTrue(removeMethod.isRetainIfException());
      NamedMethodMetaData namedMethod = removeMethod.getBeanMethod();
      assertNotNull(namedMethod);
      assertEquals("overrideMethodName", namedMethod.getMethodName());
     
   }
View Full Code Here

     
      assertNotNull(removeMethods);
      assertEquals(5, removeMethods.size());

      NamedMethodMetaData namedMethod = createNamedMethodMD("remove", "boolean");
      RemoveMethodMetaData removeMethod = getRemoveMethod(removeMethods, namedMethod);
      assertNotNull(removeMethod);
      assertEquals("remove", removeMethod.getBeanMethod().getMethodName());
      assertNotNull(removeMethod.getBeanMethod().getMethodParams());
      assertEquals(1, removeMethod.getBeanMethod().getMethodParams().size());
      assertFalse(removeMethod.isRetainIfException());

      namedMethod = createNamedMethodMD("remove", new String[]{"boolean", "boolean"});
      removeMethod = getRemoveMethod(removeMethods, namedMethod);
      assertNotNull(removeMethod);
      assertEquals("remove", removeMethod.getBeanMethod().getMethodName());
      assertNotNull(removeMethod.getBeanMethod().getMethodParams());
      assertEquals(2, removeMethod.getBeanMethod().getMethodParams().size());
      assertTrue(removeMethod.isRetainIfException());
     
      namedMethod = createNamedMethodMD("retain", "boolean");
      removeMethod = getRemoveMethod(removeMethods, namedMethod);
      assertNotNull(removeMethod);
      assertEquals("retain", removeMethod.getBeanMethod().getMethodName());
      assertNotNull(removeMethod.getBeanMethod().getMethodParams());
      assertEquals("boolean", removeMethod.getBeanMethod().getMethodParams().get(0));
      assertFalse(removeMethod.isRetainIfException());
     
      namedMethod = createNamedMethodMD("retain", null);
      removeMethod = getRemoveMethod(removeMethods, namedMethod);
      assertNotNull(removeMethod);
      assertEquals("retain", removeMethod.getBeanMethod().getMethodName());
      assertNull(removeMethod.getBeanMethod().getMethodParams());
      assertTrue(removeMethod.isRetainIfException());

      namedMethod = createNamedMethodMD("remove", null);
      removeMethod = getRemoveMethod(removeMethods, namedMethod);
      assertNotNull(removeMethod);
      assertEquals("remove", removeMethod.getBeanMethod().getMethodName());
      assertTrue(removeMethod.getBeanMethod().getMethodParams().isEmpty());
      assertFalse(removeMethod.isRetainIfException());
     
   }
View Full Code Here

/*    */   {
/* 58 */     Remove remove = (Remove)this.finder.getAnnotation(method, Remove.class);
/* 59 */     if (remove == null) {
/* 60 */       return null;
/*    */     }
/* 62 */     RemoveMethodMetaData metaData = new RemoveMethodMetaData();
/* 63 */     NamedMethodMetaData beanMethod = new NamedMethodMetaData();
/* 64 */     beanMethod.setMethodName(method.getName());
/* 65 */     metaData.setBeanMethod(beanMethod);
/* 66 */     metaData.setRetainIfException(remove.retainIfException());
/*    */
/* 68 */     MethodParametersMetaData methodParams = ProcessorUtils.getMethodParameters(method);
/* 69 */     beanMethod.setMethodParams(methodParams);
/*    */
/* 71 */     return metaData;
View Full Code Here

/* 71 */     return metaData;
/*    */   }
/*    */
/*    */   public void process(SessionBeanMetaData bean, Method method)
/*    */   {
/* 76 */     RemoveMethodMetaData removeMethod = create(method);
/* 77 */     if (removeMethod == null) {
/* 78 */       return;
/*    */     }
/* 80 */     if (bean.getSessionType() != SessionType.Stateful) {
/* 81 */       throw new IllegalArgumentException("Remove annotation is only valid on a stateful bean");
View Full Code Here

TOP

Related Classes of org.jboss.metadata.ejb.spec.RemoveMethodMetaData

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.