use of com.sun.enterprise.config.serverbeans.Cluster in project Payara by payara.
the class DuckMethodsTest method getClusterFromServerTest.
@Test
public void getClusterFromServerTest() {
Domain d = habitat.getService(Domain.class);
Server server = d.getServerNamed("server");
assertTrue(server != null);
Cluster cluster = server.getCluster();
System.out.println("Cluster name is " + cluster.getName());
}
use of com.sun.enterprise.config.serverbeans.Cluster in project Payara by payara.
the class ReferenceConstrainClusterTest method clusterConfigRefInvalid.
@Test
public void clusterConfigRefInvalid() throws TransactionFailure {
Cluster cluster = habitat.getService(Cluster.class, "clusterA");
assertNotNull(cluster);
ConfigBean serverConfig = (ConfigBean) ConfigBean.unwrap(cluster);
Map<ConfigBean, Map<String, String>> changes = new HashMap<ConfigBean, Map<String, String>>();
Map<String, String> configChanges = new HashMap<String, String>();
configChanges.put("config-ref", "server-config-nonexist");
changes.put(serverConfig, configChanges);
try {
ConfigSupport cs = getHabitat().getService(ConfigSupport.class);
cs.apply(changes);
fail("Can not reach this point");
} catch (TransactionFailure tf) {
ConstraintViolationException cv = findConstrViolation(tf);
assertNotNull(cv);
}
}
use of com.sun.enterprise.config.serverbeans.Cluster in project Payara by payara.
the class ReferenceConstrainClusterTest method clusterConfigRefValid.
@Test
public void clusterConfigRefValid() throws TransactionFailure {
Cluster cluster = habitat.getService(Cluster.class, "clusterA");
assertNotNull(cluster);
ConfigBean serverConfig = (ConfigBean) ConfigBean.unwrap(cluster);
Map<ConfigBean, Map<String, String>> changes = new HashMap<ConfigBean, Map<String, String>>();
Map<String, String> configChanges = new HashMap<String, String>();
configChanges.put("config-ref", "server-config");
changes.put(serverConfig, configChanges);
try {
ConfigSupport cs = getHabitat().getService(ConfigSupport.class);
cs.apply(changes);
} catch (TransactionFailure tf) {
fail("Can not reach this point");
}
}
use of com.sun.enterprise.config.serverbeans.Cluster in project Payara by payara.
the class DomainXml method decorate.
protected void decorate() {
Server server = habitat.getService(Server.class, env.getInstanceName());
if (server == null) {
LogRecord lr = new LogRecord(Level.SEVERE, badEnv);
lr.setLoggerName(getClass().getName());
EarlyLogHandler.earlyMessages.add(lr);
return;
}
ServiceLocatorUtilities.addOneConstant(habitat, server, ServerEnvironment.DEFAULT_INSTANCE_NAME, Server.class);
server.getConfig().addIndex(habitat, ServerEnvironment.DEFAULT_INSTANCE_NAME);
Cluster c = server.getCluster();
if (c != null) {
ServiceLocatorUtilities.addOneConstant(habitat, c, ServerEnvironment.DEFAULT_INSTANCE_NAME, Cluster.class);
}
}
use of com.sun.enterprise.config.serverbeans.Cluster in project Payara by payara.
the class ConfigApiTest method decorate.
@Override
public void decorate(ServiceLocator habitat) {
Server server = habitat.getService(Server.class, "server");
if (server != null) {
ActiveDescriptor<Server> serverDescriptor = BuilderHelper.createConstantDescriptor(server, ServerEnvironment.DEFAULT_INSTANCE_NAME, Server.class);
ServiceLocatorUtilities.addOneDescriptor(habitat, serverDescriptor);
server.getConfig().addIndex(habitat, ServerEnvironment.DEFAULT_INSTANCE_NAME);
Cluster c = server.getCluster();
if (c != null) {
ActiveDescriptor<Cluster> clusterDescriptor = BuilderHelper.createConstantDescriptor(c, ServerEnvironment.DEFAULT_INSTANCE_NAME, Cluster.class);
ServiceLocatorUtilities.addOneDescriptor(habitat, clusterDescriptor);
}
}
}
Aggregations