Example usage for javax.ejb.embeddable EJBContainer APP_NAME

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

Introduction

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

Prototype

String APP_NAME

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

Click Source Link

Document

Standard property name for specifying the application name of the EJB modules executing within the embeddable container.

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;/* ww w  .j  a  va  2 s .  c o  m*/
    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();/*  w  w w.ja v  a2 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);
}