diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/openecomp/vid/asdc/Base64Encoder.java | 42 | ||||
-rw-r--r-- | src/test/java/org/openecomp/vid/asdc/BaseClientTest.java | 323 | ||||
-rw-r--r-- | src/test/java/org/openecomp/vid/asdc/FindServices.java | 127 | ||||
-rw-r--r-- | src/test/java/org/openecomp/vid/asdc/InMemoryClientTest.java | 80 | ||||
-rw-r--r-- | src/test/java/org/openecomp/vid/asdc/RestfulClientTest.java | 107 | ||||
-rw-r--r-- | src/test/resources/CI2-DEV30_DEMO.postman_collection.json | 228 | ||||
-rw-r--r-- | src/test/resources/External API's Integration ATT-Amdocs.postman_collection.json | 158 | ||||
-rw-r--r-- | src/test/resources/asdc.properties | 4 | ||||
-rw-r--r-- | src/test/resources/catalog.json | 174 | ||||
-rw-r--r-- | src/test/resources/sampleTosca.csar | bin | 0 -> 6177 bytes |
10 files changed, 1243 insertions, 0 deletions
diff --git a/src/test/java/org/openecomp/vid/asdc/Base64Encoder.java b/src/test/java/org/openecomp/vid/asdc/Base64Encoder.java new file mode 100644 index 0000000..4c945d2 --- /dev/null +++ b/src/test/java/org/openecomp/vid/asdc/Base64Encoder.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * VID ASDC Client + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.vid.asdc; + +import java.util.Base64; + +/** + * The Class Base64Encoder. + */ +public class Base64Encoder { + + /** + * The main method. + * + * @param args the arguments + */ + public static void main(String[] args) { + if (args.length != 2) throw new RuntimeException("Usage: Base64Encoder <user> <pass>"); + + final String user = args[0]; + final String pass = args[1]; + System.out.println(Base64.getEncoder().encodeToString((user + ":" + pass).getBytes())); + } +} diff --git a/src/test/java/org/openecomp/vid/asdc/BaseClientTest.java b/src/test/java/org/openecomp/vid/asdc/BaseClientTest.java new file mode 100644 index 0000000..f564544 --- /dev/null +++ b/src/test/java/org/openecomp/vid/asdc/BaseClientTest.java @@ -0,0 +1,323 @@ +/*- + * ============LICENSE_START======================================================= + * VID ASDC Client + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.vid.asdc; + +import java.util.Collection; +import java.util.Collections; +import java.util.Map; +import java.util.UUID; + +import javax.ws.rs.NotFoundException; + +import org.hamcrest.core.IsEqual; +import org.junit.Assert; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ErrorCollector; + +import org.openecomp.vid.asdc.beans.Artifact; +import org.openecomp.vid.asdc.beans.Resource; +import org.openecomp.vid.asdc.beans.Service; +import org.openecomp.vid.asdc.beans.Service.DistributionStatus; +import org.openecomp.vid.asdc.beans.tosca.Group; +import org.openecomp.vid.asdc.beans.tosca.Input; +import org.openecomp.vid.asdc.beans.tosca.NodeTemplate; +import org.openecomp.vid.asdc.beans.tosca.ToscaCsar; +import org.openecomp.vid.asdc.beans.tosca.ToscaModel; + +/** + * The Class BaseClientTest. + */ +public class BaseClientTest { + + /** The collector. */ + @Rule + public ErrorCollector collector = new ErrorCollector(); + + /** + * Run resource tests. + * + * @param client the client + * @throws AsdcCatalogException the asdc catalog exception + */ + protected void runResourceTests(AsdcClient client) throws AsdcCatalogException { + final Collection<Resource> resources = client.getResources(); + + collector.checkThat("getResources() returned nothing", resources.isEmpty(), IsEqual.equalTo(false)); + + final Resource resource = resources.iterator().next(); + + testResource(resource); + + final Resource thisResource = client.getResource(UUID.fromString(resource.getUuid())); + + collector.checkThat(thisResource, IsEqual.equalTo(resource)); + + for (Resource aResource : resources) { + if (aResource.getArtifacts() != null && !aResource.getArtifacts().isEmpty()) { + + final Artifact artifact = aResource.getArtifacts().iterator().next(); + + testArtifact(artifact); + + final UUID resourceUuid = UUID.fromString(aResource.getUuid()); + final UUID artifactUuid = UUID.fromString(artifact.getArtifactUUID()); + final Artifact thisArtifact = client.getResourceArtifact(resourceUuid, artifactUuid); + + collector.checkThat(artifact, IsEqual.equalTo(thisArtifact)); + } + } + + try { + final Collection<Resource> badResources = client.getResources(Collections.singletonMap("category", new String[] {"Bad Resources"})); + + for (Resource badResource : badResources) { + collector.checkThat(badResource.getCategory(), IsEqual.equalTo("Bad Resources")); + } + } catch (NotFoundException e) { + //No resources of this category were found + } + + try { + final Collection<Resource> reallyBadResources = client.getResources(Collections.singletonMap("subCategory", new String[] {"Really Bad Resources"})); + + for (Resource reallyBadResource : reallyBadResources) { + collector.checkThat(reallyBadResource.getSubCategory(), IsEqual.equalTo("Really Bad Resources")); + } + } catch (NotFoundException e) { + //No resources of this subcategory were found + } + + final ToscaCsar toscaCsar = client.getResourceToscaModel(UUID.fromString(resource.getUuid())); + + testToscaCsar(toscaCsar); + } + + /** + * Run service tests. + * + * @param client the client + * @throws AsdcCatalogException the asdc catalog exception + */ + protected void runServiceTests(AsdcClient client) throws AsdcCatalogException { + final Collection<Service> services = client.getServices(); + + collector.checkThat("getServices() returned nothing", services.isEmpty(), IsEqual.equalTo(false)); + + final Service service = services.iterator().next(); + + testService(service); + + final Service thisService = client.getService(UUID.fromString(service.getUuid())); + + collector.checkThat(thisService, IsEqual.equalTo(service)); + + for (Service aService : services) { + if (aService.getArtifacts() != null && ! aService.getArtifacts().isEmpty()) { + final Artifact artifact = aService.getArtifacts().iterator().next(); + + testArtifact(artifact); + + final UUID serviceUuid = UUID.fromString(aService.getUuid()); + final UUID artifactUuid = UUID.fromString(artifact.getArtifactUUID()); + final Artifact thisArtifact = client.getServiceArtifact(serviceUuid, artifactUuid); + + collector.checkThat(artifact, IsEqual.equalTo(thisArtifact)); + break; + } + } + + try { + final Collection<Service> distributedServices = client.getServices(Collections.singletonMap("distributionStatus", new String[] {"DISTRIBUTED"})); + + for (Service distributedService : distributedServices) { + collector.checkThat(distributedService.getDistributionStatus(), IsEqual.equalTo(DistributionStatus.DISTRIBUTED)); + } + } catch (NotFoundException e) { + //No services of this distributionStatus were found + } + + try { + final Collection<Service> badServices = client.getServices(Collections.singletonMap("category", new String[] {"Bad Services"})); + + for (Service badService : badServices) { + collector.checkThat(badService.getCategory(), IsEqual.equalTo("Bad Services")); + } + } catch (NotFoundException e) { + //No services of this category were found + } + + final ToscaCsar toscaCsar = client.getServiceToscaModel(UUID.fromString(service.getUuid())); + + testToscaCsar(toscaCsar); + } + + /** + * Test service. + * + * @param service the service + */ + private void testService(Service service) { + service.getArtifacts(); + service.getCategory(); + service.getDistributionStatus(); + service.getInvariantUUID(); + service.getLastUpdaterUserId(); + service.getLastUpdaterFullName(); + service.getLifecycleState(); + service.getName(); + service.getResources(); + service.getToscaModelURL(); + service.getUuid(); + service.getVersion(); + } + + /** + * Test resource. + * + * @param resource the resource + */ + private void testResource(Resource resource) { + resource.getArtifacts(); + resource.getCategory(); + resource.getInvariantUUID(); + resource.getLastUpdaterUserId(); + resource.getLastUpdaterFullName(); + resource.getLifecycleState(); + resource.getName(); + resource.getResources(); + resource.getResourceType(); + resource.getSubCategory(); + resource.getToscaModel(); + resource.getToscaModelURL(); + resource.getToscaResourceName(); + resource.getUuid(); + resource.getVersion(); + } + + /** + * Test artifact. + * + * @param artifact the artifact + */ + private void testArtifact(Artifact artifact) { + artifact.getArtifactChecksum(); + artifact.getArtifactDescription(); + artifact.getArtifactName(); + artifact.getArtifactTimeout(); + artifact.getArtifactType(); + artifact.getArtifactURL(); + artifact.getArtifactUUID(); + artifact.getArtifactVersion(); + artifact.getGeneratedFromUUID(); + } + + /** + * Test tosca csar. + * + * @param toscaCsar the tosca csar + */ + private void testToscaCsar(ToscaCsar toscaCsar) { + testToscaModel(toscaCsar.getParent()); + + for (ToscaModel childModel : toscaCsar.getChildren()) { + testToscaModel(childModel); + } + } + + /** + * Test tosca model. + * + * @param toscaModel the tosca model + */ + private void testToscaModel(ToscaModel toscaModel) { + + toscaModel.getDescription(); + toscaModel.getMetadata().getCategory(); + toscaModel.getMetadata().getDescription(); + toscaModel.getMetadata().getInvariantUUID(); + toscaModel.getMetadata().getName(); + toscaModel.getMetadata().getType(); + toscaModel.getMetadata().gettemplate_name(); + toscaModel.getMetadata().getUUID(); + toscaModel.getMetadata().getVersion(); + toscaModel.getMetadata().isServiceEcompNaming(); + toscaModel.getMetadata().isServiceHoming(); + + if (!toscaModel.gettopology_template().getInputs().isEmpty()) { + final Input input = toscaModel.gettopology_template().getInputs().values().iterator().next(); + input.getDefault(); + input.getDescription(); + input.getType(); + input.toString(); + } + + if (!toscaModel.gettopology_template().getnode_templates().isEmpty()) { + final NodeTemplate nodeTemplate = toscaModel.gettopology_template().getnode_templates().values().iterator().next(); + nodeTemplate.getMetadata(); + nodeTemplate.getProperties(); + nodeTemplate.getRequirements(); + nodeTemplate.getType(); + } + + if (!toscaModel.gettopology_template().getGroups().isEmpty()) { + final Group group = toscaModel.gettopology_template().getGroups().values().iterator().next(); + group.getMembers(); + group.getMetadata(); + group.getType(); + } + + if (!toscaModel.getImports().isEmpty()) { + for (Map<String, Map<String, String>> imports : toscaModel.getImports()) { + imports.values().iterator().next().get("file"); + } + } + + toscaModel.gettopology_template().getsubstitution_mappings().getnode_type(); + + if (!toscaModel.gettopology_template().getsubstitution_mappings().getCapabilities().isEmpty()) { + toscaModel.gettopology_template().getsubstitution_mappings().getCapabilities(); + } + + toscaModel.gettosca_definitions_version(); + } + + /** + * Test try catch asdc catalog exception. + */ + @Test + public void testTryCatchAsdcCatalogException() { + try { + throw new AsdcCatalogException("testing"); + } catch (AsdcCatalogException e) { + Assert.assertEquals("testing", e.getMessage()); + } + + final Exception cause = new Exception(); + + try { + throw new AsdcCatalogException("testing", cause); + } catch (AsdcCatalogException e) { + Assert.assertEquals("testing", e.getMessage()); + Assert.assertEquals(cause, e.getCause()); + } + } +} diff --git a/src/test/java/org/openecomp/vid/asdc/FindServices.java b/src/test/java/org/openecomp/vid/asdc/FindServices.java new file mode 100644 index 0000000..2eb325a --- /dev/null +++ b/src/test/java/org/openecomp/vid/asdc/FindServices.java @@ -0,0 +1,127 @@ +package org.openecomp.vid.asdc; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Collection; +import java.util.Collections; +import java.util.Map.Entry; +import java.util.Properties; +import java.util.UUID; + +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; + +import org.openecomp.vid.asdc.AsdcCatalogException; +import org.openecomp.vid.asdc.AsdcClient; +import org.openecomp.vid.asdc.beans.Service; +import org.openecomp.vid.asdc.beans.tosca.Group; +import org.openecomp.vid.asdc.beans.tosca.NodeTemplate; +import org.openecomp.vid.asdc.beans.tosca.ToscaCsar; +import org.openecomp.vid.asdc.beans.tosca.ToscaModel; +import org.openecomp.vid.asdc.rest.RestfulAsdcClient; + +/** + * The Class FindServices. + */ +public class FindServices { + + /** + * The main method. + * + * @param args the arguments + * @throws IOException Signals that an I/O exception has occurred. + * @throws URISyntaxException the URI syntax exception + * @throws AsdcCatalogException the asdc catalog exception + */ + public static void main(String[] args) throws IOException, URISyntaxException, AsdcCatalogException { + + final InputStream propertiesFile = FindServices.class.getClassLoader().getResourceAsStream("asdc.properties"); + + final Properties properties = new Properties(); + properties.load(propertiesFile); + + final String protocol = properties.getProperty("protocol", "http"); + + final Client restClient = ClientBuilder.newClient(); + final URI uri = new URI(protocol + "://" + properties.getProperty("host", "localhost") + ":" + properties.getProperty("port", "80") + "/"); + final String auth = properties.getProperty("auth"); + + final AsdcClient client = new RestfulAsdcClient.Builder(restClient, uri).auth(auth).build(); + + try { + final Collection<Service> services = client.getServices(Collections.singletonMap("distributionStatus", new String[] {"DISTRIBUTED"})); + + for (Service service : services) { + + final ToscaCsar toscaCsar; + + try { + toscaCsar = client.getServiceToscaModel(UUID.fromString(service.getUuid())); + } catch (NullPointerException e) { + //System.out.println(service.getUuid() + " has a bad tosca metadata entry"); + continue; + } catch (Throwable t) { + System.out.println(t.getMessage()); + continue; + } + + System.out.println(service.getUuid() + ", " + service.getName()); + + if (checkToscaModelForVnf(toscaCsar.getParent())) { + for (ToscaModel vnfModel : toscaCsar.getChildren()) { + if (checkToscaModelForVfModule(vnfModel)) { + System.out.println("******" + service); + } + } + } + } + } catch (AsdcCatalogException e) { + throw e; + } + } + + /** + * Check tosca model for vf module. + * + * @param model the model + * @return true, if successful + */ + private static boolean checkToscaModelForVfModule(ToscaModel model) { + + for (Entry<String, Group> component : model.gettopology_template().getGroups().entrySet()) { + final Group group = component.getValue(); + final String type = group.getType(); + + if (type.startsWith("com.att.d2.groups.VfModule")) { + final String rawValue = group.getProperties().get("volume_group"); + if (Boolean.valueOf(rawValue)) { + return true; + } + } + } + + return false; + } + + /** + * Check tosca model for vnf. + * + * @param model the model + * @return true, if successful + */ + private static boolean checkToscaModelForVnf(ToscaModel model) { + + for (Entry<String, NodeTemplate> component: model.gettopology_template().getnode_templates().entrySet()) { + final NodeTemplate nodeTemplate = component.getValue(); + final String type = nodeTemplate.getType(); + + if (type.startsWith("com.att.d2.resource.vf")) { + return true; + } + } + + return false; + } +} diff --git a/src/test/java/org/openecomp/vid/asdc/InMemoryClientTest.java b/src/test/java/org/openecomp/vid/asdc/InMemoryClientTest.java new file mode 100644 index 0000000..c083934 --- /dev/null +++ b/src/test/java/org/openecomp/vid/asdc/InMemoryClientTest.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * VID ASDC Client + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.vid.asdc; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URISyntaxException; + +import org.codehaus.jackson.map.ObjectMapper; +import org.json.JSONObject; +import org.json.JSONTokener; +import org.junit.Before; +import org.junit.Test; + +import org.openecomp.vid.asdc.memory.InMemoryAsdcClient; + +/** + * The Class InMemoryClientTest. + */ +public class InMemoryClientTest extends BaseClientTest { + + /** The catalog. */ + private JSONObject catalog; + + /** + * Sets the up. + * + * @throws URISyntaxException the URI syntax exception + * @throws IOException Signals that an I/O exception has occurred. + */ + @Before + public void setUp() throws URISyntaxException, IOException { + final InputStream asdcCatalogFile = getClass().getClassLoader().getResourceAsStream("catalog.json"); + + final JSONTokener tokener = new JSONTokener(asdcCatalogFile); + + catalog = new JSONObject(tokener); + } + + /** + * Test resources. + * + * @throws AsdcCatalogException the asdc catalog exception + */ + @Test + public void testResources() throws AsdcCatalogException { + + runResourceTests(new InMemoryAsdcClient.Builder().catalog(catalog).mapper(new ObjectMapper()).build()); + } + + /** + * Test services. + * + * @throws AsdcCatalogException the asdc catalog exception + * @throws URISyntaxException the URI syntax exception + */ + @Test + public void testServices() throws AsdcCatalogException, URISyntaxException { + + runServiceTests(new InMemoryAsdcClient.Builder().catalog(catalog).build()); + } +} diff --git a/src/test/java/org/openecomp/vid/asdc/RestfulClientTest.java b/src/test/java/org/openecomp/vid/asdc/RestfulClientTest.java new file mode 100644 index 0000000..b51dd4e --- /dev/null +++ b/src/test/java/org/openecomp/vid/asdc/RestfulClientTest.java @@ -0,0 +1,107 @@ +/*- + * ============LICENSE_START======================================================= + * VID ASDC Client + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.vid.asdc; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Properties; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.SSLSession; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; + +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.openecomp.vid.asdc.rest.RestfulAsdcClient; + +/** + * The Class RestfulClientTest. + */ +@Ignore +public class RestfulClientTest extends BaseClientTest { + + /** The rest client. */ + private Client restClient; + + /** The uri. */ + private URI uri; + + /** The properties. */ + private Properties properties; + + /** The auth. */ + private String auth; + + /** + * Sets the up. + * + * @throws URISyntaxException the URI syntax exception + * @throws IOException Signals that an I/O exception has occurred. + */ + @Before + public void setUp() throws URISyntaxException, IOException { + final InputStream propertiesFile = getClass().getClassLoader().getResourceAsStream("asdc.properties"); + + properties = new Properties(); + properties.load(propertiesFile); + + final String protocol = properties.getProperty("protocol", "http"); + + restClient = ClientBuilder.newBuilder() + .hostnameVerifier(new HostnameVerifier() { + + @Override + public boolean verify(String arg0, SSLSession arg1) { + return true; + } + }) + .build(); + uri = new URI(protocol + "://" + properties.getProperty("host", "localhost") + ":" + properties.getProperty("port", "80") + "/"); + auth = properties.getProperty("auth"); + } + + /** + * Test resources. + * + * @throws AsdcCatalogException the asdc catalog exception + */ + @Test + public void testResources() throws AsdcCatalogException { + + runResourceTests(new RestfulAsdcClient.Builder(restClient, uri).auth(auth).build()); + } + + /** + * Test services. + * + * @throws AsdcCatalogException the asdc catalog exception + * @throws URISyntaxException the URI syntax exception + */ + @Test + public void testServices() throws AsdcCatalogException, URISyntaxException { + + runServiceTests(new RestfulAsdcClient.Builder(restClient, uri).auth(auth).build()); + } +} diff --git a/src/test/resources/CI2-DEV30_DEMO.postman_collection.json b/src/test/resources/CI2-DEV30_DEMO.postman_collection.json new file mode 100644 index 0000000..1a625b5 --- /dev/null +++ b/src/test/resources/CI2-DEV30_DEMO.postman_collection.json @@ -0,0 +1,228 @@ +{ + "id": "da59cfcf-92ca-5f33-4d29-42c3b315be89", + "name": "CI2-DEV30/DEMO ", + "description": "", + "order": [ + "4d0583bc-1fc8-d609-a5bc-12402bcdf8b1" + ], + "folders": [ + { + "id": "ad4a6141-7100-c011-8edf-16af405196e1", + "name": "AssetDataServlet GET Specific Asset copy", + "description": "", + "order": [ + "5e52a321-afbf-09f5-0b32-7b0fba79ac7c", + "998cdf3e-f569-ba24-5430-8134a07c138f" + ], + "owner": "395001" + }, + { + "id": "e01ed772-c26e-9a6f-030d-2481f530013d", + "name": "AssetsDataServlet GET by AssetType copy", + "description": "", + "order": [ + "e8b3af1a-d384-801a-4959-70f7bcbe7b20", + "c6c184ce-ed95-830a-4103-214b3b6d07d8" + ], + "owner": "395001", + "collectionId": "7bb57b55-be95-b305-5b06-294bd9a54554" + }, + { + "id": "6e37e3ba-1962-201d-f21a-745cd50d6481", + "name": "Auth copy", + "description": "", + "order": [ + "bd5b959a-bc21-3e32-1f67-e56658cf362d", + "5333b52a-24d0-ffb5-8a3d-57376805f7dc", + "09678fbb-2aad-c01f-f131-d0e2a8170041", + "1654e686-5e0c-b5bb-9ef7-28880fe5fcf7" + ], + "owner": "395001", + "collectionId": "378f0077-151f-2a55-e7aa-a3e52ca7037c" + } + ], + "timestamp": 1472571436940, + "owner": "395001", + "public": false, + "published": false, + "requests": [ + { + "id": "09678fbb-2aad-c01f-f131-d0e2a8170041", + "headers": "Content-Type: application/json;charset=UTF-8\nHTTP_CSP_ATTUID: jh0003\n", + "url": "http://behost:8080/sdc2/rest/v1/consumers/Test", + "preRequestScript": "", + "pathVariables": {}, + "method": "GET", + "data": [], + "dataMode": "params", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1467800804647, + "name": "Get consumer", + "description": "", + "collectionId": "da59cfcf-92ca-5f33-4d29-42c3b315be89", + "responses": [], + "folder": "6e37e3ba-1962-201d-f21a-745cd50d6481" + }, + { + "id": "1654e686-5e0c-b5bb-9ef7-28880fe5fcf7", + "headers": "Content-Type: application/json;charset=UTF-8\nAccept: application/octet-stream\nAuthorization: Basic dGVzdDoxMjM0NTY=\nX-ECOMP-InstanceID: demo\n", + "url": "http://behost:8080/asdc/v1/catalog/services/Demo/0.1/artifacts/heat.yaml", + "pathVariables": {}, + "preRequestScript": "", + "method": "GET", + "collectionId": "da59cfcf-92ca-5f33-4d29-42c3b315be89", + "data": [], + "dataMode": "params", + "name": "Download service artifact - Distribution API copy", + "description": "", + "descriptionFormat": "html", + "time": 1448881625181, + "version": 2, + "responses": [], + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "folder": "6e37e3ba-1962-201d-f21a-745cd50d6481", + "isFromCollection": true + }, + { + "id": "4d0583bc-1fc8-d609-a5bc-12402bcdf8b1", + "headers": "Accept: application/octet-stream\nX-ECOMP-InstanceID: demo\nAuthorization: Basic VGVzdDoxMjM0NTY=\n", + "url": "http://135.21.125.36:8080/asdc/v1/catalog/services/39c4b59c-8a3f-4c5c-b9b8-cefb86547561/toscaModel ", + "preRequestScript": null, + "pathVariables": {}, + "method": "GET", + "data": null, + "dataMode": "params", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1473685576046, + "name": "GET /{assetType}/{uuid}/toscaModel <-- Download CSAR-Volume", + "description": "", + "collectionId": "da59cfcf-92ca-5f33-4d29-42c3b315be89", + "responses": [] + }, + { + "id": "5333b52a-24d0-ffb5-8a3d-57376805f7dc", + "headers": "Content-Type: application/json;charset=UTF-8\nHTTP_CSP_ATTUID: jh0003\n", + "url": "http://behost:8080/sdc2/rest/v1/consumers/test", + "pathVariables": {}, + "preRequestScript": "", + "method": "DELETE", + "collectionId": "da59cfcf-92ca-5f33-4d29-42c3b315be89", + "data": [], + "dataMode": "params", + "name": "Delete consumer", + "description": "", + "descriptionFormat": "html", + "time": 1448881916175, + "version": 2, + "responses": [], + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "folder": "6e37e3ba-1962-201d-f21a-745cd50d6481" + }, + { + "id": "5e52a321-afbf-09f5-0b32-7b0fba79ac7c", + "headers": "Content-Type: application/json;charset=UTF-8\nAccept: application/json\nX-ECOMP-InstanceID: demo\nAuthorization: Basic VGVzdDoxMjM0NTY=\n", + "url": "http://135.21.125.36:8080/asdc/v1/catalog/resources/3e3773b0-8526-4236-8a93-8660660fc047/metadata", + "preRequestScript": null, + "pathVariables": {}, + "method": "GET", + "data": null, + "dataMode": "params", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1473678716020, + "name": "GET /v1/catalog/{assetType} (resources)<-- getAssetList ", + "description": "", + "collectionId": "da59cfcf-92ca-5f33-4d29-42c3b315be89", + "responses": [] + }, + { + "id": "998cdf3e-f569-ba24-5430-8134a07c138f", + "headers": "Content-Type: application/json;charset=UTF-8\nAccept: application/json\nX-ECOMP-InstanceID: demo\nAuthorization: Basic VGVzdDoxMjM0NTY=\n", + "url": "http://135.21.125.36:8080/asdc/v1/catalog/services/39c4b59c-8a3f-4c5c-b9b8-cefb86547561/metadata", + "preRequestScript": null, + "pathVariables": {}, + "method": "GET", + "data": null, + "dataMode": "params", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1473678822013, + "name": "GET /v1/catalog/{assetType} (services)<-- getAssetList copy", + "description": "", + "collectionId": "da59cfcf-92ca-5f33-4d29-42c3b315be89", + "responses": [] + }, + { + "id": "bd5b959a-bc21-3e32-1f67-e56658cf362d", + "headers": "Content-Type: application/json;charset=UTF-8\nHTTP_CSP_ATTUID: jh0003\nAccept: application/json; charset=UTF-8\n", + "url": "http://135.21.125.36:8080/sdc2/rest/v1/consumers", + "preRequestScript": "", + "pathVariables": {}, + "method": "POST", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1473678594153, + "name": "Create consumer", + "description": "", + "collectionId": "da59cfcf-92ca-5f33-4d29-42c3b315be89", + "responses": [], + "rawModeData": "{\r\n \"consumerName\": \"Test\",\r\n \"consumerSalt\": \"8b70b3eaf116c0fc7ff9696ade47970d\",\r\n \"consumerPassword\": \"555bce57ba624c48ff0ac6736d8aa1877010c6d529d2c9985e32d52bd695e35a\"\r\n}\r\n" + }, + { + "id": "c6c184ce-ed95-830a-4103-214b3b6d07d8", + "headers": "Content-Type: application/json;charset=UTF-8\nAccept: application/json\nX-ECOMP-InstanceID: demo\nAuthorization: Basic VGVzdDoxMjM0NTY=\n", + "url": "http://135.21.125.36:8080/asdc/v1/catalog/services", + "preRequestScript": null, + "pathVariables": {}, + "method": "GET", + "data": null, + "dataMode": "params", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1473678680793, + "name": "GET /v1/catalog/{assetType} (services)<-- getAssetList copy", + "description": "", + "collectionId": "da59cfcf-92ca-5f33-4d29-42c3b315be89", + "responses": [] + }, + { + "id": "e8b3af1a-d384-801a-4959-70f7bcbe7b20", + "headers": "Content-Type: application/json;charset=UTF-8\nAccept: application/json\nX-ECOMP-InstanceID: demo\nAuthorization: Basic VGVzdDoxMjM0NTY=\n", + "url": "http://135.21.125.36:8080/asdc/v1/catalog/resources", + "preRequestScript": null, + "pathVariables": {}, + "method": "GET", + "data": null, + "dataMode": "params", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1473678669242, + "name": "GET /v1/catalog/{assetType} (resources) <-- getAssetList", + "description": "", + "collectionId": "da59cfcf-92ca-5f33-4d29-42c3b315be89", + "responses": [] + } + ] +}
\ No newline at end of file diff --git a/src/test/resources/External API's Integration ATT-Amdocs.postman_collection.json b/src/test/resources/External API's Integration ATT-Amdocs.postman_collection.json new file mode 100644 index 0000000..ddae510 --- /dev/null +++ b/src/test/resources/External API's Integration ATT-Amdocs.postman_collection.json @@ -0,0 +1,158 @@ +{ + "id": "7bb57b55-be95-b305-5b06-294bd9a54554", + "name": "External API's Integration ATT-Amdocs", + "description": "", + "order": [], + "folders": [ + { + "id": "51e6462a-8e6b-3699-b964-13750e49355a", + "name": "AssetsDataServlet", + "description": "", + "order": [ + "89c45dd7-62c2-517f-d444-70fd0e1c8643", + "1dcfcd29-7b47-174b-2bf5-e3b2b60c3208" + ], + "owner": "395001" + }, + { + "id": "1475e2a6-6bcb-7d8f-6297-74d1bd6c2f3a", + "name": "Auth copy", + "description": "", + "order": [ + "1aa1e3d9-4df0-5f6e-b891-bd3299300e20", + "7dac9d45-5e05-2b9e-26ee-96080f6b86fa", + "6244e569-4e08-eb29-769c-556410f3e6c7", + "3c31842b-dfe2-aecc-76b8-6176dd7bb21a" + ], + "owner": "395001", + "collectionId": "8ee68528-4e80-dfa2-7934-89de12bc9ab6" + } + ], + "timestamp": 1470748341282, + "owner": "395001", + "public": false, + "published": false, + "requests": [ + { + "id": "1aa1e3d9-4df0-5f6e-b891-bd3299300e20", + "headers": "Content-Type: application/json;charset=UTF-8\nHTTP_CSP_ATTUID: jh0003\nAccept: application/json; charset=UTF-8\n", + "url": "http://135.21.125.105:8080/sdc2/rest/v1/consumers", + "preRequestScript": "", + "pathVariables": {}, + "method": "POST", + "data": [], + "dataMode": "raw", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1470748438189, + "name": "Create consumer", + "description": "", + "collectionId": "7bb57b55-be95-b305-5b06-294bd9a54554", + "responses": [], + "rawModeData": "{\r\n \"consumerName\": \"Test\",\r\n \"consumerSalt\": \"8b70b3eaf116c0fc7ff9696ade47970d\",\r\n \"consumerPassword\": \"555bce57ba624c48ff0ac6736d8aa1877010c6d529d2c9985e32d52bd695e35a\"\r\n}\r\n" + }, + { + "id": "1dcfcd29-7b47-174b-2bf5-e3b2b60c3208", + "headers": "Content-Type: application/json;charset=UTF-8\nAccept: application/json\nX-ECOMP-InstanceID: demo\nAuthorization: Basic VGVzdDoxMjM0NTY=\n", + "url": "http://135.21.125.105:8080/asdc/v1/catalog/services", + "preRequestScript": null, + "pathVariables": {}, + "method": "GET", + "data": null, + "dataMode": "params", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1470748433437, + "name": "GET /v1/catalog/{assetType} (services)<-- getAssetList copy", + "description": "", + "collectionId": "7bb57b55-be95-b305-5b06-294bd9a54554", + "responses": [] + }, + { + "id": "3c31842b-dfe2-aecc-76b8-6176dd7bb21a", + "headers": "Content-Type: application/json;charset=UTF-8\nAccept: application/octet-stream\nAuthorization: Basic dGVzdDoxMjM0NTY=\nX-ECOMP-InstanceID: demo\n", + "url": "http://behost:8080/asdc/v1/catalog/services/Demo/0.1/artifacts/heat.yaml", + "pathVariables": {}, + "preRequestScript": "", + "method": "GET", + "collectionId": "7bb57b55-be95-b305-5b06-294bd9a54554", + "data": [], + "dataMode": "params", + "name": "Download service artifact - Distribution API copy", + "description": "", + "descriptionFormat": "html", + "time": 1448881625181, + "version": 2, + "responses": [], + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "isFromCollection": true, + "folder": "1475e2a6-6bcb-7d8f-6297-74d1bd6c2f3a" + }, + { + "id": "6244e569-4e08-eb29-769c-556410f3e6c7", + "headers": "Content-Type: application/json;charset=UTF-8\nHTTP_CSP_ATTUID: jh0003\n", + "url": "http://behost:8080/sdc2/rest/v1/consumers/Test", + "preRequestScript": "", + "pathVariables": {}, + "method": "GET", + "data": [], + "dataMode": "params", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1467800804647, + "name": "Get consumer", + "description": "", + "collectionId": "7bb57b55-be95-b305-5b06-294bd9a54554", + "responses": [], + "folder": "1475e2a6-6bcb-7d8f-6297-74d1bd6c2f3a" + }, + { + "id": "7dac9d45-5e05-2b9e-26ee-96080f6b86fa", + "headers": "Content-Type: application/json;charset=UTF-8\nHTTP_CSP_ATTUID: jh0003\n", + "url": "http://behost:8080/sdc2/rest/v1/consumers/test", + "pathVariables": {}, + "preRequestScript": "", + "method": "DELETE", + "collectionId": "7bb57b55-be95-b305-5b06-294bd9a54554", + "data": [], + "dataMode": "params", + "name": "Delete consumer", + "description": "", + "descriptionFormat": "html", + "time": 1448881916175, + "version": 2, + "responses": [], + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "folder": "1475e2a6-6bcb-7d8f-6297-74d1bd6c2f3a" + }, + { + "id": "89c45dd7-62c2-517f-d444-70fd0e1c8643", + "headers": "Content-Type: application/json;charset=UTF-8\nAccept: application/json\nX-ECOMP-InstanceID: demo\nAuthorization: Basic VGVzdDoxMjM0NTY=\n", + "url": "http://135.21.125.105:8080/asdc/v1/catalog/resources", + "preRequestScript": null, + "pathVariables": {}, + "method": "GET", + "data": null, + "dataMode": "params", + "version": 2, + "tests": "", + "currentHelper": "normal", + "helperAttributes": {}, + "time": 1470748435902, + "name": "GET /v1/catalog/{assetType} (resources) <-- getAssetList", + "description": "", + "collectionId": "7bb57b55-be95-b305-5b06-294bd9a54554", + "responses": [] + } + ] +}
\ No newline at end of file diff --git a/src/test/resources/asdc.properties b/src/test/resources/asdc.properties new file mode 100644 index 0000000..8402c2e --- /dev/null +++ b/src/test/resources/asdc.properties @@ -0,0 +1,4 @@ +protocol=https +host=localhost +port=8443 +auth=Basic changeme diff --git a/src/test/resources/catalog.json b/src/test/resources/catalog.json new file mode 100644 index 0000000..f2889fb --- /dev/null +++ b/src/test/resources/catalog.json @@ -0,0 +1,174 @@ +{ + "services": { + "0346aa9f-57b7-458a-9681-daf5b19d52b0": { + "uuid": "0346aa9f-57b7-458a-9681-daf5b19d52b0", + "name": "The Worst Service", + "version": "1.0", + "toscaModelURL": "sampleTosca.csar", + "category": "Bad Services", + "lifecycleState": "NOT_CERTIFIED_CHECKOUT", + "lastUpdaterUserId": "example@example.org", + "lastUpdaterFullName": "Example user", + "distributionStatus": "DISTRIBUTION_REJECTED", + "artifacts": [], + "resources": [] + }, + "1346aa9f-57b7-458a-9681-daf5b19d52b1": { + "uuid": "1346aa9f-57b7-458a-9681-daf5b19d52b1", + "name": "The Worst Service", + "version": "1.1", + "toscaModelURL": "sampleTosca.csar", + "category": "Bad Services", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "example@example.org", + "lastUpdaterFullName": "Example user", + "distributionStatus": "DISTRIBUTED", + "artifacts": [], + "resources": [] + }, + "3346aa9f-57b7-458a-9681-daf5b19d52b3": { + "uuid": "3346aa9f-57b7-458a-9681-daf5b19d52b3", + "name": "Bland Service", + "version": "1.9", + "toscaModelURL": "sampleTosca.csar", + "category": "Neutral Services", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "example@example.org", + "lastUpdaterFullName": "Example user", + "distributionStatus": "DISTRIBUTION_NOT_APPROVED", + "artifacts": [], + "resources": [] + }, + "2346aa9f-57b7-458a-9681-daf5b19d52b2": { + "uuid": "2346aa9f-57b7-458a-9681-daf5b19d52b2", + "name": "The Best Service", + "version": "1.3", + "toscaModelURL": "sampleTosca.csar", + "category": "Good Services", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "example@example.org", + "lastUpdaterFullName": "Example user", + "distributionStatus": "DISTRIBUTION_APPROVED", + "artifacts": [ + { + "artifactUUID": "0cf78c81-1246-45e7-a190-eaa309ee5680", + "generatedFromUUID": "3cf78c81-1246-45e7-a190-eaa309ee5680", + "artifactName": "The Worst Artifact", + "artifactType": "HEAT", + "artifactDescription": "This is the worst artifact", + "artifactURL": "http://www.openecomp.org/", + "artifactTimeout": "60", + "artifactChecksum": "A worthy checksum", + "artifactVersion": "0.1", + }, + { + "artifactUUID": "1cf78c81-1246-45e7-a190-eaa309ee5681", + "generatedFromUUID": "3cf78c81-1246-45e7-a190-eaa309ee5680", + "artifactName": "The Worst Artifact", + "artifactType": "HEAT", + "artifactDescription": "This is the worst artifact", + "artifactURL": "http://www.openecomp.org/", + "artifactTimeout": "60", + "artifactChecksum": "A worthy checksum", + "artifactVersion": "0.1", + }, + { + "artifactUUID": "2cf78c81-1246-45e7-a190-eaa309ee5682", + "generatedFromUUID": "3cf78c81-1246-45e7-a190-eaa309ee5680", + "artifactName": "The Worst Artifact", + "artifactType": "HEAT", + "artifactDescription": "This is the worst artifact", + "artifactURL": "http://www.openecomp.org/", + "artifactTimeout": "60", + "artifactChecksum": "A worthy checksum", + "artifactVersion": "0.1", + } + ], + "resources": [] + } + }, + "resources": { + "2f92b5b0-10ff-4cf4-9531-88546fe88a42": { + "uuid": "2f92b5b0-10ff-4cf4-9531-88546fe88a42", + "invariantUUID": "df92b5b0-10ff-4cf4-9531-88546fe88a4d", + "name": "The Worst Resource", + "version": "0.1", + "toscaModelURL": "sampleTosca.csar", + "toscaModel": "http://www.openecomp.org/", + "toscaResourceName": "The Worst Resource (TOSCA)", + "category": "Bad Resources", + "subCategory": "Really Bad Resources", + "resourceType": "VF", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "example@example.org", + "lastUpdaterFullName": "Example user", + "artifacts": [ + { + "artifactUUID": "0cf78c81-1246-45e7-a190-eaa309ee5680", + "generatedFromUUID": "3cf78c81-1246-45e7-a190-eaa309ee5680", + "artifactName": "The Worst Artifact", + "artifactType": "HEAT", + "artifactDescription": "This is the worst artifact", + "artifactURL": "http://www.openecomp.org/", + "artifactTimeout": "60", + "artifactChecksum": "A worthy checksum", + "artifactVersion": "0.1", + }, + { + "artifactUUID": "1cf78c81-1246-45e7-a190-eaa309ee5681", + "generatedFromUUID": "3cf78c81-1246-45e7-a190-eaa309ee5680", + "artifactName": "The Worst Artifact", + "artifactType": "HEAT", + "artifactDescription": "This is the worst artifact", + "artifactURL": "http://www.openecomp.org/", + "artifactTimeout": "60", + "artifactChecksum": "A worthy checksum", + "artifactVersion": "0.1", + }, + { + "artifactUUID": "2cf78c81-1246-45e7-a190-eaa309ee5682", + "generatedFromUUID": "3cf78c81-1246-45e7-a190-eaa309ee5680", + "artifactName": "The Worst Artifact", + "artifactType": "HEAT", + "artifactDescription": "This is the worst artifact", + "artifactURL": "http://www.openecomp.org/", + "artifactTimeout": "60", + "artifactChecksum": "A worthy checksum", + "artifactVersion": "0.1", + } + ] + }, + "0f92b5b0-10ff-4cf4-9531-88546fe88a40": { + "uuid": "0f92b5b0-10ff-4cf4-9531-88546fe88a40", + "invariantUUID": "df92b5b0-10ff-4cf4-9531-88546fe88a4d", + "name": "The Worst Resource", + "version": "0.1", + "toscaModelURL": "sampleTosca.csar", + "toscaModel": "http://www.openecomp.org/", + "toscaResourceName": "The Worst Resource (TOSCA)", + "category": "Bad Resources", + "subCategory": "Really Bad Resources", + "resourceType": "VF", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "example@example.org", + "lastUpdaterFullName": "Example user", + "artifacts": [] + }, + "1f92b5b0-10ff-4cf4-9531-88546fe88a41": { + "uuid": "1f92b5b0-10ff-4cf4-9531-88546fe88a41", + "invariantUUID": "df92b5b0-10ff-4cf4-9531-88546fe88a4d", + "name": "The Worst Resource", + "version": "0.1", + "toscaModelURL": "sampleTosca.csar", + "toscaModel": "http://www.openecomp.org/", + "toscaResourceName": "The Worst Resource (TOSCA)", + "category": "Bad Resources", + "subCategory": "Really Bad Resources", + "resourceType": "VF", + "lifecycleState": "CERTIFIED", + "lastUpdaterUserId": "example@example.org", + "lastUpdaterFullName": "Example user", + "artifacts": [] + } + } +}
\ No newline at end of file diff --git a/src/test/resources/sampleTosca.csar b/src/test/resources/sampleTosca.csar Binary files differnew file mode 100644 index 0000000..d9c469a --- /dev/null +++ b/src/test/resources/sampleTosca.csar |