Code Review
/
aai
/
babel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Load type mappings from a group configuration file
[aai/babel.git]
/
src
/
test
/
java
/
org
/
onap
/
aai
/
babel
/
service
/
TestGenerateArtifactsServiceImpl.java
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
(file)
--- 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
* ================================================================================
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
- * Copyright © 2017-201
8
AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-201
8
European Software Marketing Ltd.
+ * Copyright © 2017-201
9
AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-201
9
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.
* ================================================================================
* 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=========================================================
*/
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.aai.babel.service;
import static org.hamcrest.Matchers.is;
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.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;
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");
}
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() {
@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
}
@Test
@@
-148,13
+147,25
@@
public class TestGenerateArtifactsServiceImpl {
*
* @param csar
* @return the Response from the HTTP API
*
* @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);
}
*/
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)
private Response invokeService(String jsonString) throws URISyntaxException {
UriInfo mockUriInfo = Mockito.mock(UriInfo.class);
Mockito.when(mockUriInfo.getRequestUri()).thenReturn(new URI("/validate")); // NOSONAR (mocked)