@Test public void testDeployConf() { CommandOutput mockExecData = mock(CommandOutput.class); when(Config.service.deployConf(anyString(), anyString(), anyString(), anyString(), any(ResourceGroup.class), any(User.class))).thenReturn(mockExecData); when(mockExecData.getReturnCode()).thenReturn(new ExecReturnCode(0)); Response response = applicationServiceRestInterface.deployConf(Config.application.getName(), Config.group1.getName(), "jvmName", "ServerXMLTemplate.tpl", Config.authenticatedUser); assertNotNull(response.getEntity()); when(mockExecData.getReturnCode()).thenReturn(new ExecReturnCode(1)); response = applicationServiceRestInterface.deployConf(Config.application.getName(), Config.group1.getName(), "jvmName", "ServerXMLTemplate.tpl", Config.authenticatedUser); assertNotNull(response.getEntity()); when(Config.service.deployConf(anyString(), anyString(), anyString(), anyString(), any(ResourceGroup.class), any(User.class))).thenThrow(new InternalErrorException(FaultType.REMOTE_COMMAND_FAILURE, "Target JVM must be stopped")); boolean exceptionThrown = false; try { applicationServiceRestInterface.deployConf(Config.application.getName(), Config.group1.getName(), "jvmName", "ServerXMLTemplate.tpl", Config.authenticatedUser); } catch (InternalErrorException ie) { exceptionThrown = true; assertEquals("Target JVM must be stopped", ie.getMessage()); } assertTrue(exceptionThrown); }
@Override public Response deployConf(final String appName, final String groupName, final String jvmName, final String resourceTemplateName, final AuthenticatedUser authUser) { LOGGER.info("Deploying the application conf file {} for app {} to JVM {} in group {} by ", resourceTemplateName, appName, jvmName, groupName, authUser.getUser().getId()); return ResponseBuilder.ok(service.deployConf(appName, groupName, jvmName, resourceTemplateName, resourceService.generateResourceGroup(), authUser.getUser())); }
ApplicationServiceRestImpl implements ApplicationServiceRest { @Override public Response deployConf(final String appName, final String groupName, final String jvmName, final String resourceTemplateName, final AuthenticatedUser authUser) { LOGGER.info("Deploying the application conf file {} for app {} to JVM {} in group {} by ", resourceTemplateName, appName, jvmName, groupName, authUser.getUser().getId()); return ResponseBuilder.ok(service.deployConf(appName, groupName, jvmName, resourceTemplateName, resourceService.generateResourceGroup(), authUser.getUser())); } }
ApplicationServiceRestImpl implements ApplicationServiceRest { @Override public Response deployConf(final String appName, final String groupName, final String jvmName, final String resourceTemplateName, final AuthenticatedUser authUser) { LOGGER.info("Deploying the application conf file {} for app {} to JVM {} in group {} by ", resourceTemplateName, appName, jvmName, groupName, authUser.getUser().getId()); return ResponseBuilder.ok(service.deployConf(appName, groupName, jvmName, resourceTemplateName, resourceService.generateResourceGroup(), authUser.getUser())); } ApplicationServiceRestImpl(ApplicationService applicationService,
                                      ResourceService resourceService,
                                      final GroupService groupService); }
ApplicationServiceRestImpl implements ApplicationServiceRest { @Override public Response deployConf(final String appName, final String groupName, final String jvmName, final String resourceTemplateName, final AuthenticatedUser authUser) { LOGGER.info("Deploying the application conf file {} for app {} to JVM {} in group {} by ", resourceTemplateName, appName, jvmName, groupName, authUser.getUser().getId()); return ResponseBuilder.ok(service.deployConf(appName, groupName, jvmName, resourceTemplateName, resourceService.generateResourceGroup(), authUser.getUser())); } ApplicationServiceRestImpl(ApplicationService applicationService,
                                      ResourceService resourceService,
                                      final GroupService groupService); @Override Response getApplication(Identifier<Application> anAppId); @Override Response getApplicationByName(final String name); @Override Response getApplications(Identifier<Group> aGroupId); @Override Response findApplicationsByJvmId(Identifier<Jvm> aJvmId); @Override Response createApplication(final JsonCreateApplication anAppToCreate, final AuthenticatedUser aUser); @Override Response updateApplication(final JsonUpdateApplication anAppToUpdate, final AuthenticatedUser aUser); @Override Response removeApplication(final Identifier<Application> anAppToRemove, final AuthenticatedUser aUser); @Override Response deployWebArchive(final Identifier<Application> anAppToGet, final AuthenticatedUser aUser); @Override Response deployWebArchive(final Identifier<Application> anAppToGet, String hostName); @Override Response getResourceNames(final String appName, final String jvmName); @Override Response updateResourceTemplate(final String appName,
                                           final String resourceTemplateName,
                                           final String jvmName,
                                           final String groupName,
                                           final String content); @Override Response deployConf(final String appName, final String groupName, final String jvmName,
                               final String resourceTemplateName, final AuthenticatedUser authUser); @Override Response previewResourceTemplate(final String appName, final String groupName, final String jvmName,
                                            final String fileName,
                                            final String template); @Override Response deployConf(final String appName, final AuthenticatedUser aUser, final String hostName); @Override Response checkIfFileExists(final String filePath, final AuthenticatedUser aUser, final String hostName); }
ApplicationServiceRestImpl implements ApplicationServiceRest { @Override public Response deployConf(final String appName, final String groupName, final String jvmName, final String resourceTemplateName, final AuthenticatedUser authUser) { LOGGER.info("Deploying the application conf file {} for app {} to JVM {} in group {} by ", resourceTemplateName, appName, jvmName, groupName, authUser.getUser().getId()); return ResponseBuilder.ok(service.deployConf(appName, groupName, jvmName, resourceTemplateName, resourceService.generateResourceGroup(), authUser.getUser())); } ApplicationServiceRestImpl(ApplicationService applicationService,
                                      ResourceService resourceService,
                                      final GroupService groupService); @Override Response getApplication(Identifier<Application> anAppId); @Override Response getApplicationByName(final String name); @Override Response getApplications(Identifier<Group> aGroupId); @Override Response findApplicationsByJvmId(Identifier<Jvm> aJvmId); @Override Response createApplication(final JsonCreateApplication anAppToCreate, final AuthenticatedUser aUser); @Override Response updateApplication(final JsonUpdateApplication anAppToUpdate, final AuthenticatedUser aUser); @Override Response removeApplication(final Identifier<Application> anAppToRemove, final AuthenticatedUser aUser); @Override Response deployWebArchive(final Identifier<Application> anAppToGet, final AuthenticatedUser aUser); @Override Response deployWebArchive(final Identifier<Application> anAppToGet, String hostName); @Override Response getResourceNames(final String appName, final String jvmName); @Override Response updateResourceTemplate(final String appName,
                                           final String resourceTemplateName,
                                           final String jvmName,
                                           final String groupName,
                                           final String content); @Override Response deployConf(final String appName, final String groupName, final String jvmName,
                               final String resourceTemplateName, final AuthenticatedUser authUser); @Override Response previewResourceTemplate(final String appName, final String groupName, final String jvmName,
                                            final String fileName,
                                            final String template); @Override Response deployConf(final String appName, final AuthenticatedUser aUser, final String hostName); @Override Response checkIfFileExists(final String filePath, final AuthenticatedUser aUser, final String hostName);  }