@Test public void testGetResourceContent() { ResourceHierarchyParam param = new ResourceHierarchyParam(); param.setGroup("test-group"); param.setJvm("test-jvm"); param.setWebApp("test-app"); param.setWebServer("test-webserver"); when(impl.getResourceContent(any(ResourceIdentifier.class))).thenReturn(new ResourceContent("{}", "key=value")); Response response = cut.getResourceContent("external.properties", param); assertEquals(200, response.getStatus()); }
@Override public Response getResourceContent(final String resourceName, final ResourceHierarchyParam param) { LOGGER.debug("Get the resource content for {} with hierarchy {}", resourceName, param); final ResourceIdentifier resourceIdentifier = new ResourceIdentifier.Builder().setResourceName(resourceName) .setGroupName(param.getGroup()) .setWebServerName(param.getWebServer()) .setJvmName(param.getJvm()) .setWebAppName(param.getWebApp()).build(); final ResourceContent resourceContent = resourceService.getResourceContent(resourceIdentifier); if (resourceContent == null) { return Response.noContent().build(); } return ResponseBuilder.ok(resourceContent); }
ResourceServiceRestImpl implements ResourceServiceRest { @Override public Response getResourceContent(final String resourceName, final ResourceHierarchyParam param) { LOGGER.debug("Get the resource content for {} with hierarchy {}", resourceName, param); final ResourceIdentifier resourceIdentifier = new ResourceIdentifier.Builder().setResourceName(resourceName) .setGroupName(param.getGroup()) .setWebServerName(param.getWebServer()) .setJvmName(param.getJvm()) .setWebAppName(param.getWebApp()).build(); final ResourceContent resourceContent = resourceService.getResourceContent(resourceIdentifier); if (resourceContent == null) { return Response.noContent().build(); } return ResponseBuilder.ok(resourceContent); } }
ResourceServiceRestImpl implements ResourceServiceRest { @Override public Response getResourceContent(final String resourceName, final ResourceHierarchyParam param) { LOGGER.debug("Get the resource content for {} with hierarchy {}", resourceName, param); final ResourceIdentifier resourceIdentifier = new ResourceIdentifier.Builder().setResourceName(resourceName) .setGroupName(param.getGroup()) .setWebServerName(param.getWebServer()) .setJvmName(param.getJvm()) .setWebAppName(param.getWebApp()).build(); final ResourceContent resourceContent = resourceService.getResourceContent(resourceIdentifier); if (resourceContent == null) { return Response.noContent().build(); } return ResponseBuilder.ok(resourceContent); } ResourceServiceRestImpl(final ResourceService resourceService); }
ResourceServiceRestImpl implements ResourceServiceRest { @Override public Response getResourceContent(final String resourceName, final ResourceHierarchyParam param) { LOGGER.debug("Get the resource content for {} with hierarchy {}", resourceName, param); final ResourceIdentifier resourceIdentifier = new ResourceIdentifier.Builder().setResourceName(resourceName) .setGroupName(param.getGroup()) .setWebServerName(param.getWebServer()) .setJvmName(param.getJvm()) .setWebAppName(param.getWebApp()).build(); final ResourceContent resourceContent = resourceService.getResourceContent(resourceIdentifier); if (resourceContent == null) { return Response.noContent().build(); } return ResponseBuilder.ok(resourceContent); } ResourceServiceRestImpl(final ResourceService resourceService); Response createTemplate(final List<Attachment> attachments, final String targetName, final AuthenticatedUser user); @Override Response getResourceAttrData(); @Override Response getResourceTopology(); @Override Response getApplicationResourceNames(final String groupName, final String appName); @Override Response getAppTemplate(final String groupName, final String appName, final String templateName); @Override Response checkFileExists(final String groupName, final String jvmName, final String webappName, final String webserverName, final String fileName); @Override Response createResource(final String deployFilename, final CreateResourceParam createResourceParam,
                                   final List<Attachment> attachments); void setMessageContext(MessageContext messageContext); @Override Response uploadExternalProperties(AuthenticatedUser user); @Override // TODO: Re validation, maybe we can use CXF bean validation ? Response deleteResource(final String templateName, final ResourceHierarchyParam resourceHierarchyParam,
                                   final AuthenticatedUser aUser); @Override Response deleteResources(final String[] templateNameArray, ResourceHierarchyParam
            resourceHierarchyParam, AuthenticatedUser user); @Override Response getResourceContent(final String resourceName, final ResourceHierarchyParam param); @Override Response updateResourceContent(String resourceName, ResourceHierarchyParam
            resourceHierarchyParam, String templateContent); @Override Response updateResourceMetaData(String resourceName, ResourceHierarchyParam resourceHierarchyParam, String metaData); @Override Response previewResourceContent(final String resourceName, final ResourceHierarchyParam resourceHierarchyParam, String content); @Override Response getResourcesFileNames(ResourceHierarchyParam resourceHierarchyParam); @Override Response getExternalProperties(); @Override Response getExternalPropertiesView(); @Override Response getExternalPropertiesDownload(); @Override void afterPropertiesSet(); }
ResourceServiceRestImpl implements ResourceServiceRest { @Override public Response getResourceContent(final String resourceName, final ResourceHierarchyParam param) { LOGGER.debug("Get the resource content for {} with hierarchy {}", resourceName, param); final ResourceIdentifier resourceIdentifier = new ResourceIdentifier.Builder().setResourceName(resourceName) .setGroupName(param.getGroup()) .setWebServerName(param.getWebServer()) .setJvmName(param.getJvm()) .setWebAppName(param.getWebApp()).build(); final ResourceContent resourceContent = resourceService.getResourceContent(resourceIdentifier); if (resourceContent == null) { return Response.noContent().build(); } return ResponseBuilder.ok(resourceContent); } ResourceServiceRestImpl(final ResourceService resourceService); Response createTemplate(final List<Attachment> attachments, final String targetName, final AuthenticatedUser user); @Override Response getResourceAttrData(); @Override Response getResourceTopology(); @Override Response getApplicationResourceNames(final String groupName, final String appName); @Override Response getAppTemplate(final String groupName, final String appName, final String templateName); @Override Response checkFileExists(final String groupName, final String jvmName, final String webappName, final String webserverName, final String fileName); @Override Response createResource(final String deployFilename, final CreateResourceParam createResourceParam,
                                   final List<Attachment> attachments); void setMessageContext(MessageContext messageContext); @Override Response uploadExternalProperties(AuthenticatedUser user); @Override // TODO: Re validation, maybe we can use CXF bean validation ? Response deleteResource(final String templateName, final ResourceHierarchyParam resourceHierarchyParam,
                                   final AuthenticatedUser aUser); @Override Response deleteResources(final String[] templateNameArray, ResourceHierarchyParam
            resourceHierarchyParam, AuthenticatedUser user); @Override Response getResourceContent(final String resourceName, final ResourceHierarchyParam param); @Override Response updateResourceContent(String resourceName, ResourceHierarchyParam
            resourceHierarchyParam, String templateContent); @Override Response updateResourceMetaData(String resourceName, ResourceHierarchyParam resourceHierarchyParam, String metaData); @Override Response previewResourceContent(final String resourceName, final ResourceHierarchyParam resourceHierarchyParam, String content); @Override Response getResourcesFileNames(ResourceHierarchyParam resourceHierarchyParam); @Override Response getExternalProperties(); @Override Response getExternalPropertiesView(); @Override Response getExternalPropertiesDownload(); @Override void afterPropertiesSet(); static final String UNEXPECTED_CONTENT_TYPE_ERROR_MSG; static final String TPL_FILE_EXTENSION; static final String EXT_PROPERTIES_RESOURCE_NAME; static final String EXT_PROPERTIES_RESOURCE_META_DATA; static final int CREATE_RESOURCE_ATTACHMENT_SIZE; }