Search in sources :

Example 1 with SimpleServiceManager

use of org.apache.openejb.server.SimpleServiceManager in project tomee by apache.

the class DerbyNetworkServiceTest method test.

@Test
public void test() throws Exception {
    final int port = NetworkUtil.getNextAvailablePort();
    final SimpleServiceManager serviceManager = new SimpleServiceManager(new ServiceFinder() {

        @Override
        public Map<String, Properties> mapAvailableServices(Class interfase) throws IOException, ClassNotFoundException {
            final Properties properties = new Properties();
            properties.setProperty("server", DerbyNetworkService.class.getName());
            properties.setProperty("port", port + "");
            properties.setProperty("disabled", "false");
            properties.put(ServerService.class, DerbyNetworkService.class);
            properties.put("derby.system.home", new File(SystemInstance.get().getBase().getDirectory(), "target").getAbsolutePath());
            final Map<String, Properties> services = new HashMap<String, Properties>();
            services.put("derbynet", properties);
            return services;
        }
    });
    serviceManager.init();
    serviceManager.start(false);
    waitForDerby(port);
    assertConnection(port);
    serviceManager.stop();
}
Also used : IOException(java.io.IOException) Properties(java.util.Properties) ServiceFinder(org.apache.openejb.server.ServiceFinder) ServerService(org.apache.openejb.server.ServerService) SimpleServiceManager(org.apache.openejb.server.SimpleServiceManager) HashMap(java.util.HashMap) Map(java.util.Map) File(java.io.File) Test(org.junit.Test)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Properties (java.util.Properties)1 ServerService (org.apache.openejb.server.ServerService)1 ServiceFinder (org.apache.openejb.server.ServiceFinder)1 SimpleServiceManager (org.apache.openejb.server.SimpleServiceManager)1 Test (org.junit.Test)1