X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Forg%2Fonap%2Faai%2Fbabel%2Fservice%2FTestGenerateArtifactsServiceImpl.java;h=d87f3c38eb7e1de2ec08e0d32188377609fad060;hb=7fcc74469c941c1834cd02b54ff5ca88a53bf83b;hp=5bd54846814305d4b3de2539a7ddbb1043d76679;hpb=6b2de4b2de03890d0f0ba0663244ef1a98457309;p=aai%2Fbabel.git 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 5bd5484..d87f3c3 100644 --- a/src/test/java/org/onap/aai/babel/service/TestGenerateArtifactsServiceImpl.java +++ b/src/test/java/org/onap/aai/babel/service/TestGenerateArtifactsServiceImpl.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.service; import static org.hamcrest.Matchers.is; @@ -42,7 +43,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; import org.onap.aai.auth.AAIMicroServiceAuth; -import org.onap.aai.babel.parser.ArtifactGeneratorToscaParser; import org.onap.aai.babel.service.data.BabelRequest; import org.onap.aai.babel.testdata.CsarTest; import org.onap.aai.babel.util.ArtifactTestUtils; @@ -65,15 +65,14 @@ public class TestGenerateArtifactsServiceImpl { System.setProperty("CONFIG_HOME", "src/test/resources"); } - private static final String ARTIFACT_GENERATOR_CONFIG = "artifact-generator.properties"; @Inject private AAIMicroServiceAuth auth; @BeforeClass public static void setup() { - System.setProperty(ArtifactGeneratorToscaParser.PROPERTY_ARTIFACT_GENERATOR_CONFIG_FILE, - new ArtifactTestUtils().getResourcePath(ARTIFACT_GENERATOR_CONFIG)); + new ArtifactTestUtils().setGeneratorSystemProperties(); + } @Test @@ -148,13 +147,25 @@ public class TestGenerateArtifactsServiceImpl { * * @param csar * @return the Response from the HTTP API - * @throws URISyntaxException if the URI cannot be created - * @throws IOException if the resource cannot be loaded + * @throws URISyntaxException + * if the URI cannot be created + * @throws IOException + * if the resource cannot be loaded */ private Response processJsonRequest(CsarTest csar) throws IOException, URISyntaxException { String jsonString = csar.getJsonRequest(); return invokeService(jsonString); } + + /** + * Create a (mocked) HTTPS request and invoke the Babel generate artifacts API. + * + * @param jsonString + * the JSON request + * @return the Response from the HTTP API + * @throws URISyntaxException + * if the URI cannot be created + */ private Response invokeService(String jsonString) throws URISyntaxException { UriInfo mockUriInfo = Mockito.mock(UriInfo.class); Mockito.when(mockUriInfo.getRequestUri()).thenReturn(new URI("/validate")); // NOSONAR (mocked)