aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
authormark.j.leonard <mark.j.leonard@gmail.com>2019-03-26 10:51:07 +0000
committermark.j.leonard <mark.j.leonard@gmail.com>2019-03-26 10:51:07 +0000
commit8a7d9a0d7782b9339810b02208620bdd2f0a12b2 (patch)
treee3cac78df7c662eee95ad17cf9a01d19158114ad /src/test/java
parent550216df935437b1380b6d4425fd422ea7c013f5 (diff)
Allow UUID definitions in the mappings JSON
Add support for reading the Widget invariant and version UUIDs from the TOSCA mappings JSON. In this commit the artifact-generator.properties is also read and used to provide default values. This step prevents any existing deployments (e.g. automated test integration) from failing. The redundant properties file will be deprecated in a future commit, only when the JSON configuration has been updated. Also remove two unused Java files to help with coverage stats. Change-Id: Idc82e28092a2b028214225c7974db411c9f8a173 Issue-ID: AAI-2284 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/onap/aai/babel/csar/fixture/ArtifactInfoBuilder.java81
-rw-r--r--src/test/java/org/onap/aai/babel/csar/fixture/TestArtifactInfoImpl.java123
-rw-r--r--src/test/java/org/onap/aai/babel/xml/generator/model/TestWidget.java10
3 files changed, 0 insertions, 214 deletions
diff --git a/src/test/java/org/onap/aai/babel/csar/fixture/ArtifactInfoBuilder.java b/src/test/java/org/onap/aai/babel/csar/fixture/ArtifactInfoBuilder.java
deleted file mode 100644
index cb70677..0000000
--- a/src/test/java/org/onap/aai/babel/csar/fixture/ArtifactInfoBuilder.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.onap.aai.babel.csar.fixture;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.onap.sdc.api.notification.IArtifactInfo;
-
-/**
- * This class builds an instance of IArtifactInfo for test purposes.
- */
-public class ArtifactInfoBuilder {
-
- /**
- * Builds an implementation of IArtifactInfo for test purposes.
- * <p/>
- *
- * @param type
- * type of artifact
- * @param name
- * name of artifact
- * @param description
- * description of artifact
- * @param version
- * version of artifact
- * @return IArtifactInfo implementation of IArtifactInfo from given parameters for test purposes
- */
- public static IArtifactInfo build(final String type, final String name, final String description,
- final String version) {
- IArtifactInfo artifact = new TestArtifactInfoImpl();
-
- ((TestArtifactInfoImpl) artifact).setArtifactType(type);
- ((TestArtifactInfoImpl) artifact).setArtifactName(name);
- ((TestArtifactInfoImpl) artifact).setArtifactDescription(description);
- ((TestArtifactInfoImpl) artifact).setArtifactVersion(version);
-
- return artifact;
- }
-
- /**
- * This method is responsible for building a collection of artifacts from a given set of info.
- * <p/>
- * The info supplied is a two dimensional array with each element of the first dimension representing a single
- * artifact and each element of the second dimension represents a property of the artifact.
- * <p/>
- * The method will call {@link #build(String, String, String, String)} to build each element in the first dimension
- * where the elements of the second dimension are the arguments to {@link #build(String, String, String, String)}.
- * <p/>
- *
- * @param artifactInfoBits
- * a two dimensional array of data used to build the artifacts
- * @return List&lt;IArtifactInfo&gt; a list of artifacts built from the given array of info
- */
- static List<IArtifactInfo> buildArtifacts(final String[][] artifactInfoBits) {
- List<IArtifactInfo> artifacts = new ArrayList<>();
-
- for (String[] artifactInfoBit : artifactInfoBits) {
- artifacts.add(build(artifactInfoBit[0], artifactInfoBit[1], artifactInfoBit[2], artifactInfoBit[3]));
- }
-
- return artifacts;
- }
-}
diff --git a/src/test/java/org/onap/aai/babel/csar/fixture/TestArtifactInfoImpl.java b/src/test/java/org/onap/aai/babel/csar/fixture/TestArtifactInfoImpl.java
deleted file mode 100644
index 6c0078d..0000000
--- a/src/test/java/org/onap/aai/babel/csar/fixture/TestArtifactInfoImpl.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.onap.aai.babel.csar.fixture;
-
-import java.util.Objects;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.onap.sdc.api.notification.IArtifactInfo;
-
-/**
- * This class is an implementation of IArtifactInfo for test purposes.
- */
-public class TestArtifactInfoImpl implements IArtifactInfo {
-
- private String artifactName;
- private String artifactType;
- private String artifactDescription;
- private String artifactVersion;
-
- @Override
- public String getArtifactName() {
- return artifactName;
- }
-
- void setArtifactName(String artifactName) {
- this.artifactName = artifactName;
- }
-
- @Override
- public String getArtifactType() {
- return artifactType;
- }
-
- void setArtifactType(String artifactType) {
- this.artifactType = artifactType;
- }
-
- @Override
- public String getArtifactURL() {
- return null;
- }
-
- @Override
- public String getArtifactChecksum() {
- return null;
- }
-
- @Override
- public String getArtifactDescription() {
- return artifactDescription;
- }
-
- void setArtifactDescription(String artifactDescription) {
- this.artifactDescription = artifactDescription;
- }
-
- @Override
- public Integer getArtifactTimeout() {
- return null;
- }
-
- @Override
- public String getArtifactVersion() {
- return artifactVersion;
- }
-
- void setArtifactVersion(String artifactVersion) {
- this.artifactVersion = artifactVersion;
- }
-
- @Override
- public String getArtifactUUID() {
- return null;
- }
-
- @Override
- public IArtifactInfo getGeneratedArtifact() {
- return null;
- }
-
- @Override
- public java.util.List<IArtifactInfo> getRelatedArtifacts() {
- return null;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof TestArtifactInfoImpl)) {
- return false;
- }
- TestArtifactInfoImpl rhs = (TestArtifactInfoImpl) obj;
- return new EqualsBuilder() //
- .append(artifactType, rhs.artifactType) //
- .append(artifactDescription, rhs.artifactDescription) //
- .append(artifactVersion, rhs.artifactVersion) //
- .isEquals();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(this.artifactType, this.artifactDescription, this.artifactVersion);
- }
-}
diff --git a/src/test/java/org/onap/aai/babel/xml/generator/model/TestWidget.java b/src/test/java/org/onap/aai/babel/xml/generator/model/TestWidget.java
index 2b64bfb..e5702ac 100644
--- a/src/test/java/org/onap/aai/babel/xml/generator/model/TestWidget.java
+++ b/src/test/java/org/onap/aai/babel/xml/generator/model/TestWidget.java
@@ -187,16 +187,6 @@ public class TestWidget {
Widget.createWidget("OAM_NETWORK").addResource(null);
}
- @Test(expected = IllegalArgumentException.class)
- public void testGetVersionIdForUknownWidget() {
- new Widget(new WidgetType("test"), null, false).getId();
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testGetInvariantIdForUknownWidget() {
- new Widget(new WidgetType("test"), null, false).getWidgetId();
- }
-
// Call Widget methods which are not supported, purely for code coverage.
@Test(expected = org.onap.aai.babel.xml.generator.error.IllegalAccessException.class)