Package javax.ejb.embeddable

Examples of javax.ejb.embeddable.EJBContainer


    @Test
    public void play() throws Exception {
        Properties properties = new Properties();
        properties.setProperty(LocalMBeanServer.OPENEJB_JMX_ACTIVE, Boolean.TRUE.toString());
        EJBContainer container = EJBContainer.createEJBContainer(properties);

        MBeanServer server = ManagementFactory.getPlatformMBeanServer();
        ObjectName objectName = new ObjectName(OBJECT_NAME);
        assertEquals(0, server.getAttribute(objectName, "value"));
        server.setAttribute(objectName, new Attribute("value", 3));
        assertEquals(3, server.getAttribute(objectName, "value"));
        assertEquals("winner", server.invoke(objectName, "tryValue", new Object[]{3}, null));
        assertEquals("not the correct value, please have another try", server.invoke(objectName, "tryValue", new Object[]{2}, null));

        container.close();
    }
View Full Code Here


        properties.setProperty("ProtectedDatasource.Password", "fEroTNXjaL5SOTyRQ92x3DNVS/ksbtgs");
        properties.setProperty("ProtectedDatasource.PasswordCipher", "Static3DES");
        properties.setProperty("ProtectedDatasource.JtaManaged", "true");

        // start the context and makes junit test injections
        EJBContainer container = EJBContainer.createEJBContainer(properties);
        Context context = container.getContext();
        context.bind("inject", this);

        // test the datasource
        assertNotNull(dataSource);
        assertNotNull(dataSource.getConnection());

        // closing the context
        container.close();
    }
View Full Code Here

        properties.setProperty("ProtectedDatasource.Password", "3MdniFr3v3NLLuoY");
        properties.setProperty("ProtectedDatasource.PasswordCipher", "reverse");
        properties.setProperty("ProtectedDatasource.JtaManaged", "true");

        // start the context and makes junit test injections
        EJBContainer container = EJBContainer.createEJBContainer(properties);
        Context context = container.getContext();
        context.bind("inject", this);

        // test the datasource
        assertNotNull(dataSource);
        assertNotNull(dataSource.getConnection());

        // closing the context
        container.close();
    }
View Full Code Here

        p.setProperty(EJBContainer.APP_NAME, "test");
        p.setProperty(EJBContainer.PROVIDER, EmbeddedTomEEContainer.class.getName());
        p.put(EJBContainer.MODULES, war.getAbsolutePath());
        p.setProperty(EmbeddedTomEEContainer.TOMEE_EJBCONTAINER_HTTP_PORT, "-1");
        try {
            EJBContainer container = EJBContainer.createEJBContainer(p);
            assertNotNull(container);
            assertNotNull(container.getContext());
            URL url = new URL("http://127.0.0.1:" + System.getProperty(EmbeddedTomEEContainer.TOMEE_EJBCONTAINER_HTTP_PORT) + "/" + war.getName() + "/index.html");
            assertEquals("true", IO.readProperties(url).getProperty("ok"));
            container.close();
        } finally {
            try {
                FileUtils.forceDelete(war);
            } catch (IOException e) {
                FileUtils.deleteQuietly(war);
View Full Code Here

* @author <a href="mailto:cdewolf@redhat.com">Carlo de Wolf</a>
*/
public class SimpleITCase {
    @Test
    public void test1() throws Exception {
        EJBContainer container = EJBContainer.createEJBContainer();

        GreeterBean view = (GreeterBean) container.getContext().lookup("java:global/test-classes/GreeterBean");
        String name = "μετεμψύχωσις";
        String result = view.sayHi(name);
        assertEquals("Hi μετεμψύχωσις", result);

        container.close();
    }
View Full Code Here

    private static final String OBJECT_NAME = "openejb.user.mbeans:group=org.superbiz.mbean,application=mbean-auto-registration,name=GuessHowManyMBean";

    @Test public void play() throws Exception {
        Properties properties = new Properties();
        properties.setProperty("openejb.user.mbeans.list", GuessHowManyMBean.class.getName());
        EJBContainer container = EJBContainer.createEJBContainer(properties);

        MBeanServer server = ManagementFactory.getPlatformMBeanServer();
        ObjectName objectName = new ObjectName(OBJECT_NAME);
        MBeanInfo infos = server.getMBeanInfo(objectName);
        assertEquals(0, server.getAttribute(objectName, "value"));
        server.setAttribute(objectName, new Attribute("value", 3));
        assertEquals(3, server.getAttribute(objectName, "value"));
        assertEquals("winner", server.invoke(objectName, "tryValue", new Object[]{3}, null));
        assertEquals("not the correct value, please have another try", server.invoke(objectName, "tryValue", new Object[]{2}, null));

        container.close();
    }
View Full Code Here

        properties.setProperty("ProtectedDatasource.Password", "fEroTNXjaL5SOTyRQ92x3DNVS/ksbtgs");
        properties.setProperty("ProtectedDatasource.PasswordCipher", "Static3DES");
        properties.setProperty("ProtectedDatasource.JtaManaged", "true");

        // start the context and makes junit test injections
        EJBContainer container = EJBContainer.createEJBContainer(properties);
        Context context = container.getContext();
        context.bind("inject", this);

        // test the datasource
        assertNotNull(dataSource);
        assertNotNull(dataSource.getConnection());

        // closing the context
        container.close();
    }
View Full Code Here

        properties.setProperty("ProtectedDatasource.Password", "3MdniFr3v3NLLuoY");
        properties.setProperty("ProtectedDatasource.PasswordCipher", "reverse");
        properties.setProperty("ProtectedDatasource.JtaManaged", "true");

        // start the context and makes junit test injections
        EJBContainer container = EJBContainer.createEJBContainer(properties);
        Context context = container.getContext();
        context.bind("inject", this);

        // test the datasource
        assertNotNull(dataSource);
        assertNotNull(dataSource.getConnection());

        // closing the context
        container.close();
    }
View Full Code Here

    @Test
    public void play() throws Exception {
        Properties properties = new Properties();
        properties.setProperty("openejb.user.mbeans.list", GuessHowManyMBean.class.getName());
        EJBContainer container = EJBContainer.createEJBContainer(properties);

        MBeanServer server = ManagementFactory.getPlatformMBeanServer();
        ObjectName objectName = new ObjectName(OBJECT_NAME);
        MBeanInfo infos = server.getMBeanInfo(objectName);
        assertEquals(0, server.getAttribute(objectName, "value"));
        server.setAttribute(objectName, new Attribute("value", 3));
        assertEquals(3, server.getAttribute(objectName, "value"));
        assertEquals("winner", server.invoke(objectName, "tryValue", new Object[]{3}, null));
        assertEquals("not the correct value, please have another try", server.invoke(objectName, "tryValue", new Object[]{2}, null));

        container.close();
    }
View Full Code Here

        p.setProperty(EJBContainer.APP_NAME, "test");
        p.setProperty(EJBContainer.PROVIDER, EmbeddedTomEEContainer.class.getName());
        p.put(EJBContainer.MODULES, war.getAbsolutePath());
        p.setProperty(EmbeddedTomEEContainer.TOMEE_EJBCONTAINER_HTTP_PORT, "-1");
        try {
            EJBContainer container = EJBContainer.createEJBContainer(p);
            assertNotNull(container);
            assertNotNull(container.getContext());
            URL url = new URL("http://127.0.0.1:" + System.getProperty(EmbeddedTomEEContainer.TOMEE_EJBCONTAINER_HTTP_PORT) + "/" + war.getName() + "/index.html");
            assertEquals("true", IOUtils.readProperties(url).getProperty("ok"));
            container.close();
        } finally {
            try {
                FileUtils.forceDelete(war);
            } catch (IOException e) {
                FileUtils.deleteQuietly(war);
View Full Code Here

TOP

Related Classes of javax.ejb.embeddable.EJBContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.