@Test public void testDeployWebArchive() { Set<Jvm> set = new HashSet<>(); set.add(Config.mockJvm); when(Config.service.getApplication(Config.anAppToGet)).thenReturn(Config.mockApplication); when(Config.mockApplication.getGroup()).thenReturn( Config.mockGroup); when(Config.mockGroup.getJvms()).thenReturn(set); Response response = applicationServiceRestInterface.deployWebArchive(Config.anAppToGet, Config.authenticatedUser); assertEquals(response.getStatus(), 200); }
@Override public Response deployWebArchive(final Identifier<Application> anAppToGet, final AuthenticatedUser aUser) { LOGGER.info("Deploying web archive for app ID {}", anAppToGet); Application app = service.getApplication(anAppToGet); final Group group = app.getGroup(); Set<Jvm> jvms = group.getJvms(); final String appName = app.getName(); final String groupName = group.getName(); if (null != jvms && !jvms.isEmpty()) { service.copyApplicationWarToGroupHosts(app); service.deployApplicationResourcesToGroupHosts(groupName, app, resourceService.generateResourceGroup()); } else { LOGGER.info("Skip deploying application {}, no JVM's in group {}", appName, groupName); } return ResponseBuilder.ok(app); }
ApplicationServiceRestImpl implements ApplicationServiceRest { @Override public Response deployWebArchive(final Identifier<Application> anAppToGet, final AuthenticatedUser aUser) { LOGGER.info("Deploying web archive for app ID {}", anAppToGet); Application app = service.getApplication(anAppToGet); final Group group = app.getGroup(); Set<Jvm> jvms = group.getJvms(); final String appName = app.getName(); final String groupName = group.getName(); if (null != jvms && !jvms.isEmpty()) { service.copyApplicationWarToGroupHosts(app); service.deployApplicationResourcesToGroupHosts(groupName, app, resourceService.generateResourceGroup()); } else { LOGGER.info("Skip deploying application {}, no JVM's in group {}", appName, groupName); } return ResponseBuilder.ok(app); } }
ApplicationServiceRestImpl implements ApplicationServiceRest { @Override public Response deployWebArchive(final Identifier<Application> anAppToGet, final AuthenticatedUser aUser) { LOGGER.info("Deploying web archive for app ID {}", anAppToGet); Application app = service.getApplication(anAppToGet); final Group group = app.getGroup(); Set<Jvm> jvms = group.getJvms(); final String appName = app.getName(); final String groupName = group.getName(); if (null != jvms && !jvms.isEmpty()) { service.copyApplicationWarToGroupHosts(app); service.deployApplicationResourcesToGroupHosts(groupName, app, resourceService.generateResourceGroup()); } else { LOGGER.info("Skip deploying application {}, no JVM's in group {}", appName, groupName); } return ResponseBuilder.ok(app); } ApplicationServiceRestImpl(ApplicationService applicationService,
                                      ResourceService resourceService,
                                      final GroupService groupService); }
ApplicationServiceRestImpl implements ApplicationServiceRest { @Override public Response deployWebArchive(final Identifier<Application> anAppToGet, final AuthenticatedUser aUser) { LOGGER.info("Deploying web archive for app ID {}", anAppToGet); Application app = service.getApplication(anAppToGet); final Group group = app.getGroup(); Set<Jvm> jvms = group.getJvms(); final String appName = app.getName(); final String groupName = group.getName(); if (null != jvms && !jvms.isEmpty()) { service.copyApplicationWarToGroupHosts(app); service.deployApplicationResourcesToGroupHosts(groupName, app, resourceService.generateResourceGroup()); } else { LOGGER.info("Skip deploying application {}, no JVM's in group {}", appName, groupName); } return ResponseBuilder.ok(app); } 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 deployWebArchive(final Identifier<Application> anAppToGet, final AuthenticatedUser aUser) { LOGGER.info("Deploying web archive for app ID {}", anAppToGet); Application app = service.getApplication(anAppToGet); final Group group = app.getGroup(); Set<Jvm> jvms = group.getJvms(); final String appName = app.getName(); final String groupName = group.getName(); if (null != jvms && !jvms.isEmpty()) { service.copyApplicationWarToGroupHosts(app); service.deployApplicationResourcesToGroupHosts(groupName, app, resourceService.generateResourceGroup()); } else { LOGGER.info("Skip deploying application {}, no JVM's in group {}", appName, groupName); } return ResponseBuilder.ok(app); } 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);  }