aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap/aai/babel/service/TestGenerateArtifactsServiceImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/onap/aai/babel/service/TestGenerateArtifactsServiceImpl.java')
-rw-r--r--src/test/java/org/onap/aai/babel/service/TestGenerateArtifactsServiceImpl.java20
1 files changed, 16 insertions, 4 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 b5063dd..c770c60 100644
--- a/src/test/java/org/onap/aai/babel/service/TestGenerateArtifactsServiceImpl.java
+++ b/src/test/java/org/onap/aai/babel/service/TestGenerateArtifactsServiceImpl.java
@@ -48,7 +48,7 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
- * Direct invocation of the generate artifacts service implementation
+ * Direct invocation of the generate artifacts service implementation.
*
*/
@RunWith(SpringJUnit4ClassRunner.class)
@@ -63,6 +63,7 @@ public class TestGenerateArtifactsServiceImpl {
}
private static final String ARTIFACT_GENERATOR_CONFIG = "artifact-generator.properties";
+
@Inject
private AAIMicroServiceAuth auth;
@@ -73,6 +74,13 @@ public class TestGenerateArtifactsServiceImpl {
}
@Test
+ public void testGenerateArtifacts() throws Exception {
+ Response response = processJsonRequest("success_request_vnf_catalog.json");
+ assertThat(response.getStatus(), is(Response.Status.OK.getStatusCode()));
+ assertThat(response.getEntity(), is(getResponseJson("response.json")));
+ }
+
+ @Test
public void testInvalidCsarFile() throws URISyntaxException, IOException {
Response response = processJsonRequest("invalid_csar_request.json");
assertThat(response.getStatus(), is(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()));
@@ -108,12 +116,12 @@ public class TestGenerateArtifactsServiceImpl {
}
/**
- * Create a (mocked) HTTPS request and invoke the Babel generate artifacts API
+ * Create a (mocked) HTTPS request and invoke the Babel generate artifacts API.
*
* @param resource path to the incoming JSON request
* @return the Response from the HTTP API
- * @throws URISyntaxException
- * @throws IOException
+ * @throws URISyntaxException if the URI cannot be created
+ * @throws IOException if the resource cannot be loaded
*/
private Response processJsonRequest(String resource) throws URISyntaxException, IOException {
UriInfo mockUriInfo = Mockito.mock(UriInfo.class);
@@ -156,6 +164,10 @@ public class TestGenerateArtifactsServiceImpl {
return new ArtifactTestUtils().getRequestJson(resource);
}
+ private String getResponseJson(String jsonResponse) throws IOException, URISyntaxException {
+ return new ArtifactTestUtils().getResponseJson(jsonResponse);
+ }
+
private List<String> createSingletonList(String listItem) {
return Collections.<String>singletonList(listItem);
}