context.setAttribute(TuscanyServletListener.MODULE_COMPONENT_NAME, createModuleWithJSONRPCEntryPoint(entryPointName, instance));
return servletConfig;
}
public static CompositeContext createModuleWithJSONRPCEntryPoint(String entryPointName, Object instance) {
MockCompositeContextImpl cci = new MockCompositeContextImpl();
Module module = (Module) cci.getComposite();
List<EntryPoint> entryPoints = module.getEntryPoints();
EntryPoint ep = createMockEntryPoint(entryPointName);
addJSONRPCBinding(ep);
entryPoints.add(ep);
cci.start();
Map<String, Context> ics = new HashMap<String, Context>();
ics.put(entryPointName, new MockEntryPointContext(instance));
ScopeContext sc = new MockScopeContext(ics);
sc.start();
Map<String, ScopeContext> scopeIndex = cci.getScopeIndex();
scopeIndex.put(entryPointName, sc);
return cci;
}