use of fish.payara.enterprise.config.serverbeans.DeploymentGroups in project Payara by payara.
the class ListDeploymentGroupsCommand method execute.
@Override
public void execute(AdminCommandContext context) {
final ActionReport report = context.getActionReport();
DeploymentGroups deploymentGroups = domain.getDeploymentGroups();
List<DeploymentGroup> listOfDeploymentGroup = deploymentGroups.getDeploymentGroup();
if (listOfDeploymentGroup.isEmpty()) {
report.appendMessage("No Deployment Group has been created");
} else {
StringBuffer sb = new StringBuffer();
sb.append("List of Deployment Groups" + ":\n");
Properties extrasProps = new Properties();
ArrayList<String> deploymentGroupNames = new ArrayList<String>();
for (DeploymentGroup deploymentGroup : listOfDeploymentGroup) {
sb.append("\t" + deploymentGroup.getName() + "\n");
deploymentGroupNames.add(deploymentGroup.getName());
}
extrasProps.put("listOfDeploymentGroups", deploymentGroupNames);
report.setMessage(sb.toString());
report.setExtraProperties(extrasProps);
}
}
use of fish.payara.enterprise.config.serverbeans.DeploymentGroups in project Payara by payara.
the class DGTest method testThereAreTwo.
@Test
public void testThereAreTwo() {
Domain d = habitat.getService(Domain.class);
DeploymentGroups dgs = d.getDeploymentGroups();
assertNotNull("Deployment Groups should not be null", dgs);
List<DeploymentGroup> ldg = dgs.getDeploymentGroup();
assertNotNull("Deployment Groups List should not be null", ldg);
assertEquals("List should have 2 deployment groups", 2L, ldg.size());
}
use of fish.payara.enterprise.config.serverbeans.DeploymentGroups in project Payara by payara.
the class DGTest method getNamedDeploymentGroup.
@Test
public void getNamedDeploymentGroup() {
Domain d = habitat.getService(Domain.class);
DeploymentGroups dgs = d.getDeploymentGroups();
assertNotNull("Deployment Groups should not be null", dgs);
DeploymentGroup dg = dgs.getDeploymentGroup("dg1");
assertNotNull("Deployment Group should not be null", dg);
assertEquals("Deployment Group Name should be dg1", "dg1", dg.getName());
}
use of fish.payara.enterprise.config.serverbeans.DeploymentGroups in project Payara by payara.
the class DGTest method testGetServersFromDG.
@Test
public void testGetServersFromDG() {
Domain d = habitat.getService(Domain.class);
DeploymentGroups dgs = d.getDeploymentGroups();
assertNotNull("Deployment Groups should not be null", dgs);
List<DeploymentGroup> ldg = dgs.getDeploymentGroup();
assertNotNull("Deployment Groups List should not be null", ldg);
assertEquals("List should have 2 deployment groups", 2L, ldg.size());
// get first named group
DeploymentGroup dg = dgs.getDeploymentGroup("dg1");
assertNotNull("Deployment Group dg1 should not be null", dg);
List<Server> servers = dg.getInstances();
assertNotNull("Servers List for dg1 should not be null", servers);
assertEquals("List should have 1 Server", 1L, servers.size());
Server server = servers.get(0);
assertNotNull("Server for dg1 should not be null", server);
assertEquals("Server should be called server", "server", server.getName());
// get second named group
dg = dgs.getDeploymentGroup("dg2");
assertNotNull("Deployment Group dg2 should not be null", dg);
servers = dg.getInstances();
assertNotNull("Servers List for dg2 should not be null", servers);
assertEquals("List should have 2 Servers", 2L, servers.size());
server = servers.get(0);
assertNotNull("First Server for dg2 should not be null", server);
assertEquals("First Server should be called server", "server", server.getName());
server = servers.get(1);
assertNotNull("Second Server for dg2 should not be null", server);
assertEquals("Second Server should be called server2", "server2", server.getName());
}
Aggregations