public class StatefulTransactionAttributesTest extends TestCase {
public void test() throws Exception {
System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, InitContextFactory.class.getName());
Assembler assembler = new Assembler();
ConfigurationFactory config = new ConfigurationFactory();
assembler.createProxyFactory(config.configureService(ProxyFactoryInfo.class));
assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
EjbJar ejbJar = new EjbJar();
ejbJar.addEnterpriseBean(new StatefulBean(Color.class));
ejbJar.addEnterpriseBean(new StatefulBean(Red.class));
ejbJar.addEnterpriseBean(new StatefulBean(Crimson.class));
ejbJar.addEnterpriseBean(new StatefulBean(Scarlet.class));
List<ContainerTransaction> declared = ejbJar.getAssemblyDescriptor().getContainerTransaction();
declared.add(new ContainerTransaction(TransAttribute.REQUIRED, "*", "Crimson", "*"));
declared.add(new ContainerTransaction(TransAttribute.REQUIRES_NEW, "*", "Crimson", "create"));
ContainerTransaction o = new ContainerTransaction(TransAttribute.SUPPORTS, "*", "Crimson", "create");
o.getMethod().get(0).setMethodIntf(MethodIntf.HOME);
declared.add(o);
declared.add(new ContainerTransaction(TransAttribute.REQUIRES_NEW, "*", "Crimson", "remove"));
declared.add(new ContainerTransaction(TransAttribute.REQUIRES_NEW, Color.class.getName(), "Scarlet", "*"));
declared.add(new ContainerTransaction(TransAttribute.NEVER, Red.class.getName(), "Scarlet", "red"));
declared.add(new ContainerTransaction(TransAttribute.REQUIRED, "Scarlet", Scarlet.class.getMethod("scarlet")));
EjbJarInfo ejbJarInfo = config.configureApplication(ejbJar);
assembler.createApplication(ejbJarInfo);
InitialContext context = new InitialContext();
{
ColorLocal color = (ColorLocal) context.lookup("ColorLocal");