Search in sources :

Example 16 with ConfigurationFactory

use of org.apache.openejb.config.ConfigurationFactory in project tomee by apache.

the class StatelessInvocationStatsTest method testInvocation.

/**
     * @throws Exception
     */
public void testInvocation() throws Exception {
    System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, org.apache.openejb.core.LocalInitialContextFactory.class.getName());
    final ConfigurationFactory config = new ConfigurationFactory();
    final Assembler assembler = new Assembler();
    assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
    assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
    // containers
    final StatelessSessionContainerInfo statelessContainerInfo = config.configureService(StatelessSessionContainerInfo.class);
    statelessContainerInfo.properties.setProperty("AccessTimeout", "0");
    statelessContainerInfo.properties.setProperty("MaxSize", "2");
    statelessContainerInfo.properties.setProperty("MinSize", "0");
    statelessContainerInfo.properties.setProperty("StrictPooling", "true");
    statelessContainerInfo.properties.setProperty("IdleTimeout", "0");
    assembler.createContainer(statelessContainerInfo);
    // Setup the descriptor information
    CounterBean.instances.set(0);
    final EjbJar ejbJar = new EjbJar("StatsInvocModule");
    ejbJar.addEnterpriseBean(new StatelessBean(CounterBean.class));
    assembler.createApplication(config.configureApplication(ejbJar));
    final javax.naming.Context context = new InitialContext();
    final CounterBean bean = (CounterBean) context.lookup("CounterBeanLocalBean");
    //Invoke  
    bean.waitSecs();
    final MBeanServer server = ManagementFactory.getPlatformMBeanServer();
    final ObjectName invocationsName = new ObjectName("openejb.management:J2EEServer=openejb,J2EEApplication=<empty>,EJBModule=StatsInvocModule,StatelessSessionBean=CounterBean,j2eeType=Invocations,name=CounterBean");
    // Grab the mbeanInfo and check the expected attributes exist and have the correct return types and parameters        
    final MBeanInfo invocationsMBeanInfo = server.getMBeanInfo(invocationsName);
    for (final MBeanAttributeInfo info : invocationsMBeanInfo.getAttributes()) {
        //            System.out.println("//" + info.getName() + " " + server.getAttribute(invocationsName, info.getName()));
        if (info.getName().equals("waitSecs().GeometricMean") || info.getName().equals("waitSecs().Max") || info.getName().equals("waitSecs().Mean") || info.getName().equals("waitSecs().Min") || info.getName().equals("waitSecs().Percentile01") || info.getName().equals("waitSecs().Percentile10") || info.getName().equals("waitSecs().Percentile25") || info.getName().equals("waitSecs().Percentile50") || info.getName().equals("waitSecs().Percentile75") || info.getName().equals("waitSecs().Percentile90") || info.getName().equals("waitSecs().Percentile99") || info.getName().equals("waitSecs().Sum")) {
            final Double actual = (Double) (server.getAttribute(invocationsName, info.getName()));
            assertTrue("Expected: " + actual + " >= 999", actual >= 999);
        }
    }
    ejbJar.removeEnterpriseBean("StatsInvocModule");
}
Also used : StatelessSessionContainerInfo(org.apache.openejb.assembler.classic.StatelessSessionContainerInfo) MBeanInfo(javax.management.MBeanInfo) InitialContext(javax.naming.InitialContext) MBeanAttributeInfo(javax.management.MBeanAttributeInfo) ObjectName(javax.management.ObjectName) TransactionServiceInfo(org.apache.openejb.assembler.classic.TransactionServiceInfo) StatelessBean(org.apache.openejb.jee.StatelessBean) ConfigurationFactory(org.apache.openejb.config.ConfigurationFactory) Assembler(org.apache.openejb.assembler.classic.Assembler) SecurityServiceInfo(org.apache.openejb.assembler.classic.SecurityServiceInfo) EjbJar(org.apache.openejb.jee.EjbJar) MBeanServer(javax.management.MBeanServer) LocalMBeanServer(org.apache.openejb.monitoring.LocalMBeanServer)

Example 17 with ConfigurationFactory

use of org.apache.openejb.config.ConfigurationFactory in project tomee by apache.

the class StatelessInvocationStatsTest method testBasic.

/**
     * This whole method is a template, feel free to split it anyway you like
     * Fine to have one big
     *
     * @throws Exception
     */
public void testBasic() throws Exception {
    // some pre-load to avoid to load the class lazily with the first invocation
    new CounterBean().red();
    new CounterBean().blue();
    new CounterBean().green();
    // end preload
    System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, org.apache.openejb.core.LocalInitialContextFactory.class.getName());
    final ConfigurationFactory config = new ConfigurationFactory();
    final Assembler assembler = new Assembler();
    assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
    assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
    // containers
    final StatelessSessionContainerInfo statelessContainerInfo = config.configureService(StatelessSessionContainerInfo.class);
    statelessContainerInfo.properties.setProperty("AccessTimeout", "100");
    statelessContainerInfo.properties.setProperty("MaxSize", "15");
    statelessContainerInfo.properties.setProperty("MinSize", "3");
    statelessContainerInfo.properties.setProperty("StrictPooling", "true");
    assembler.createContainer(statelessContainerInfo);
    // Setup the descriptor information
    CounterBean.instances.set(0);
    final EjbJar ejbJar = new EjbJar("StatsModule");
    ejbJar.addEnterpriseBean(new StatelessBean(CounterBean.class));
    assembler.createApplication(config.configureApplication(ejbJar));
    final javax.naming.Context context = new InitialContext();
    final CounterBean bean = (CounterBean) context.lookup("CounterBeanLocalBean");
    // Invoke each method once
    bean.red();
    bean.green();
    bean.blue();
    final MBeanServer server = LocalMBeanServer.get();
    final ObjectName invocationsName = new ObjectName("openejb.management:J2EEServer=openejb,J2EEApplication=<empty>,EJBModule=StatsModule,StatelessSessionBean=CounterBean,j2eeType=Invocations,name=CounterBean");
    // Grab the mbeanInfo and check the expected attributes exist and have the correct return types and parameters
    /*
        * Invocation MBeanInfo
        *
        */
    final List<MBeanAttributeInfo> expectedAttributes = new ArrayList<MBeanAttributeInfo>();
    expectedAttributes.add(new MBeanAttributeInfo("InvocationCount", "long", "", true, false, false));
    expectedAttributes.add(new MBeanAttributeInfo("InvocationTime", "long", "", true, false, false));
    expectedAttributes.add(new MBeanAttributeInfo("MonitoredMethods", "long", "", true, false, false));
    final Map<String, Object> expectedValues = new TreeMap<String, Object>();
    expectedValues.put("InvocationCount", (long) 6);
    expectedValues.put("InvocationTime", (long) 0);
    expectedValues.put("MonitoredMethods", (long) 4);
    final String[] methods = { "PostConstruct()", "blue()", "green()", "red()" };
    for (final String s : methods) {
        expectedAttributes.add(new MBeanAttributeInfo(s + ".Count", "long", "", true, false, false));
        expectedAttributes.add(new MBeanAttributeInfo(s + ".GeometricMean", "double", "", true, false, false));
        expectedAttributes.add(new MBeanAttributeInfo(s + ".Kurtosis", "double", "", true, false, false));
        expectedAttributes.add(new MBeanAttributeInfo(s + ".Max", "double", "", true, false, false));
        expectedAttributes.add(new MBeanAttributeInfo(s + ".Mean", "double", "", true, false, false));
        expectedAttributes.add(new MBeanAttributeInfo(s + ".Min", "double", "", true, false, false));
        expectedAttributes.add(new MBeanAttributeInfo(s + ".Percentile01", "double", "", true, false, false));
        expectedAttributes.add(new MBeanAttributeInfo(s + ".Percentile10", "double", "", true, false, false));
        expectedAttributes.add(new MBeanAttributeInfo(s + ".Percentile25", "double", "", true, false, false));
        expectedAttributes.add(new MBeanAttributeInfo(s + ".Percentile50", "double", "", true, false, false));
        expectedAttributes.add(new MBeanAttributeInfo(s + ".Percentile75", "double", "", true, false, false));
        expectedAttributes.add(new MBeanAttributeInfo(s + ".Percentile90", "double", "", true, false, false));
        expectedAttributes.add(new MBeanAttributeInfo(s + ".Percentile99", "double", "", true, false, false));
        expectedAttributes.add(new MBeanAttributeInfo(s + ".SampleSize", "int", "", true, false, false));
        expectedAttributes.add(new MBeanAttributeInfo(s + ".Skewness", "double", "", true, false, false));
        expectedAttributes.add(new MBeanAttributeInfo(s + ".StandardDeviation", "double", "", true, false, false));
        expectedAttributes.add(new MBeanAttributeInfo(s + ".Sum", "double", "", true, false, false));
        expectedAttributes.add(new MBeanAttributeInfo(s + ".Sumsq", "double", "", true, false, false));
        expectedAttributes.add(new MBeanAttributeInfo(s + ".Variance", "double", "", true, false, false));
        if (s.equals("PostConstruct()")) {
            expectedValues.put(s + ".Count", (long) 3);
        } else {
            expectedValues.put(s + ".Count", (long) 1);
        }
        expectedValues.put(s + ".GeometricMean", 0.0);
        expectedValues.put(s + ".Kurtosis", Double.NaN);
        expectedValues.put(s + ".Max", 0.0);
        expectedValues.put(s + ".Mean", 0.0);
        expectedValues.put(s + ".Min", 0.0);
        expectedValues.put(s + ".Percentile01", 0.0);
        expectedValues.put(s + ".Percentile10", 0.0);
        expectedValues.put(s + ".Percentile25", 0.0);
        expectedValues.put(s + ".Percentile50", 0.0);
        expectedValues.put(s + ".Percentile75", 0.0);
        expectedValues.put(s + ".Percentile90", 0.0);
        expectedValues.put(s + ".Percentile99", 0.0);
        expectedValues.put(s + ".SampleSize", 2000);
        expectedValues.put(s + ".Skewness", Double.NaN);
        expectedValues.put(s + ".StandardDeviation", 0.0);
        expectedValues.put(s + ".Sum", 0.0);
        expectedValues.put(s + ".Sumsq", 0.0);
        expectedValues.put(s + ".Variance", 0.0);
    }
    final List<MBeanAttributeInfo> actualAttributes = new ArrayList<MBeanAttributeInfo>();
    final Map<String, Object> actualValues = new TreeMap<String, Object>();
    final MBeanInfo beanInfo = server.getMBeanInfo(invocationsName);
    for (final MBeanAttributeInfo info : beanInfo.getAttributes()) {
        actualAttributes.add(info);
        actualValues.put(info.getName(), server.getAttribute(invocationsName, info.getName()));
    }
    //Verify invocation attributes and values
    assertEquals(expectedAttributes, actualAttributes);
    boolean ok = true;
    for (final Map.Entry<String, Object> entry : actualValues.entrySet()) {
        final Number value = (Number) expectedValues.get(entry.getKey());
        final Number real = (Number) actualValues.get(entry.getKey());
        if (!value.equals(real)) {
            // tolerating a 1 wide range
            Logger.getLogger(StatelessInvocationStatsTest.class.getName()).log(Level.WARNING, "Test tolerance: " + entry.getKey() + " => " + entry.getValue() + "/" + expectedValues.get(entry.getKey()));
            final Double abs = Math.abs(real.doubleValue() - value.doubleValue());
            if (abs.intValue() > 1) {
                ok = false;
            }
        }
    }
    // assertEquals(expectedValues, actualValues);
    assertTrue(ok);
    // Grab invocation mbean operations
    final MBeanParameterInfo[] invocationParameters1 = { new MBeanParameterInfo("excludeRegex", "java.lang.String", "\"\""), new MBeanParameterInfo("includeRegex", "java.lang.String", "\"\"") };
    final MBeanParameterInfo[] invocationParameters2 = { new MBeanParameterInfo("p1", "int", "") };
    final List<MBeanOperationInfo> expectedOperations = new ArrayList<MBeanOperationInfo>();
    expectedOperations.add(new MBeanOperationInfo("FilterAttributes", "Filters the attributes that show up in the MBeanInfo.  The exclude is applied first, then any attributes that match the include are re-added.  It may be required to disconnect and reconnect the JMX console to force a refresh of the MBeanInfo", invocationParameters1, "void", MBeanOperationInfo.UNKNOWN));
    for (final String s : methods) {
        expectedOperations.add(new MBeanOperationInfo(s + ".setSampleSize", "", invocationParameters2, "void", MBeanOperationInfo.UNKNOWN));
        expectedOperations.add(new MBeanOperationInfo(s + ".sortedValues", "", new MBeanParameterInfo[0], "[D", MBeanOperationInfo.UNKNOWN));
        expectedOperations.add(new MBeanOperationInfo(s + ".values", "", new MBeanParameterInfo[0], "[D", MBeanOperationInfo.UNKNOWN));
    }
    final List<MBeanOperationInfo> actualOperations1 = new ArrayList<MBeanOperationInfo>();
    actualOperations1.addAll(Arrays.asList(beanInfo.getOperations()));
    //Verify invocation operation information and remove bean.
    assertEquals(expectedOperations, actualOperations1);
}
Also used : StatelessSessionContainerInfo(org.apache.openejb.assembler.classic.StatelessSessionContainerInfo) MBeanInfo(javax.management.MBeanInfo) ArrayList(java.util.ArrayList) ConfigurationFactory(org.apache.openejb.config.ConfigurationFactory) SecurityServiceInfo(org.apache.openejb.assembler.classic.SecurityServiceInfo) EjbJar(org.apache.openejb.jee.EjbJar) MBeanServer(javax.management.MBeanServer) LocalMBeanServer(org.apache.openejb.monitoring.LocalMBeanServer) MBeanOperationInfo(javax.management.MBeanOperationInfo) TreeMap(java.util.TreeMap) InitialContext(javax.naming.InitialContext) MBeanAttributeInfo(javax.management.MBeanAttributeInfo) ObjectName(javax.management.ObjectName) TransactionServiceInfo(org.apache.openejb.assembler.classic.TransactionServiceInfo) StatelessBean(org.apache.openejb.jee.StatelessBean) Assembler(org.apache.openejb.assembler.classic.Assembler) Map(java.util.Map) TreeMap(java.util.TreeMap) MBeanParameterInfo(javax.management.MBeanParameterInfo)

Example 18 with ConfigurationFactory

use of org.apache.openejb.config.ConfigurationFactory in project tomee by apache.

the class StatelessPoolStatsTest method deploy.

private CounterBean deploy(final String moduleId, final Properties properties) throws Exception {
    objectName = new ObjectName("openejb.management:J2EEServer=openejb,J2EEApplication=<empty>,EJBModule=" + moduleId + ",StatelessSessionBean=CounterBean,j2eeType=Pool,name=CounterBean");
    System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, org.apache.openejb.core.LocalInitialContextFactory.class.getName());
    final ConfigurationFactory config = new ConfigurationFactory();
    final Assembler assembler = new Assembler();
    assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
    assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
    // containers
    final StatelessSessionContainerInfo statelessContainerInfo = config.configureService(StatelessSessionContainerInfo.class);
    statelessContainerInfo.properties.putAll(properties);
    assembler.createContainer(statelessContainerInfo);
    final EjbJar ejbJar = new EjbJar(moduleId);
    ejbJar.addEnterpriseBean(new StatelessBean(CounterBean.class));
    assembler.createApplication(config.configureApplication(ejbJar));
    final javax.naming.Context context = new InitialContext();
    return (CounterBean) context.lookup("CounterBeanLocalBean");
}
Also used : StatelessSessionContainerInfo(org.apache.openejb.assembler.classic.StatelessSessionContainerInfo) InitialContext(javax.naming.InitialContext) ObjectName(javax.management.ObjectName) TransactionServiceInfo(org.apache.openejb.assembler.classic.TransactionServiceInfo) StatelessBean(org.apache.openejb.jee.StatelessBean) ConfigurationFactory(org.apache.openejb.config.ConfigurationFactory) Assembler(org.apache.openejb.assembler.classic.Assembler) SecurityServiceInfo(org.apache.openejb.assembler.classic.SecurityServiceInfo) EjbJar(org.apache.openejb.jee.EjbJar)

Example 19 with ConfigurationFactory

use of org.apache.openejb.config.ConfigurationFactory in project tomee by apache.

the class StatefulTest method setUp.

@Override
protected void setUp() throws Exception {
    System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.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 StatefulBean(MyBean.class));
    assembler.createApplication(config.configureApplication(ejbJar));
}
Also used : TransactionServiceInfo(org.apache.openejb.assembler.classic.TransactionServiceInfo) StatefulBean(org.apache.openejb.jee.StatefulBean) ConfigurationFactory(org.apache.openejb.config.ConfigurationFactory) Assembler(org.apache.openejb.assembler.classic.Assembler) LocalInitialContextFactory(org.apache.openejb.core.LocalInitialContextFactory) SecurityServiceInfo(org.apache.openejb.assembler.classic.SecurityServiceInfo) EjbJar(org.apache.openejb.jee.EjbJar)

Example 20 with ConfigurationFactory

use of org.apache.openejb.config.ConfigurationFactory 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)

Aggregations

ConfigurationFactory (org.apache.openejb.config.ConfigurationFactory)98 Assembler (org.apache.openejb.assembler.classic.Assembler)83 EjbJar (org.apache.openejb.jee.EjbJar)75 SecurityServiceInfo (org.apache.openejb.assembler.classic.SecurityServiceInfo)56 TransactionServiceInfo (org.apache.openejb.assembler.classic.TransactionServiceInfo)56 StatelessBean (org.apache.openejb.jee.StatelessBean)44 InitialContext (javax.naming.InitialContext)40 Properties (java.util.Properties)35 ProxyFactoryInfo (org.apache.openejb.assembler.classic.ProxyFactoryInfo)29 EjbModule (org.apache.openejb.config.EjbModule)29 LocalInitialContextFactory (org.apache.openejb.core.LocalInitialContextFactory)29 InitContextFactory (org.apache.openejb.core.ivm.naming.InitContextFactory)20 StatelessSessionContainerInfo (org.apache.openejb.assembler.classic.StatelessSessionContainerInfo)18 SingletonBean (org.apache.openejb.jee.SingletonBean)18 Context (javax.naming.Context)17 StatefulBean (org.apache.openejb.jee.StatefulBean)16 ServerFederation (org.apache.openejb.core.ServerFederation)15 EjbJarInfo (org.apache.openejb.assembler.classic.EjbJarInfo)14 AppModule (org.apache.openejb.config.AppModule)13 ContainerSystem (org.apache.openejb.spi.ContainerSystem)13