@Test public void testUpdateResourceTemplate() { String testJvmName = "testJvmName"; String resourceTemplateName = "test-resource.tpl"; String template = "<template>update</template>"; when(Config.mockJvmPersistenceService.updateResourceTemplate(testJvmName, resourceTemplateName, template)).thenReturn(template); String result = jvmService.updateResourceTemplate(testJvmName, resourceTemplateName, template); assertEquals(template, result); }
@Override @Transactional public String updateResourceTemplate(final String jvmName, final String resourceTemplateName, final String template) { String retVal = null; try { retVal = jvmPersistenceService.updateResourceTemplate(jvmName, resourceTemplateName, template); } catch (ResourceTemplateUpdateException | NonRetrievableResourceTemplateContentException e) { LOGGER.error("Failed to update the template {}", resourceTemplateName, e); } return retVal; }
JvmServiceImpl implements JvmService { @Override @Transactional public String updateResourceTemplate(final String jvmName, final String resourceTemplateName, final String template) { String retVal = null; try { retVal = jvmPersistenceService.updateResourceTemplate(jvmName, resourceTemplateName, template); } catch (ResourceTemplateUpdateException | NonRetrievableResourceTemplateContentException e) { LOGGER.error("Failed to update the template {}", resourceTemplateName, e); } return retVal; } }
JvmServiceImpl implements JvmService { @Override @Transactional public String updateResourceTemplate(final String jvmName, final String resourceTemplateName, final String template) { String retVal = null; try { retVal = jvmPersistenceService.updateResourceTemplate(jvmName, resourceTemplateName, template); } catch (ResourceTemplateUpdateException | NonRetrievableResourceTemplateContentException e) { LOGGER.error("Failed to update the template {}", resourceTemplateName, e); } return retVal; } JvmServiceImpl(final JvmPersistenceService jvmPersistenceService,
                          final GroupPersistenceService groupPersistenceService,
                          final ApplicationService applicationService,
                          final SimpMessagingTemplate messagingTemplate,
                          final GroupStateNotificationService groupStateNotificationService,
                          final ResourceService resourceService,
                          final ClientFactoryHelper clientFactoryHelper,
                          final String topicServerStates,
                          final JvmControlService jvmControlService,
                          final BinaryDistributionService binaryDistributionService,
                          final BinaryDistributionLockManager binaryDistributionLockManager,
                          final HistoryFacadeService historyFacadeService,
                          final FileUtility fileUtility); }
JvmServiceImpl implements JvmService { @Override @Transactional public String updateResourceTemplate(final String jvmName, final String resourceTemplateName, final String template) { String retVal = null; try { retVal = jvmPersistenceService.updateResourceTemplate(jvmName, resourceTemplateName, template); } catch (ResourceTemplateUpdateException | NonRetrievableResourceTemplateContentException e) { LOGGER.error("Failed to update the template {}", resourceTemplateName, e); } return retVal; } JvmServiceImpl(final JvmPersistenceService jvmPersistenceService,
                          final GroupPersistenceService groupPersistenceService,
                          final ApplicationService applicationService,
                          final SimpMessagingTemplate messagingTemplate,
                          final GroupStateNotificationService groupStateNotificationService,
                          final ResourceService resourceService,
                          final ClientFactoryHelper clientFactoryHelper,
                          final String topicServerStates,
                          final JvmControlService jvmControlService,
                          final BinaryDistributionService binaryDistributionService,
                          final BinaryDistributionLockManager binaryDistributionLockManager,
                          final HistoryFacadeService historyFacadeService,
                          final FileUtility fileUtility); @Override @Transactional Jvm createJvm(CreateJvmAndAddToGroupsRequest createJvmAndAddToGroupsRequest, User user); @Override @Transactional void createDefaultTemplates(final String jvmName, Group parentGroup); @Override @Transactional(readOnly = true) Jvm getJvm(final Identifier<Jvm> aJvmId); @Override @Transactional(readOnly = true) Jvm getJvm(final String jvmName); @Override @Transactional(readOnly = true) List<Jvm> getJvms(); @Override List<Jvm> getJvmsByGroupName(String name); @Override @Transactional Jvm updateJvm(final UpdateJvmRequest updateJvmRequest, final boolean updateJvmPassword); @Override @Transactional void deleteJvm(final Identifier<Jvm> id, boolean hardDelete, final User user); @Override Jvm generateAndDeployJvm(String jvmName, User user); Jvm upgradeJDK(String jvmName, User user); @Override Jvm generateAndDeployFile(String jvmName, String fileName, User user); @Override @Transactional void performDiagnosis(Identifier<Jvm> aJvmId, final User user); @Override @Transactional String previewResourceTemplate(String fileName, String jvmName, String groupName, String template); @Override @Transactional(readOnly = true) List<String> getResourceTemplateNames(final String jvmName); @Override @Transactional String getResourceTemplate(final String jvmName,
                                      final String resourceTemplateName,
                                      final boolean tokensReplaced); @Override @Transactional String updateResourceTemplate(final String jvmName, final String resourceTemplateName, final String template); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) void updateState(final Identifier<Jvm> id, final JvmState state); @Override @Transactional JvmHttpRequestResult pingAndUpdateJvmState(final Jvm jvm); @Override @Transactional void deployApplicationContextXMLs(Jvm jvm, User user); @Override @Transactional(readOnly = true) Long getJvmStartedCount(final String groupName); @Override @Transactional(readOnly = true) Long getJvmCount(final String groupName); @Override Long getJvmStoppedCount(final String groupName); @Override Long getJvmForciblyStoppedCount(final String groupName); @Override @Transactional void deleteJvm(final String name, final String userName); }
JvmServiceImpl implements JvmService { @Override @Transactional public String updateResourceTemplate(final String jvmName, final String resourceTemplateName, final String template) { String retVal = null; try { retVal = jvmPersistenceService.updateResourceTemplate(jvmName, resourceTemplateName, template); } catch (ResourceTemplateUpdateException | NonRetrievableResourceTemplateContentException e) { LOGGER.error("Failed to update the template {}", resourceTemplateName, e); } return retVal; } JvmServiceImpl(final JvmPersistenceService jvmPersistenceService,
                          final GroupPersistenceService groupPersistenceService,
                          final ApplicationService applicationService,
                          final SimpMessagingTemplate messagingTemplate,
                          final GroupStateNotificationService groupStateNotificationService,
                          final ResourceService resourceService,
                          final ClientFactoryHelper clientFactoryHelper,
                          final String topicServerStates,
                          final JvmControlService jvmControlService,
                          final BinaryDistributionService binaryDistributionService,
                          final BinaryDistributionLockManager binaryDistributionLockManager,
                          final HistoryFacadeService historyFacadeService,
                          final FileUtility fileUtility); @Override @Transactional Jvm createJvm(CreateJvmAndAddToGroupsRequest createJvmAndAddToGroupsRequest, User user); @Override @Transactional void createDefaultTemplates(final String jvmName, Group parentGroup); @Override @Transactional(readOnly = true) Jvm getJvm(final Identifier<Jvm> aJvmId); @Override @Transactional(readOnly = true) Jvm getJvm(final String jvmName); @Override @Transactional(readOnly = true) List<Jvm> getJvms(); @Override List<Jvm> getJvmsByGroupName(String name); @Override @Transactional Jvm updateJvm(final UpdateJvmRequest updateJvmRequest, final boolean updateJvmPassword); @Override @Transactional void deleteJvm(final Identifier<Jvm> id, boolean hardDelete, final User user); @Override Jvm generateAndDeployJvm(String jvmName, User user); Jvm upgradeJDK(String jvmName, User user); @Override Jvm generateAndDeployFile(String jvmName, String fileName, User user); @Override @Transactional void performDiagnosis(Identifier<Jvm> aJvmId, final User user); @Override @Transactional String previewResourceTemplate(String fileName, String jvmName, String groupName, String template); @Override @Transactional(readOnly = true) List<String> getResourceTemplateNames(final String jvmName); @Override @Transactional String getResourceTemplate(final String jvmName,
                                      final String resourceTemplateName,
                                      final boolean tokensReplaced); @Override @Transactional String updateResourceTemplate(final String jvmName, final String resourceTemplateName, final String template); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) void updateState(final Identifier<Jvm> id, final JvmState state); @Override @Transactional JvmHttpRequestResult pingAndUpdateJvmState(final Jvm jvm); @Override @Transactional void deployApplicationContextXMLs(Jvm jvm, User user); @Override @Transactional(readOnly = true) Long getJvmStartedCount(final String groupName); @Override @Transactional(readOnly = true) Long getJvmCount(final String groupName); @Override Long getJvmStoppedCount(final String groupName); @Override Long getJvmForciblyStoppedCount(final String groupName); @Override @Transactional void deleteJvm(final String name, final String userName);  }