Examples of MethodsMetaData


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

      original.setAssemblyDescriptor(assembly);
      MethodPermissionsMetaData permissions = new MethodPermissionsMetaData();
      assembly.setMethodPermissions(permissions);

      // original only
      MethodsMetaData methods = new MethodsMetaData();
      MethodMetaData method = new MethodMetaData();
      method.setEjbName("Original");
      method.setMethodName("execute");
      methods.add(method);

      MethodPermissionMetaData permission = new MethodPermissionMetaData();
      permission.setMethods(methods);
      permission.setRoles(java.util.Collections.singleton("original"));
      permissions.add(permission);
     
      // mixed original part
      methods = new MethodsMetaData();
      method = new MethodMetaData();
      method.setEjbName("Overriden");
      method.setMethodName("execute");
      method.setMethodIntf(MethodInterfaceType.Local);
      methods.add(method);

      permission = new MethodPermissionMetaData();
      permission.setMethods(methods);
      permission.setRoles(java.util.Collections.singleton("original"));
      permissions.add(permission);

      methods = new MethodsMetaData();
      method = new MethodMetaData();
      method.setEjbName("Overriden");
      method.setMethodName("execute");
      method.setMethodIntf(MethodInterfaceType.Remote);
      methods.add(method);

      permission = new MethodPermissionMetaData();
      permission.setMethods(methods);
      Set<String> roles = new HashSet<String>();
      roles.add("original1");
      roles.add("original2");
      permission.setRoles(roles);
      permissions.add(permission);

      // override
      JBoss50MetaData override = new JBoss50MetaData();
      assembly = new JBossAssemblyDescriptorMetaData();
      override.setAssemblyDescriptor(assembly);
      permissions = new MethodPermissionsMetaData();
      assembly.setMethodPermissions(permissions);
     
      // override only
      methods = new MethodsMetaData();
      method = new MethodMetaData();
      method.setEjbName("Override");
      method.setMethodName("execute");
      methods.add(method);

      permission = new MethodPermissionMetaData();
      permission.setMethods(methods);
      permission.setRoles(java.util.Collections.singleton("override"));
      permissions.add(permission);

      // mixed override part
      methods = new MethodsMetaData();
      method = new MethodMetaData();
      method.setEjbName("Overriden");
      method.setMethodName("execute");
      method.setMethodIntf(MethodInterfaceType.LocalHome);
      methods.add(method);

      permission = new MethodPermissionMetaData();
      permission.setMethods(methods);
      permission.setRoles(java.util.Collections.singleton("override"));
      permissions.add(permission);

      methods = new MethodsMetaData();
      method = new MethodMetaData();
      method.setEjbName("Overriden");
      method.setMethodName("execute");
      method.setMethodIntf(MethodInterfaceType.Remote);
      methods.add(method);

      permission = new MethodPermissionMetaData();
      permission.setMethods(methods);
      roles = new HashSet<String>();
      roles.add("override1");
      roles.add("override2");
      permission.setRoles(roles);
      permissions.add(permission);

      // merge
      JBoss50MetaData merged = new JBoss50MetaData();
      merged.merge(override, original);     
      assembly = merged.getAssemblyDescriptor();
      assertNotNull(assembly);
      permissions = assembly.getMethodPermissions();
      assertNotNull(permissions);
      assertEquals(6, permissions.size());

      for(MethodPermissionMetaData perm : permissions)
      {
         methods = perm.getMethods();
         assertNotNull(methods);
         assertEquals(1, methods.size());
         method = methods.get(0);
         assertNotNull(method);
         assertEquals("execute", method.getMethodName());
         roles = perm.getRoles();
         assertNotNull(roles);
        
View Full Code Here

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

      // @DenyAll
      // cls.getDeclaredMethods is un-ordered, so we must use bestMatch
      ExcludeListMetaData excludes = assembly.getExcludeList();
      assertNotNull(excludes);
      MethodsMetaData excludedMethods = excludes.getMethods();
      assertEquals(2, excludedMethods.size());
      MethodMetaData m0 = excludedMethods.bestMatch("denyAll", (Class[]) null, null, null);
      assertEquals("MyStatelessBean", m0.getEjbName());
      assertEquals("denyAll", m0.getMethodName());
      MethodParametersMetaData noargs = new MethodParametersMetaData();
      assertEquals(noargs, m0.getMethodParams());
      MethodMetaData m1 = excludedMethods.bestMatch("excluded", (Class[]) null, null, null);;
      assertEquals("MyStatelessBean", m1.getEjbName());
      assertEquals("excluded", m1.getMethodName());
      assertEquals(noargs, m1.getMethodParams());

      // @PermitAll, @RolesAllowed({"AccessRole1", "AccessRole2"})
View Full Code Here

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

      ContainerTransactionMetaData tx1 = it.next();
      assertEquals(TransactionAttributeType.NEVER, tx1.getTransAttribute());
      // TODO: methods
      ContainerTransactionMetaData tx2 = it.next();
      assertEquals(TransactionAttributeType.MANDATORY, tx2.getTransAttribute());
      MethodsMetaData tx2Methods = tx2.getMethods();
      String[] params = {};
      tx2Methods.matches("transactionAttributeMandatory", params, null);

      // @EJB
      AnnotatedEJBReferencesMetaData ejbRefs = bean.getAnnotatedEjbReferences();
      assertEquals(2, ejbRefs.size());
      AnnotatedEJBReferenceMetaData injectedField = ejbRefs.get("injectedField");
View Full Code Here

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

      ContainerTransactionMetaData tx1 = it.next();
      assertEquals(TransactionAttributeType.NEVER, tx1.getTransAttribute());
      // TODO: methods
      ContainerTransactionMetaData tx2 = it.next();
      assertEquals(TransactionAttributeType.MANDATORY, tx2.getTransAttribute());
      MethodsMetaData tx2Methods = tx2.getMethods();
      String[] params = {};
      tx2Methods.matches("transactionAttributeMandatory", params, null);

      // @EJB
      AnnotatedEJBReferencesMetaData ejbRefs = bean.getAnnotatedEjbReferences();
      assertEquals(2, ejbRefs.size());
      AnnotatedEJBReferenceMetaData injectedField = ejbRefs.get("injectedField");
View Full Code Here

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

      // @DenyAll
      // cls.getDeclaredMethods is un-ordered, so we must use bestMatch
      ExcludeListMetaData excludes = assembly.getExcludeList();
      assertNotNull(excludes);
      MethodsMetaData excludedMethods = excludes.getMethods();
      assertEquals(2, excludedMethods.size());
      MethodMetaData m0 = excludedMethods.bestMatch("denyAll", (Class[]) null, null, null);
      assertEquals("MyStatelessBean", m0.getEjbName());
      assertEquals("denyAll", m0.getMethodName());
      MethodParametersMetaData noargs = new MethodParametersMetaData();
      assertEquals(noargs, m0.getMethodParams());
      MethodMetaData m1 = excludedMethods.bestMatch("excluded", (Class[]) null, null, null);;
      assertEquals("MyStatelessBean", m1.getEjbName());
      assertEquals("excluded", m1.getMethodName());
      assertEquals(noargs, m1.getMethodParams());

      // @PermitAll, @RolesAllowed({"AccessRole1", "AccessRole2"})
View Full Code Here

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

      Iterator<ContainerTransactionMetaData> it = bean.getContainerTransactions().iterator();
      ContainerTransactionMetaData tx1 = it.next();
      assertEquals(TransactionAttributeType.NEVER, tx1.getTransAttribute());
      ContainerTransactionMetaData tx2 = it.next();
      assertEquals(TransactionAttributeType.MANDATORY, tx2.getTransAttribute());
      MethodsMetaData tx2Methods = tx2.getMethods();
      String[] params = {};
      tx2Methods.matches("transactionAttributeMandatory", params, null);

      // @EJB
      AnnotatedEJBReferencesMetaData ejbRefs = bean.getAnnotatedEjbReferences();
      assertEquals(2, ejbRefs.size());
      AnnotatedEJBReferenceMetaData injectedField = ejbRefs.get("injectedField");
View Full Code Here

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

      Iterator<ContainerTransactionMetaData> it = bean.getContainerTransactions().iterator();
      String[] params =
      {};
      ContainerTransactionMetaData tx1 = it.next();
      assertEquals(TransactionAttributeType.NEVER, tx1.getTransAttribute());
      MethodsMetaData tx1Methods = tx1.getMethods();
      assertNotNull(tx1Methods);
      assertTrue(tx1Methods.matches("*", params, null));

      ContainerTransactionMetaData tx2 = it.next();
      assertEquals(TransactionAttributeType.MANDATORY, tx2.getTransAttribute());
      MethodsMetaData tx2Methods = tx2.getMethods();
      assertTrue(tx2Methods.matches("transactionAttributeMandatory", params, null));

      // @EJB
      AnnotatedEJBReferencesMetaData ejbRefs = bean.getAnnotatedEjbReferences();
      assertEquals(2, ejbRefs.size());
      AnnotatedEJBReferenceMetaData injectedField = ejbRefs.get("injectedField");
View Full Code Here

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

      // @DenyAll
      // cls.getDeclaredMethods is un-ordered, so we must use bestMatch
      ExcludeListMetaData excludes = assembly.getExcludeList();
      assertNotNull(excludes);
      MethodsMetaData excludedMethods = excludes.getMethods();
      assertEquals(2, excludedMethods.size());
      MethodMetaData m0 = excludedMethods.bestMatch("denyAll", (Class[]) null, null, null);
      assertEquals("MyStatelessBean", m0.getEjbName());
      assertEquals("denyAll", m0.getMethodName());
      MethodParametersMetaData noargs = new MethodParametersMetaData();
      assertEquals(noargs, m0.getMethodParams());
      MethodMetaData m1 = excludedMethods.bestMatch("excluded", (Class[]) null, null, null);;
      assertEquals("MyStatelessBean", m1.getEjbName());
      assertEquals("excluded", m1.getMethodName());
      assertEquals(noargs, m1.getMethodParams());

      // @PermitAll, @RolesAllowed({"AccessRole1", "AccessRole2"})
View Full Code Here

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

            if (assemblyDescriptor != null) {
                final ContainerTransactionsMetaData containerTransactions = assemblyDescriptor.getContainerTransactionsByEjbName(componentConfiguration.getEJBName());
                if (containerTransactions != null) {
                    for (final ContainerTransactionMetaData containerTx : containerTransactions) {
                        final TransactionAttributeType txAttr = containerTx.getTransAttribute();
                        final MethodsMetaData methods = containerTx.getMethods();
                        for (final MethodMetaData method : methods) {
                            final String methodName = method.getMethodName();
                            final MethodIntf methodIntf = this.getMethodIntf(method.getMethodIntf());
                            if (methodName.equals("*")) {
                                componentConfiguration.setTransactionAttribute(methodIntf, null, txAttr);
View Full Code Here

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

                  .size());
      MethodPermissionMetaData permission = permissions.get(0);
      TestCase.assertNotNull(permission);

      // Ensure we've got the right method associated w/ the permission
      MethodsMetaData methods = permission.getMethods();
      TestCase.assertEquals(1, methods.size());
      MethodMetaData method = methods.get(0);
      TestCase.assertNotNull(method);
      String methodName = method.getMethodName();
      String expectedMethodName = "someMethod";
      TestCase.assertEquals(expectedMethodName, methodName);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.