use of com.sun.enterprise.config.serverbeans.Domain in project Payara by payara.
the class BasicModularityTest method testRanking.
@Test
public void testRanking() {
Domain d = habitat.<Domain>getService(Domain.class);
RankedConfigBean rankedConfigBean = d.getExtensionByType(RankedConfigBean.class);
assertEquals("invalid current value", "simple-value-zero", rankedConfigBean.getSimpleAttribute());
ensureRunLevel(4);
rankedConfigBean = d.getExtensionByType(RankedConfigBean.class);
assertEquals("invalid current value", "simple-value-one", rankedConfigBean.getSimpleAttribute());
}
use of com.sun.enterprise.config.serverbeans.Domain in project Payara by payara.
the class RestManagementResourceProvider method generateASM.
private void generateASM(ServiceLocator habitat) {
try {
synchronized (RestManagementResourceProvider.class) {
Domain entity = habitat.getService(Domain.class);
Dom dom = Dom.unwrap(entity);
ResourcesGenerator resourcesGenerator = new ASMResourcesGenerator(habitat);
resourcesGenerator.generateSingle(dom.document.getRoot().model, dom.document);
resourcesGenerator.endGeneration();
}
} catch (Exception ex) {
RestLogging.restLogger.log(Level.SEVERE, null, ex);
}
}
use of com.sun.enterprise.config.serverbeans.Domain in project Payara by payara.
the class CommandRunnerTest method simpleDomain.
private static Domain simpleDomain() {
InvocationHandler handler = new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
throw new UnsupportedOperationException("Feature-free dummy implementation for injection only");
}
};
Domain d = (Domain) Proxy.newProxyInstance(Domain.class.getClassLoader(), new Class[] { Domain.class }, handler);
return d;
}
use of com.sun.enterprise.config.serverbeans.Domain in project Payara by payara.
the class CommandRunnerTest method setup.
@BeforeClass
public void setup() {
/*
* The CommandRunnerImpl now injects Domain but these tests do not
* exercise the code path that requires the domain. So register a
* dummy Domain instance with the habitat so injection will work.
*/
ServiceLocatorUtilities.addOneDescriptor(testLocator, BuilderHelper.createConstantDescriptor(simpleDomain(), null, Domain.class));
ServiceLocatorUtilities.addOneConstant(testLocator, new StartupContext());
ServiceLocatorUtilities.addOneDescriptor(testLocator, BuilderHelper.createConstantDescriptor(new SingleModulesRegistry(CommandRunnerTest.class.getClassLoader()), null, ModulesRegistry.class));
}
use of com.sun.enterprise.config.serverbeans.Domain in project Payara by payara.
the class CreateJavaMailResourceTest method setUp.
@Before
public void setUp() {
System.out.println("\n\n *** Entering setup method *** \n\n");
System.out.println("Current dir: " + System.getProperty("user.dir") + "\n");
AuthorizationService foo = new AuthorizationServiceImpl();
System.out.println("Direct instantiation: " + foo);
habitat = getHabitat();
foo = habitat.getService(AuthorizationService.class);
System.out.println("Lookup via habitat: " + foo + "\n");
resources = habitat.<Domain>getService(Domain.class).getResources();
assertTrue(resources != null);
parameters = new ParameterMap();
context = new AdminCommandContextImpl(getLogger(CreateJavaMailResourceTest.class, ADMIN_LOGGER), new PropsFileActionReporter());
cr = habitat.getService(CommandRunner.class);
assertTrue(cr != null);
}
Aggregations