@Test public void testGetResourceFileNames() { final List<String> names = new ArrayList<>(); names.add("external.properties"); ResourceHierarchyParam param = new ResourceHierarchyParam(); when(impl.getResourceNames(any(ResourceIdentifier.class))).thenReturn(names); Response result = cut.getResourcesFileNames(param); assertEquals(200, result.getStatus()); verify(impl).getResourceNames(any(ResourceIdentifier.class)); ApplicationResponse entity = (ApplicationResponse) result.getEntity(); List<String> fileList = (List<String>) entity.getApplicationResponseContent(); assertTrue(!fileList.isEmpty()); reset(impl); when(impl.getResourceNames(any(ResourceIdentifier.class))).thenReturn(new ArrayList<String>()); result = cut.getResourcesFileNames(param); assertEquals(200, result.getStatus()); verify(impl).getResourceNames(any(ResourceIdentifier.class)); entity = (ApplicationResponse) result.getEntity(); fileList = (List<String>) entity.getApplicationResponseContent(); assertTrue(fileList.isEmpty()); }
@Override public Response getResourcesFileNames(ResourceHierarchyParam resourceHierarchyParam) { LOGGER.debug("Get the external properties file name"); final ResourceIdentifier resourceIdentifier = new ResourceIdentifier.Builder() .setGroupName(resourceHierarchyParam.getGroup()) .setWebServerName(resourceHierarchyParam.getWebServer()) .setJvmName(resourceHierarchyParam.getJvm()) .setWebAppName(resourceHierarchyParam.getWebApp()).build(); final List<String> propertiesFile = resourceService.getResourceNames(resourceIdentifier); return ResponseBuilder.ok(propertiesFile); }
ResourceServiceRestImpl implements ResourceServiceRest { @Override public Response getResourcesFileNames(ResourceHierarchyParam resourceHierarchyParam) { LOGGER.debug("Get the external properties file name"); final ResourceIdentifier resourceIdentifier = new ResourceIdentifier.Builder() .setGroupName(resourceHierarchyParam.getGroup()) .setWebServerName(resourceHierarchyParam.getWebServer()) .setJvmName(resourceHierarchyParam.getJvm()) .setWebAppName(resourceHierarchyParam.getWebApp()).build(); final List<String> propertiesFile = resourceService.getResourceNames(resourceIdentifier); return ResponseBuilder.ok(propertiesFile); } }
ResourceServiceRestImpl implements ResourceServiceRest { @Override public Response getResourcesFileNames(ResourceHierarchyParam resourceHierarchyParam) { LOGGER.debug("Get the external properties file name"); final ResourceIdentifier resourceIdentifier = new ResourceIdentifier.Builder() .setGroupName(resourceHierarchyParam.getGroup()) .setWebServerName(resourceHierarchyParam.getWebServer()) .setJvmName(resourceHierarchyParam.getJvm()) .setWebAppName(resourceHierarchyParam.getWebApp()).build(); final List<String> propertiesFile = resourceService.getResourceNames(resourceIdentifier); return ResponseBuilder.ok(propertiesFile); } ResourceServiceRestImpl(final ResourceService resourceService); }
ResourceServiceRestImpl implements ResourceServiceRest { @Override public Response getResourcesFileNames(ResourceHierarchyParam resourceHierarchyParam) { LOGGER.debug("Get the external properties file name"); final ResourceIdentifier resourceIdentifier = new ResourceIdentifier.Builder() .setGroupName(resourceHierarchyParam.getGroup()) .setWebServerName(resourceHierarchyParam.getWebServer()) .setJvmName(resourceHierarchyParam.getJvm()) .setWebAppName(resourceHierarchyParam.getWebApp()).build(); final List<String> propertiesFile = resourceService.getResourceNames(resourceIdentifier); return ResponseBuilder.ok(propertiesFile); } 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 getResourcesFileNames(ResourceHierarchyParam resourceHierarchyParam) { LOGGER.debug("Get the external properties file name"); final ResourceIdentifier resourceIdentifier = new ResourceIdentifier.Builder() .setGroupName(resourceHierarchyParam.getGroup()) .setWebServerName(resourceHierarchyParam.getWebServer()) .setJvmName(resourceHierarchyParam.getJvm()) .setWebAppName(resourceHierarchyParam.getWebApp()).build(); final List<String> propertiesFile = resourceService.getResourceNames(resourceIdentifier); return ResponseBuilder.ok(propertiesFile); } 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; }