Example usage for javax.ejb.embeddable EJBContainer MODULES

List of usage examples for javax.ejb.embeddable EJBContainer MODULES

Introduction

In this page you can find the example usage for javax.ejb.embeddable EJBContainer MODULES.

Prototype

String MODULES

To view the source code for javax.ejb.embeddable EJBContainer MODULES.

Click Source Link

Document

Standard property name for specifying the set of modules to be initialized.

Usage

From source file:org.apache.tomee.embedded.EmbeddedTomEEContainerTest.java

@Test
public void containerTest() throws Exception {

    final File war = createWar();
    final Properties p = new Properties();
    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");

    EJBContainer container = null;//from   w w w  . ja v a 2 s.com
    try {
        container = EJBContainer.createEJBContainer(p);
        assertNotNull(container);
        assertNotNull(container.getContext());
        final URL url = new URL("http://127.0.0.1:"
                + System.getProperty(EmbeddedTomEEContainer.TOMEE_EJBCONTAINER_HTTP_PORT) + "/test/index.html");
        assertEquals("true", getOk(url, 2));

    } finally {

        if (container != null) {
            container.close();
        }

        try {
            FileUtils.forceDelete(war);
        } catch (final IOException e) {
            FileUtils.deleteQuietly(war);
        }
    }
}

From source file:org.superbiz.moviefun.MoviesHtmlUnitTest.java

@BeforeClass
public static void start() throws IOException {

    // get a random unused port to use for http requests
    ServerSocket server = new ServerSocket(0);
    port = server.getLocalPort();//from   ww  w.j  ava2 s .c  o  m
    server.close();

    webApp = createWebApp();
    Properties p = new Properties();
    p.setProperty(EJBContainer.APP_NAME, "moviefun");
    p.setProperty(EJBContainer.PROVIDER, "tomee-embedded"); // need web feature
    p.setProperty(EJBContainer.MODULES, webApp.getAbsolutePath());
    p.setProperty(EmbeddedTomEEContainer.TOMEE_EJBCONTAINER_HTTP_PORT, String.valueOf(port));
    container = EJBContainer.createEJBContainer(p);
}