@Test public void testCreateGroupFail() { when(mockGroupService.createGroup(any(CreateGroupRequest.class), any(User.class))).thenThrow(EntityExistsException.class); Response response = groupServiceRest.createGroup(mockGroup.getName(), mockAuthenticatedUser); assertEquals(500, response.getStatus()); }
@Override public Response createGroup(final String aNewGroupName, final AuthenticatedUser aUser) { try { LOGGER.info("Create Group requested: {} by user {}", aNewGroupName, aUser.getUser().getId()); final Group group = groupService.createGroup(new CreateGroupRequest(aNewGroupName), aUser.getUser()); return ResponseBuilder.created(group); } catch (EntityExistsException eee) { LOGGER.error("Group Name already exists: {}", aNewGroupName); return ResponseBuilder.notOk(Response.Status.INTERNAL_SERVER_ERROR, new FaultCodeException( FaultType.DUPLICATE_GROUP_NAME, eee.getMessage(), eee)); } }
GroupServiceRestImpl implements GroupServiceRest { @Override public Response createGroup(final String aNewGroupName, final AuthenticatedUser aUser) { try { LOGGER.info("Create Group requested: {} by user {}", aNewGroupName, aUser.getUser().getId()); final Group group = groupService.createGroup(new CreateGroupRequest(aNewGroupName), aUser.getUser()); return ResponseBuilder.created(group); } catch (EntityExistsException eee) { LOGGER.error("Group Name already exists: {}", aNewGroupName); return ResponseBuilder.notOk(Response.Status.INTERNAL_SERVER_ERROR, new FaultCodeException( FaultType.DUPLICATE_GROUP_NAME, eee.getMessage(), eee)); } } }
GroupServiceRestImpl implements GroupServiceRest { @Override public Response createGroup(final String aNewGroupName, final AuthenticatedUser aUser) { try { LOGGER.info("Create Group requested: {} by user {}", aNewGroupName, aUser.getUser().getId()); final Group group = groupService.createGroup(new CreateGroupRequest(aNewGroupName), aUser.getUser()); return ResponseBuilder.created(group); } catch (EntityExistsException eee) { LOGGER.error("Group Name already exists: {}", aNewGroupName); return ResponseBuilder.notOk(Response.Status.INTERNAL_SERVER_ERROR, new FaultCodeException( FaultType.DUPLICATE_GROUP_NAME, eee.getMessage(), eee)); } } @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 createGroup(final String aNewGroupName, final AuthenticatedUser aUser) { try { LOGGER.info("Create Group requested: {} by user {}", aNewGroupName, aUser.getUser().getId()); final Group group = groupService.createGroup(new CreateGroupRequest(aNewGroupName), aUser.getUser()); return ResponseBuilder.created(group); } catch (EntityExistsException eee) { LOGGER.error("Group Name already exists: {}", aNewGroupName); return ResponseBuilder.notOk(Response.Status.INTERNAL_SERVER_ERROR, new FaultCodeException( FaultType.DUPLICATE_GROUP_NAME, eee.getMessage(), eee)); } } @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 createGroup(final String aNewGroupName, final AuthenticatedUser aUser) { try { LOGGER.info("Create Group requested: {} by user {}", aNewGroupName, aUser.getUser().getId()); final Group group = groupService.createGroup(new CreateGroupRequest(aNewGroupName), aUser.getUser()); return ResponseBuilder.created(group); } catch (EntityExistsException eee) { LOGGER.error("Group Name already exists: {}", aNewGroupName); return ResponseBuilder.notOk(Response.Status.INTERNAL_SERVER_ERROR, new FaultCodeException( FaultType.DUPLICATE_GROUP_NAME, eee.getMessage(), eee)); } } @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();  }