aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-translator-lib
diff options
context:
space:
mode:
authorGautam Shah <gautams@amdocs.com>2018-04-21 16:18:37 +0530
committerGAUTAMS <gautams@amdocs.com>2018-04-26 17:47:29 +0530
commit3de22e1c6c2711072ce996335e7250445a39d320 (patch)
treec7a528bee3166b3262eef9977b0f87923df0e99f /openecomp-be/lib/openecomp-sdc-translator-lib
parentd71a8de8c7b688eabb250e524dc4f6000b3233b6 (diff)
Reducing onboarding backend maven build time
Reducing onboarding backend maven build time Change-Id: Id0178cbf010e46f741f4bff11e14b0801f14d4b8 Issue-ID: SDC-1189 Signed-off-by: GAUTAMS <gautams@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-translator-lib')
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml10
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/helper/impl/NameExtractorServiceImpl.java19
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java224
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-impl/pom.xml52
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-sdk/pom.xml45
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/pom.xml2
6 files changed, 115 insertions, 237 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml
index b08067b6b4..0535d9dba1 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml
@@ -93,7 +93,7 @@
<configuration>
<parallel>classes</parallel>
<threadCount>1</threadCount>
- <forkCount>0</forkCount>
+ <forkCount>${fork.count}</forkCount>
<printSummary>false</printSummary>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<rerunFailingTestsCount>1</rerunFailingTestsCount>
@@ -103,12 +103,14 @@
<systemPropertyVariables>
<logback.configurationFile>src/test/resources/logback-test.xml</logback.configurationFile>
</systemPropertyVariables>
- <dependenciesToScan>
- org.openecomp.sdc:build-helper
- </dependenciesToScan>
+ <useSystemClassLoader>${useSystemClassLoader}</useSystemClassLoader>
</configuration>
</plugin>
</plugins>
</build>
+ <properties>
+ <useSystemClassLoader>false</useSystemClassLoader>
+ </properties>
+
</project>
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/helper/impl/NameExtractorServiceImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/helper/impl/NameExtractorServiceImpl.java
deleted file mode 100644
index 3867dadaeb..0000000000
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/helper/impl/NameExtractorServiceImpl.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java
index 2387390df9..801f2c67a0 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java
@@ -18,11 +18,22 @@ package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslati
import static org.junit.Assert.assertEquals;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
import org.apache.commons.collections4.MapUtils;
import org.junit.Assert;
import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.rules.TestName;
import org.openecomp.core.translator.api.HeatToToscaTranslator;
import org.openecomp.core.translator.datatypes.TranslatorOutput;
import org.openecomp.core.translator.factory.HeatToToscaTranslatorFactory;
@@ -39,133 +50,116 @@ import org.openecomp.sdc.translator.TestUtils;
import org.togglz.testing.TestFeatureManager;
import org.togglz.testing.TestFeatureManagerProvider;
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
public class BaseFullTranslationTest {
- public static final String IN_POSTFIX = "/in";
- public static final String OUT_POSTFIX = "/out";
-
- @Rule
- public TestName name = new TestName();
-
- protected static TestFeatureManager manager;
- private static File tempDir = new File(System.getProperty("java.io.tmpdir"));
-
- @BeforeClass
- public static void enableToggleableFeatures(){
- manager = new TestFeatureManager(ToggleableFeature.class);
- manager.enableAll();
- TestFeatureManagerProvider.setFeatureManager(manager);
- }
-
-
- public static void disableToggleableFeatures() {
- manager.disableAll();
- manager = null;
- TestFeatureManagerProvider.setFeatureManager(null);
- }
-
- protected void testTranslationWithInit(String path) throws IOException {
- byte[] translatedZipFile = initTranslatorAndTranslate(path);
- testTranslation(path, translatedZipFile);
- }
-
- protected byte[] initTranslatorAndTranslate(String path) throws IOException {
- HeatToToscaTranslator heatToToscaTranslator = HeatToToscaTranslatorFactory.getInstance().createInterface();
- return translateZipFile(path, heatToToscaTranslator);
- }
-
- protected void testTranslation(String basePath, byte[] translatedZipFile) throws IOException {
-
- URL url = BaseFullTranslationTest.class.getResource(basePath + OUT_POSTFIX);
- Set<String> expectedResultFileNameSet = new HashSet<>();
- Map<String, byte[]> expectedResultMap = new HashMap<>();
-
- String path = url.getPath();
- File pathFile = new File(path);
- File[] files = pathFile.listFiles();
- Assert.assertNotNull("manifest files is empty", files);
- for (File expectedFile : files) {
- expectedResultFileNameSet.add(expectedFile.getName());
- try (FileInputStream input = new FileInputStream(expectedFile)) {
- expectedResultMap.put(expectedFile.getName(), FileUtils.toByteArray(input));
- }
+ public static final String IN_POSTFIX = "/in";
+ public static final String OUT_POSTFIX = "/out";
+
+
+ protected static TestFeatureManager manager;
+
+ @BeforeClass
+ public static void enableToggleableFeatures() {
+ manager = new TestFeatureManager(ToggleableFeature.class);
+ manager.enableAll();
+ TestFeatureManagerProvider.setFeatureManager(manager);
}
- try (ByteArrayInputStream fis = new ByteArrayInputStream(translatedZipFile);BufferedInputStream bis = new BufferedInputStream(fis);
- ZipInputStream zis = new ZipInputStream(bis)) {
- ZipEntry entry;
- String name;
- String expected;
- String actual;
- while ((entry = zis.getNextEntry()) != null) {
+ public static void disableToggleableFeatures() {
+ manager.disableAll();
+ manager = null;
+ TestFeatureManagerProvider.setFeatureManager(null);
+ }
- name = entry.getName()
- .substring(entry.getName().lastIndexOf(File.separator) + 1, entry.getName().length());
- if (expectedResultFileNameSet.contains(name)) {
- expected = new String(expectedResultMap.get(name)).trim().replace("\r", "");
- actual = new String(FileUtils.toByteArray(zis)).trim().replace("\r", "");
- assertEquals("difference in file: " + name, expected, actual);
+ protected void testTranslationWithInit(String path) throws IOException {
+ byte[] translatedZipFile = initTranslatorAndTranslate(path);
+ testTranslation(path, translatedZipFile);
+ }
- expectedResultFileNameSet.remove(name);
- }
- }
- if (expectedResultFileNameSet.isEmpty()) {
- expectedResultFileNameSet.forEach(System.out::println);
- }
+ protected byte[] initTranslatorAndTranslate(String path) throws IOException {
+ HeatToToscaTranslator heatToToscaTranslator = HeatToToscaTranslatorFactory.getInstance().createInterface();
+ return translateZipFile(path, heatToToscaTranslator);
}
- assertEquals(0, expectedResultFileNameSet.size());
- }
-
- private byte[] translateZipFile(String basePath, HeatToToscaTranslator heatToToscaTranslator) throws IOException {
- URL inputFilesUrl = this.getClass().getResource(basePath + IN_POSTFIX);
- String path = inputFilesUrl.getPath();
- TestUtils.addFilesToTranslator(heatToToscaTranslator, path);
- TranslatorOutput translatorOutput = heatToToscaTranslator.translate();
- Assert.assertNotNull(translatorOutput);
- if (MapUtils.isNotEmpty(translatorOutput.getErrorMessages()) && MapUtils.isNotEmpty(
- MessageContainerUtil
- .getMessageByLevel(ErrorLevel.ERROR, translatorOutput.getErrorMessages()))) {
- throw new CoreException((new ErrorCode.ErrorCodeBuilder()).withMessage(
- "Error in validation " + getErrorAsString(translatorOutput.getErrorMessages()))
- .withId("Validation Error").withCategory(ErrorCategory.APPLICATION).build());
+
+ protected void testTranslation(String basePath, byte[] translatedZipFile) throws IOException {
+
+ URL url = BaseFullTranslationTest.class.getResource(basePath + OUT_POSTFIX);
+ Set<String> expectedResultFileNameSet = new HashSet<>();
+ Map<String, byte[]> expectedResultMap = new HashMap<>();
+
+ String path = url.getPath();
+ File pathFile = new File(path);
+ File[] files = pathFile.listFiles();
+ Assert.assertNotNull("manifest files is empty", files);
+ for (File expectedFile : files) {
+ expectedResultFileNameSet.add(expectedFile.getName());
+ try (FileInputStream input = new FileInputStream(expectedFile)) {
+ expectedResultMap.put(expectedFile.getName(), FileUtils.toByteArray(input));
+ }
+ }
+
+ try (ByteArrayInputStream fis = new ByteArrayInputStream(translatedZipFile);
+ BufferedInputStream bis = new BufferedInputStream(fis); ZipInputStream zis = new ZipInputStream(bis)) {
+ ZipEntry entry;
+ String name;
+ String expected;
+ String actual;
+
+ while ((entry = zis.getNextEntry()) != null) {
+
+ name = entry.getName()
+ .substring(entry.getName().lastIndexOf(File.separator) + 1, entry.getName().length());
+ if (expectedResultFileNameSet.contains(name)) {
+ expected = new String(expectedResultMap.get(name)).trim().replace("\r", "");
+ actual = new String(FileUtils.toByteArray(zis)).trim().replace("\r", "");
+ assertEquals("difference in file: " + name, expected, actual);
+
+ expectedResultFileNameSet.remove(name);
+ }
+ }
+ if (expectedResultFileNameSet.isEmpty()) {
+ expectedResultFileNameSet.forEach(System.out::println);
+ }
+ }
+ assertEquals(0, expectedResultFileNameSet.size());
}
- byte[] data = new ToscaFileOutputServiceCsarImpl().createOutputFile(translatorOutput.getToscaServiceModel(), null);
+ private byte[] translateZipFile(String basePath, HeatToToscaTranslator heatToToscaTranslator) throws IOException {
+ URL inputFilesUrl = this.getClass().getResource(basePath + IN_POSTFIX);
+ String path = inputFilesUrl.getPath();
+ TestUtils.addFilesToTranslator(heatToToscaTranslator, path);
+ TranslatorOutput translatorOutput = heatToToscaTranslator.translate();
+ Assert.assertNotNull(translatorOutput);
+ if (MapUtils.isNotEmpty(translatorOutput.getErrorMessages()) && MapUtils.isNotEmpty(
+ MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, translatorOutput.getErrorMessages()))) {
+ throw new CoreException((new ErrorCode.ErrorCodeBuilder()).withMessage(
+ "Error in validation " + getErrorAsString(translatorOutput.getErrorMessages()))
+ .withId("Validation Error")
+ .withCategory(ErrorCategory.APPLICATION).build());
+ }
- return data;
- }
+ byte[] data =
+ new ToscaFileOutputServiceCsarImpl().createOutputFile(translatorOutput.getToscaServiceModel(), null);
- private String getErrorAsString(Map<String, List<ErrorMessage>> errorMessages) {
- StringBuilder sb = new StringBuilder();
- errorMessages.entrySet().forEach(
- entry -> sb.append("File:").append(entry.getKey()).append(System.lineSeparator())
- .append(getErrorList(entry.getValue())));
+ return data;
+ }
- return sb.toString();
- }
+ private String getErrorAsString(Map<String, List<ErrorMessage>> errorMessages) {
+ StringBuilder sb = new StringBuilder();
+ errorMessages.entrySet().forEach(
+ entry -> sb.append("File:").append(entry.getKey()).append(System.lineSeparator())
+ .append(getErrorList(entry.getValue())));
- private String getErrorList(List<ErrorMessage> errors) {
- StringBuilder sb = new StringBuilder();
- errors.forEach(
- error -> sb.append(error.getMessage()).append("[").append(error.getLevel()).append("]")
- .append(System.lineSeparator()));
- return sb.toString();
- }
+ return sb.toString();
+ }
+
+ private String getErrorList(List<ErrorMessage> errors) {
+ StringBuilder sb = new StringBuilder();
+ errors.forEach(error -> sb.append(error.getMessage()).append("[").append(error.getLevel()).append("]")
+ .append(System.lineSeparator()));
+ return sb.toString();
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-impl/pom.xml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-impl/pom.xml
deleted file mode 100644
index 8b59f02f95..0000000000
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-impl/pom.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://maven.apache.org/POM/4.0.0"
- 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>
-
- <name>openecomp-sdc-translator-impl</name>
- <artifactId>openecomp-sdc-translator-impl</artifactId>
-
-
- <parent>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
- <version>1.2.0-SNAPSHOT</version>
- <relativePath>../..</relativePath>
- </parent>
-
- <dependencies>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <version>${logback.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-translator-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc.core</groupId>
- <artifactId>openecomp-heat-lib</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc.core</groupId>
- <artifactId>openecomp-tosca-lib</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!-- need to be changed to sdk -->
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-translator-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-sdk/pom.xml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-sdk/pom.xml
deleted file mode 100644
index 6e48011eb2..0000000000
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-sdk/pom.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://maven.apache.org/POM/4.0.0"
- 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>
-
- <name>openecomp-sdc-translator-sdk</name>
- <artifactId>openecomp-sdc-translator-sdk</artifactId>
-
-
- <parent>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
- <version>1.2.0-SNAPSHOT</version>
- <relativePath>../..</relativePath>
- </parent>
-
- <dependencies>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <version>${logback.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-translator-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc.core</groupId>
- <artifactId>openecomp-heat-lib</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc.core</groupId>
- <artifactId>openecomp-tosca-lib</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/pom.xml b/openecomp-be/lib/openecomp-sdc-translator-lib/pom.xml
index bf7f5aa957..814b152daf 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/pom.xml
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/pom.xml
@@ -16,9 +16,7 @@
<modules>
<module>openecomp-sdc-translator-api</module>
- <module>openecomp-sdc-translator-sdk</module>
<module>openecomp-sdc-translator-core</module>
- <module>openecomp-sdc-translator-impl</module>
</modules>
<dependencies>