aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormark.j.leonard <mark.j.leonard@gmail.com>2019-02-05 15:47:47 +0000
committermark.j.leonard <mark.j.leonard@gmail.com>2019-02-05 16:25:22 +0000
commit4217e6f7018d08b11291490b3ad5c54064cdc031 (patch)
tree8d783b6a34582eba9c58776358fec5c8e4ae7b82 /src
parent1954294aed95c2db4eb2659dcef91248535de079 (diff)
Fix checkstyle issues including javadoc
Minor code tidy-ups: mostly formatting and Javadoc comments Change-Id: I8a9ab692428fa09c73bd1fb542100610a86f6eca Issue-ID: AAI-2121 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/aai/auth/AAIMicroServiceAuth.java6
-rw-r--r--src/main/java/org/onap/aai/babel/logging/ApplicationMsgs.java29
-rw-r--r--src/main/java/org/onap/aai/babel/xml/generator/ModelGenerator.java21
-rw-r--r--src/main/java/org/onap/aai/babel/xml/generator/api/AaiModelGeneratorImpl.java38
-rw-r--r--src/main/java/org/onap/aai/babel/xml/generator/model/Resource.java14
-rw-r--r--src/main/java/org/onap/aai/babel/xml/generator/model/Widget.java3
-rw-r--r--src/test/java/org/onap/aai/babel/MicroServiceAuthTest.java40
-rw-r--r--src/test/java/org/onap/aai/babel/csar/vnfcatalog/SdcToscaHelper.java14
-rw-r--r--src/test/java/org/onap/aai/babel/parser/TestToscaParser.java5
-rw-r--r--src/test/java/org/onap/aai/babel/service/CsarToXmlConverterTest.java18
-rw-r--r--src/test/java/org/onap/aai/babel/service/TestGenerateArtifactsServiceImpl.java10
-rw-r--r--src/test/java/org/onap/aai/babel/testdata/CsarTest.java22
-rw-r--r--src/test/java/org/onap/aai/babel/util/ArtifactTestUtils.java12
13 files changed, 148 insertions, 84 deletions
diff --git a/src/main/java/org/onap/aai/auth/AAIMicroServiceAuth.java b/src/main/java/org/onap/aai/auth/AAIMicroServiceAuth.java
index c2402cd..5e4f3c4 100644
--- a/src/main/java/org/onap/aai/auth/AAIMicroServiceAuth.java
+++ b/src/main/java/org/onap/aai/auth/AAIMicroServiceAuth.java
@@ -2,8 +2,8 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 European Software Marketing Ltd.
+ * Copyright © 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2019 European Software Marketing Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.aai.auth;
import java.security.cert.X509Certificate;
@@ -41,6 +42,7 @@ public class AAIMicroServiceAuth {
/**
* @param babelAuthConfig
* @throws AAIAuthException
+ * if the Auth Policy cannot be loaded
*/
@Inject
public AAIMicroServiceAuth(final BabelAuthConfig babelAuthConfig) throws AAIAuthException {
diff --git a/src/main/java/org/onap/aai/babel/logging/ApplicationMsgs.java b/src/main/java/org/onap/aai/babel/logging/ApplicationMsgs.java
index 7178810..7d18a40 100644
--- a/src/main/java/org/onap/aai/babel/logging/ApplicationMsgs.java
+++ b/src/main/java/org/onap/aai/babel/logging/ApplicationMsgs.java
@@ -2,8 +2,8 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 European Software Marketing Ltd.
+ * Copyright © 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2019 European Software Marketing Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.aai.babel.logging;
import com.att.eelf.i18n.EELFResourceManager;
@@ -25,18 +26,18 @@ import org.onap.aai.cl.eelf.LogMessageEnum;
public enum ApplicationMsgs implements LogMessageEnum {
- DISTRIBUTION_EVENT,
- MESSAGE_AUDIT,
- MESSAGE_METRIC,
- MISSING_REQUEST_ID,
- PROCESS_REQUEST_ERROR,
- INVALID_CSAR_FILE,
- INVALID_REQUEST_JSON,
- BABEL_REQUEST_PAYLOAD,
- BABEL_RESPONSE_PAYLOAD,
- LOAD_PROPERTIES,
- PROCESSING_VNF_CATALOG_ERROR,
- TEMP_FILE_ERROR,
+ DISTRIBUTION_EVENT, //
+ MESSAGE_AUDIT, //
+ MESSAGE_METRIC, //
+ MISSING_REQUEST_ID, //
+ PROCESS_REQUEST_ERROR, //
+ INVALID_CSAR_FILE, //
+ INVALID_REQUEST_JSON, //
+ BABEL_REQUEST_PAYLOAD, //
+ BABEL_RESPONSE_PAYLOAD, //
+ LOAD_PROPERTIES, //
+ PROCESSING_VNF_CATALOG_ERROR, //
+ TEMP_FILE_ERROR, //
MISSING_SERVICE_METADATA;
static {
diff --git a/src/main/java/org/onap/aai/babel/xml/generator/ModelGenerator.java b/src/main/java/org/onap/aai/babel/xml/generator/ModelGenerator.java
index f474321..bbd1ff3 100644
--- a/src/main/java/org/onap/aai/babel/xml/generator/ModelGenerator.java
+++ b/src/main/java/org/onap/aai/babel/xml/generator/ModelGenerator.java
@@ -2,8 +2,8 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 European Software Marketing Ltd.
+ * Copyright © 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2019 European Software Marketing Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.aai.babel.xml.generator;
import java.util.Base64;
@@ -42,6 +43,7 @@ import org.onap.aai.cl.api.Logger;
*/
public class ModelGenerator implements ArtifactGenerator {
+
private static final Logger logger = LogHelper.INSTANCE;
private static final String VERSION_DELIMITER = ".";
@@ -52,9 +54,11 @@ public class ModelGenerator implements ArtifactGenerator {
* Invokes the TOSCA artifact generator API with the input artifacts.
*
* @param csarArchive
- * @param csarArtifacts the input artifacts
+ * @param csarArtifacts
+ * the input artifacts
* @return {@link List} of output artifacts
- * @throws XmlArtifactGenerationException if there is an error trying to generate XML artifacts
+ * @throws XmlArtifactGenerationException
+ * if there is an error trying to generate XML artifacts
*/
@Override
public List<BabelArtifact> generateArtifacts(byte[] csarArchive, List<Artifact> csarArtifacts)
@@ -89,9 +93,12 @@ public class ModelGenerator implements ArtifactGenerator {
/**
* Creates an instance of an input artifact for the generator.
*
- * @param payload the payload downloaded from SDC
- * @param artifactName name of the artifact to create
- * @param artifactVersion version of the artifact to create
+ * @param payload
+ * the payload downloaded from SDC
+ * @param artifactName
+ * name of the artifact to create
+ * @param artifactVersion
+ * version of the artifact to create
* @return an {@link Artifact} object constructed from the payload and artifactInfo
*/
public static Artifact createArtifact(byte[] payload, String artifactName, String artifactVersion) {
diff --git a/src/main/java/org/onap/aai/babel/xml/generator/api/AaiModelGeneratorImpl.java b/src/main/java/org/onap/aai/babel/xml/generator/api/AaiModelGeneratorImpl.java
index 488faae..3bff7e7 100644
--- a/src/main/java/org/onap/aai/babel/xml/generator/api/AaiModelGeneratorImpl.java
+++ b/src/main/java/org/onap/aai/babel/xml/generator/api/AaiModelGeneratorImpl.java
@@ -2,8 +2,8 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 European Software Marketing Ltd.
+ * Copyright © 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2019 European Software Marketing Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.aai.babel.xml.generator.api;
import java.io.StringWriter;
@@ -52,7 +53,8 @@ public class AaiModelGeneratorImpl implements AaiModelGenerator {
/**
* Method to generate the AAI model for a Service.
*
- * @param service Java object model representing an AAI {@link Service} model
+ * @param service
+ * Java object model representing an AAI {@link Service} model
* @return XML representation of the service model in String format
*/
@Override
@@ -111,7 +113,8 @@ public class AaiModelGeneratorImpl implements AaiModelGenerator {
/**
* Method to generate the AAI model for a Resource.
*
- * @param resource Java object model representing an AAI {@link Resource} model
+ * @param resource
+ * Java object model representing an AAI {@link Resource} model
* @return XML representation of the resource model in String format
*/
@Override
@@ -164,10 +167,11 @@ public class AaiModelGeneratorImpl implements AaiModelGenerator {
/**
* Method to create the <model-element></model-element> holding the relationship value for a resource/widget model.
*
- * @param newDataDelFlag Value of the <new-data-del-flag></new-data-del-flag> attribute for a widget/resource in the
- * model xml
- * @param relationshipValue Value of the <relationship-value></relationship-value> attribute for the widget/resource
- * in the model xml
+ * @param newDataDelFlag
+ * Value of the <new-data-del-flag></new-data-del-flag> attribute for a widget/resource in the model xml
+ * @param relationshipValue
+ * Value of the <relationship-value></relationship-value> attribute for the widget/resource in the model
+ * xml
* @return Java object representation for the <model-element></model-element> holding the relationship
*/
private ModelElement createRelationshipModelElement(String newDataDelFlag, String modelVersionId,
@@ -200,8 +204,10 @@ public class AaiModelGeneratorImpl implements AaiModelGenerator {
* Method to create the child model elements of the widget. Handles the generation of recursive child widget
* elements (if any)
*
- * @param parent Reference to the parent widget model element
- * @param widgetChildrenSet Set of children obtained from the tosca/widget definition
+ * @param parent
+ * Reference to the parent widget model element
+ * @param widgetChildrenSet
+ * Set of children obtained from the tosca/widget definition
*/
private void generateWidgetChildren(ModelElement parent, Set<Widget> widgetChildrenSet) {
for (Widget widget : widgetChildrenSet) {
@@ -223,21 +229,19 @@ public class AaiModelGeneratorImpl implements AaiModelGenerator {
/**
* Converts the data delete flag value from boolean to String as per AAI model.
*
- * @param delFlag Boolean value as true/false from the annotation
+ * @param delFlag
+ * Boolean value as true/false from the annotation
* @return Converted value to a flag as per AAI model
*/
private String getNewDataDelFlagValue(boolean delFlag) {
- if (delFlag) {
- return "T";
- } else {
- return "F";
- }
+ return delFlag ? "T" : "F";
}
/**
* JAXB marshalling helper method to convert the Java object model to XML String.
*
- * @param model Java Object model of a service/widget/resource
+ * @param model
+ * Java Object model of a service/widget/resource
* @return XML representation of the Java model in String format
*/
private String getModelAsString(Model model) {
diff --git a/src/main/java/org/onap/aai/babel/xml/generator/model/Resource.java b/src/main/java/org/onap/aai/babel/xml/generator/model/Resource.java
index 121bc19..dffff62 100644
--- a/src/main/java/org/onap/aai/babel/xml/generator/model/Resource.java
+++ b/src/main/java/org/onap/aai/babel/xml/generator/model/Resource.java
@@ -18,6 +18,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.aai.babel.xml.generator.model;
import java.util.Collections;
@@ -29,7 +30,7 @@ public class Resource extends Model {
private Type type;
private boolean deleteFlag;
- private boolean isResource = true;
+ private boolean isResource = true;
private Map<String, Object> properties = Collections.emptyMap();
Widget vserver = null;
@@ -106,18 +107,17 @@ public class Resource extends Model {
public boolean addWidget(Widget widget) {
if (type == Type.VFMODULE) {
if (widget.memberOf(members)) {
- if (vserver == null && widget.getId().equals(new VServerWidget().getId())) {
+ if (vserver == null && widget instanceof VServerWidget) {
addVserverWidget(widget);
- } else if (widget.getId().equals(new LIntfWidget().getId())) {
+ } else if (widget instanceof LIntfWidget) {
return addLIntfWidget(widget);
- } else if (widget.getId().equals(new VolumeWidget().getId())) {
+ } else if (widget instanceof VolumeWidget) {
addVolumeWidget(widget);
return true;
}
- if (widget.getId().equals(new OamNetwork().getId())) {
- return false;
+ if (!(widget instanceof OamNetwork)) {
+ return widgets.add(widget);
}
- return widgets.add(widget);
}
return false;
} else {
diff --git a/src/main/java/org/onap/aai/babel/xml/generator/model/Widget.java b/src/main/java/org/onap/aai/babel/xml/generator/model/Widget.java
index 11a9612..be84526 100644
--- a/src/main/java/org/onap/aai/babel/xml/generator/model/Widget.java
+++ b/src/main/java/org/onap/aai/babel/xml/generator/model/Widget.java
@@ -114,8 +114,7 @@ public abstract class Widget extends Model {
}
public String getName() {
- ModelWidget widgetModel = this.getClass().getAnnotation(ModelWidget.class);
- return widgetModel.name();
+ return this.getClass().getAnnotation(ModelWidget.class).name();
}
/**
diff --git a/src/test/java/org/onap/aai/babel/MicroServiceAuthTest.java b/src/test/java/org/onap/aai/babel/MicroServiceAuthTest.java
index a8f1f92..aae7846 100644
--- a/src/test/java/org/onap/aai/babel/MicroServiceAuthTest.java
+++ b/src/test/java/org/onap/aai/babel/MicroServiceAuthTest.java
@@ -2,8 +2,8 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 European Software Marketing Ltd.
+ * Copyright © 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2019 European Software Marketing Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.aai.babel;
import static org.hamcrest.CoreMatchers.is;
@@ -37,7 +38,7 @@ import org.onap.aai.babel.config.BabelAuthConfig;
import org.springframework.mock.web.MockHttpServletRequest;
/**
- * Tests @{link AAIMicroServiceAuth}
+ * Tests @{link AAIMicroServiceAuth}.
*/
public class MicroServiceAuthTest {
@@ -54,10 +55,10 @@ public class MicroServiceAuthTest {
* of a policy file that does not exist.
*
* @throws AAIAuthException
- * @throws IOException
+ * if the Auth policy file cannot be loaded
*/
@Test(expected = AAIAuthException.class)
- public void missingPolicyFile() throws AAIAuthException, IOException {
+ public void missingPolicyFile() throws AAIAuthException {
String defaultFile = AAIMicroServiceAuthCore.getDefaultAuthFileName();
try {
AAIMicroServiceAuthCore.setDefaultAuthFileName("invalid.default.file");
@@ -70,14 +71,17 @@ public class MicroServiceAuthTest {
}
/**
- * Test loading of a temporary file created with the specified roles
+ * Test loading of a temporary file created with the specified roles.
*
* @throws AAIAuthException
+ * if the test creates invalid Auth Policy roles
* @throws IOException
+ * for I/O failures
* @throws JSONException
+ * if this test creates an invalid JSON object
*/
@Test
- public void createLocalAuthFile() throws AAIAuthException, IOException, JSONException {
+ public void createLocalAuthFile() throws JSONException, AAIAuthException, IOException {
JSONObject roles = createRoleObject("role", createUserObject("user"), createFunctionObject("func"));
createAuthService(roles);
assertThat(AAIMicroServiceAuthCore.authorize("nosuchuser", "method:func"), is(false));
@@ -85,9 +89,10 @@ public class MicroServiceAuthTest {
}
/**
- * Test that the default policy file is loaded when a non-existent file is passed to the authorisation clas.
+ * Test that the default policy file is loaded when a non-existent file is passed to the authorisation class.
*
* @throws AAIAuthException
+ * if the Auth Policy cannot be loaded
*/
@Test
public void createAuthFromDefaultFile() throws AAIAuthException {
@@ -99,9 +104,10 @@ public class MicroServiceAuthTest {
}
/**
- * Test loading of the policy file relative to CONFIG_HOME
+ * Test loading of the policy file relative to CONFIG_HOME.
*
* @throws AAIAuthException
+ * if the Auth Policy cannot be loaded
*/
@Test
public void createAuth() throws AAIAuthException {
@@ -129,12 +135,17 @@ public class MicroServiceAuthTest {
}
/**
- * @param rolesJson
- * @return
+ * Create a test Auth policy JSON file and pass this to the Auth Service.
+ *
+ * @param roles
+ * the Auth policy JSON content
+ * @return a new Auth Service configured with the supplied roles
* @throws IOException
+ * for I/O failures
* @throws AAIAuthException
+ * if the auth policy file cannot be loaded
*/
- private AAIMicroServiceAuth createAuthService(JSONObject roles) throws IOException, AAIAuthException {
+ private AAIMicroServiceAuth createAuthService(JSONObject roles) throws AAIAuthException, IOException {
File file = File.createTempFile("auth-policy", "json");
file.deleteOnExit();
FileWriter fileWriter = new FileWriter(file);
@@ -148,11 +159,14 @@ public class MicroServiceAuthTest {
}
/**
- * Assert authorisation results for an admin user based on the test policy file
+ * Assert authorisation results for an admin user based on the test policy file.
*
* @param auth
+ * the Auth Service to test
* @param adminUser
+ * admin username
* @throws AAIAuthException
+ * if the Auth Service is not initialized
*/
private void assertAdminUserAuthorisation(AAIMicroServiceAuth auth, String adminUser) throws AAIAuthException {
assertThat(AAIMicroServiceAuthCore.authorize(adminUser, "GET:actions"), is(true));
diff --git a/src/test/java/org/onap/aai/babel/csar/vnfcatalog/SdcToscaHelper.java b/src/test/java/org/onap/aai/babel/csar/vnfcatalog/SdcToscaHelper.java
index 9fcc5a4..6fbb1f1 100644
--- a/src/test/java/org/onap/aai/babel/csar/vnfcatalog/SdcToscaHelper.java
+++ b/src/test/java/org/onap/aai/babel/csar/vnfcatalog/SdcToscaHelper.java
@@ -2,8 +2,8 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 European Software Marketing Ltd.
+ * Copyright © 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2019 European Software Marketing Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,7 +31,9 @@ public class SdcToscaHelper {
private ArrayList<NodeTemplate> smnodetemplates = new ArrayList<>();
/**
- * @return
+ * Create the test SubstitutionMappings.
+ *
+ * @return the new Substitution Mappings
*/
public SubstitutionMappings buildMappings() {
LinkedHashMap<String, Object> defProps = getImagesDefProps();
@@ -78,7 +80,7 @@ public class SdcToscaHelper {
}
/**
- *
+ * Create a new NodeTemplate and add it to the list (for populating the Substitution Mappings).
*/
public void addNodeTemplate() {
String name = "node name";
@@ -98,7 +100,11 @@ public class SdcToscaHelper {
}
/**
+ * Simulate the creation of a NodeTemplate by the SDC TOSCA parser. Populate the properties of the NodeTemplate with
+ * the supplied images.
+ *
* @param images
+ * the value of the images property
*/
public void addNodeTemplate(Object images) {
LinkedHashMap<String, Object> properties = new LinkedHashMap<>();
diff --git a/src/test/java/org/onap/aai/babel/parser/TestToscaParser.java b/src/test/java/org/onap/aai/babel/parser/TestToscaParser.java
index f8d8478..348e1a1 100644
--- a/src/test/java/org/onap/aai/babel/parser/TestToscaParser.java
+++ b/src/test/java/org/onap/aai/babel/parser/TestToscaParser.java
@@ -18,6 +18,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.aai.babel.parser;
import static org.hamcrest.CoreMatchers.equalTo;
@@ -64,8 +65,8 @@ public class TestToscaParser {
GenerationData data =
generator.generateArtifact(CsarTest.VNF_VENDOR_CSAR.getContent(), ymlFiles, additionalParams);
- assertThat(data.getErrorData().size(), is(equalTo(0)));
- assertThat(data.getResultData().size(), is(equalTo(2)));
+ assertThat("Number of errors produced", data.getErrorData().size(), is(equalTo(0)));
+ assertThat("Number of resources generated", data.getResultData().size(), is(equalTo(2)));
}
}
diff --git a/src/test/java/org/onap/aai/babel/service/CsarToXmlConverterTest.java b/src/test/java/org/onap/aai/babel/service/CsarToXmlConverterTest.java
index 1ead8e6..bcd1e8a 100644
--- a/src/test/java/org/onap/aai/babel/service/CsarToXmlConverterTest.java
+++ b/src/test/java/org/onap/aai/babel/service/CsarToXmlConverterTest.java
@@ -113,9 +113,6 @@ public class CsarToXmlConverterTest {
* if there is an error either extracting the YAML files or generating XML artifacts
* @throws IOException
* if an I/O exception occurs loading the test CSAR file
- * @throws IOException
- * @throws XmlArtifactGenerationException
- * @throws CsarConverterException
*/
@Test
public void testArtifactGeneratorConfigMissing() throws CsarConverterException, IOException {
@@ -131,13 +128,13 @@ public class CsarToXmlConverterTest {
/**
* Test that an Exception is thrown when the Artifact Generator's Group Filter properties are not present.
*
- * @throws IOException
- * @throws XmlArtifactGenerationException
* @throws CsarConverterException
+ * if there is an error either extracting the YAML files or generating XML artifacts
+ * @throws IOException
+ * if an I/O exception occurs
*/
@Test
- public void generateXmlFromCsarFilterTypesSystemPropertyNotSet()
- throws IOException, XmlArtifactGenerationException, CsarConverterException {
+ public void generateXmlFromCsarFilterTypesSystemPropertyNotSet() throws CsarConverterException, IOException {
exception.expect(CsarConverterException.class);
exception.expectMessage("Cannot generate artifacts. System property "
+ ArtifactGeneratorToscaParser.PROPERTY_GROUP_FILTERS_CONFIG_FILE + " not configured");
@@ -195,6 +192,13 @@ public class CsarToXmlConverterTest {
assertThatGeneratedFilesMatchExpected(createExpectedXmlFiles(filesToLoad), CsarTest.SERVICE_PROXY_CSAR_FILE);
}
+ /**
+ * A Matcher for comparing generated XML Strings with expected XML content.
+ *
+ * @param expected
+ * the expected XML String
+ * @return a new Matcher for comparing XML Strings
+ */
public Matcher<String> matches(final String expected) {
return new BaseMatcher<String>() {
protected String theExpected = expected;
diff --git a/src/test/java/org/onap/aai/babel/service/TestGenerateArtifactsServiceImpl.java b/src/test/java/org/onap/aai/babel/service/TestGenerateArtifactsServiceImpl.java
index d87f3c3..a38686f 100644
--- a/src/test/java/org/onap/aai/babel/service/TestGenerateArtifactsServiceImpl.java
+++ b/src/test/java/org/onap/aai/babel/service/TestGenerateArtifactsServiceImpl.java
@@ -84,11 +84,14 @@ public class TestGenerateArtifactsServiceImpl {
/**
* No VNF Configuration exists.
- *
- * @throws Exception
+ *
+ * @throws URISyntaxException
+ * if the URI cannot be created
+ * @throws IOException
+ * if the resource cannot be loaded
*/
@Test
- public void testGenerateArtifactsWithoutVnfConfiguration() throws Exception {
+ public void testGenerateArtifactsWithoutVnfConfiguration() throws IOException, URISyntaxException {
Response response = processJsonRequest(CsarTest.NO_VNF_CONFIG_CSAR);
assertThat(response.getStatus(), is(Response.Status.OK.getStatusCode()));
assertThat(response.getEntity(), is(getResponseJson("validNoVnfConfigurationResponse.json")));
@@ -146,6 +149,7 @@ public class TestGenerateArtifactsServiceImpl {
* Create a (mocked) HTTPS request and invoke the Babel generate artifacts API.
*
* @param csar
+ * test CSAR file
* @return the Response from the HTTP API
* @throws URISyntaxException
* if the URI cannot be created
diff --git a/src/test/java/org/onap/aai/babel/testdata/CsarTest.java b/src/test/java/org/onap/aai/babel/testdata/CsarTest.java
index 4f4c8ad..8b28551 100644
--- a/src/test/java/org/onap/aai/babel/testdata/CsarTest.java
+++ b/src/test/java/org/onap/aai/babel/testdata/CsarTest.java
@@ -2,8 +2,8 @@
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 European Software Marketing Ltd.
+ * Copyright © 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2019 European Software Marketing Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -66,8 +66,10 @@ public enum CsarTest {
* Extract YAML Artifacts.
*
* @return the extracted artifacts
- * @throws InvalidArchiveException if the CSAR is invalid
- * @throws IOException for I/O errors
+ * @throws InvalidArchiveException
+ * if the CSAR is invalid
+ * @throws IOException
+ * for I/O errors
*/
public List<Artifact> extractArtifacts() throws InvalidArchiveException, IOException {
return new YamlExtractor().extract(getContent(), getName(), "v1");
@@ -77,14 +79,22 @@ public enum CsarTest {
* Extract VNF Vendor Image Artifacts.
*
* @return the extracted artifacts
- * @throws IOException
* @throws ToscaToCatalogException
- *
+ * if the CSAR content is not valid
+ * @throws IOException
+ * if an I/O exception occursSince:
*/
public BabelArtifact extractVnfVendorImages() throws ToscaToCatalogException, IOException {
return new VnfVendorImageExtractor().extract(getContent());
}
+ /**
+ * Create a BabelRequest containing the encoded CSAR content.
+ *
+ * @return a new Babel request for this CSAR
+ * @throws IOException
+ * if an I/O exception occurs
+ */
public String getJsonRequest() throws IOException {
BabelRequest request = new BabelRequest();
request.setArtifactName(getName());
diff --git a/src/test/java/org/onap/aai/babel/util/ArtifactTestUtils.java b/src/test/java/org/onap/aai/babel/util/ArtifactTestUtils.java
index 6608c00..445dd84 100644
--- a/src/test/java/org/onap/aai/babel/util/ArtifactTestUtils.java
+++ b/src/test/java/org/onap/aai/babel/util/ArtifactTestUtils.java
@@ -56,6 +56,9 @@ public class ArtifactTestUtils {
private static final String JSON_RESPONSES_FOLDER = "response/";
private static final String CSAR_INPUTS_FOLDER = "compressedArtifacts/";
+ /**
+ * Initialise System Properties for test configuration files.
+ */
public void setGeneratorSystemProperties() {
System.setProperty(ArtifactGeneratorToscaParser.PROPERTY_ARTIFACT_GENERATOR_CONFIG_FILE,
getResourcePath(Resources.ARTIFACT_GENERATOR_CONFIG));
@@ -143,6 +146,15 @@ public class ArtifactTestUtils {
return Files.lines(Paths.get(getResource(resourceFile).toURI())).collect(Collectors.joining());
}
+ /**
+ * Create Properties from the content of the named resource (e.g. a file on the classpath).
+ *
+ * @param resourceName
+ * the resource name
+ * @return Properties loaded from the named resource
+ * @throws IOException
+ * if an error occurred when reading from the named resource
+ */
public Properties getResourceAsProperties(String resourceName) throws IOException {
final Properties properties = new Properties();
InputStream in = ArtifactTestUtils.class.getClassLoader().getResourceAsStream(resourceName);