From 5b05708e3dec3200eb0d996e45c76a049038ca09 Mon Sep 17 00:00:00 2001 From: sebdet Date: Tue, 1 Sep 2020 23:47:27 +0200 Subject: [PATCH] Optimize Build Optimize the time required to compute the tests so that the build can be faster Issue-ID: SDC-3232 Signed-off-by: sebdet Change-Id: I0ccbc3a0f9d895e75dcf5e4c1ef35ebf3ba06808 Signed-off-by: sebdet --- catalog-be/pom.xml | 7 ++++ catalog-dao/pom.xml | 11 ++++- .../onap-configuration-management-core/pom.xml | 1 - .../onap-generic-artifact-browser-service/pom.xml | 10 ----- integration-tests/pom.xml | 25 +++++------ .../backend/ci/tests/api/ComponentBaseTest.java | 10 ++--- .../ci/tests/utils/general/FileHandling.java | 2 +- .../ci/tests/execute/setup/SetupCDTest.java | 8 ++-- .../frontend/ci/tests/utilities/FileHandling.java | 2 +- .../src/test/resources/ci/conf/sdc-conf.yaml | 2 +- .../ci/testSuites/frontend/onapUiSanity.xml | 48 +++++++++++----------- onboarding/pom.xml | 4 -- .../vnf-repository-rest-services/pom.xml | 10 ----- pom.xml | 8 ++-- 14 files changed, 69 insertions(+), 79 deletions(-) diff --git a/catalog-be/pom.xml b/catalog-be/pom.xml index 61a40e4ee2..4eb05e6d0a 100644 --- a/catalog-be/pom.xml +++ b/catalog-be/pom.xml @@ -752,6 +752,13 @@ ${project.artifactId}-${project.version} + + org.apache.maven.plugins + maven-surefire-plugin + + 1 + + maven-dependency-plugin diff --git a/catalog-dao/pom.xml b/catalog-dao/pom.xml index 52a317dd74..4634ce30f9 100644 --- a/catalog-dao/pom.xml +++ b/catalog-dao/pom.xml @@ -345,7 +345,15 @@ Modifications copyright (c) 2018 Nokia - + + + org.apache.maven.plugins + maven-surefire-plugin + + 1 + + + - - - - diff --git a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/api/ComponentBaseTest.java b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/api/ComponentBaseTest.java index 71c8db0f8e..985d161dd6 100644 --- a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/api/ComponentBaseTest.java +++ b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/api/ComponentBaseTest.java @@ -7,9 +7,9 @@ * 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. @@ -68,7 +68,7 @@ public abstract class ComponentBaseTest { protected static Logger logger = LogManager.getLogger(ComponentBaseTest.class); - protected static final String REPORT_FOLDER = "target" + File.separator + "ExtentReport" + File.separator; + protected static final String REPORT_FOLDER = "target" + File.separator + "ExtentReport" + File.separator + "API" + File.separator; private static final String REPORT_FILE_NAME = "SDC_CI_Extent_Report.html"; public static Config config; protected static ITestContext myContext; @@ -108,7 +108,7 @@ public abstract class ComponentBaseTest { @BeforeMethod(alwaysRun = true) public void setupBeforeTest(java.lang.reflect.Method method, ITestContext context) throws Exception { if (!"onboardVNFShotFlow".equals(method.getName()) && - !"onboardPNFFlow".equals(method.getName()) ) { + !"onboardPNFFlow".equals(method.getName())) { logger.info("ExtentReport instance started from BeforeMethod..."); ExtentTestManager.startTest(method.getName()); ExtentTestManager.assignCategory(this.getClass()); @@ -186,7 +186,7 @@ public abstract class ComponentBaseTest { List genericCollection = new ArrayList<>(); - if(resourcesArrayList.get(0) != null) { + if (resourcesArrayList.get(0) != null) { ComponentTypeEnum componentTypeEnum = resourcesArrayList.get(0).getComponentType(); resourcesArrayList.stream().filter(Objects::nonNull). filter(s -> s.getName().toLowerCase().startsWith("ci") && !s.getName().toLowerCase().equals("cindervolume")). diff --git a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/utils/general/FileHandling.java b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/utils/general/FileHandling.java index 5cb55fd91c..19533e90f1 100644 --- a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/utils/general/FileHandling.java +++ b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/utils/general/FileHandling.java @@ -312,7 +312,7 @@ public class FileHandling { public static void createDirectory(String directoryPath) { File directory = new File(String.valueOf(directoryPath)); if (! directory.exists()){ - directory.mkdir(); + directory.mkdirs(); } } diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/setup/SetupCDTest.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/setup/SetupCDTest.java index 9f5a7cc7cd..18b5a71061 100644 --- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/setup/SetupCDTest.java +++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/setup/SetupCDTest.java @@ -24,11 +24,13 @@ import ch.qos.logback.classic.Level; import ch.qos.logback.classic.LoggerContext; import com.aventstack.extentreports.ExtentTest; import com.aventstack.extentreports.Status; + import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.Arrays; import java.util.UUID; + import net.lightbody.bmp.core.har.Har; import org.json.simple.JSONObject; import org.onap.sdc.backend.ci.tests.config.UserCredentialsFromFile; @@ -75,7 +77,7 @@ public abstract class SetupCDTest extends DriverFactory { private static final String CREDENTIALS_FILE = "credentials.yaml"; private static final String REPORT_FILE_NAME = "SDC_UI_Extent_Report.html"; - private static final String REPORT_FOLDER = "target" + File.separator + "ExtentReport" + File.separator; + private static final String REPORT_FOLDER = "target" + File.separator + "ExtentReport" + File.separator + "UI" + File.separator; private static final String SCREENSHOT_FOLDER = REPORT_FOLDER + "screenshots" + File.separator; private static final String HAR_FILES_FOLDER_NAME = "har_files"; private static final String HAR_FILES_FOLDER = REPORT_FOLDER + HAR_FILES_FOLDER_NAME + File.separator; @@ -392,7 +394,7 @@ public abstract class SetupCDTest extends DriverFactory { private void loginWithUser(final UserRoleEnum role) { try { final String msg = String - .format("Login as user '%s', role '%s'", role.getUserId(), role.getUserRole()); + .format("Login as user '%s', role '%s'", role.getUserId(), role.getUserRole()); getExtendTest().log(Status.INFO, msg); LOGGER.info(msg); loginToSystem(role); @@ -423,7 +425,7 @@ public abstract class SetupCDTest extends DriverFactory { LOGGER.info(String.format("Setup before test for role '%s'", role.name())); if (!getWindowTest().getPreviousRole().equalsIgnoreCase(role.name())) { LOGGER.info(String.format("Logging in with new role '%s'. Previous role was: '%s'.", role.name(), - getWindowTest().getPreviousRole())); + getWindowTest().getPreviousRole())); navigateAndLogin(role); } } diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/FileHandling.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/FileHandling.java index bb058e4fca..b7f199d1b8 100644 --- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/FileHandling.java +++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/FileHandling.java @@ -304,7 +304,7 @@ public class FileHandling { public static void createDirectory(String directoryPath) { File directory = new File(String.valueOf(directoryPath)); if (!directory.exists()) { - directory.mkdir(); + directory.mkdirs(); } } diff --git a/integration-tests/src/test/resources/ci/conf/sdc-conf.yaml b/integration-tests/src/test/resources/ci/conf/sdc-conf.yaml index cea230e309..5303e3b120 100644 --- a/integration-tests/src/test/resources/ci/conf/sdc-conf.yaml +++ b/integration-tests/src/test/resources/ci/conf/sdc-conf.yaml @@ -5,7 +5,7 @@ remoteTestingMachinePort: 4444 remoteTesting: true useBrowserMobProxy: false captureTraffic: false -downloadAutomationFolder: target/automationDownloadDir +downloadAutomationFolder: /tmp/sdc-integration-tests/downloadAutomation uiSimulator: true #### Local Front end testing diff --git a/integration-tests/src/test/resources/ci/testSuites/frontend/onapUiSanity.xml b/integration-tests/src/test/resources/ci/testSuites/frontend/onapUiSanity.xml index a9d56619da..47dc9f6960 100644 --- a/integration-tests/src/test/resources/ci/testSuites/frontend/onapUiSanity.xml +++ b/integration-tests/src/test/resources/ci/testSuites/frontend/onapUiSanity.xml @@ -1,30 +1,30 @@ + data-provider-thread-count="1"> - + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/onboarding/pom.xml b/onboarding/pom.xml index 4ccb3d831b..2d7927e56b 100644 --- a/onboarding/pom.xml +++ b/onboarding/pom.xml @@ -309,10 +309,7 @@ org.apache.maven.plugins maven-surefire-plugin - ${maven-surefire-plugin.version} - ${fork.count} - ${fork.mode} false ${project.basedir}/src/test/resources @@ -323,7 +320,6 @@ ${project.basedir}/configuration - ${useSystemClassLoader} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vnf-repository-rest-services/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vnf-repository-rest-services/pom.xml index 44ea11c091..d1269cf70c 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vnf-repository-rest-services/pom.xml +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vnf-repository-rest-services/pom.xml @@ -89,14 +89,4 @@ - - - - org.apache.maven.plugins - maven-surefire-plugin - ${maven-surefire-plugin.version} - - - - diff --git a/pom.xml b/pom.xml index 08a6dc9c8b..ea422e0247 100644 --- a/pom.xml +++ b/pom.xml @@ -156,15 +156,14 @@ Modifications copyright (c) 2018-2019 Nokia ${project.version}-${maven.build.timestamp} 2.4.1.Final - 2.9.9 - 1.6.0 0.8.5 - 4.5.1 + 1C + true @@ -513,6 +512,9 @@ Modifications copyright (c) 2018-2019 Nokia ${project.build.directory}/jacoco.exec + ${surefire.forkCount} + ${surefire.reuseForks} + methods -- 2.16.6