~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.cds.components.cba</groupId>
<artifactId>blueprint-model</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.7.0-SNAPSHOT</version>
</parent>
<artifactId>test-blueprint-kotlin-parent</artifactId>
<name>Components Model Catalog - Blueprints Model - Test Kotlin Parent</name>
<dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>blueprintsprocessor-application</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor.modules</groupId>
<artifactId>execution-service</artifactId>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.12</version>
+ <version>4.13.1</version>
<scope>test</scope>
</dependency>
<dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
- <version>4.9.3</version>
+ <version>4.10.0</version>
</dependency>
</dependencies>
<directory>${project.basedir}/Environments</directory>
</resource>
</resources>
+ <testResources>
+ <testResource>
+ <directory>${project.basedir}/Tests/resources</directory>
+ </testResource>
+ </testResources>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
+ <version>${maven-surefire-plugin.version}</version>
<executions>
<execution>
<id>default-test</id>
<phase>test</phase>
+ <configuration>
+ <!-- Sets the VM argument line used when unit tests are run. -->
+ <argLine>-Xmx1024m </argLine>
+ <reuseForks>false</reuseForks>
+ <forkCount>1</forkCount>
+ </configuration>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.6</version>
+ <executions>
+ <execution>
+ <id>copy-test-resources</id>
+ <goals>
+ <goal>testResources</goal>
+ </goals>
+ <phase>process-test-resources</phase>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
- <version>3.14.0</version>
+ <version>4.10.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
def publishEndpoint = properties['cds.publish.endpoint'] ?: 'api/v1/blueprint-model/publish'
def throwIfPropMissing(prop) {
- value = properties[prop]
- if (!value || "".equals(value)) {
- throw new RuntimeException("Property missing: $prop")
- }
- return value
+ value = properties[prop]
+ if (!value || "".equals(value)) {
+ throw new RuntimeException("Property missing: $prop")
+ }
+ return value
}
def buildRequest(endpoint, fileName) {
- body = new MultipartBody.Builder()
- .setType(MultipartBody.FORM)
- .addFormDataPart("file",
- fileName,
- RequestBody.create(MediaType.parse('application/zip'), new File(target, fileName)))
- .build()
+ body = new MultipartBody.Builder()
+ .setType(MultipartBody.FORM)
+ .addFormDataPart("file",
+ fileName,
+ RequestBody.create(MediaType.parse('application/zip'), new File(target, fileName)))
+ .build()
- return new Request.Builder()
- .url("$protocol://$host:$port/$endpoint")
- .addHeader('Authorization', Credentials.basic(userName, password))
- .post(body)
- .build()
+ return new Request.Builder()
+ .url("$protocol://$host:$port/$endpoint")
+ .addHeader('Authorization', Credentials.basic(userName, password))
+ .post(body)
+ .build()
}
def logAndThrow(msg) {
- if(response) {
- log.error(response.body().string())
- }
- throw new RuntimeException(msg)
+ if(response) {
+ log.error(response.body().string())
+ }
+ throw new RuntimeException(msg)
}
response = null
try {
- def client = new OkHttpClient()
+ def client = new OkHttpClient()
- response = client.newCall(buildRequest(enrichEndpoint, cba)).execute()
- if (!response || !response.isSuccessful()) {
- logAndThrow("Failed to enrich CBA")
- }
+ response = client.newCall(buildRequest(enrichEndpoint, cba)).execute()
+ if (!response || !response.isSuccessful()) {
+ logAndThrow("Failed to enrich CBA")
+ }
- IOUtils.copy(
- response.body().byteStream(),
- new FileOutputStream(new File(target, enrichedCba))
- )
- log.info("Created enriched cba: $enrichedCba")
+ IOUtils.copy(
+ response.body().byteStream(),
+ new FileOutputStream(new File(target, enrichedCba))
+ )
+ log.info("Created enriched cba: $enrichedCba")
- response = client.newCall(buildRequest(publishEndpoint, enrichedCba)).execute()
- if (!response || !response.isSuccessful()) {
- logAndThrow("Failed to publish CBA")
- }
+ response = client.newCall(buildRequest(publishEndpoint, enrichedCba)).execute()
+ if (!response || !response.isSuccessful()) {
+ logAndThrow("Failed to publish CBA")
+ }
- log.info("CBA Deployed")
- log.info(response.body().string())
+ log.info("CBA Deployed")
+ log.info(response.body().string())
} finally {
- if (response) {
- response.close()
- }
+ if (response) {
+ response.close()
+ }
}
</source>
</configuration>