use of org.apache.openejb.jee.SingletonBean in project tomee by apache.
the class ConcurrentLockTypeTest method test.
public void test() throws Exception {
final Assembler assembler = new Assembler();
final ConfigurationFactory config = new ConfigurationFactory();
assembler.createProxyFactory(config.configureService(ProxyFactoryInfo.class));
assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
final EjbJar ejbJar = new EjbJar();
ejbJar.addEnterpriseBean(new SingletonBean(Color.class));
ejbJar.addEnterpriseBean(new SingletonBean(Red.class));
ejbJar.addEnterpriseBean(new SingletonBean(Crimson.class));
ejbJar.addEnterpriseBean(new SingletonBean(Scarlet.class));
final List<ContainerConcurrency> declared = ejbJar.getAssemblyDescriptor().getContainerConcurrency();
declared.add(new ContainerConcurrency(ConcurrentLockType.WRITE, "*", "*", "*"));
declared.add(new ContainerConcurrency(ConcurrentLockType.READ, "*", "Crimson", "*"));
declared.add(new ContainerConcurrency(ConcurrentLockType.READ, Color.class.getName(), "Scarlet", "*"));
declared.add(new ContainerConcurrency(ConcurrentLockType.READ, Red.class.getName(), "Scarlet", "red"));
declared.add(new ContainerConcurrency(ConcurrentLockType.WRITE, "Scarlet", Scarlet.class.getMethod("scarlet")));
final EjbJarInfo ejbJarInfo = config.configureApplication(ejbJar);
assembler.createApplication(ejbJarInfo);
loadAttributes(ejbJarInfo, "Color");
assertAttribute("Read", Color.class.getMethod("color"));
assertAttribute("Write", Color.class.getMethod("color", Object.class));
assertAttribute("Write", Color.class.getMethod("color", String.class));
assertAttribute("Write", Color.class.getMethod("color", Boolean.class));
assertAttribute("Write", Color.class.getMethod("color", Integer.class));
loadAttributes(ejbJarInfo, "Red");
assertAttribute("Read", Red.class.getMethod("color"));
assertAttribute("Write", Red.class.getMethod("color", Object.class));
assertAttribute("Write", Red.class.getMethod("color", String.class));
assertAttribute("Write", Red.class.getMethod("color", Boolean.class));
assertAttribute("Write", Red.class.getMethod("color", Integer.class));
assertAttribute("Write", Red.class.getMethod("red"));
assertAttribute("Write", Red.class.getMethod("red", Object.class));
assertAttribute("Write", Red.class.getMethod("red", String.class));
loadAttributes(ejbJarInfo, "Crimson");
assertAttribute("Read", Crimson.class.getMethod("color"));
assertAttribute("Read", Crimson.class.getMethod("color", Object.class));
assertAttribute("Read", Crimson.class.getMethod("color", String.class));
assertAttribute("Read", Crimson.class.getMethod("color", Boolean.class));
assertAttribute("Read", Crimson.class.getMethod("color", Integer.class));
assertAttribute("Write", Crimson.class.getMethod("red"));
assertAttribute("Read", Crimson.class.getMethod("red", Object.class));
assertAttribute("Read", Crimson.class.getMethod("red", String.class));
assertAttribute("Write", Crimson.class.getMethod("crimson"));
assertAttribute("Read", Crimson.class.getMethod("crimson", String.class));
loadAttributes(ejbJarInfo, "Scarlet");
assertAttribute("Read", Scarlet.class.getMethod("color"));
assertAttribute("Write", Scarlet.class.getMethod("color", Object.class));
assertAttribute("Read", Scarlet.class.getMethod("color", String.class));
assertAttribute("Read", Scarlet.class.getMethod("color", Boolean.class));
assertAttribute("Read", Scarlet.class.getMethod("color", Integer.class));
assertAttribute("Write", Scarlet.class.getMethod("red"));
assertAttribute("Read", Scarlet.class.getMethod("red", Object.class));
assertAttribute("Read", Scarlet.class.getMethod("red", String.class));
assertAttribute("Write", Scarlet.class.getMethod("scarlet"));
assertAttribute("Read", Scarlet.class.getMethod("scarlet", String.class));
}
use of org.apache.openejb.jee.SingletonBean in project tomee by apache.
the class AppExceptionTest method jar.
@Module
public EjbJar jar() {
final EjbJar ejbJar = new EjbJar();
ejbJar.addEnterpriseBean(new SingletonBean(Ejb.class).localBean());
return ejbJar;
}
use of org.apache.openejb.jee.SingletonBean in project tomee by apache.
the class ImportSqlScriptTest method app.
@Module
public SingletonBean app() throws Exception {
final SingletonBean bean = new SingletonBean(Persister.class);
bean.setLocalBean(new Empty());
return bean;
}
use of org.apache.openejb.jee.SingletonBean in project tomee by apache.
the class VagueEnvEntriesMatchTest method foo.
@Module
public SingletonBean foo() {
final SingletonBean singletonBean = new SingletonBean(Blue.class);
singletonBean.getEnvEntry().add(new EnvEntry().name("one").type(String.class).value("hello"));
singletonBean.getEnvEntry().add(new EnvEntry().name("two").type(String.class).value("false"));
singletonBean.getEnvEntry().add(new EnvEntry().name(Blue.class.getName() + "/two").type(String.class).value("true"));
return singletonBean;
}
use of org.apache.openejb.jee.SingletonBean in project tomee by apache.
the class CheckInvalidConcurrencyAttributeTest method test.
@Keys({ @Key(value = "ann.invalidConcurrencyAttribute", type = KeyType.WARNING), @Key(value = "aroundInvoke.invalidArguments") })
public EjbJar test() throws Exception {
System.setProperty("openejb.validation.output.level", "VERBOSE");
final EjbJar ejbJar = new EjbJar();
ejbJar.addEnterpriseBean(new SingletonBean(TestBean.class));
return ejbJar;
}
Aggregations