use of org.apache.openejb.assembler.classic.EjbJarInfo in project tomee by apache.
the class AppInfoBuilderTest method testShouldAddSecurityDetailsToPortInfo.
public void testShouldAddSecurityDetailsToPortInfo() throws Exception {
final EjbJar ejbJar = new EjbJar();
final SessionBean sessionBean = new SessionBean();
sessionBean.setEjbName("MySessionBean");
sessionBean.setEjbClass("org.superbiz.MySessionBean");
sessionBean.setRemote("org.superbiz.MySession");
ejbJar.addEnterpriseBean(sessionBean);
final OpenejbJar openejbJar = new OpenejbJar();
final EjbDeployment ejbDeployment = new EjbDeployment();
openejbJar.addEjbDeployment(ejbDeployment);
ejbDeployment.setEjbName("MySessionBean");
ejbDeployment.addProperty("webservice.security.realm", "MyRealm");
ejbDeployment.addProperty("webservice.security.securityRealm", "MySecurityRealm");
ejbDeployment.addProperty("webservice.security.transportGarantee", TransportGuaranteeType.NONE.value());
ejbDeployment.addProperty("webservice.security.authMethod", AuthMethodType.BASIC.value());
ejbDeployment.addProperty("wss4j.in.action", "Timestamp");
ejbDeployment.addProperty("wss4j.out.action", "Timestamp");
final EjbModule ejbModule = new EjbModule(ejbJar, openejbJar);
final EjbJarInfo ejbJarInfo = new EjbJarInfo();
final PortInfo portInfo = new PortInfo();
portInfo.serviceLink = "MySessionBean";
ejbJarInfo.portInfos.add(portInfo);
new AppInfoBuilder(null).configureWebserviceSecurity(ejbJarInfo, ejbModule);
final List<PortInfo> portInfoList = ejbJarInfo.portInfos;
assertEquals(1, portInfoList.size());
final PortInfo info = portInfoList.get(0);
assertEquals("MyRealm", info.realmName);
assertEquals("MySecurityRealm", info.securityRealmName);
assertEquals("BASIC", info.authMethod);
assertEquals("NONE", info.transportGuarantee);
assertEquals("Timestamp", portInfo.properties.getProperty("wss4j.in.action"));
assertEquals("Timestamp", portInfo.properties.getProperty("wss4j.out.action"));
}
use of org.apache.openejb.assembler.classic.EjbJarInfo in project tomee by apache.
the class AppPathsTest method _testMixedCaseMetaInf.
/**
* Seems like this may not be a feature that can be supported on
* all platforms. Seems to work on the mac VM, but not the linux vm.
*
* @throws Exception
*/
public void _testMixedCaseMetaInf() throws Exception {
final Assembler assmbler = new Assembler();
final ConfigurationFactory factory = new ConfigurationFactory();
final URL resource = AppPathsTest.class.getClassLoader().getResource("mixedcase");
final File file = URLs.toFile(resource);
final AppInfo appInfo = factory.configureApplication(file);
assertNotNull(appInfo);
assertEquals(1, appInfo.ejbJars.size());
final EjbJarInfo ejbJar = appInfo.ejbJars.get(0);
// was the footest.ejb-jar.xml picked up
assertEquals("EjbJar.enterpriseBeans", 1, ejbJar.enterpriseBeans.size());
}
use of org.apache.openejb.assembler.classic.EjbJarInfo in project tomee by apache.
the class AutoConfigMdbContainerTest method _testJmsMdbNoContainerConfigured.
public void _testJmsMdbNoContainerConfigured() throws Exception {
final EjbJar ejbJar = new EjbJar();
ejbJar.addEnterpriseBean(new MessageDrivenBean(JmsBean.class));
final EjbJarInfo info = config.configureApplication(ejbJar);
// assembler.createApplication(info);
}
use of org.apache.openejb.assembler.classic.EjbJarInfo in project tomee by apache.
the class CleanEnvEntriesTest method test.
@Test
public void test() throws Exception {
final Assembler assembler = new Assembler();
final ConfigurationFactory factory = new ConfigurationFactory();
final SingletonBean singletonBean = new SingletonBean(Blue.class);
// keep
singletonBean.getEnvEntry().add(new EnvEntry().name("message").type(String.class).value("hello").injectionTarget(Blue.class, "message"));
// remove
singletonBean.getEnvEntry().add(new EnvEntry().name("novalue1").type(String.class));
singletonBean.getEnvEntry().add(new EnvEntry().name("novalue2"));
// fill in type
singletonBean.getEnvEntry().add(new EnvEntry().name("value-but-no-type1").value("10").injectionTarget(Blue.class, "number").injectionTarget(Orange.class, // attempt to confuse the type
"number"));
singletonBean.getEnvEntry().add(new EnvEntry().name("value-but-no-type2").value("D").injectionTarget(Blue.class, "letter"));
singletonBean.getEnvEntry().add(new EnvEntry().name("value-but-no-type3").value("2").injectionTarget(Blue.class, // short
"vague").injectionTarget(Orange.class, // character
"vague"));
final EjbJar ejbJar = new EjbJar();
ejbJar.addEnterpriseBean(singletonBean);
final EjbJarInfo ejbJarInfo = factory.configureApplication(ejbJar);
final Map<String, EnvEntryInfo> entries = map(ejbJarInfo.enterpriseBeans.get(0).jndiEnc.envEntries);
assertNotNull(entries.get("comp/env/message"));
assertNotNull(entries.get("comp/env/value-but-no-type1"));
assertNotNull(entries.get("comp/env/value-but-no-type2"));
assertNull(entries.get("comp/env/novalue1"));
assertNull(entries.get("comp/env/novalue2"));
assertEquals(Integer.class.getName(), entries.get("comp/env/value-but-no-type1").type);
assertEquals(Character.class.getName(), entries.get("comp/env/value-but-no-type2").type);
assertEquals(String.class.getName(), entries.get("comp/env/value-but-no-type3").type);
}
use of org.apache.openejb.assembler.classic.EjbJarInfo in project tomee by apache.
the class EjbModuleIdTest method testDefault.
@Test
public void testDefault() throws Exception {
final Map<String, String> map = new HashMap<String, String>();
map.put("META-INF/ejb-jar.xml", "<ejb-jar/>");
final File file = Archives.jarArchive(map, "test", OrangeBean.class);
final Assembler assembler = new Assembler();
final ConfigurationFactory factory = new ConfigurationFactory();
final AppInfo appInfo = factory.configureApplication(file);
final EjbJarInfo ejbJarInfo = appInfo.ejbJars.get(0);
assertEquals(file.getName().substring(0, file.getName().length() - 4), ejbJarInfo.moduleName);
}
Aggregations