public void testMethodPermissions() throws Exception { EjbJarMetaData result = unmarshal(); JBossMetaData jbossMetaData = new JBossMetaData(); jbossMetaData.merge(null, result); // ApplicationMetaData appData = new ApplicationMetaData(jbossMetaData); // Validate the assembly descriptor permissions IAssemblyDescriptorMetaData admd = result.getAssemblyDescriptor(); MethodPermissionsMetaData allPerms = admd.getMethodPermissions(); assertEquals("ejb-jar has 4 method-permissions", 4, allPerms.size()); // Validate StatelessSession bean permission count IEnterpriseBeanMetaData ebmd = result.getEnterpriseBeans().get("StatelessSession"); MethodPermissionsMetaData beanPerms = ebmd.getMethodPermissions(); assertEquals("StatelessSession has 3 method-permissions", 3, beanPerms.size()); // Now validate the method matching logic String echo = "Echo"; String echoLocal = "EchoLocal"; String internal = "InternalRole"; /* BeanMetaData ss = appData.getBeanByEjbName("StatelessSession"); Class[] sig = {}; Set<String> perms = ss.getMethodPermissions("create", sig, InvocationType.HOME); getLog().debug("home create perms: "+perms); assertTrue("Echo can invoke StatelessSessionHome.create", perms.contains(echo)); assertTrue("EchoLocal cannot invoke StatelessSessionHome.create", perms.contains(echoLocal) == false); perms = ss.getMethodPermissions("create", sig, InvocationType.LOCALHOME); getLog().debug("local home create perms: "+perms); assertTrue("Echo can invoke StatelessSessionLocalHome.create", perms.contains(echo)); assertTrue("EchoLocal can invoke StatelessSessionLocalHome.create", perms.contains(echoLocal)); */ }
public void testMultipleMerge() throws Exception { EjbJarMetaData result = unmarshal(); JBossMetaData jboss = unmarshal("JBoss40_testMultipleMerge.xml", JBossMetaData.class, PropertyReplacers.noop()); JBossEnterpriseBeansMetaData beans = jboss.getEnterpriseBeans(); assertEquals(4, beans.size()); JBossEnterpriseBeanMetaData entity = beans.get("EntityCallee"); assertTrue(entity instanceof JBossEntityBeanMetaData); JBossMetaData jbossMetaData = new JBossMetaData(); jbossMetaData.merge(jboss, result); entity = jbossMetaData.getEnterpriseBean("EntityCallee"); JBossEntityBeanMetaData jentity = (JBossEntityBeanMetaData) entity; assertEquals("caller-info.EntityCallee", jentity.getJndiName()); }