@Inject
private Instance<ProtocolMetaData> protocolMetadata;
public void beforeSuite(@Observes final BeforeEnrichment event) {
final ProtocolMetaData metaData = protocolMetadata.get();
if(metaData == null || !metaData.hasContext(HTTPContext.class)) {
return;
}
try {
Thread.currentThread().getContextClassLoader().loadClass(REMOTE_INITIAL_CONTEXT_FACTORY);
final HTTPContext httpContext = metaData.getContexts(HTTPContext.class).iterator().next();
final Properties props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY, REMOTE_INITIAL_CONTEXT_FACTORY);
props.setProperty(Context.PROVIDER_URL, "http://" + httpContext.getHost() + ":" + httpContext.getPort() + "/tomee/ejb");
Context existing = null;