@Test public void getOtherGroupMembershipDetailsOfTheChildrenChildTypeNull() { when(mockGroupService.getOtherGroupingDetailsOfJvms(any(Identifier.class))).thenReturn(jvms); when(mockGroupService.getOtherGroupingDetailsOfWebServers(any(Identifier.class))).thenReturn(webServers); final Response response = groupServiceRest.getOtherGroupMembershipDetailsOfTheChildren(new Identifier<Group>("1"), null); assertEquals(response.getStatus(), 200); final ApplicationResponse applicationResponse = (ApplicationResponse) response.getEntity(); final List<MembershipDetails> membershipDetailsList = (List) applicationResponse.getApplicationResponseContent(); assertEquals("jvm1", membershipDetailsList.get(0).getName()); assertEquals("group1", membershipDetailsList.get(0).getGroupNames().get(0)); assertEquals("webServer1", membershipDetailsList.get(1).getName()); assertEquals("group2", membershipDetailsList.get(1).getGroupNames().get(0)); }
@Override public Response getOtherGroupMembershipDetailsOfTheChildren(final Identifier<Group> id, final GroupChildType groupChildType) { LOGGER.debug("Get other group membership details of the children for group {} and child {}", id, groupChildType); final List<Jvm> jvmGroupingDetails; final List<WebServer> webServerGroupingDetails; if (groupChildType != null) { if (groupChildType == GroupChildType.JVM) { jvmGroupingDetails = groupService.getOtherGroupingDetailsOfJvms(id); return ResponseBuilder.ok(createMembershipDetailsFromJvms(jvmGroupingDetails)); } else if (groupChildType == GroupChildType.WEB_SERVER) { webServerGroupingDetails = groupService.getOtherGroupingDetailsOfWebServers(id); return ResponseBuilder.ok(createMembershipDetailsFromWebServers(webServerGroupingDetails)); } } jvmGroupingDetails = groupService.getOtherGroupingDetailsOfJvms(id); final List<MembershipDetails> membershipDetailsList = createMembershipDetailsFromJvms(jvmGroupingDetails); webServerGroupingDetails = groupService.getOtherGroupingDetailsOfWebServers(id); membershipDetailsList.addAll(createMembershipDetailsFromWebServers(webServerGroupingDetails)); return ResponseBuilder.ok(membershipDetailsList); }
GroupServiceRestImpl implements GroupServiceRest { @Override public Response getOtherGroupMembershipDetailsOfTheChildren(final Identifier<Group> id, final GroupChildType groupChildType) { LOGGER.debug("Get other group membership details of the children for group {} and child {}", id, groupChildType); final List<Jvm> jvmGroupingDetails; final List<WebServer> webServerGroupingDetails; if (groupChildType != null) { if (groupChildType == GroupChildType.JVM) { jvmGroupingDetails = groupService.getOtherGroupingDetailsOfJvms(id); return ResponseBuilder.ok(createMembershipDetailsFromJvms(jvmGroupingDetails)); } else if (groupChildType == GroupChildType.WEB_SERVER) { webServerGroupingDetails = groupService.getOtherGroupingDetailsOfWebServers(id); return ResponseBuilder.ok(createMembershipDetailsFromWebServers(webServerGroupingDetails)); } } jvmGroupingDetails = groupService.getOtherGroupingDetailsOfJvms(id); final List<MembershipDetails> membershipDetailsList = createMembershipDetailsFromJvms(jvmGroupingDetails); webServerGroupingDetails = groupService.getOtherGroupingDetailsOfWebServers(id); membershipDetailsList.addAll(createMembershipDetailsFromWebServers(webServerGroupingDetails)); return ResponseBuilder.ok(membershipDetailsList); } }
GroupServiceRestImpl implements GroupServiceRest { @Override public Response getOtherGroupMembershipDetailsOfTheChildren(final Identifier<Group> id, final GroupChildType groupChildType) { LOGGER.debug("Get other group membership details of the children for group {} and child {}", id, groupChildType); final List<Jvm> jvmGroupingDetails; final List<WebServer> webServerGroupingDetails; if (groupChildType != null) { if (groupChildType == GroupChildType.JVM) { jvmGroupingDetails = groupService.getOtherGroupingDetailsOfJvms(id); return ResponseBuilder.ok(createMembershipDetailsFromJvms(jvmGroupingDetails)); } else if (groupChildType == GroupChildType.WEB_SERVER) { webServerGroupingDetails = groupService.getOtherGroupingDetailsOfWebServers(id); return ResponseBuilder.ok(createMembershipDetailsFromWebServers(webServerGroupingDetails)); } } jvmGroupingDetails = groupService.getOtherGroupingDetailsOfJvms(id); final List<MembershipDetails> membershipDetailsList = createMembershipDetailsFromJvms(jvmGroupingDetails); webServerGroupingDetails = groupService.getOtherGroupingDetailsOfWebServers(id); membershipDetailsList.addAll(createMembershipDetailsFromWebServers(webServerGroupingDetails)); return ResponseBuilder.ok(membershipDetailsList); } @Autowired  GroupServiceRestImpl(final GroupService groupService, final ResourceService resourceService,
                                final GroupControlService groupControlService, final GroupJvmControlService groupJvmControlService,
                                final GroupWebServerControlService groupWebServerControlService, final JvmService jvmService,
                                final WebServerService webServerService, ApplicationService applicationService,
                                final ApplicationServiceRest applicationServiceRest, final WebServerServiceRest webServerServiceRest); }
GroupServiceRestImpl implements GroupServiceRest { @Override public Response getOtherGroupMembershipDetailsOfTheChildren(final Identifier<Group> id, final GroupChildType groupChildType) { LOGGER.debug("Get other group membership details of the children for group {} and child {}", id, groupChildType); final List<Jvm> jvmGroupingDetails; final List<WebServer> webServerGroupingDetails; if (groupChildType != null) { if (groupChildType == GroupChildType.JVM) { jvmGroupingDetails = groupService.getOtherGroupingDetailsOfJvms(id); return ResponseBuilder.ok(createMembershipDetailsFromJvms(jvmGroupingDetails)); } else if (groupChildType == GroupChildType.WEB_SERVER) { webServerGroupingDetails = groupService.getOtherGroupingDetailsOfWebServers(id); return ResponseBuilder.ok(createMembershipDetailsFromWebServers(webServerGroupingDetails)); } } jvmGroupingDetails = groupService.getOtherGroupingDetailsOfJvms(id); final List<MembershipDetails> membershipDetailsList = createMembershipDetailsFromJvms(jvmGroupingDetails); webServerGroupingDetails = groupService.getOtherGroupingDetailsOfWebServers(id); membershipDetailsList.addAll(createMembershipDetailsFromWebServers(webServerGroupingDetails)); return ResponseBuilder.ok(membershipDetailsList); } @Autowired  GroupServiceRestImpl(final GroupService groupService, final ResourceService resourceService,
                                final GroupControlService groupControlService, final GroupJvmControlService groupJvmControlService,
                                final GroupWebServerControlService groupWebServerControlService, final JvmService jvmService,
                                final WebServerService webServerService, ApplicationService applicationService,
                                final ApplicationServiceRest applicationServiceRest, final WebServerServiceRest webServerServiceRest); @Override Response getGroups(final NameSearchParameterProvider aGroupNameSearch, final boolean fetchWebServers); @Override Response getGroup(final String groupIdOrName, final boolean byName); @Override Response createGroup(final String aNewGroupName,
                                final AuthenticatedUser aUser); @Override Response updateGroup(final JsonUpdateGroup anUpdatedGroup,
                                final AuthenticatedUser aUser); @Override Response removeGroup(final String name, final boolean byName); @Override Response removeJvmFromGroup(final Identifier<Group> aGroupId,
                                       final Identifier<Jvm> aJvmId,
                                       final AuthenticatedUser aUser); @Override Response addJvmsToGroup(final Identifier<Group> aGroupId,
                                   final JsonJvms someJvmsToAdd,
                                   final AuthenticatedUser aUser); @Override Response controlGroupJvms(final Identifier<Group> aGroupId,
                                     final JsonControlJvm jsonControlJvm,
                                     final AuthenticatedUser aUser); @Override Response updateGroupWebServerResourceTemplate(final String groupName, final String resourceTemplateName, final String content); @Override Response previewGroupWebServerResourceTemplate(String groupName, String resourceTemplateName, String template); @Override Response getGroupWebServerResourceTemplate(String groupName, String resourceTemplateName, boolean tokensReplaced); @Override Response generateAndDeployGroupJvmFile(final String groupName, final String fileName,
                                                  final AuthenticatedUser authUser); @Override Response getGroupJvmResourceTemplate(final String groupName,
                                                final String resourceTemplateName,
                                                final boolean tokensReplaced); @Override Response updateGroupJvmResourceTemplate(final String groupName, final String resourceTemplateName, final String content); @Override Response previewGroupJvmResourceTemplate(String groupName, String fileName, String template); @Override Response generateAndDeployGroupWebServersFile(final String groupName, final String resourceFileName, final AuthenticatedUser aUser); @Override Response controlGroupWebservers(final Identifier<Group> aGroupId,
                                           final JsonControlWebServer jsonControlWebServer,
                                           final AuthenticatedUser aUser); @Override Response generateGroupWebservers(Identifier<Group> aGroupId, final AuthenticatedUser aUser); @Override Response generateGroupJvms(final Identifier<Group> aGroupId, final AuthenticatedUser aUser); @Override Response controlGroup(final Identifier<Group> aGroupId,
                                 final JsonControlGroup jsonControlGroup,
                                 final AuthenticatedUser aUser); @Override Response controlGroups(final JsonControlGroup jsonControlGroup, final AuthenticatedUser authenticatedUser); @Override Response getOtherGroupMembershipDetailsOfTheChildren(final Identifier<Group> id,
                                                                final GroupChildType groupChildType); @Override Response getGroupJvmsResourceNames(String groupName); @Override Response getGroupWebServersResourceNames(String groupName); @Override Response updateGroupAppResourceTemplate(final String groupName, final String appName, final String resourceTemplateName, final String content); @Override Response generateAndDeployGroupAppFile(final String groupName, final String fileName, final String appName, final AuthenticatedUser aUser, final String hostName); @Override Response previewGroupAppResourceTemplate(String groupName, String resourceTemplateName, String appName, String template); @Override Response getGroupAppResourceTemplate(String groupName, String appName, String resourceTemplateName, boolean tokensReplaced); @Override Response getGroupAppResourceNames(String groupName); @Override Response getStartedWebServersAndJvmsCount(); @Override Response getStartedAndStoppedWebServersAndJvmsCount(); @Override Response getStartedWebServersAndJvmsCount(final String groupName); @Override Response getStartedAndStoppedWebServersAndJvmsCount(final String groupName); @Override Response getStoppedWebServersAndJvmsCount(); @Override Response getStoppedWebServersAndJvmsCount(final String groupName); @Override Response areAllJvmsStopped(final String groupName); @Override Response areAllWebServersStopped(final String groupName); @Override Response getHosts(final String groupName); @Override Response getAllHosts(); @Override Response getGroupState(final String groupName); @Override Response getGroupStates(); }
GroupServiceRestImpl implements GroupServiceRest { @Override public Response getOtherGroupMembershipDetailsOfTheChildren(final Identifier<Group> id, final GroupChildType groupChildType) { LOGGER.debug("Get other group membership details of the children for group {} and child {}", id, groupChildType); final List<Jvm> jvmGroupingDetails; final List<WebServer> webServerGroupingDetails; if (groupChildType != null) { if (groupChildType == GroupChildType.JVM) { jvmGroupingDetails = groupService.getOtherGroupingDetailsOfJvms(id); return ResponseBuilder.ok(createMembershipDetailsFromJvms(jvmGroupingDetails)); } else if (groupChildType == GroupChildType.WEB_SERVER) { webServerGroupingDetails = groupService.getOtherGroupingDetailsOfWebServers(id); return ResponseBuilder.ok(createMembershipDetailsFromWebServers(webServerGroupingDetails)); } } jvmGroupingDetails = groupService.getOtherGroupingDetailsOfJvms(id); final List<MembershipDetails> membershipDetailsList = createMembershipDetailsFromJvms(jvmGroupingDetails); webServerGroupingDetails = groupService.getOtherGroupingDetailsOfWebServers(id); membershipDetailsList.addAll(createMembershipDetailsFromWebServers(webServerGroupingDetails)); return ResponseBuilder.ok(membershipDetailsList); } @Autowired  GroupServiceRestImpl(final GroupService groupService, final ResourceService resourceService,
                                final GroupControlService groupControlService, final GroupJvmControlService groupJvmControlService,
                                final GroupWebServerControlService groupWebServerControlService, final JvmService jvmService,
                                final WebServerService webServerService, ApplicationService applicationService,
                                final ApplicationServiceRest applicationServiceRest, final WebServerServiceRest webServerServiceRest); @Override Response getGroups(final NameSearchParameterProvider aGroupNameSearch, final boolean fetchWebServers); @Override Response getGroup(final String groupIdOrName, final boolean byName); @Override Response createGroup(final String aNewGroupName,
                                final AuthenticatedUser aUser); @Override Response updateGroup(final JsonUpdateGroup anUpdatedGroup,
                                final AuthenticatedUser aUser); @Override Response removeGroup(final String name, final boolean byName); @Override Response removeJvmFromGroup(final Identifier<Group> aGroupId,
                                       final Identifier<Jvm> aJvmId,
                                       final AuthenticatedUser aUser); @Override Response addJvmsToGroup(final Identifier<Group> aGroupId,
                                   final JsonJvms someJvmsToAdd,
                                   final AuthenticatedUser aUser); @Override Response controlGroupJvms(final Identifier<Group> aGroupId,
                                     final JsonControlJvm jsonControlJvm,
                                     final AuthenticatedUser aUser); @Override Response updateGroupWebServerResourceTemplate(final String groupName, final String resourceTemplateName, final String content); @Override Response previewGroupWebServerResourceTemplate(String groupName, String resourceTemplateName, String template); @Override Response getGroupWebServerResourceTemplate(String groupName, String resourceTemplateName, boolean tokensReplaced); @Override Response generateAndDeployGroupJvmFile(final String groupName, final String fileName,
                                                  final AuthenticatedUser authUser); @Override Response getGroupJvmResourceTemplate(final String groupName,
                                                final String resourceTemplateName,
                                                final boolean tokensReplaced); @Override Response updateGroupJvmResourceTemplate(final String groupName, final String resourceTemplateName, final String content); @Override Response previewGroupJvmResourceTemplate(String groupName, String fileName, String template); @Override Response generateAndDeployGroupWebServersFile(final String groupName, final String resourceFileName, final AuthenticatedUser aUser); @Override Response controlGroupWebservers(final Identifier<Group> aGroupId,
                                           final JsonControlWebServer jsonControlWebServer,
                                           final AuthenticatedUser aUser); @Override Response generateGroupWebservers(Identifier<Group> aGroupId, final AuthenticatedUser aUser); @Override Response generateGroupJvms(final Identifier<Group> aGroupId, final AuthenticatedUser aUser); @Override Response controlGroup(final Identifier<Group> aGroupId,
                                 final JsonControlGroup jsonControlGroup,
                                 final AuthenticatedUser aUser); @Override Response controlGroups(final JsonControlGroup jsonControlGroup, final AuthenticatedUser authenticatedUser); @Override Response getOtherGroupMembershipDetailsOfTheChildren(final Identifier<Group> id,
                                                                final GroupChildType groupChildType); @Override Response getGroupJvmsResourceNames(String groupName); @Override Response getGroupWebServersResourceNames(String groupName); @Override Response updateGroupAppResourceTemplate(final String groupName, final String appName, final String resourceTemplateName, final String content); @Override Response generateAndDeployGroupAppFile(final String groupName, final String fileName, final String appName, final AuthenticatedUser aUser, final String hostName); @Override Response previewGroupAppResourceTemplate(String groupName, String resourceTemplateName, String appName, String template); @Override Response getGroupAppResourceTemplate(String groupName, String appName, String resourceTemplateName, boolean tokensReplaced); @Override Response getGroupAppResourceNames(String groupName); @Override Response getStartedWebServersAndJvmsCount(); @Override Response getStartedAndStoppedWebServersAndJvmsCount(); @Override Response getStartedWebServersAndJvmsCount(final String groupName); @Override Response getStartedAndStoppedWebServersAndJvmsCount(final String groupName); @Override Response getStoppedWebServersAndJvmsCount(); @Override Response getStoppedWebServersAndJvmsCount(final String groupName); @Override Response areAllJvmsStopped(final String groupName); @Override Response areAllWebServersStopped(final String groupName); @Override Response getHosts(final String groupName); @Override Response getAllHosts(); @Override Response getGroupState(final String groupName); @Override Response getGroupStates();  }