* ============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.
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.aai.babel.service;
import static org.hamcrest.Matchers.is;
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;
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
*
* @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)