@Test public void testGetSelectedValue() { Application mockApp = mock(Application.class); Jvm mockJvm = mock(Jvm.class); when(mockAppPersistence.getApplication(anyString())).thenReturn(mockApp); when(mockJvmPersistence.findJvmByExactName(anyString())).thenReturn(mockJvm); Application app = (Application) appResourceHandler.getSelectedValue(resourceIdentifier); verify(mockApp).setParentJvm(eq(mockJvm)); assertEquals(mockApp, app); }
@Override public Object getSelectedValue(ResourceIdentifier resourceIdentifier) { if (canHandle(resourceIdentifier)) { Application application = applicationPersistenceService.getApplication(resourceIdentifier.webAppName); application.setParentJvm(jvmPersistenceService.findJvmByExactName(resourceIdentifier.jvmName)); return application; } else { return successor.getSelectedValue(resourceIdentifier); } }
AppResourceHandler extends ResourceHandler { @Override public Object getSelectedValue(ResourceIdentifier resourceIdentifier) { if (canHandle(resourceIdentifier)) { Application application = applicationPersistenceService.getApplication(resourceIdentifier.webAppName); application.setParentJvm(jvmPersistenceService.findJvmByExactName(resourceIdentifier.jvmName)); return application; } else { return successor.getSelectedValue(resourceIdentifier); } } }
AppResourceHandler extends ResourceHandler { @Override public Object getSelectedValue(ResourceIdentifier resourceIdentifier) { if (canHandle(resourceIdentifier)) { Application application = applicationPersistenceService.getApplication(resourceIdentifier.webAppName); application.setParentJvm(jvmPersistenceService.findJvmByExactName(resourceIdentifier.jvmName)); return application; } else { return successor.getSelectedValue(resourceIdentifier); } } AppResourceHandler(final ResourceDao resourceDao, final JvmPersistenceService jvmPersistenceService,
                              final ApplicationPersistenceService applicationPersistenceService,
                              final ResourceHandler successor); }
AppResourceHandler extends ResourceHandler { @Override public Object getSelectedValue(ResourceIdentifier resourceIdentifier) { if (canHandle(resourceIdentifier)) { Application application = applicationPersistenceService.getApplication(resourceIdentifier.webAppName); application.setParentJvm(jvmPersistenceService.findJvmByExactName(resourceIdentifier.jvmName)); return application; } else { return successor.getSelectedValue(resourceIdentifier); } } AppResourceHandler(final ResourceDao resourceDao, final JvmPersistenceService jvmPersistenceService,
                              final ApplicationPersistenceService applicationPersistenceService,
                              final ResourceHandler successor); @Override ConfigTemplate fetchResource(final ResourceIdentifier resourceIdentifier); @Override CreateResourceResponseWrapper createResource(final ResourceIdentifier resourceIdentifier,
                                                        final ResourceTemplateMetaData metaData,
                                                        final String templateContent); @Override void deleteResource(final ResourceIdentifier resourceIdentifier); @Override String updateResourceMetaData(ResourceIdentifier resourceIdentifier, String resourceName, String metaData); @Override Object getSelectedValue(ResourceIdentifier resourceIdentifier); @Override List<String> getResourceNames(ResourceIdentifier resourceIdentifier); }
AppResourceHandler extends ResourceHandler { @Override public Object getSelectedValue(ResourceIdentifier resourceIdentifier) { if (canHandle(resourceIdentifier)) { Application application = applicationPersistenceService.getApplication(resourceIdentifier.webAppName); application.setParentJvm(jvmPersistenceService.findJvmByExactName(resourceIdentifier.jvmName)); return application; } else { return successor.getSelectedValue(resourceIdentifier); } } AppResourceHandler(final ResourceDao resourceDao, final JvmPersistenceService jvmPersistenceService,
                              final ApplicationPersistenceService applicationPersistenceService,
                              final ResourceHandler successor); @Override ConfigTemplate fetchResource(final ResourceIdentifier resourceIdentifier); @Override CreateResourceResponseWrapper createResource(final ResourceIdentifier resourceIdentifier,
                                                        final ResourceTemplateMetaData metaData,
                                                        final String templateContent); @Override void deleteResource(final ResourceIdentifier resourceIdentifier); @Override String updateResourceMetaData(ResourceIdentifier resourceIdentifier, String resourceName, String metaData); @Override Object getSelectedValue(ResourceIdentifier resourceIdentifier); @Override List<String> getResourceNames(ResourceIdentifier resourceIdentifier);  }