summaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap
diff options
context:
space:
mode:
authorPolavarapu, Chaitanya (cp8128) <cp8128@att.com>2019-04-09 17:02:50 -0400
committerTian Lee <TianL@amdocs.com>2019-04-11 16:05:25 +0000
commit0e93cb3b54e7868cfe5b8a85902adc100391da9c (patch)
tree108793d1b7a1e196917ff268d6d056ab6ee7fdd1 /src/test/java/org/onap
parente3de90587ada88dcb3cb0a87fbfe283b2ae9f08b (diff)
Updated to use dublin schema version
Using 1.0.2 schema-service version Fixed the junit test failure for default service version Issue-ID: AAI-2338 Change-Id: Ie0ddda41f6895ff0ce8e97ad065fb935462e643a Signed-off-by: Polavarapu, Chaitanya (cp8128) <cp8128@att.com>
Diffstat (limited to 'src/test/java/org/onap')
-rw-r--r--src/test/java/org/onap/aai/babel/service/TestGenerateArtifactsServiceImpl.java50
-rw-r--r--src/test/java/org/onap/aai/babel/testdata/CsarTest.java25
2 files changed, 73 insertions, 2 deletions
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 d011ba6..45eadb0 100644
--- a/src/test/java/org/onap/aai/babel/service/TestGenerateArtifactsServiceImpl.java
+++ b/src/test/java/org/onap/aai/babel/service/TestGenerateArtifactsServiceImpl.java
@@ -103,6 +103,56 @@ public class TestGenerateArtifactsServiceImpl {
assertThat(response.toString(), response.getStatus(), is(Response.Status.OK.getStatusCode()));
assertThat(response.getEntity(), is(getResponseJson("response.json")));
}
+
+ /**
+ * Test with a valid request without Minor Artifact version.
+ *
+ * @throws URISyntaxException
+ * if the URI cannot be created
+ * @throws IOException
+ * if the resource cannot be loaded
+ */
+ @Test
+ public void testGenerateArtifactsWithoutMinorArtifactVersion() throws URISyntaxException, IOException {
+ Response response = invokeService(CsarTest.VNF_VENDOR_CSAR.getJsonRequestWithArtifactVersion("1"),
+ Optional.of("transaction-id"), auth);
+ assertThat(response.toString(), response.getStatus(), is(Response.Status.OK.getStatusCode()));
+ assertThat(response.getEntity(), is(getResponseJson("response.json")));
+ }
+
+ /**
+ * Test with a valid request without Minor Artifact version.
+ *
+ * @throws URISyntaxException
+ * if the URI cannot be created
+ * @throws IOException
+ * if the resource cannot be loaded
+ */
+ @Test
+ public void testGenerateArtifactsWithInvalidArtifactVersion() throws URISyntaxException, IOException {
+ Response response = invokeService(CsarTest.VNF_VENDOR_CSAR.getJsonRequestWithArtifactVersion("a"),
+ Optional.of("transaction-id"), auth);
+ assertThat(response.toString(), response.getStatus(), is(Response.Status.OK.getStatusCode()));
+ assertThat(response.getEntity(), is(getResponseJson("response.json")));
+ }
+
+
+ /**
+ * Test with a valid request with Artifact version less than 1.
+ *
+ * @throws URISyntaxException
+ * if the URI cannot be created
+ * @throws IOException
+ * if the resource cannot be loaded
+ */
+ @Test
+ public void testGenerateArtifactsWithArtifactVerLessThan1() throws URISyntaxException, IOException {
+ Response response = invokeService(CsarTest.VNF_VENDOR_CSAR.getJsonRequestWithArtifactVersion("0.1"),
+ Optional.of("transaction-id"), auth);
+ assertThat(response.toString(), response.getStatus(), is(Response.Status.OK.getStatusCode()));
+ assertThat(response.getEntity(), is(getResponseJson("responseWithVersionLessThan1.json")));
+ }
+
/**
* Test with a valid request, using a CSAR file that has no VNF configuration present.
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 8b28551..1885555 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-2019 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2019 European Software Marketing Ltd.
+ * 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.
@@ -39,12 +39,18 @@ public enum CsarTest {
VNF_VENDOR_CSAR("catalog_csar.csar"),
NO_VNF_CONFIG_CSAR("noVnfConfiguration.csar"),
SD_WAN_CSAR_FILE("service-SdWanServiceTest-csar.csar"),
+ COS_AVPN_CSAR_FILE("service_CosAvpn_csar.csar"),
MISSING_METADATA_CSAR("service-MissingMetadataTest.csar"),
NO_YAML_FILES("noYmlFilesArchive.zip"),
PORT_MIRROR_CSAR("service_PortMirror.csar"),
MULTIPLE_VNF_CSAR("catalog_csar_too_many_vnfConfigurations.csar"),
NETWORK_COLLECTION_CSAR_FILE("service_NetworkCollection.csar"),
+ RG_COLLECTOR_615_CSAR_FILE("service-RgCollector615-csar.csar"),
+ VDBE_SERVICE_CSAR_FILE("service-VdbeSrv-csar.csar"),
+ VNFOD_SERVICE("service-Dev2devnfodservice17July-csar.csar"),
+ CHILD_RESOURCE_CSAR_FILE("service-NetworkCloudVnfServiceMock-csar.csar"),
SERVICE_PROXY_CSAR_FILE("service-S1-csar.csar");
+
// @formatter:on
private String filename;
@@ -102,4 +108,19 @@ public enum CsarTest {
request.setCsar(new String(GeneratorUtil.encode(getContent())));
return new Gson().toJson(request);
}
+
+ /**
+ * Create a BabelRequest containing the encoded CSAR content by passing in the artifact version.
+ *
+ * @return a new Babel request for this CSAR
+ * @throws IOException
+ * if an I/O exception occurs
+ */
+ public String getJsonRequestWithArtifactVersion(String artifactVersion) throws IOException {
+ BabelRequest request = new BabelRequest();
+ request.setArtifactName(getName());
+ request.setArtifactVersion(artifactVersion);
+ request.setCsar(new String(GeneratorUtil.encode(getContent())));
+ return new Gson().toJson(request);
+ }
}