Search in sources :

Example 6 with ContainerTransaction$JAXB.readContainerTransaction

use of org.apache.openejb.jee.ContainerTransaction$JAXB.readContainerTransaction in project tomee by apache.

the class StatefulTransactionAttributesTest method test.

public void test() throws Exception {
    System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.class.getName());
    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 StatefulBean(Color.class));
    ejbJar.addEnterpriseBean(new StatefulBean(Red.class));
    ejbJar.addEnterpriseBean(new StatefulBean(Crimson.class));
    ejbJar.addEnterpriseBean(new StatefulBean(Scarlet.class));
    final List<ContainerTransaction> declared = ejbJar.getAssemblyDescriptor().getContainerTransaction();
    declared.add(new ContainerTransaction(TransAttribute.REQUIRED, "*", "Crimson", "*"));
    declared.add(new ContainerTransaction(TransAttribute.REQUIRES_NEW, "*", "Crimson", "create"));
    final 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")));
    final EjbJarInfo ejbJarInfo = config.configureApplication(ejbJar);
    assembler.createApplication(ejbJarInfo);
    final InitialContext context = new InitialContext();
    {
        final ColorLocal color = (ColorLocal) context.lookup("ColorLocal");
        assertEquals("Never", color.color());
        assertEquals("RequiresNew", color.color((Object) null));
        assertEquals("Supports", color.color((String) null));
        assertEquals("Supports", color.color((Boolean) null));
        assertEquals("Supports", color.color((Integer) null));
    }
    {
        final ColorRemote color = (ColorRemote) context.lookup("ColorRemote");
        assertEquals("Never", color.color());
        assertEquals("RequiresNew", color.color((Object) null));
        assertEquals("Supports", color.color((String) null));
        assertEquals("Supports", color.color((Boolean) null));
        assertEquals("Supports", color.color((Integer) null));
    }
    {
        final ColorEjbLocalHome home = (ColorEjbLocalHome) context.lookup("ColorLocalHome");
        final ColorEjbLocalObject color = home.create("Supports");
        assertEquals("Never", color.color());
        assertEquals("RequiresNew", color.color((Object) null));
        assertEquals("Supports", color.color((String) null));
        assertEquals("Supports", color.color((Boolean) null));
        assertEquals("Supports", color.color((Integer) null));
        expected.set("Supports");
        color.remove();
    }
    {
        final ColorEjbHome home = (ColorEjbHome) context.lookup("ColorRemoteHome");
        final ColorEjbObject color = home.create("Supports");
        assertEquals("Never", color.color());
        assertEquals("RequiresNew", color.color((Object) null));
        assertEquals("Supports", color.color((String) null));
        assertEquals("Supports", color.color((Boolean) null));
        assertEquals("Supports", color.color((Integer) null));
        expected.set("Supports");
        color.remove();
    }
    {
        final RedLocal red = (RedLocal) context.lookup("RedLocal");
        assertEquals("Never", red.color());
        assertEquals("Required", red.color((Object) null));
        assertEquals("Supports", red.color((String) null));
        assertEquals("Supports", red.color((Boolean) null));
        assertEquals("Supports", red.color((Integer) null));
        assertEquals("RequiresNew", red.red());
        assertEquals("Required", red.red((Object) null));
        assertEquals("Required", red.red((String) null));
    }
    {
        final RedRemote red = (RedRemote) context.lookup("RedRemote");
        assertEquals("Never", red.color());
        assertEquals("Required", red.color((Object) null));
        assertEquals("Supports", red.color((String) null));
        assertEquals("Supports", red.color((Boolean) null));
        assertEquals("Supports", red.color((Integer) null));
        assertEquals("RequiresNew", red.red());
        assertEquals("Required", red.red((Object) null));
        assertEquals("Required", red.red((String) null));
    }
    {
        final RedEjbLocalHome home = (RedEjbLocalHome) context.lookup("RedLocalHome");
        final RedEjbLocalObject red = home.create("Supports");
        assertEquals("Never", red.color());
        assertEquals("Required", red.color((Object) null));
        assertEquals("Supports", red.color((String) null));
        assertEquals("Supports", red.color((Boolean) null));
        assertEquals("Supports", red.color((Integer) null));
        assertEquals("RequiresNew", red.red());
        assertEquals("Required", red.red((Object) null));
        assertEquals("Required", red.red((String) null));
        expected.set("Supports");
        red.remove();
    }
    {
        final RedEjbHome home = (RedEjbHome) context.lookup("RedRemoteHome");
        final RedEjbObject red = home.create("Supports");
        assertEquals("Never", red.color());
        assertEquals("Required", red.color((Object) null));
        assertEquals("Supports", red.color((String) null));
        assertEquals("Supports", red.color((Boolean) null));
        assertEquals("Supports", red.color((Integer) null));
        assertEquals("RequiresNew", red.red());
        assertEquals("Required", red.red((Object) null));
        assertEquals("Required", red.red((String) null));
        expected.set("Supports");
        red.remove();
    }
    {
        final CrimsonLocal crimson = (CrimsonLocal) context.lookup("CrimsonLocal");
        assertEquals("Required", crimson.color());
        assertEquals("Required", crimson.color((Object) null));
        assertEquals("Required", crimson.color((String) null));
        assertEquals("Required", crimson.color((Boolean) null));
        assertEquals("Required", crimson.color((Integer) null));
        assertEquals("RequiresNew", crimson.red());
        assertEquals("Required", crimson.red((Object) null));
        assertEquals("Required", crimson.red((String) null));
        assertEquals("RequiresNew", crimson.crimson());
        assertEquals("Required", crimson.crimson((String) null));
    }
    {
        final CrimsonRemote crimson = (CrimsonRemote) context.lookup("CrimsonRemote");
        assertEquals("Required", crimson.color());
        assertEquals("Required", crimson.color((Object) null));
        assertEquals("Required", crimson.color((String) null));
        assertEquals("Required", crimson.color((Boolean) null));
        assertEquals("Required", crimson.color((Integer) null));
        assertEquals("RequiresNew", crimson.red());
        assertEquals("Required", crimson.red((Object) null));
        assertEquals("Required", crimson.red((String) null));
        assertEquals("RequiresNew", crimson.crimson());
        assertEquals("Required", crimson.crimson((String) null));
    }
    {
        final CrimsonEjbLocalHome home = (CrimsonEjbLocalHome) context.lookup("CrimsonLocalHome");
        final CrimsonEjbLocalObject crimson = home.create("RequiresNew");
        assertEquals("Required", crimson.color());
        assertEquals("Required", crimson.color((Object) null));
        assertEquals("Required", crimson.color((String) null));
        assertEquals("Required", crimson.color((Boolean) null));
        assertEquals("Required", crimson.color((Integer) null));
        assertEquals("RequiresNew", crimson.red());
        assertEquals("Required", crimson.red((Object) null));
        assertEquals("Required", crimson.red((String) null));
        assertEquals("RequiresNew", crimson.crimson());
        assertEquals("Required", crimson.crimson((String) null));
        expected.set("RequiresNew");
        crimson.remove();
    }
    {
        final CrimsonEjbHome home = (CrimsonEjbHome) context.lookup("CrimsonRemoteHome");
        final CrimsonEjbObject crimson = home.create("Supports");
        assertEquals("Required", crimson.color());
        assertEquals("Required", crimson.color((Object) null));
        assertEquals("Required", crimson.color((String) null));
        assertEquals("Required", crimson.color((Boolean) null));
        assertEquals("Required", crimson.color((Integer) null));
        assertEquals("RequiresNew", crimson.red());
        assertEquals("Required", crimson.red((Object) null));
        assertEquals("Required", crimson.red((String) null));
        assertEquals("RequiresNew", crimson.crimson());
        assertEquals("Required", crimson.crimson((String) null));
        expected.set("RequiresNew");
        crimson.remove();
    }
    {
        final ScarletLocal scarlet = (ScarletLocal) context.lookup("ScarletLocal");
        assertEquals("Never", scarlet.color());
        assertEquals("Required", scarlet.color((Object) null));
        assertEquals("RequiresNew", scarlet.color((String) null));
        assertEquals("RequiresNew", scarlet.color((Boolean) null));
        assertEquals("RequiresNew", scarlet.color((Integer) null));
        assertEquals("RequiresNew", scarlet.red());
        assertEquals("Never", scarlet.red((Object) null));
        assertEquals("Never", scarlet.red((String) null));
        assertEquals("Required", scarlet.scarlet());
        assertEquals("NotSupported", scarlet.scarlet((String) null));
    }
    {
        final ScarletRemote scarlet = (ScarletRemote) context.lookup("ScarletRemote");
        assertEquals("Never", scarlet.color());
        assertEquals("Required", scarlet.color((Object) null));
        assertEquals("RequiresNew", scarlet.color((String) null));
        assertEquals("RequiresNew", scarlet.color((Boolean) null));
        assertEquals("RequiresNew", scarlet.color((Integer) null));
        assertEquals("RequiresNew", scarlet.red());
        assertEquals("Never", scarlet.red((Object) null));
        assertEquals("Never", scarlet.red((String) null));
        assertEquals("Required", scarlet.scarlet());
        assertEquals("NotSupported", scarlet.scarlet((String) null));
    }
    {
        final ScarletEjbLocalHome home = (ScarletEjbLocalHome) context.lookup("ScarletLocalHome");
        final ScarletEjbLocalObject scarlet = home.create("RequiresNew");
        assertEquals("Never", scarlet.color());
        assertEquals("Required", scarlet.color((Object) null));
        assertEquals("RequiresNew", scarlet.color((String) null));
        assertEquals("RequiresNew", scarlet.color((Boolean) null));
        assertEquals("RequiresNew", scarlet.color((Integer) null));
        assertEquals("RequiresNew", scarlet.red());
        assertEquals("Never", scarlet.red((Object) null));
        assertEquals("Never", scarlet.red((String) null));
        assertEquals("Required", scarlet.scarlet());
        assertEquals("NotSupported", scarlet.scarlet((String) null));
    }
    {
        final ScarletEjbHome home = (ScarletEjbHome) context.lookup("ScarletRemoteHome");
        final ScarletEjbObject scarlet = home.create("RequiresNew");
        assertEquals("Never", scarlet.color());
        assertEquals("Required", scarlet.color((Object) null));
        assertEquals("RequiresNew", scarlet.color((String) null));
        assertEquals("RequiresNew", scarlet.color((Boolean) null));
        assertEquals("RequiresNew", scarlet.color((Integer) null));
        assertEquals("RequiresNew", scarlet.red());
        assertEquals("Never", scarlet.red((Object) null));
        assertEquals("Never", scarlet.red((String) null));
        assertEquals("Required", scarlet.scarlet());
        assertEquals("NotSupported", scarlet.scarlet((String) null));
    }
}
Also used : LocalInitialContextFactory(org.apache.openejb.core.LocalInitialContextFactory) ConfigurationFactory(org.apache.openejb.config.ConfigurationFactory) SecurityServiceInfo(org.apache.openejb.assembler.classic.SecurityServiceInfo) EjbJar(org.apache.openejb.jee.EjbJar) StatefulBean(org.apache.openejb.jee.StatefulBean) InitialContext(javax.naming.InitialContext) ProxyFactoryInfo(org.apache.openejb.assembler.classic.ProxyFactoryInfo) TransactionServiceInfo(org.apache.openejb.assembler.classic.TransactionServiceInfo) ContainerTransaction(org.apache.openejb.jee.ContainerTransaction) Assembler(org.apache.openejb.assembler.classic.Assembler) EjbJarInfo(org.apache.openejb.assembler.classic.EjbJarInfo)

Example 7 with ContainerTransaction$JAXB.readContainerTransaction

use of org.apache.openejb.jee.ContainerTransaction$JAXB.readContainerTransaction in project tomee by apache.

the class CheckInvalidTransactionAttributeTest method xml.

@Keys(@Key(value = "xml.invalidTransactionAttribute", type = KeyType.WARNING))
public EjbJar xml() throws SecurityException, NoSuchMethodException {
    final EjbJar ejbJar = new EjbJar();
    final StatelessBean bean = ejbJar.addEnterpriseBean(new StatelessBean(CheeseEjb.class));
    bean.setTransactionType(TransactionType.BEAN);
    final ContainerTransaction tx = new ContainerTransaction();
    tx.getMethod().add(new Method(bean.getEjbName(), CheeseEjb.class.getMethod("sayCheesePlease", null)));
    tx.setTransAttribute(TransAttribute.REQUIRED);
    ejbJar.getAssemblyDescriptor().getContainerTransaction().add(tx);
    return ejbJar;
}
Also used : StatelessBean(org.apache.openejb.jee.StatelessBean) ContainerTransaction(org.apache.openejb.jee.ContainerTransaction) Method(org.apache.openejb.jee.Method) EjbJar(org.apache.openejb.jee.EjbJar)

Example 8 with ContainerTransaction$JAXB.readContainerTransaction

use of org.apache.openejb.jee.ContainerTransaction$JAXB.readContainerTransaction in project tomee by apache.

the class LegacyInterfaceTest method test.

public void test() throws Exception {
    System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, InitContextFactory.class.getName());
    final ConfigurationFactory config = new ConfigurationFactory();
    final Assembler assembler = new Assembler();
    assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
    assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
    final EjbJar ejbJar = new EjbJar();
    ejbJar.addEnterpriseBean(new SingletonBean(MySingletonBean.class));
    ejbJar.addEnterpriseBean(new EntityBean(MyBmpBean.class, PersistenceType.BEAN));
    // <entity>
    // <ejb-name>License</ejb-name>
    // <local-home>org.apache.openejb.test.entity.cmr.onetoone.LicenseLocalHome</local-home>
    // <local>org.apache.openejb.test.entity.cmr.onetoone.LicenseLocal</local>
    // <ejb-class>org.apache.openejb.test.entity.cmr.onetoone.LicenseBean</ejb-class>
    // <persistence-type>Container</persistence-type>
    // <prim-key-class>java.lang.Integer</prim-key-class>
    // <reentrant>false</reentrant>
    // <cmp-version>2.x</cmp-version>
    // <abstract-schema-name>License</abstract-schema-name>
    // <cmp-field>
    // <field-name>id</field-name>
    // </cmp-field>
    // <cmp-field>
    // <field-name>number</field-name>
    // </cmp-field>
    // <cmp-field>
    // <field-name>points</field-name>
    // </cmp-field>
    // <cmp-field>
    // <field-name>notes</field-name>
    // </cmp-field>
    // <primkey-field>id</primkey-field>
    // <query>
    // <!-- CompondPK one-to-one shares the local home interface so we need to declare this useless finder -->
    // <query-method>
    // <method-name>findByPrimaryKey</method-name>
    // <method-params>
    // <method-param>org.apache.openejb.test.entity.cmr.onetoone.LicensePk</method-param>
    // </method-params>
    // </query-method>
    // <ejb-ql>SELECT OBJECT(DL) FROM License DL</ejb-ql>
    // </query>
    // </entity>
    final EntityBean cmp = ejbJar.addEnterpriseBean(new EntityBean(MyCmpBean.class, PersistenceType.CONTAINER));
    cmp.setPrimKeyClass(Integer.class.getName());
    cmp.setPrimkeyField("id");
    cmp.getCmpField().add(new CmpField("id"));
    cmp.getCmpField().add(new CmpField("name"));
    final Query query = new Query();
    query.setQueryMethod(new QueryMethod("findByPrimaryKey", Integer.class.getName()));
    query.setEjbQl("SELECT OBJECT(DL) FROM License DL");
    cmp.getQuery().add(query);
    final List<ContainerTransaction> transactions = ejbJar.getAssemblyDescriptor().getContainerTransaction();
    // <container-transaction>
    // <method>
    // <ejb-name>MyBean</ejb-name>
    // <method-name>*</method-name>
    // </method>
    // <trans-attribute>Supports</trans-attribute>
    // </container-transaction>
    transactions.add(new ContainerTransaction(TransAttribute.SUPPORTS, null, "MyBmpBean", "*"));
    transactions.add(new ContainerTransaction(TransAttribute.SUPPORTS, null, "MyCmpBean", "*"));
    transactions.add(new ContainerTransaction(TransAttribute.SUPPORTS, null, "MySingletonBean", "*"));
    final File f = new File("test").getAbsoluteFile();
    if (!f.exists() && !f.mkdirs()) {
        throw new Exception("Failed to create test directory: " + f);
    }
    final AppModule module = new AppModule(this.getClass().getClassLoader(), f.getAbsolutePath());
    module.getEjbModules().add(new EjbModule(ejbJar));
    assembler.createApplication(config.configureApplication(module));
}
Also used : AppModule(org.apache.openejb.config.AppModule) Query(org.apache.openejb.jee.Query) QueryMethod(org.apache.openejb.jee.QueryMethod) EjbModule(org.apache.openejb.config.EjbModule) InitContextFactory(org.apache.openejb.core.ivm.naming.InitContextFactory) RemoveException(javax.ejb.RemoveException) RemoteException(java.rmi.RemoteException) EJBException(javax.ejb.EJBException) CreateException(javax.ejb.CreateException) SingletonBean(org.apache.openejb.jee.SingletonBean) TransactionServiceInfo(org.apache.openejb.assembler.classic.TransactionServiceInfo) CmpField(org.apache.openejb.jee.CmpField) ContainerTransaction(org.apache.openejb.jee.ContainerTransaction) EntityBean(org.apache.openejb.jee.EntityBean) ConfigurationFactory(org.apache.openejb.config.ConfigurationFactory) Assembler(org.apache.openejb.assembler.classic.Assembler) SecurityServiceInfo(org.apache.openejb.assembler.classic.SecurityServiceInfo) File(java.io.File) EjbJar(org.apache.openejb.jee.EjbJar)

Example 9 with ContainerTransaction$JAXB.readContainerTransaction

use of org.apache.openejb.jee.ContainerTransaction$JAXB.readContainerTransaction in project tomee by apache.

the class AssemblyDescriptor$JAXB method _write.

public static final void _write(final XoXMLStreamWriter writer, final AssemblyDescriptor assemblyDescriptor, RuntimeContext context) throws Exception {
    if (assemblyDescriptor == null) {
        writer.writeXsiNil();
        return;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (AssemblyDescriptor.class != assemblyDescriptor.getClass()) {
        context.unexpectedSubclass(writer, assemblyDescriptor, AssemblyDescriptor.class);
        return;
    }
    context.beforeMarshal(assemblyDescriptor, LifecycleCallback.NONE);
    // ATTRIBUTE: id
    final String idRaw = assemblyDescriptor.id;
    if (idRaw != null) {
        String id = null;
        try {
            id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(assemblyDescriptor, "id", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "id", id);
    }
    // ELEMENT: securityRole
    final List<SecurityRole> securityRole = assemblyDescriptor.securityRole;
    if (securityRole != null) {
        for (final SecurityRole securityRoleItem : securityRole) {
            if (securityRoleItem != null) {
                writer.writeStartElement(prefix, "security-role", "http://java.sun.com/xml/ns/javaee");
                writeSecurityRole(writer, securityRoleItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(assemblyDescriptor, "securityRole");
            }
        }
    }
    // ELEMENT: methodPermission
    final List<MethodPermission> methodPermission = assemblyDescriptor.methodPermission;
    if (methodPermission != null) {
        for (final MethodPermission methodPermissionItem : methodPermission) {
            if (methodPermissionItem != null) {
                writer.writeStartElement(prefix, "method-permission", "http://java.sun.com/xml/ns/javaee");
                writeMethodPermission(writer, methodPermissionItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(assemblyDescriptor, "methodPermission");
            }
        }
    }
    // ELEMENT: containerTransaction
    final List<ContainerTransaction> containerTransaction = assemblyDescriptor.containerTransaction;
    if (containerTransaction != null) {
        for (final ContainerTransaction containerTransactionItem : containerTransaction) {
            if (containerTransactionItem != null) {
                writer.writeStartElement(prefix, "container-transaction", "http://java.sun.com/xml/ns/javaee");
                writeContainerTransaction(writer, containerTransactionItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(assemblyDescriptor, "containerTransaction");
            }
        }
    }
    // ELEMENT: containerConcurrency
    final List<ContainerConcurrency> containerConcurrency = assemblyDescriptor.containerConcurrency;
    if (containerConcurrency != null) {
        for (final ContainerConcurrency containerConcurrencyItem : containerConcurrency) {
            if (containerConcurrencyItem != null) {
                writer.writeStartElement(prefix, "container-concurrency", "http://java.sun.com/xml/ns/javaee");
                writeContainerConcurrency(writer, containerConcurrencyItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(assemblyDescriptor, "containerConcurrency");
            }
        }
    }
    // ELEMENT: interceptorBinding
    final List<InterceptorBinding> interceptorBinding = assemblyDescriptor.interceptorBinding;
    if (interceptorBinding != null) {
        for (final InterceptorBinding interceptorBindingItem : interceptorBinding) {
            if (interceptorBindingItem != null) {
                writer.writeStartElement(prefix, "interceptor-binding", "http://java.sun.com/xml/ns/javaee");
                writeInterceptorBinding(writer, interceptorBindingItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(assemblyDescriptor, "interceptorBinding");
            }
        }
    }
    // ELEMENT: messageDestination
    final List<MessageDestination> messageDestination = assemblyDescriptor.messageDestination;
    if (messageDestination != null) {
        for (final MessageDestination messageDestinationItem : messageDestination) {
            if (messageDestinationItem != null) {
                writer.writeStartElement(prefix, "message-destination", "http://java.sun.com/xml/ns/javaee");
                writeMessageDestination(writer, messageDestinationItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(assemblyDescriptor, "messageDestination");
            }
        }
    }
    // ELEMENT: excludeList
    final ExcludeList excludeList = assemblyDescriptor.excludeList;
    if (excludeList != null) {
        writer.writeStartElement(prefix, "exclude-list", "http://java.sun.com/xml/ns/javaee");
        writeExcludeList(writer, excludeList, context);
        writer.writeEndElement();
    }
    // ELEMENT: applicationException
    final KeyedCollection<String, ApplicationException> applicationException = assemblyDescriptor.applicationException;
    if (applicationException != null) {
        for (final ApplicationException applicationExceptionItem : applicationException) {
            if (applicationExceptionItem != null) {
                writer.writeStartElement(prefix, "application-exception", "http://java.sun.com/xml/ns/javaee");
                writeApplicationException(writer, applicationExceptionItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(assemblyDescriptor, "applicationException");
            }
        }
    }
    context.afterMarshal(assemblyDescriptor, LifecycleCallback.NONE);
}
Also used : ExcludeList$JAXB.writeExcludeList(org.apache.openejb.jee.ExcludeList$JAXB.writeExcludeList) ExcludeList$JAXB.readExcludeList(org.apache.openejb.jee.ExcludeList$JAXB.readExcludeList) SecurityRole$JAXB.readSecurityRole(org.apache.openejb.jee.SecurityRole$JAXB.readSecurityRole) SecurityRole$JAXB.writeSecurityRole(org.apache.openejb.jee.SecurityRole$JAXB.writeSecurityRole) MessageDestination$JAXB.readMessageDestination(org.apache.openejb.jee.MessageDestination$JAXB.readMessageDestination) MessageDestination$JAXB.writeMessageDestination(org.apache.openejb.jee.MessageDestination$JAXB.writeMessageDestination) CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) ApplicationException$JAXB.readApplicationException(org.apache.openejb.jee.ApplicationException$JAXB.readApplicationException) ApplicationException$JAXB.writeApplicationException(org.apache.openejb.jee.ApplicationException$JAXB.writeApplicationException) MethodPermission$JAXB.readMethodPermission(org.apache.openejb.jee.MethodPermission$JAXB.readMethodPermission) MethodPermission$JAXB.writeMethodPermission(org.apache.openejb.jee.MethodPermission$JAXB.writeMethodPermission) InterceptorBinding$JAXB.writeInterceptorBinding(org.apache.openejb.jee.InterceptorBinding$JAXB.writeInterceptorBinding) InterceptorBinding$JAXB.readInterceptorBinding(org.apache.openejb.jee.InterceptorBinding$JAXB.readInterceptorBinding) ApplicationException$JAXB.readApplicationException(org.apache.openejb.jee.ApplicationException$JAXB.readApplicationException) ApplicationException$JAXB.writeApplicationException(org.apache.openejb.jee.ApplicationException$JAXB.writeApplicationException) ContainerConcurrency$JAXB.writeContainerConcurrency(org.apache.openejb.jee.ContainerConcurrency$JAXB.writeContainerConcurrency) ContainerConcurrency$JAXB.readContainerConcurrency(org.apache.openejb.jee.ContainerConcurrency$JAXB.readContainerConcurrency) ContainerTransaction$JAXB.writeContainerTransaction(org.apache.openejb.jee.ContainerTransaction$JAXB.writeContainerTransaction) ContainerTransaction$JAXB.readContainerTransaction(org.apache.openejb.jee.ContainerTransaction$JAXB.readContainerTransaction) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext)

Example 10 with ContainerTransaction$JAXB.readContainerTransaction

use of org.apache.openejb.jee.ContainerTransaction$JAXB.readContainerTransaction in project tomee by apache.

the class InterfaceTransactionTest method module.

@Module
public EjbJar module() throws Exception {
    final EjbJar ejbJar = new EjbJar();
    ejbJar.addEnterpriseBean(new StatelessBean(OrangeBean.class));
    final Method remoteMethod = new Method("OrangeBean", "isInTransaction").withInterface(MethodIntf.REMOTE);
    final Method localMethod = new Method("OrangeBean", "isInTransaction").withInterface(MethodIntf.LOCAL);
    final List<ContainerTransaction> transactions = ejbJar.getAssemblyDescriptor().getContainerTransaction();
    transactions.add(new ContainerTransaction(TransAttribute.REQUIRED, remoteMethod));
    transactions.add(new ContainerTransaction(TransAttribute.SUPPORTS, localMethod));
    return ejbJar;
}
Also used : StatelessBean(org.apache.openejb.jee.StatelessBean) ContainerTransaction(org.apache.openejb.jee.ContainerTransaction) Method(org.apache.openejb.jee.Method) EjbJar(org.apache.openejb.jee.EjbJar) Module(org.apache.openejb.testing.Module)

Aggregations

ContainerTransaction (org.apache.openejb.jee.ContainerTransaction)10 EjbJar (org.apache.openejb.jee.EjbJar)8 Method (org.apache.openejb.jee.Method)6 InterceptorBinding (org.apache.openejb.jee.InterceptorBinding)4 ConfigurationFactory (org.apache.openejb.config.ConfigurationFactory)3 AssemblyDescriptor (org.apache.openejb.jee.AssemblyDescriptor)3 EnterpriseBean (org.apache.openejb.jee.EnterpriseBean)3 MethodPermission (org.apache.openejb.jee.MethodPermission)3 ArrayList (java.util.ArrayList)2 Assembler (org.apache.openejb.assembler.classic.Assembler)2 SecurityServiceInfo (org.apache.openejb.assembler.classic.SecurityServiceInfo)2 TransactionServiceInfo (org.apache.openejb.assembler.classic.TransactionServiceInfo)2 ApplicationException$JAXB.readApplicationException (org.apache.openejb.jee.ApplicationException$JAXB.readApplicationException)2 ApplicationException$JAXB.writeApplicationException (org.apache.openejb.jee.ApplicationException$JAXB.writeApplicationException)2 ContainerConcurrency$JAXB.readContainerConcurrency (org.apache.openejb.jee.ContainerConcurrency$JAXB.readContainerConcurrency)2 ContainerConcurrency$JAXB.writeContainerConcurrency (org.apache.openejb.jee.ContainerConcurrency$JAXB.writeContainerConcurrency)2 ContainerTransaction$JAXB.readContainerTransaction (org.apache.openejb.jee.ContainerTransaction$JAXB.readContainerTransaction)2 ContainerTransaction$JAXB.writeContainerTransaction (org.apache.openejb.jee.ContainerTransaction$JAXB.writeContainerTransaction)2 EntityBean (org.apache.openejb.jee.EntityBean)2 ExcludeList$JAXB.readExcludeList (org.apache.openejb.jee.ExcludeList$JAXB.readExcludeList)2