use of fish.payara.enterprise.config.serverbeans.DeploymentGroup in project Payara by payara.
the class CreateApplicationRefCommand method isDeploymentGroup.
private boolean isDeploymentGroup(String target) {
boolean isDeploymentGroup = false;
List<DeploymentGroup> listOfDeploymentGroups = domain.getDeploymentGroups().getDeploymentGroup();
for (DeploymentGroup deploymentGroup : listOfDeploymentGroups) {
if (deploymentGroup.getName().equals(target)) {
isDeploymentGroup = true;
break;
}
}
return isDeploymentGroup;
}
use of fish.payara.enterprise.config.serverbeans.DeploymentGroup 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.DeploymentGroup in project Payara by payara.
the class DGTest method getDeploymentGroupFromServerTest.
@Test
public void getDeploymentGroupFromServerTest() {
Domain d = habitat.getService(Domain.class);
Server server = d.getServerNamed("server2");
assertTrue(server != null);
List<DeploymentGroup> dgs = server.getDeploymentGroup();
assertEquals("List should have 1 element", 1L, dgs.size());
}
use of fish.payara.enterprise.config.serverbeans.DeploymentGroup in project Payara by payara.
the class DeploymentUtils method getVirtualServers.
/*
* @return comma-separated list of all defined virtual servers (exclusive
* of __asadmin) on the specified target
*/
public static String getVirtualServers(String target, ServerEnvironment env, Domain domain) {
if (target == null) {
// return null;
// work around till the OE sets the virtualservers param when it's
// handling the default target
target = "server";
}
if (env.isDas() && DeploymentUtils.isDomainTarget(target)) {
target = "server";
}
StringBuilder sb = new StringBuilder();
boolean first = true;
Server server = domain.getServerNamed(target);
Config config = null;
if (server != null) {
config = domain.getConfigs().getConfigByName(server.getConfigRef());
} else {
Cluster cluster = domain.getClusterNamed(target);
if (cluster != null) {
config = domain.getConfigs().getConfigByName(cluster.getConfigRef());
} else {
DeploymentGroup dg = domain.getDeploymentGroupNamed(target);
if (dg != null) {
// get the first server in the group
List<Server> servers = dg.getInstances();
if (servers != null && servers.size() >= 1) {
config = servers.get(0).getConfig();
}
}
}
}
if (config != null) {
HttpService httpService = config.getHttpService();
if (httpService != null) {
List<VirtualServer> hosts = httpService.getVirtualServer();
if (hosts != null) {
for (VirtualServer host : hosts) {
if (("__asadmin").equals(host.getId())) {
continue;
}
if (first) {
sb.append(host.getId());
first = false;
} else {
sb.append(",");
sb.append(host.getId());
}
}
}
}
}
return sb.toString();
}
use of fish.payara.enterprise.config.serverbeans.DeploymentGroup 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();
ArrayList<String> deploymentGroupNames = new ArrayList<>();
if (listOfDeploymentGroup.isEmpty()) {
report.appendMessage("No Deployment Group has been created");
} else {
StringBuilder sb = new StringBuilder();
sb.append("List of Deployment Groups" + ":\n");
for (DeploymentGroup deploymentGroup : listOfDeploymentGroup) {
sb.append("\t" + deploymentGroup.getName() + "\n");
deploymentGroupNames.add(deploymentGroup.getName());
}
report.setMessage(sb.toString());
}
Properties extrasProps = new Properties();
extrasProps.put("listOfDeploymentGroups", deploymentGroupNames);
report.setExtraProperties(extrasProps);
}
Aggregations