Search in sources :

Example 21 with Domain

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());
}
Also used : Domain(com.sun.enterprise.config.serverbeans.Domain) ConfigApiTest(com.sun.enterprise.configapi.tests.ConfigApiTest) Test(org.junit.Test)

Example 22 with Domain

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);
    }
}
Also used : Dom(org.jvnet.hk2.config.Dom) ASMResourcesGenerator(org.glassfish.admin.rest.generator.ASMResourcesGenerator) ResourcesGenerator(org.glassfish.admin.rest.generator.ResourcesGenerator) Domain(com.sun.enterprise.config.serverbeans.Domain) ASMResourcesGenerator(org.glassfish.admin.rest.generator.ASMResourcesGenerator) EndpointRegistrationException(org.glassfish.api.container.EndpointRegistrationException)

Example 23 with Domain

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;
}
Also used : BeforeClass(org.junit.BeforeClass) Method(java.lang.reflect.Method) Domain(com.sun.enterprise.config.serverbeans.Domain) InvocationHandler(java.lang.reflect.InvocationHandler)

Example 24 with Domain

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));
}
Also used : StartupContext(com.sun.enterprise.module.bootstrap.StartupContext) SingleModulesRegistry(com.sun.enterprise.module.single.SingleModulesRegistry) SingleModulesRegistry(com.sun.enterprise.module.single.SingleModulesRegistry) ModulesRegistry(com.sun.enterprise.module.ModulesRegistry) Domain(com.sun.enterprise.config.serverbeans.Domain) BeforeClass(org.junit.BeforeClass)

Example 25 with Domain

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);
}
Also used : AdminCommandContextImpl(org.glassfish.api.admin.AdminCommandContextImpl) AuthorizationService(org.glassfish.security.services.api.authorization.AuthorizationService) ParameterMap(org.glassfish.api.admin.ParameterMap) Domain(com.sun.enterprise.config.serverbeans.Domain) PropsFileActionReporter(com.sun.enterprise.admin.report.PropsFileActionReporter) CommandRunner(org.glassfish.api.admin.CommandRunner) AuthorizationServiceImpl(org.glassfish.security.services.impl.authorization.AuthorizationServiceImpl) Before(org.junit.Before)

Aggregations

Domain (com.sun.enterprise.config.serverbeans.Domain)70 Test (org.junit.Test)21 Server (com.sun.enterprise.config.serverbeans.Server)15 ConfigApiTest (com.sun.enterprise.configapi.tests.ConfigApiTest)12 Dom (org.jvnet.hk2.config.Dom)11 PropertyVetoException (java.beans.PropertyVetoException)10 Cluster (com.sun.enterprise.config.serverbeans.Cluster)7 Resources (com.sun.enterprise.config.serverbeans.Resources)7 ServiceLocator (org.glassfish.hk2.api.ServiceLocator)7 ServerContext (org.glassfish.internal.api.ServerContext)7 Config (com.sun.enterprise.config.serverbeans.Config)6 Resource (com.sun.enterprise.config.serverbeans.Resource)6 ParameterMap (org.glassfish.api.admin.ParameterMap)6 TransactionFailure (org.jvnet.hk2.config.TransactionFailure)6 DeploymentGroup (fish.payara.enterprise.config.serverbeans.DeploymentGroup)5 HashMap (java.util.HashMap)5 Map (java.util.Map)5 Before (org.junit.Before)5 ConfigModel (org.jvnet.hk2.config.ConfigModel)5 PropsFileActionReporter (com.sun.enterprise.admin.report.PropsFileActionReporter)4