3 * * ============LICENSE_START=======================================================
5 * * ================================================================================
6 * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved.
7 * * ================================================================================
8 * * Licensed under the Apache License, Version 2.0 (the "License");
9 * * you may not use this file except in compliance with the License.
10 * * You may obtain a copy of the License at
12 * * http://www.apache.org/licenses/LICENSE-2.0
14 * * Unless required by applicable law or agreed to in writing, software
15 * * distributed under the License is distributed on an "AS IS" BASIS,
16 * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * * See the License for the specific language governing permissions and
18 * * limitations under the License.
19 * * ============LICENSE_END=========================================================
24 package org.onap.blueprintgenerator.test;
26 import org.apache.commons.io.FileUtils;
27 import org.junit.Assert;
28 import org.junit.FixMethodOrder;
29 import org.junit.Ignore;
30 import org.junit.Test;
31 import org.junit.jupiter.api.Order;
32 import org.junit.runners.MethodSorters;
33 import org.onap.blueprintgenerator.test.BlueprintGeneratorTests;
36 import java.io.IOException;
37 import java.nio.file.Paths;
40 * @author : Ravi Mantena
41 * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Bueprint Jar Comparision with
42 * Blueprint Comparator using preious and new Jar files to make sure the new code doesnt break previous changes.
45 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
46 public class BlueprintJarComparatorTest extends BlueprintGeneratorTests {
48 private String previousJarVersion = "0.1";
49 private String latestJarVersion = "1.0";
50 private String previousVersion = "0_1";
51 private String latestVersion = "1_0";
52 private String latestJarPath = Paths.get("target").toAbsolutePath().toString() + "\\";
53 private String previousJarPath =
54 Paths.get("src", "test", "resources", "archives").toAbsolutePath().toString() + "\\";
55 private String inputPath =
56 Paths.get("src", "test", "resources", "componentspecs").toAbsolutePath().toString() + "\\";
57 private String inputPolicyPath =
58 Paths.get("src", "test", "resources", "policyjson").toAbsolutePath().toString() + "\\";
59 private String outputPath =
60 Paths.get("src", "test", "resources", "outputfiles").toAbsolutePath().toString() + "\\";
61 private String previousJar = "onap-blueprint-generator-" + previousJarVersion + ".jar";
62 private String latestJar = "onap-blueprint-generator-" + latestJarVersion + ".jar";
66 public void filesCleanup() throws IOException {
67 FileUtils.deleteDirectory(new File(outputPath));
71 public void jarTestVeswithDmaapK8s() throws IOException, InterruptedException {
72 String inputFileName = ves;
73 String outputFileName = "dcae-ves-collector-dmaap-";
74 String inputImportsFileName = testImports;
76 String previousJarCommand =
90 + inputImportsFileName
92 Runtime.getRuntime().exec(previousJarCommand);
94 String latestJarCommand =
108 + inputImportsFileName
110 Runtime.getRuntime().exec(latestJarCommand);
115 "The BluePrint files ("
119 + " with -m option don't match!",
120 FileUtils.readFileToString(
121 new File(outputPath + outputFileName + previousVersion + ".yaml"), "utf-8"),
122 FileUtils.readFileToString(
123 new File(outputPath + outputFileName + latestVersion + ".yaml"), "utf-8"));
127 public void jarTestVeswithoutDmaapK8s() throws IOException, InterruptedException {
128 String inputFileName = ves;
129 String outputFileName = "dcae-ves-collector-";
130 String inputImportsFileName = testImports;
132 String previousJarCommand =
146 + inputImportsFileName;
147 Runtime.getRuntime().exec(previousJarCommand);
149 String latestJarCommand =
163 + inputImportsFileName;
164 Runtime.getRuntime().exec(latestJarCommand);
169 "The BluePrint files ("
173 + " with -m option dont match!",
174 FileUtils.readFileToString(
175 new File(outputPath + outputFileName + previousVersion + ".yaml"), "utf-8"),
176 FileUtils.readFileToString(
177 new File(outputPath + outputFileName + latestVersion + ".yaml"), "utf-8"));