diff options
author | 2017-12-10 18:55:03 +0200 | |
---|---|---|
committer | 2017-12-10 19:33:38 +0200 | |
commit | 51d50f0ef642e0f996a1c8b8d2ef4838bdfec892 (patch) | |
tree | 3ac236a864d74d19b0f5c9020891a7a7e5c31b44 /test-apis-ci/src/main/java/org/openecomp/sdc/ci | |
parent | b5cc2e0695f195716d6ccdc65e73807a6632ec70 (diff) |
Final commit to master merge from
Change-Id: Ib464f9a8828437c86fe6def8af238aaf83473507
Issue-ID: SDC-714
Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'test-apis-ci/src/main/java/org/openecomp/sdc/ci')
135 files changed, 2177 insertions, 1078 deletions
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java index fcbf3b2fee..a49d5c61fe 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java @@ -20,13 +20,21 @@ package org.openecomp.sdc.ci.tests.api; -import com.aventstack.extentreports.ExtentTest; -import com.aventstack.extentreports.Status; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.TitanVertex; +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertNotNull; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.function.Consumer; +import java.util.stream.Collectors; + import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.ImmutableTriple; import org.apache.tinkerpop.gremlin.structure.Direction; @@ -37,7 +45,11 @@ import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.Product; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; @@ -47,7 +59,13 @@ import org.openecomp.sdc.ci.tests.utils.cassandra.CassandraUtils; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.general.FileHandling; -import org.openecomp.sdc.ci.tests.utils.rest.*; +import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; +import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils; +import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils; +import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils; +import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; +import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; +import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.ITestContext; @@ -57,31 +75,21 @@ import org.testng.annotations.AfterMethod; import org.testng.annotations.AfterSuite; import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeSuite; -import org.testng.annotations.Test; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.*; -import java.util.function.Consumer; -import java.util.stream.Collectors; - -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertNotNull; +import com.aventstack.extentreports.ExtentTest; +import com.aventstack.extentreports.Status; +import com.thinkaurelius.titan.core.TitanFactory; +import com.thinkaurelius.titan.core.TitanGraph; +import com.thinkaurelius.titan.core.TitanVertex; +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.LoggerContext; public abstract class ComponentBaseTest { -// private static Logger logger = LoggerFactory.getLogger(ComponentBaseTest.class.getName()); - protected static Logger logger= LoggerFactory.getLogger(ComponentBaseTest.class); - - -// public ComponentBaseTest(TestName testName, String className) { -// super(testName, className); -// } + protected static Logger logger= LoggerFactory.getLogger(ComponentBaseTest.class); protected static final String REPORT_FOLDER = "." + File.separator + "ExtentReport" + File.separator; private static final String VERSIONS_INFO_FILE_NAME = "versions.info"; private static final String REPORT_FILE_NAME = "SDC_CI_Extent_Report.html"; @@ -93,7 +101,8 @@ public abstract class ComponentBaseTest { /**************** METHODS ****************/ public static ExtentTest getExtendTest() { - return ExtentTestManager.getTest(); + SomeInterface testManager = new ExtentTestManager(); + return testManager.getTest(); } public static enum ComponentOperationEnum { @@ -101,16 +110,12 @@ public abstract class ComponentBaseTest { }; public ComponentBaseTest(TestName name, String name2) { - // TODO Auto-generated constructor stub -// LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); -// lc.getLogger("com.thinkaurelius").setLevel(Level.INFO); -// lc.getLogger("com.datastax").setLevel(Level.INFO); -// lc.getLogger("io.netty").setLevel(Level.INFO); -// lc.getLogger("c.d").setLevel(Level.INFO); -// lc.getLogger("o.a.h").setLevel(Level.INFO); -// lc.getLogger("o.o.s.c.t.d.h").setLevel(Level.INFO); - -} + LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); + lc.getLogger("com.thinkaurelius").setLevel(Level.INFO); + lc.getLogger("com.datastax").setLevel(Level.INFO); + lc.getLogger("io.netty").setLevel(Level.INFO); + lc.getLogger("c.d").setLevel(Level.INFO); + } public static String getReportFolder() { return REPORT_FOLDER; @@ -124,33 +129,26 @@ public abstract class ComponentBaseTest { AtomicOperationUtils.createDefaultConsumer(true); openTitanLogic(); performClean(); - - String basePath = FileHandling.getBasePath(); - String csarDir = FileHandling.getCreateDirByName("outputCsar"); - FileUtils.cleanDirectory(new File(csarDir)); + + + } @BeforeMethod(alwaysRun = true) - public void setBrowserBeforeTest(java.lang.reflect.Method method, ITestContext context) throws Exception { + public void setupBeforeTest(java.lang.reflect.Method method, ITestContext context) throws Exception { - -// String suiteName = ExtentManager.getSuiteName(context); -// ExtentTestManager.startTest(method.getName()); -// ExtentTestManager.assignCategory(this.getClass()); - - boolean emptyDataProvider = method.getAnnotation(Test.class).dataProvider().isEmpty(); - String className = method.getDeclaringClass().getName(); System.out.println(" method.getName() " + method.getName()); if (!method.getName().equals("onboardVNFShotFlow")) { - System.out.println("ExtentReport instance started from BeforeMethod..."); +// System.out.println("ExtentReport instance started from BeforeMethod..."); + logger.info("ExtentReport instance started from BeforeMethod..."); ExtentTestManager.startTest(method.getName()); ExtentTestManager.assignCategory(this.getClass()); } else { - System.out.println("ExtentReport instance started from Test..."); +// System.out.println("ExtentReport instance started from Test..."); + logger.debug("ExtentReport instance started from Test..."); } - } @AfterMethod(alwaysRun = true) @@ -187,8 +185,13 @@ public abstract class ComponentBaseTest { @AfterClass(alwaysRun = true) public synchronized static void cleanAfterClass() throws Exception{ +// System.out.println("<<<<<<<<class name>>>>>"+method.getDeclaringClass()); +// System.out.println("<<<<<<<<class name>>>>>"+method.getName()); + + System.out.println("delete components AfterClass"); deleteCreatedComponents(getCatalogAsMap()); +// extentReport.flush(); } @@ -197,6 +200,7 @@ public abstract class ComponentBaseTest { performClean(); shutdownTitanLogic(); + } protected static void openTitanLogic() throws Exception { @@ -228,8 +232,14 @@ public abstract class ComponentBaseTest { protected static void performClean() throws Exception, FileNotFoundException { // cleanComponents(); - deleteCreatedComponents(getCatalogAsMap()); - CassandraUtils.truncateAllKeyspaces(); + if(!config.getSystemUnderDebug()){ + deleteCreatedComponents(getCatalogAsMap()); + CassandraUtils.truncateAllKeyspaces(); + FileHandling.overWriteExistindDir("outputCsar"); + + }else{ + System.out.println("Accordindig to configuration components will not be deleted, in case to unable option to delete, please change systemUnderDebug parameter value to false ..."); + } } public void verifyErrorCode(RestResponse response, String action, int expectedCode) { @@ -372,13 +382,14 @@ public abstract class ComponentBaseTest { titanGraph.tx().commit(); String adminId = UserRoleEnum.ADMIN.getUserId(); - String productStrategistId = UserRoleEnum.PRODUCT_STRATEGIST1.getUserId(); + /* String productStrategistId = UserRoleEnum.PRODUCT_STRATEGIST1.getUserId();*/ // Component delete - for (String id : productsToDelete) { + +/* for (String id : productsToDelete) { RestResponse deleteProduct = ProductRestUtils.deleteProduct(id, productStrategistId); - } + }*/ for (String id : servicesToDelete) { RestResponse deleteServiceById = ServiceRestUtils.deleteServiceById(id, adminId); @@ -394,7 +405,7 @@ public abstract class ComponentBaseTest { } // Categories delete - product - String componentType = BaseRestUtils.PRODUCT_COMPONENT_TYPE; + /*String componentType = BaseRestUtils.PRODUCT_COMPONENT_TYPE; for (ImmutableTriple<String, String, String> triple : productGroupingsToDelete) { CategoryRestUtils.deleteGrouping(triple.getRight(), triple.getMiddle(), triple.getLeft(), productStrategistId, componentType); } @@ -403,10 +414,10 @@ public abstract class ComponentBaseTest { } for (String id : productCategoriesToDelete) { CategoryRestUtils.deleteCategory(id, productStrategistId, componentType); - } + }*/ // Categories delete - resource - componentType = BaseRestUtils.RESOURCE_COMPONENT_TYPE; + String componentType = BaseRestUtils.RESOURCE_COMPONENT_TYPE; for (ImmutablePair<String, String> pair : resourceSubsToDelete) { CategoryRestUtils.deleteSubCategory(pair.getRight(), pair.getLeft(), adminId, componentType); } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentInstanceBaseTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentInstanceBaseTest.java index 47efca66d0..4fe9d623b2 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentInstanceBaseTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentInstanceBaseTest.java @@ -33,8 +33,8 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.function.Function; import java.util.Set; +import java.util.function.Function; import java.util.stream.Collectors; import org.apache.commons.lang3.tuple.ImmutablePair; @@ -46,7 +46,7 @@ import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Product; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; @@ -641,7 +641,7 @@ public class ComponentInstanceBaseTest extends ComponentBaseTest { private void deleteAssociatedFromExpected(RequirementCapabilityRelDef requirementDef) { // removing from requirements - RequirementAndRelationshipPair relationship = requirementDef.getRelationships().get(0); + RelationshipInfo relationship = requirementDef.getRelationships().get(0).getRelation(); String type = relationship.getRelationship().getType(); String fromId = requirementDef.getFromNode(); List<RequirementDefinition> reqList = expectedContainerRequirements.get(type); @@ -729,7 +729,7 @@ public class ComponentInstanceBaseTest extends ComponentBaseTest { private void addDissociatedToExpected(RequirementCapabilityRelDef requirementDef) { // adding to requirements - RequirementAndRelationshipPair relationship = requirementDef.getRelationships().get(0); + RelationshipInfo relationship = requirementDef.getRelationships().get(0).getRelation(); String type = relationship.getRelationship().getType(); String fromId = requirementDef.getFromNode(); Map<String, List<RequirementDefinition>> map = removedRequirements.get(fromId); diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentManager.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentManager.java index 335b787430..26edee9c7f 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentManager.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentManager.java @@ -20,19 +20,19 @@ package org.openecomp.sdc.ci.tests.api; -import com.aventstack.extentreports.ExtentReports; -import com.aventstack.extentreports.reporter.ExtentHtmlReporter; -import com.aventstack.extentreports.reporter.ExtentXReporter; -import com.aventstack.extentreports.reporter.configuration.Protocol; -import com.aventstack.extentreports.reporter.configuration.Theme; -import org.openecomp.sdc.ci.tests.config.Config; +import java.io.File; +import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.FileHandling; import org.openecomp.sdc.ci.tests.utils.rest.AutomationUtils; import org.testng.ITestContext; -import java.io.File; +import com.aventstack.extentreports.ExtentReports; +import com.aventstack.extentreports.reporter.ExtentHtmlReporter; +import com.aventstack.extentreports.reporter.ExtentXReporter; +import com.aventstack.extentreports.reporter.configuration.Protocol; +import com.aventstack.extentreports.reporter.configuration.Theme; public class ExtentManager { @@ -40,7 +40,12 @@ public class ExtentManager { private static ExtentReports extent; private static ExtentHtmlReporter htmlReporter; private static ExtentXReporter extentxReporter; - + private static final String icon = "$(document).ready(function() {" +"\n"+ + "$('.brand-logo').html('').prepend(\"<span><img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQ4AAAB7CAYAAACFKW5jAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH3wwXFAQf1clFIAAANNxJREFUeNrtnXeYXVXV/z+n3To101ImvZFGQiCANKUoSBEFebEj1hcb2MWC+lpAbGD5CaKoiL2ggIgoRUIgQAohJCG9TTLJ9Dszt52y9++PfSeZTO6duXfmTkk4n+eZJ5Nbztn7zNnrrL32Wt8NPj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+PgOjjXYDhpX7WgkZMD2qY2qQFtDlSkSvjlsaGJpGUIeQAS1pyb60hMurRrv1Pj5jFnO0G1As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U6OkhlaWdodAAyNjLFg9PDAAAAF3RFWHRUaHVtYjo6SW1hZ2U6OldpZHRoADU3Mz0hlMwAAAAZdEVYdFRodW1iOjpNaW1ldHlwZQBpbWFnZS9zdme/73BOAAAAF3RFWHRUaHVtYjo6TVRpbWUAMTQ1MDkwMTA3McPsyX0AAAAPdEVYdFRodW1iOjpTaXplADBCQpSiPuwAAABIdEVYdFRodW1iOjpVUkkAZmlsZTovLy90bXAvdmlnbmV0dGUvYzFkNDRkZjYtYzVkNi00OTAwLThkMGEtZDQ5ZWYzMGJkYTcxLnN2Z4N+SbEAAAAASUVORK5CYII=' style='display: block; margin-left: auto; margin-right: auto; margin-top: 7px; width: 89px;'/></span>\").width(\"120px\").css(\"float\",\"left\").css(\"padding-left\",\"0\");$('.report-name').css(\"font-weight\",\"bold\");"+"\n"+ +// "$('.logo-content' ).remove();"+"\n"+ +// "$('#slide-out li:first-child').on('click', function(){ $('#charts-row').hide() }) ; $('#slide-out li:last-child').on('click', function(){ $('#charts-row').show() });"+"\n"+ +// "$('.charts div:nth-child(2)').remove();"+"\n"+ + "})"; public enum suiteNameXml { @@ -145,7 +150,7 @@ public class ExtentManager { // htmlReporter.config().setReportName(AutomationUtils.getATTVersion()); htmlReporter.config().setReportName("SDC Automation Report"); htmlReporter.config().setChartVisibilityOnOpen(false); -// htmlReporter.config().setJS(icon); + htmlReporter.config().setJS(icon); return htmlReporter; } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentTestActions.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentTestActions.java index f865ef1699..045d565a41 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentTestActions.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentTestActions.java @@ -20,25 +20,26 @@ package org.openecomp.sdc.ci.tests.api; +import java.io.File; + import com.aventstack.extentreports.ExtentTest; -import com.aventstack.extentreports.MediaEntityBuilder; import com.aventstack.extentreports.Status; import com.aventstack.extentreports.markuputils.ExtentColor; import com.aventstack.extentreports.markuputils.Markup; import com.aventstack.extentreports.markuputils.MarkupHelper; -import java.io.File; - public class ExtentTestActions { + public static SomeInterface testManager = new ExtentTestManager(); + public static void log(Status logStatus, Markup mark){ - ExtentTest test = ExtentTestManager.getTest(); + ExtentTest test = testManager.getTest(); test.log(logStatus, mark); } public static void log(Status logStatus, String message){ - ExtentTest test = ExtentTestManager.getTest(); + ExtentTest test = testManager.getTest(); test.log(logStatus, message); } @@ -47,7 +48,7 @@ public class ExtentTestActions { } public static void log(Status logStatus, Throwable throwabel){ - ExtentTest test = ExtentTestManager.getTest(); + ExtentTest test = testManager.getTest(); test.log(logStatus, throwabel); } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentTestManager.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentTestManager.java index 3d8c6a999e..b525150af4 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentTestManager.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ExtentTestManager.java @@ -20,17 +20,20 @@ package org.openecomp.sdc.ci.tests.api; -import com.aventstack.extentreports.ExtentReports; -import com.aventstack.extentreports.ExtentTest; - import java.util.HashMap; -public class ExtentTestManager { +import com.aventstack.extentreports.ExtentReports; +import com.aventstack.extentreports.ExtentTest; +public class ExtentTestManager implements SomeInterface{ private static HashMap<Long, ExtentTest> extentTestMap = new HashMap<Long, ExtentTest>(); private static ExtentReports extent = ExtentManager.getReporter(); - - public static synchronized ExtentTest getTest() { + + public ExtentTestManager(){ + } + + @Override + public synchronized ExtentTest getTest() { return extentTestMap.get(Thread.currentThread().getId()); } @@ -54,7 +57,7 @@ public class ExtentTestManager { String[] parts = clazz.getName().split("\\."); String lastOne1 = parts[parts.length-1]; String lastOne2 = parts[parts.length-2]; - getTest().assignCategory(lastOne2 + "-" + lastOne1); + extentTestMap.get(Thread.currentThread().getId()).assignCategory(lastOne2 + "-" + lastOne1); } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/SomeInterface.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/SomeInterface.java new file mode 100644 index 0000000000..e71a16b37d --- /dev/null +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/SomeInterface.java @@ -0,0 +1,9 @@ +package org.openecomp.sdc.ci.tests.api; + +import com.aventstack.extentreports.ExtentTest; + +public interface SomeInterface { + + abstract ExtentTest getTest(); + +} diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java index 15a1eb783a..fd6e9eebc0 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java @@ -142,7 +142,7 @@ public interface Urls { final String GET_FOLLWED_LIST = "http://%s:%s/sdc2/rest/v1/followed"; - final String GET_CATALOG_DATA = "http://%s:%s/sdc2/rest/v1/screen"; + final String GET_CATALOG_DATA = "http://%s:%s/sdc2/rest/v1/screen/?excludeTypes=VFCMT&excludeTypes=Configuration"; // *****************************************Resources // ********************************************************************** @@ -179,6 +179,7 @@ public interface Urls { final String CHANGE_COMPONENT_LIFECYCLE_STATE = "http://%s:%s/sdc2/rest/v1/catalog/%s/%s/lifecycleState/%s"; final String CREATE_PROPERTY = "http://%s:%s/sdc2/rest/v1/catalog/resources/%s/properties"; + final String DECLARE_PROPERTIES = "http://%s:%s/sdc2/rest/v1/catalog/%s/%s/create/inputs"; final String UPDATE_RESOURCE_METADATA = "http://%s:%s/sdc2/rest/v1/catalog/resources/%s/metadata"; @@ -285,6 +286,7 @@ public interface Urls { final String DISTRIBUTION_DOWNLOAD_ARTIFACT = "http://%s:%s/download"; final String ACTIVATE_DISTRIBUTION = "http://%s:%s/sdc2/rest/v1/catalog/services/%s/distribution/%s/activate"; final String DISTRIBUTION_SERVICE_LIST = "http://%s:%s/sdc2/rest/v1/catalog/services/%s/distribution"; + final String DISTRIBUTION_SERVICE_MONITOR = "http://%s:%s/sdc2/rest/v1/catalog/services/distribution/%s"; final String DEPLOY_SERVICE = "http://%s:%s/sdc2/rest/v1/catalog/services/%s/distribution/%s/markDeployed"; final String UPDATE_SERVICE_METADATA = "http://%s:%s/sdc2/rest/v1/catalog/services/%s/metadata"; @@ -366,5 +368,22 @@ public interface Urls { // amdocs APIs final String GET_VENDOR_SOFTWARE_PRODUCT = "http://%s:%s/onboarding-api/v1.0/vendor-software-products/packages/%s"; - + final String UPLOAD_SNMP_POLL_ARTIFACT = "http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/uploads/types/SNMP_POLL"; + final String UPLOAD_SNMP_TRAP_ARTIFACT = "http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/uploads/types/SNMP_TRAP"; + final String UPLOAD_VES_EVENTS_ARTIFACT = "http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/uploads/types/VES_EVENTS"; + final String UPLOAD_AMDOCS_ARTIFACT = "http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/uploads/types/%s"; + final String DELETE_AMDOCS_ARTIFACT_BY_TYPE = "http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/monitors/%s"; + final String GET_VSP_COMPONENTS = "http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components"; + final String CREATE_VENDOR_LISENCE_MODELS = "http://%s:%s/onboarding-api/v1.0/vendor-license-models"; + final String CREATE_VENDOR_LISENCE_AGREEMENT = "http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/license-agreements"; + final String CREATE_VENDOR_LISENCE_FEATURE_GROUPS = "http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/feature-groups"; + final String CREATE_VENDOR_LISENCE_ENTITLEMENT_POOL = "http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/entitlement-pools"; + final String CREATE_VENDOR_LISENCE_KEY_GROUPS = "http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/license-key-groups"; + final String CREATE_VENDOR_SOFTWARE_PRODUCT = "http://%s:%s/onboarding-api/v1.0/vendor-software-products"; + final String VALIDATE_UPLOAD = "http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/orchestration-template-candidate/process"; + final String UPLOAD_HEAT_PACKAGE = "http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/%s/orchestration-template-candidate"; + final String ACTION_ON_COMPONENT = "http://%s:%s/onboarding-api/v1.0/%s/%s/versions/%s/actions"; + final String UPDATE_VSP = "http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/%s"; + final String GET_VSP_COMPONENT_BY_VERSION = "http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/%s"; + final String GET_VLM_COMPONENT_BY_VERSION = "http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/%s"; } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/Config.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/Config.java index d2e8d14c04..7bb4602433 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/Config.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/Config.java @@ -174,7 +174,6 @@ public class Config { try { in.close(); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } } @@ -216,7 +215,6 @@ public class Config { try { in.close(); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnboardingDataProviders.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnboardingDataProviders.java index cf94c79462..fc75ffb78d 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnboardingDataProviders.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnboardingDataProviders.java @@ -1,14 +1,13 @@ package org.openecomp.sdc.ci.tests.dataProviders; -import org.openecomp.sdc.ci.tests.utils.general.FileHandling; -import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils; -import org.testng.annotations.DataProvider; - - import java.util.ArrayList; import java.util.Collections; import java.util.List; +import org.openecomp.sdc.ci.tests.utils.general.FileHandling; +import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils; +import org.testng.annotations.DataProvider; + public class OnboardingDataProviders { protected static String filepath = FileHandling.getVnfRepositoryPath(); diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnbordingDataProviders.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnbordingDataProviders.java new file mode 100644 index 0000000000..8a9171e5bd --- /dev/null +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnbordingDataProviders.java @@ -0,0 +1,76 @@ +package org.openecomp.sdc.ci.tests.dataProviders; + +import static org.testng.Assert.assertFalse; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.openecomp.sdc.ci.tests.utils.general.FileHandling; +import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils; +import org.testng.annotations.DataProvider; + +public class OnbordingDataProviders { + + protected static String filepath = FileHandling.getVnfRepositoryPath(); + +// -----------------------dataProviders----------------------------------------- + @DataProvider(name = "randomVNF_List", parallel = false) + private static final Object[][] randomVnfList() throws Exception { + int randomElementNumber = 3; //how many VNFs to onboard randomly + List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure(); + List<String> newRandomFileNamesFromFolder = getRandomElements(randomElementNumber, fileNamesFromFolder); + if(newRandomFileNamesFromFolder == null){ + assertFalse(true,"Requered number of VNF files not exists under " + filepath); + } + System.out.println(String.format("There are %s zip file(s) to test", newRandomFileNamesFromFolder.size())); + return provideData(newRandomFileNamesFromFolder, filepath); + } + + @DataProvider(name = "VNF_List" , parallel = true) + private static final Object[][] VnfList() throws Exception { + + List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList(); + + System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size())); + return provideData(fileNamesFromFolder, filepath); + } + +// -----------------------factories----------------------------------------- + + + + +// -----------------------methods----------------------------------------- + public static Object[][] provideData(List<String> fileNamesFromFolder, String filepath) { + + Object[][] arObject = new Object[fileNamesFromFolder.size()][]; + int index = 0; + for (Object obj : fileNamesFromFolder) { + arObject[index++] = new Object[] { filepath, obj }; + } + return arObject; + } + + public static List<String> getRandomElements(int randomElementNumber, List<String> fileNamesFromFolder) { + if(fileNamesFromFolder.size() == 0 || fileNamesFromFolder.size() < randomElementNumber){ + return null; + }else{ + List<Integer> indexList = new ArrayList<>(); + List<String> newRandomFileNamesFromFolder = new ArrayList<>(); + for(int i = 0; i < fileNamesFromFolder.size(); i++){ + indexList.add(i); + } + Collections.shuffle(indexList); + Integer[] randomArray = indexList.subList(0, randomElementNumber).toArray(new Integer[randomElementNumber]); + for(int i = 0; i < randomArray.length; i++){ + newRandomFileNamesFromFolder.add(fileNamesFromFolder.get(randomArray[i])); + } + return newRandomFileNamesFromFolder; + } + } + + + + +} diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/AmdocsLicenseMembers.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/AmdocsLicenseMembers.java index 9c2cfa809c..30efbc370a 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/AmdocsLicenseMembers.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/AmdocsLicenseMembers.java @@ -6,6 +6,35 @@ public class AmdocsLicenseMembers { private String vendorLicenseName; private String vendorLicenseAgreementId; private String featureGroupId; + private String licenseVersionId; + private String licenseVersionLabel; + private String version; + + public AmdocsLicenseMembers(String vendorId, String vendorLicenseName, String vendorLicenseAgreementId, + String featureGroupId, String licenseVersionId, String licenseVersionLabel) { + this.vendorId = vendorId; + this.vendorLicenseName = vendorLicenseName; + this.vendorLicenseAgreementId = vendorLicenseAgreementId; + this.featureGroupId = featureGroupId; + this.licenseVersionId = licenseVersionId; + this.licenseVersionLabel = licenseVersionLabel; + } + + public String getLicenseVersionId() { + return licenseVersionId; + } + + public void setLicenseVersionId(String licenseVersionId) { + this.licenseVersionId = licenseVersionId; + } + + public String getLicenseVersionLabel() { + return licenseVersionLabel; + } + + public void setLicenseVersionLabel(String licenseVersionLabel) { + this.licenseVersionLabel = licenseVersionLabel; + } public AmdocsLicenseMembers(String vendorId, String vendorLicenseName, String vendorLicenseAgreementId, String featureGroupId) { super(); @@ -47,10 +76,26 @@ public class AmdocsLicenseMembers { this.featureGroupId = featureGroupId; } + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + @Override public String toString() { - return "AmdocsLicenseMembers [vendorId=" + vendorId + ", vendorLicenseName=" + vendorLicenseName + ", vendorLicenseAgreementId=" + vendorLicenseAgreementId + ", featureGroupId=" + featureGroupId + "]"; + return "AmdocsLicenseMembers{" + + "vendorId='" + vendorId + '\'' + + ", vendorLicenseName='" + vendorLicenseName + '\'' + + ", vendorLicenseAgreementId='" + vendorLicenseAgreementId + '\'' + + ", featureGroupId='" + featureGroupId + '\'' + + ", licenseVersionId='" + licenseVersionId + '\'' + + ", licenseVersionLabel='" + licenseVersionLabel + '\'' + + ", version='" + version + '\'' + + '}'; } - - + + } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactAssetStructure.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactAssetStructure.java index 41936e2c30..37f6243f96 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactAssetStructure.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactAssetStructure.java @@ -49,7 +49,6 @@ public class ArtifactAssetStructure { public ArtifactAssetStructure() { super(); - // TODO Auto-generated constructor stub } public String getArtifactName() { diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactReqDetails.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactReqDetails.java index 93f65b9f63..15e1e0aab3 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactReqDetails.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactReqDetails.java @@ -22,7 +22,6 @@ package org.openecomp.sdc.ci.tests.datatypes; import java.util.List; -import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.HeatParameterDefinition; public class ArtifactReqDetails { diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ComponentInstanceReqDetails.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ComponentInstanceReqDetails.java index 549700f384..13e51a092f 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ComponentInstanceReqDetails.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ComponentInstanceReqDetails.java @@ -33,7 +33,6 @@ public class ComponentInstanceReqDetails { public ComponentInstanceReqDetails() { super(); - // TODO Auto-generated constructor stub } public ComponentInstanceReqDetails(ComponentInstance componentInstance) { diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DistributionMonitorObject.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DistributionMonitorObject.java new file mode 100644 index 0000000000..8f259f4d2b --- /dev/null +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DistributionMonitorObject.java @@ -0,0 +1,69 @@ +package org.openecomp.sdc.ci.tests.datatypes; + +public class DistributionMonitorObject { + + private String omfComponentID; + private String timestamp; + private String url; + private String status; + private String errorReason; + + public DistributionMonitorObject() { + super(); + } + + public DistributionMonitorObject(String omfComponentID, String timestamp, String url, String status, String errorReason) { + super(); + this.omfComponentID = omfComponentID; + this.timestamp = timestamp; + this.url = url; + this.status = status; + this.errorReason = errorReason; + } + + public String getOmfComponentID() { + return omfComponentID; + } + + public void setOmfComponentID(String omfComponentID) { + this.omfComponentID = omfComponentID; + } + + public String getTimestamp() { + return timestamp; + } + + public void setTimestamp(String timestamp) { + this.timestamp = timestamp; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getErrorReason() { + return errorReason; + } + + public void setErrorReason(String errorReason) { + this.errorReason = errorReason; + } + + @Override + public String toString() { + return "DistributionMonitorObject [omfComponentID=" + omfComponentID + ", timestamp=" + timestamp + ", url=" + url + ", status=" + status + ", errorReason=" + errorReason + "]"; + } + +} diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/HeatMetaFirstLevelDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/HeatMetaFirstLevelDefinition.java index 4e760227f3..88033024d5 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/HeatMetaFirstLevelDefinition.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/HeatMetaFirstLevelDefinition.java @@ -36,7 +36,6 @@ public class HeatMetaFirstLevelDefinition { public HeatMetaFirstLevelDefinition() { super(); - // TODO Auto-generated constructor stub } public String getFileName() { diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ImportReqDetails.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ImportReqDetails.java index 638ece8c6d..0089eec5a7 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ImportReqDetails.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ImportReqDetails.java @@ -32,12 +32,9 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; -import java.util.LinkedHashSet; import java.util.List; import java.util.Map; -import java.util.Set; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jettison.json.JSONArray; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/LicensingData.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/LicensingData.java new file mode 100644 index 0000000000..70bd4e8650 --- /dev/null +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/LicensingData.java @@ -0,0 +1,39 @@ +package org.openecomp.sdc.ci.tests.datatypes; +import java.util.List; + +public class LicensingData { + private String licenseAgreement; + private List<String> featureGroups = null; + + public LicensingData() { + } + + public LicensingData(String licenseAgreement, List<String> featureGroups) { + this.licenseAgreement = licenseAgreement; + this.featureGroups = featureGroups; + } + + public String getLicenseAgreement() { + return licenseAgreement; + } + + public void setLicenseAgreement(String licenseAgreement) { + this.licenseAgreement = licenseAgreement; + } + + public List<String> getFeatureGroups() { + return featureGroups; + } + + public void setFeatureGroups(List<String> featureGroups) { + this.featureGroups = featureGroups; + } + + @Override + public String toString() { + return "LicensingData{" + + "licenseAgreement='" + licenseAgreement + '\'' + + ", featureGroups=" + featureGroups + + '}'; + } +} diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/LicensingVersion.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/LicensingVersion.java new file mode 100644 index 0000000000..82838cc6b5 --- /dev/null +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/LicensingVersion.java @@ -0,0 +1,31 @@ +package org.openecomp.sdc.ci.tests.datatypes; + +public class LicensingVersion { + + private String id; + private String label; + + public LicensingVersion(String id, String label) { + this.id = id; + this.label = label; + } + + public LicensingVersion() { + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @Override + public String toString() { + return "LicensingVersion{" + + "id='" + id + '\'' + + ", label='" + label + '\'' + + '}'; + } +} diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceExternalReqDetails.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceExternalReqDetails.java index a5132e8bf6..4d5806b90f 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceExternalReqDetails.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceExternalReqDetails.java @@ -23,7 +23,6 @@ package org.openecomp.sdc.ci.tests.datatypes; import java.util.List; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.Resource; public class ResourceExternalReqDetails extends ComponentReqDetails { String vendorName; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceRespJavaObject.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceRespJavaObject.java index 8779c49915..a915af4eb2 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceRespJavaObject.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceRespJavaObject.java @@ -144,7 +144,6 @@ public class ResourceRespJavaObject { public ResourceRespJavaObject() { super(); - // TODO Auto-generated constructor stub } // public ResourceRespJavaObject(String uniqueId, String resourceName, diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceDistributionStatus.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceDistributionStatus.java index dde1f27cca..fa80999bb3 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceDistributionStatus.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceDistributionStatus.java @@ -29,7 +29,6 @@ public class ServiceDistributionStatus { public ServiceDistributionStatus() { super(); - // TODO Auto-generated constructor stub } public ServiceDistributionStatus(String distributionID, String timestamp, String userId, String deployementStatus) { diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceReqDetails.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceReqDetails.java index 2f3d648ef6..fbcbfd4fe0 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceReqDetails.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceReqDetails.java @@ -27,10 +27,10 @@ import org.openecomp.sdc.be.model.category.CategoryDefinition; public class ServiceReqDetails extends ComponentReqDetails { - protected String serviceType; - protected String serviceRole; - protected String namingPolicy; - protected Boolean ecompGeneratedNaming; + protected String serviceType = "MyServiceType"; + protected String serviceRole = "MyServiceRole"; + protected String namingPolicy = "MyServiceNamingPolicy"; + protected Boolean ecompGeneratedNaming = true; public String getServiceType() { return serviceType; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceRespJavaObject.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceRespJavaObject.java index 723f6a47c6..7bec221ef1 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceRespJavaObject.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceRespJavaObject.java @@ -21,7 +21,6 @@ package org.openecomp.sdc.ci.tests.datatypes; import java.util.ArrayList; -import java.util.List; public class ServiceRespJavaObject { @@ -50,7 +49,6 @@ public class ServiceRespJavaObject { public ServiceRespJavaObject() { super(); - // TODO Auto-generated constructor stub } public ServiceRespJavaObject(String category, String creatorUserId, String creatorFullName, diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VendorSoftwareProductObject.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VendorSoftwareProductObject.java index fbdb88e712..8b40210c0d 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VendorSoftwareProductObject.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VendorSoftwareProductObject.java @@ -1,47 +1,27 @@ package org.openecomp.sdc.ci.tests.datatypes; -public class VendorSoftwareProductObject { +public class VendorSoftwareProductObject extends VendorSoftwareProductObjectReqDetails { - private String vendorName; private String vspId; - private String category; - private String subCategory; private String componentId; - private String description; private String attContact; - private String vspName; - - public VendorSoftwareProductObject() { - super(); - // TODO Auto-generated constructor stub - } + private String version; + + public VendorSoftwareProductObject(){super();} - public VendorSoftwareProductObject(String vendorName, String vspId, String category, String subCategory, String componentId, String description, String attContact) { - super(); - this.vendorName = vendorName; + public VendorSoftwareProductObject(String vspId, String componentId, String attContact, String version) { this.vspId = vspId; - this.category = category; - this.subCategory = subCategory; this.componentId = componentId; - this.description = description; this.attContact = attContact; + this.version = version; } - - public String getVspName() { - return vspName; - } - - public void setVspName(String vspName) { - this.vspName = vspName; - } - - public String getVendorName() { - return vendorName; - } - - public void setVendorName(String vendorName) { - this.vendorName = vendorName; + public VendorSoftwareProductObject(String name, String description, String category, String subCategory, String vendorId, String vendorName, LicensingVersion licensingVersion, LicensingData licensingData, String onboardingMethod, String networkPackageName, String onboardingOrigin, String vspId, String componentId, String attContact, String version) { + super(name, description, category, subCategory, vendorId, vendorName, licensingVersion, licensingData, onboardingMethod, networkPackageName, onboardingOrigin); + this.vspId = vspId; + this.componentId = componentId; + this.attContact = attContact; + this.version = version; } public String getVspId() { @@ -52,22 +32,6 @@ public class VendorSoftwareProductObject { this.vspId = vspId; } - public String getCategory() { - return category; - } - - public void setCategory(String category) { - this.category = category; - } - - public String getSubCategory() { - return subCategory; - } - - public void setSubCategory(String subCategory) { - this.subCategory = subCategory; - } - public String getComponentId() { return componentId; } @@ -76,14 +40,6 @@ public class VendorSoftwareProductObject { this.componentId = componentId; } - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - public String getAttContact() { return attContact; } @@ -92,11 +48,21 @@ public class VendorSoftwareProductObject { this.attContact = attContact; } + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + @Override public String toString() { - return "VendorSoftwareProductObject [vendorName=" + vendorName + ", vspId=" + vspId + ", category=" + category + ", subCategory=" + subCategory + ", componentId=" + componentId + ", description=" + description + ", attContact=" - + attContact + "]"; + return "VendorSoftwareProductObject{" + + "vspId='" + vspId + '\'' + + ", componentId='" + componentId + '\'' + + ", attContact='" + attContact + '\'' + + ", version='" + version + '\'' + + '}'; } - - } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VendorSoftwareProductObjectReqDetails.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VendorSoftwareProductObjectReqDetails.java new file mode 100644 index 0000000000..10093c2a93 --- /dev/null +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VendorSoftwareProductObjectReqDetails.java @@ -0,0 +1,148 @@ +package org.openecomp.sdc.ci.tests.datatypes; + +public class VendorSoftwareProductObjectReqDetails { + + private String name; + private String description; + private String category; + private String subCategory; + private String vendorId; + private String vendorName; + private LicensingVersion licensingVersion; + private LicensingData licensingData; + private String onboardingMethod; + private String networkPackageName; + private String onboardingOrigin; + + public String getIcon() { + return icon; + } + + public void setIcon(String icon) { + this.icon = icon; + } + + private String icon; + + public VendorSoftwareProductObjectReqDetails() { + } + + public VendorSoftwareProductObjectReqDetails(String name, String description, String category, String subCategory, String vendorId, String vendorName, LicensingVersion licensingVersion, LicensingData licensingData, String onboardingMethod, String networkPackageName, String onboardingOrigin) { + this.name = name; + this.description = description; + this.category = category; + this.subCategory = subCategory; + this.vendorId = vendorId; + this.vendorName = vendorName; + this.licensingVersion = licensingVersion; + this.licensingData = licensingData; + this.onboardingMethod = onboardingMethod; + this.networkPackageName = networkPackageName; + this.onboardingOrigin = onboardingOrigin; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getSubCategory() { + return subCategory; + } + + public void setSubCategory(String subCategory) { + this.subCategory = subCategory; + } + + public String getVendorId() { + return vendorId; + } + + public void setVendorId(String vendorId) { + this.vendorId = vendorId; + } + + public String getVendorName() { + return vendorName; + } + + public void setVendorName(String vendorName) { + this.vendorName = vendorName; + } + + public LicensingVersion getLicensingVersion() { + return licensingVersion; + } + + public void setLicensingVersion(LicensingVersion licensingVersion) { + this.licensingVersion = licensingVersion; + } + + public LicensingData getLicensingData() { + return licensingData; + } + + public void setLicensingData(LicensingData licensingData) { + this.licensingData = licensingData; + } + + public String getOnboardingMethod() { + return onboardingMethod; + } + + public void setOnboardingMethod(String onboardingMethod) { + this.onboardingMethod = onboardingMethod; + } + + public String getNetworkPackageName() { + return networkPackageName; + } + + public void setNetworkPackageName(String networkPackageName) { + this.networkPackageName = networkPackageName; + } + + public String getOnboardingOrigin() { + return onboardingOrigin; + } + + public void setOnboardingOrigin(String onboardingOrigin) { + this.onboardingOrigin = onboardingOrigin; + } + + @Override + public String toString() { + return "VendorSoftwareProductObjectReqDetails{" + + "name='" + name + '\'' + + ", description='" + description + '\'' + + ", category='" + category + '\'' + + ", subCategory='" + subCategory + '\'' + + ", vendorId='" + vendorId + '\'' + + ", vendorName='" + vendorName + '\'' + + ", licensingVersion=" + licensingVersion + + ", licensingData=" + licensingData + + ", onboardingMethod='" + onboardingMethod + '\'' + + ", networkPackageName='" + networkPackageName + '\'' + + ", onboardingOrigin='" + onboardingOrigin + '\'' + + '}'; + } +} diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/CircleSize.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/CircleSize.java new file mode 100644 index 0000000000..46e9eb3f7b --- /dev/null +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/CircleSize.java @@ -0,0 +1,7 @@ +package org.openecomp.sdc.ci.tests.datatypes.enums; + +public enum CircleSize { + VF(), + SERVICE(), + NORMATIVE(); +} diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/CvfcTypeEnum.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/CvfcTypeEnum.java new file mode 100644 index 0000000000..ee9892cc98 --- /dev/null +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/CvfcTypeEnum.java @@ -0,0 +1,19 @@ +package org.openecomp.sdc.ci.tests.datatypes.enums; + +public enum CvfcTypeEnum { + + SNMP_POLL ("SNMP_POLL"), + SNMP_TRAP ("SNMP_TRAP"), + VES_EVENTS ("VES_EVENTS"); + + private String value; + + public String getValue() { + return value; + } + + private CvfcTypeEnum(String value) { + this.value = value; + } + +} diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ErrorInfo.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ErrorInfo.java index c2a28a1edf..2d5075e6c7 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ErrorInfo.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ErrorInfo.java @@ -28,7 +28,6 @@ public class ErrorInfo { public ErrorInfo() { super(); - // TODO Auto-generated constructor stub } public ErrorInfo(Integer code, String message, String messageId) { diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/LifeCycleStatesEnum.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/LifeCycleStatesEnum.java index 9edfb9aced..7c330a3d10 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/LifeCycleStatesEnum.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/LifeCycleStatesEnum.java @@ -20,8 +20,6 @@ package org.openecomp.sdc.ci.tests.datatypes.enums; -import java.util.List; - public enum LifeCycleStatesEnum { CHECKOUT("checkout", "NOT_CERTIFIED_CHECKOUT"), diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/PropertyTypeEnum.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/PropertyTypeEnum.java index 8a1dc84684..b5550fcdd3 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/PropertyTypeEnum.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/PropertyTypeEnum.java @@ -20,37 +20,40 @@ package org.openecomp.sdc.ci.tests.datatypes.enums; -import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; public enum PropertyTypeEnum { - INTEGER("defaultIntegerPropName1", "integer", "125", "default integer type property description", null), - STRING("defaultStringPropName1", "string", "string", "default string type property description", null), - BOOLEAN("defaultBooleanPropName1", "boolean", "true", "default boolean type property description", null), - FLOAT("defaultBooleanPropName1", "float", "1.2", "default float type property description", null), - STRING_LIST("defaultStringListPropName", "list", "[a,b]", "outer description", getDefaultStringSchema(ToscaPropertyType.STRING.getType())), - INTEGER_LIST("defaultIntegerListPropName", "list", "[1,2]", "outer description", getDefaultStringSchema(ToscaPropertyType.INTEGER.getType())), - BOOLEAN_LIST("defaultBooleanListPropName", "list", "[true,false]", "outer description", getDefaultStringSchema(ToscaPropertyType.BOOLEAN.getType())), - FLOAT_LIST("defaultFloatMapPropName", "list", "[1.0,2.0]", "outer description", getDefaultStringSchema(ToscaPropertyType.FLOAT.getType())), - STRING_MAP("defaultStringMapPropName", "map", "{\"key1\":val1 , \"key2\":val2}", "outer description", getDefaultStringSchema(ToscaPropertyType.STRING.getType())), - INTEGER_MAP("defaultIntegerMapPropName", "map", "{\"key1\":123 , \"key2\":-456}", "outer description", getDefaultStringSchema(ToscaPropertyType.INTEGER.getType())), - BOOLEAN_MAP("defaultBooleanMapPropName", "map", "{\"key1\":true , \"key2\":false}", "outer description", getDefaultStringSchema(ToscaPropertyType.BOOLEAN.getType())), - FLOAT_MAP("defaultFloatMapPropName", "map", "{\"key1\":0.2123 , \"key2\":43.545f}", "outer description", getDefaultStringSchema(ToscaPropertyType.FLOAT.getType())); + INTEGER("defaultIntegerPropName1", "integer", "125", "346", "default integer type property description", "updated integer type property description",null), + STRING("defaultStringPropName1", "string", "string", "updated string","default string type property description", "updated string type property description",null), + BOOLEAN("defaultBooleanPropName1", "boolean", "true", "false","default boolean type property description", "updated boolean type property description",null), + FLOAT("defaultFloatPropName1", "float", "1.2", "3.4","default float type property description", "updated float type property description",null), + STRING_LIST("defaultStringListPropName", "list", "[a,b]", "[c,d]","outer description", "updated outer description", getDefaultStringSchema(ToscaPropertyType.STRING.getType())), + INTEGER_LIST("defaultIntegerListPropName", "list", "[1,2]", "[3,4]","outer description", "updated outer description", getDefaultStringSchema(ToscaPropertyType.INTEGER.getType())), + BOOLEAN_LIST("defaultBooleanListPropName", "list", "[true,false]", "[false,true]","outer description", "updated outer description", getDefaultStringSchema(ToscaPropertyType.BOOLEAN.getType())), + FLOAT_LIST("defaultFloatMapPropName", "list", "[1.0,2.0]", "[3.0,4.0]","outer description", "updated outer description", getDefaultStringSchema(ToscaPropertyType.FLOAT.getType())), + STRING_MAP("defaultStringMapPropName", "map", "{\"key1\":val1 , \"key2\":val2}", "{\"key1\":val11 , \"key2\":val22}", "outer description", "updated outer description",getDefaultStringSchema(ToscaPropertyType.STRING.getType())), + INTEGER_MAP("defaultIntegerMapPropName", "map", "{\"key1\":123 , \"key2\":-456}", "{\"key1\":456 , \"key2\":-789}", "outer description", "updated outer description", getDefaultStringSchema(ToscaPropertyType.INTEGER.getType())), + BOOLEAN_MAP("defaultBooleanMapPropName", "map", "{\"key1\":true , \"key2\":false}", "{\"key1\":false , \"key2\":true}", "outer description", "updated outer description",getDefaultStringSchema(ToscaPropertyType.BOOLEAN.getType())), + FLOAT_MAP("defaultFloatMapPropName", "map", "{\"key1\":0.2123 , \"key2\":43.545f}", "{\"key1\":0.5678 , \"key2\":12.789f}","outer description", "updated outer description", getDefaultStringSchema(ToscaPropertyType.FLOAT.getType())); private String name; private String type; private String value; + private String updateValue; private String description; + private String updateDescription; private SchemaDefinition schemaDefinition; - private PropertyTypeEnum(String name, String type, String value, String description, + private PropertyTypeEnum(String name, String type, String value, String updateValue,String description,String updateDescription, SchemaDefinition schemaDefinition) { this.name = name; this.type = type; this.value = value; + this.updateValue = updateValue; this.description = description; + this.updateDescription = updateDescription; this.schemaDefinition = schemaDefinition; } @@ -77,6 +80,14 @@ public enum PropertyTypeEnum { public void setValue(String value) { this.value = value; } + + public String getUpdateValue() { + return updateValue; + } + + public void setUpdateValue(String updateValue) { + this.updateValue = updateValue; + } public String getDescription() { return description; @@ -85,6 +96,14 @@ public enum PropertyTypeEnum { public void setDescription(String description) { this.description = description; } + + public String getUpdateDescription() { + return updateDescription; + } + + public void setUpdateDescription(String updateDescription) { + this.updateDescription = updateDescription; + } public SchemaDefinition getSchemaDefinition() { return schemaDefinition; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ResourceCategoryEnum.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ResourceCategoryEnum.java index 47123a61e7..1ba6c5c7f1 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ResourceCategoryEnum.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ResourceCategoryEnum.java @@ -20,23 +20,87 @@ package org.openecomp.sdc.ci.tests.datatypes.enums; +import java.util.Random; + public enum ResourceCategoryEnum { - NETWORK_L2_3_ROUTERS("Network L2-3", "Router"), NETWORK_L2_3_GETEWAY("Network L2-3","Gateway"), NETWORK_L2_3_WAN_CONNECTORS("Network L2-3", "WAN Connectors"), NETWORK_L2_3_LAN_CONNECTORS("Network L2-3", "LAN Connectors"), - NETWORK_L2_3_INFRASTRUCTURE("Network L2-3", "Infrastructure"), NETWORK_L4("Network L4+", "Common Network Resources"), APPLICATION_L4_BORDER("Application L4+", "Border Element"), - APPLICATION_L4_APP_SERVER("Application L4+", "Application Server"), APPLICATION_L4_WEB_SERVERS("Application L4+", "Web Server"), APPLICATION_L4_CALL_CONTROL("Application L4+","Call Control"), - APPLICATION_L4_MEDIA_SERVER("Application L4+", "Media Servers"), APPLICATION_L4_LOAD_BALANCER("Application L4+", "Load Balancer"), APPLICATION_L4_DATABASE("Application L4+","Database"), - APPLICATION_L4_FIREWALL("Application L4+", "Firewall"), GENERIC_INFRASTRUCTURE("Generic", "Infrastructure"), GENERIC_ABSTRACT("Generic", "Abstract"), GENERIC_NETWORK_ELEMENTS("Generic","Network Elements"), - GENERIC_DATABASE("Generic", "Database"), NETWORK_CONNECTIVITY_CON_POINT("Network Connectivity", "Connection Points"), NETWORK_CONNECTIVITY_VIRTUAL_LINK("Network Connectivity","Virtual Links"), - TEMPLATE_MONITORING_TEMPLATE("Template", "Monitoring Template"), ALLOTTED_RESOURCE("Allotted Resource", "Allotted Resource"); + NETWORK_L2_3_ROUTERS("Network L2-3", "Router", "resourceNewCategory.network l2-3", "resourceNewCategory.network l2-3.router"), + NETWORK_L2_3_GETEWAY("Network L2-3","Gateway", "resourceNewCategory.network l2-3", "resourceNewCategory.network l2-3.gateway"), + NETWORK_L2_3_WAN_CONNECTORS("Network L2-3", "WAN Connectors", "resourceNewCategory.network l2-3", "resourceNewCategory.network l2-3.lan connectors"), + NETWORK_L2_3_LAN_CONNECTORS("Network L2-3", "LAN Connectors", "resourceNewCategory.network l2-3", "resourceNewCategory.network l2-3.wan connectors"), + NETWORK_L2_3_INFRASTRUCTURE("Network L2-3", "Infrastructure", "resourceNewCategory.network l2-3", "resourceNewCategory.network l2-3.infrastructure"), + + NETWORK_L4("Network L4+", "Common Network Resources", "resourceNewCategory.network l4+", "resourceNewCategory.network l4+.common network resources"), + + APPLICATION_L4_BORDER("Application L4+", "Border Element", "resourceNewCategory.application l4+", "resourceNewCategory.application l4+.border element"), + APPLICATION_L4_APP_SERVER("Application L4+", "Application Server", "resourceNewCategory.application l4+", "resourceNewCategory.application l4+.application server"), + APPLICATION_L4_WEB_SERVERS("Application L4+", "Web Server", "resourceNewCategory.application l4+", "resourceNewCategory.application l4+.web server"), + APPLICATION_L4_CALL_CONTROL("Application L4+","Call Control", "resourceNewCategory.application l4+", "resourceNewCategory.application l4+.call control"), + APPLICATION_L4_MEDIA_SERVER("Application L4+", "Media Servers", "resourceNewCategory.application l4+", "resourceNewCategory.application l4+.media servers"), + APPLICATION_L4_LOAD_BALANCER("Application L4+", "Load Balancer", "resourceNewCategory.application l4+", "resourceNewCategory.application l4+.load balancer"), + APPLICATION_L4_DATABASE("Application L4+","Database", "resourceNewCategory.application l4+", "resourceNewCategory.application l4+.database"), + APPLICATION_L4_FIREWALL("Application L4+", "Firewall", "resourceNewCategory.application l4+", "resourceNewCategory.application l4+.firewall"), + + GENERIC_INFRASTRUCTURE("Generic", "Infrastructure", "resourceNewCategory.generic", "resourceNewCategory.generic.infrastructure"), + GENERIC_ABSTRACT("Generic", "Abstract", "resourceNewCategory.generic", "resourceNewCategory.generic.abstract"), + GENERIC_NETWORK_ELEMENTS("Generic","Network Elements", "resourceNewCategory.generic", "resourceNewCategory.generic.network elements"), + GENERIC_DATABASE("Generic", "Database", "resourceNewCategory.generic", "resourceNewCategory.generic.database"), + GENERIC_RULES("Generic", "Rules", "resourceNewCategory.generic", "resourceNewCategory.generic.rules"), + + NETWORK_CONNECTIVITY_CON_POINT("Network Connectivity", "Connection Points", "resourceNewCategory.network connectivity", "resourceNewCategory.network connectivity.connection points"), + NETWORK_CONNECTIVITY_VIRTUAL_LINK("Network Connectivity","Virtual Links", "resourceNewCategory.network connectivity", "resourceNewCategory.network connectivity.virtual links"), + + TEMPLATE_MONITORING_TEMPLATE("Template", "Monitoring Template", "resourceNewCategory.template", "resourceNewCategory.template.monitoring template"), + + ALLOTTED_RESOURCE("Allotted Resource", "Allotted Resource", "resourceNewCategory.allotted resource", "resourceNewCategory.allotted resource.allotted resource"), + ALLOTTED_RESOURCE_SERVICE_ADMIN("Allotted Resource", "Service Admin", "resourceNewCategory.allotted resource", "resourceNewCategory.allotted resource.service admin"), + ALLOTTED_RESOURCE_CONTRAIL_ROUTE("Allotted Resource", "Contrail Route", "resourceNewCategory.allotted resource", "resourceNewCategory.allotted resource.contrail route"), + ALLOTTED_RESOURCE_TUNNEL_XCONNECT("Allotted Resource", "Tunnel XConnect", "resourceNewCategory.allotted resource", "resourceNewCategory.allotted resource.tunnel xconnect"), + ALLOTTED_RESOURCE_IP_MUX_DEMUX("Allotted Resource", "IP Mux Demux", "resourceNewCategory.allotted resource", "resourceNewCategory.allotted resource.ip mux demux"), + ALLOTTED_RESOURCE_SECURITY_ZONE("Allotted Resource", "Security Zone", "resourceNewCategory.allotted resource", "resourceNewCategory.allotted resource.security zone"), + + DCAE_COMPONENT_MICROSERVICE("DCAE Component", "Microservice", "resourceNewCategory.dcae component", "resourceNewCategory.dcae component.microservice"), + DCAE_COMPONENT_DATABASE("DCAE Component", "Database", "resourceNewCategory.dcae component", "resourceNewCategory.dcae component.database"), + DCAE_COMPONENT_POLICY("DCAE Component", "policy", "resourceNewCategory.dcae component", "resourceNewCategory.dcae component.policy"), + DCAE_COMPONENT_SOURCE("DCAE Component", "Source", "resourceNewCategory.dcae component", "resourceNewCategory.dcae component.source"), + DCAE_COMPONENT_ANALYSTICS("DCAE Component", "Analytics", "resourceNewCategory.dcae component", "resourceNewCategory.dcae component.analytics"), + DCAE_COMPONENT_UTILITY("DCAE Component", "Utility", "resourceNewCategory.dcae component", "resourceNewCategory.dcae component.utility"), + DCAE_COMPONENT_COLLECTOR("DCAE Component", "Collector", "resourceNewCategory.dcae component", "resourceNewCategory.dcae component.collector"), + ; private String category; private String subCategory; + private String categoryUniqeId; + private String subCategoryUniqeId; ResourceCategoryEnum(String category, String subCategory) { this.category = category; this.subCategory = subCategory; } + + private ResourceCategoryEnum(String category, String subCategory, String categoryUniqeId, String subCategoryUniqeId) { + this.category = category; + this.subCategory = subCategory; + this.categoryUniqeId = categoryUniqeId; + this.subCategoryUniqeId = subCategoryUniqeId; + } + + public String getCategoryUniqeId() { + return categoryUniqeId; + } + + public void setCategoryUniqeId(String categoryUniqeId) { + this.categoryUniqeId = categoryUniqeId; + } + + public String getSubCategoryUniqeId() { + return subCategoryUniqeId; + } + + public void setSubCategoryUniqeId(String subCategoryUniqeId) { + this.subCategoryUniqeId = subCategoryUniqeId; + } + public String getCategory() { return category; @@ -54,4 +118,44 @@ public enum ResourceCategoryEnum { this.subCategory = subCategory; } + + public static ResourceCategoryEnum findEnumNameByValues(String category, String subCategory){ + for(ResourceCategoryEnum resourceCategoryEnum : ResourceCategoryEnum.values()) { + if(resourceCategoryEnum.getCategory().equals(category) && resourceCategoryEnum.getSubCategory().equals(subCategory)){ + return resourceCategoryEnum; + } + } + return null; + } + + + /** + * @return random category enum except allotted category + */ + public static ResourceCategoryEnum getRandomElement() { + Random random = new Random(); + ResourceCategoryEnum resourceCategoryEnum = ResourceCategoryEnum.values()[random.nextInt(ResourceCategoryEnum.values().length)]; + + if(!resourceCategoryEnum.toString().startsWith("ALLOTTED")){ + return resourceCategoryEnum; + }else{ + return getRandomElement(); + } + } + + + /** + * @return random allotted category enum + */ + public static ResourceCategoryEnum getRandomAllottedElement() { + Random random = new Random(); + ResourceCategoryEnum resourceCategoryEnum = ResourceCategoryEnum.values()[random.nextInt(ResourceCategoryEnum.values().length)]; + + if(resourceCategoryEnum.toString().startsWith("ALLOTTED")){ + return resourceCategoryEnum; + }else{ + return getRandomAllottedElement(); + } + } + } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ServiceCategoriesEnum.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ServiceCategoriesEnum.java index 61d4e487e2..c8611b1bc8 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ServiceCategoriesEnum.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/ServiceCategoriesEnum.java @@ -20,6 +20,8 @@ package org.openecomp.sdc.ci.tests.datatypes.enums; +import java.util.Random; + public enum ServiceCategoriesEnum { VOIP("VoIP Call Control"), MOBILITY("Mobility"), NETWORK_L4("Network L4+"), NETWORK_L3("Network L1-3"); @@ -34,4 +36,8 @@ public enum ServiceCategoriesEnum { return value; } + public static ServiceCategoriesEnum getRandomElement() { + Random random = new Random(); + return ServiceCategoriesEnum.values()[random.nextInt(ServiceCategoriesEnum.values().length)]; + } } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/UserRoleEnum.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/UserRoleEnum.java index d59b3f44f2..20a4b12a92 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/UserRoleEnum.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/UserRoleEnum.java @@ -25,7 +25,7 @@ public enum UserRoleEnum { // ADMIN("jh0003", "Jimmy", "Hendrix"), DESIGNER("cs0008", "Carlos", "Santana"), DESIGNER2("me0009", "Melissa","Etheridge"), TESTER("jm0007", "Joni", "Mitchell"), ADMIN4("km2000", "Kot", "May"), // GOVERNOR("gv0001","David", "Shadmi"), OPS("op0001", "Steve", "Regev"), PRODUCT_STRATEGIST1("ps0001", "Eden","Rozin"), PRODUCT_STRATEGIST2("ps0002", "Ella", "Kvetny"), PRODUCT_STRATEGIST3("ps0003", "Geva", "Alon"), // PRODUCT_MANAGER1("pm0001", "Teddy", "Isashar"), PRODUCT_MANAGER2("pm0002", "Sarah", "Bettens"); - ADMIN("jh0003", "Jimmy", "Hendrix"), DESIGNER("cs0008", "Carlos", "Santana"), DESIGNER2("me0009", "Melissa","Etheridge"), TESTER("jm0007", "Johnny", "Depp"), ADMIN4("km2000", "Kot", "May"), + ADMIN("jh0003", "Jimmy", "Hendrix"), DESIGNER("m08740", "Zero", "ASDCMech"), DESIGNER2("me0009", "Melissa","Etheridge"), DESIGNER3("cs0008", "Carlos", "Santana"),TESTER("jm0007", "Johnny", "Depp"), ADMIN4("km2000", "Kot", "May"), GOVERNOR("gv0001","David", "Shadmi"), OPS("op0001", "Aretha", "Franklin"), PRODUCT_STRATEGIST1("ps0001", "Eden","Rozin"), PRODUCT_STRATEGIST2("ps0002", "Ella", "Kvetny"), PRODUCT_STRATEGIST3("ps0003", "Geva", "Alon"), PRODUCT_MANAGER1("pm0001", "Teddy", "Isashar"), PRODUCT_MANAGER2("pm0002", "Sarah", "Bettens"); private String userId; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/expected/ExpectedExternalAudit.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/expected/ExpectedExternalAudit.java index e689a3921b..bc15a0e983 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/expected/ExpectedExternalAudit.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/expected/ExpectedExternalAudit.java @@ -37,7 +37,6 @@ public class ExpectedExternalAudit { public ExpectedExternalAudit() { super(); - // TODO Auto-generated constructor stub } public String getRESOURCE_NAME() { diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/expected/ExpectedResourceAuditJavaObject.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/expected/ExpectedResourceAuditJavaObject.java index 7fdc899317..59ca7bbf7e 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/expected/ExpectedResourceAuditJavaObject.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/expected/ExpectedResourceAuditJavaObject.java @@ -142,7 +142,6 @@ public class ExpectedResourceAuditJavaObject { public ExpectedResourceAuditJavaObject() { super(); - // TODO Auto-generated constructor stub } public ExpectedResourceAuditJavaObject(String action, String modifierName, String modifierUid, String status, diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/http/HttpRequest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/http/HttpRequest.java index c1f559a870..a8ca77d055 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/http/HttpRequest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/http/HttpRequest.java @@ -53,7 +53,6 @@ import org.apache.http.entity.mime.content.StringBody; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; -import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/TODO/ImportCapabilityTypeCITest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/TODO/ImportCapabilityTypeCITest.java index 71e75c9a1e..3af40c5bb8 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/TODO/ImportCapabilityTypeCITest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/TODO/ImportCapabilityTypeCITest.java @@ -20,9 +20,6 @@ package org.openecomp.sdc.ci.tests.execute.TODO; -import org.testng.annotations.AfterClass; -import org.testng.annotations.Test; -import org.testng.AssertJUnit; import java.io.File; import java.io.IOException; @@ -36,8 +33,11 @@ import org.apache.tinkerpop.gremlin.structure.Vertex; import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.DbUtils.TitanState; +import org.openecomp.sdc.ci.tests.utils.Utils; +import org.testng.AssertJUnit; +import org.testng.annotations.AfterClass; +import org.testng.annotations.Test; import fj.data.Either; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java index 1f578d108c..49b556fc28 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ArtifactServletTest.java @@ -61,10 +61,8 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openecomp.sdc.ci.tests.utils.general.FileUtils; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/DownloadComponentArt.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/DownloadComponentArt.java index 5f1230f4ce..65c0bba6a0 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/DownloadComponentArt.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/DownloadComponentArt.java @@ -78,7 +78,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; -import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.ServiceValidationUtils; @@ -91,15 +90,12 @@ import org.testng.Assert; import org.testng.AssertJUnit; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import org.testng.internal.Yaml; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.typesafe.config.ConfigException.Null; import fj.data.Either; -import fj.data.List; public class DownloadComponentArt extends ComponentBaseTest { diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/HeatEnvArtifact.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/HeatEnvArtifact.java index e50d5b4ef9..bc57512a11 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/HeatEnvArtifact.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/HeatEnvArtifact.java @@ -35,7 +35,6 @@ import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.ArtifactUiDownloadData; import org.openecomp.sdc.be.model.ComponentInstance; -import org.openecomp.sdc.be.model.HeatParameterDefinition; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/PlaceHolderValidations.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/PlaceHolderValidations.java index 0718fb6e5c..02bef89f2c 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/PlaceHolderValidations.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/PlaceHolderValidations.java @@ -39,20 +39,15 @@ import org.javatuples.Pair; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.Product; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; @@ -68,14 +63,11 @@ import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.general.FileUtils; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; -import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.BeforeMethod; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateArtResponse.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateArtResponse.java index 6b902dbfb8..c049211e97 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateArtResponse.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateArtResponse.java @@ -121,7 +121,6 @@ public class ValidateArtResponse extends ComponentBaseTest { } protected void assertnull(String string, boolean equals) { - // TODO Auto-generated method stub } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateHeatArtFieldsTypes.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateHeatArtFieldsTypes.java index dfbf035b41..8a7a2f65fa 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateHeatArtFieldsTypes.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/ValidateHeatArtFieldsTypes.java @@ -28,7 +28,6 @@ import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition; import org.openecomp.sdc.be.model.ArtifactDefinition; -import org.openecomp.sdc.be.model.HeatParameterDefinition; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CatalogDataApiTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CatalogDataApiTest.java index 9938266602..61c9442f44 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CatalogDataApiTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CatalogDataApiTest.java @@ -24,7 +24,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Map; -import org.apache.log4j.lf5.util.ResourceUtils; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.JSONValue; @@ -49,7 +48,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; -import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.testng.AssertJUnit; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CategoriesTests.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CategoriesTests.java index 3b85c052a1..ade662a20c 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CategoriesTests.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/CategoriesTests.java @@ -54,7 +54,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedCategoryAudit; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils; @@ -62,7 +61,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.CategoryValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; -import org.testng.SkipException; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/ElementsApiTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/ElementsApiTest.java index 2f48f4fa1e..ec36798bc1 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/ElementsApiTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/ElementsApiTest.java @@ -26,7 +26,6 @@ import static org.testng.AssertJUnit.assertNotNull; import java.util.HashMap; import java.util.Map; -import org.apache.log4j.lf5.util.ResourceUtils; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.JSONValue; @@ -48,15 +47,6 @@ public class ElementsApiTest extends ComponentBaseTest { super(name, ElementsApiTest.class.getName()); } - // public LCSbaseTest(TestName testName, String className) { - // super(testName, className); - // } - - // public ElementsApiTest(TestName name, String name2) { - //// super(name, name2); - // // TODO Auto-generated constructor stub - // } - // Expected 200 Keep @Test public void getAllPropertyScopesSuccess() throws Exception { diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/GroupingTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/GroupingTest.java index f6b6113b99..7858b3259f 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/GroupingTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/GroupingTest.java @@ -32,9 +32,6 @@ import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_RE import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS; import static org.testng.AssertJUnit.assertEquals; -import java.util.ArrayList; -import java.util.List; - import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -47,7 +44,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedCategoryAudit; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/SubCategoriesTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/SubCategoriesTest.java index dcc3172d59..dd96ebfc2f 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/SubCategoriesTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/category/SubCategoriesTest.java @@ -47,7 +47,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedCategoryAudit; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/AndreyTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/AndreyTest.java index c9064a41eb..586856bd72 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/AndreyTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/AndreyTest.java @@ -21,27 +21,18 @@ package org.openecomp.sdc.ci.tests.execute.devCI; import java.io.File; -import java.io.IOException; import java.text.SimpleDateFormat; -import java.util.ArrayList; import java.util.Date; import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; import java.util.Map; +import org.openecomp.sdc.be.model.PropertyDefinition; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition; import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaTopologyTemplateDefinition; import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; -import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; -import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException; -import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory; -//import org.openecomp.sdc.toscaparser.api.Metadata; -import org.openecomp.sdc.toscaparser.api.Capability; -import org.openecomp.sdc.toscaparser.api.NodeTemplate; -import org.openecomp.sdc.toscaparser.api.common.JToscaException; -import org.testng.annotations.Test; public class AndreyTest { @@ -70,14 +61,14 @@ public class AndreyTest { toscaMainAmdocsDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + amdocsCsarFileName)); toscaMainVfDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + VfCsarFileName)); toscaMainServiceDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + serviceCsarFileName)); -// Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, "Generic_VF", "1.0"); + Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, "Generic_VF", "1.0"); ToscaTopologyTemplateDefinition topologyTemplate = toscaMainAmdocsDefinition.getTopology_template(); // FileHandling.parseYamlFileToMapByPattern("",""); -// Map<String, Object> newInput = new HashMap<String, Object>(); -// for (PropertyDefinition property : resource.getProperties()) { -// newInput.put(property.getName(),property); -// } + Map<String, Object> newInput = new HashMap<String, Object>(); + for (PropertyDefinition property : resource.getProperties()) { + newInput.put(property.getName(),property); + } // topologyTemplate.addInputs(newInput); // @@ -104,7 +95,7 @@ public class AndreyTest { } - @Test + /*@Test public void distributionTest() throws SdcToscaParserException, JToscaException, IOException { //String serviceName = import and create().getName(); //getServiceObject(); @@ -157,6 +148,6 @@ public class AndreyTest { ArrayList<Object> requirements2 = nodeTemplate.getRequirements(); } - } + }*/ } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ArtifactFromCsar.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ArtifactFromCsar.java index c3346952b2..4cb46a3810 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ArtifactFromCsar.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ArtifactFromCsar.java @@ -28,10 +28,8 @@ import java.nio.file.DirectoryStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -53,7 +51,6 @@ public class ArtifactFromCsar { public static void main(String[] args) throws Exception { - // TODO Auto-generated method stub String zipFile = "C:\\Users\\rp955r\\Documents\\InTesting\\resource-CivfonboardedFdnt2f792348-csar.csar"; // Map<String, Object> combinedMap = combineHeatArtifacstWithFolderArtifacsToMap(zipFile); @@ -138,7 +135,6 @@ public class ArtifactFromCsar { try { map.put(file.getName(), getMapArtifactFromFolderStructure(file)); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarUpdate.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarUpdate.java index f66fd670f6..99890c1105 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarUpdate.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarUpdate.java @@ -20,20 +20,15 @@ package org.openecomp.sdc.ci.tests.execute.devCI; -import static org.testng.AssertJUnit.assertTrue; - import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.execute.imports.ImportCsarResourceTest; @@ -42,7 +37,6 @@ import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; -import org.openecomp.sdc.ci.tests.utils.validation.CsarValidationUtils; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.DataProvider; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarValidateArtifacts.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarValidateArtifacts.java index 5ed71e53b0..49e5950db5 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarValidateArtifacts.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ImportCsarValidateArtifacts.java @@ -25,16 +25,11 @@ import static org.testng.AssertJUnit.assertTrue; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ToscaGroupInsideVF.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ToscaGroupInsideVF.java index 64df976c09..54ab644157 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ToscaGroupInsideVF.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ToscaGroupInsideVF.java @@ -20,41 +20,11 @@ package org.openecomp.sdc.ci.tests.execute.devCI; -import static org.testng.AssertJUnit.assertEquals; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.lang3.tuple.Pair; import org.junit.Rule; import org.junit.rules.TestName; -import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.Service; -import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; -import org.openecomp.sdc.ci.tests.api.Urls; -import org.openecomp.sdc.ci.tests.config.Config; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; -import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; -import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition; -import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; -import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; -import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; -import org.openecomp.sdc.ci.tests.utils.validation.CsarValidationUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.testng.annotations.Test; public class ToscaGroupInsideVF extends ComponentBaseTest { private static Logger logger = LoggerFactory.getLogger(ToscaGroupInsideVF.class.getName()); diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/DistributionDownloadArtifactTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/DistributionDownloadArtifactTest.java index 258619292f..e2a9207718 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/DistributionDownloadArtifactTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/DistributionDownloadArtifactTest.java @@ -31,7 +31,6 @@ import java.util.Map; import java.util.zip.ZipInputStream; import org.apache.commons.codec.binary.Base64; -import org.apache.log4j.lf5.util.ResourceUtils; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.elements.ConsumerDataDefinition; @@ -53,7 +52,6 @@ import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedDistDownloadAudit; import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.Utils; -import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; @@ -66,7 +64,6 @@ import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.util.GeneralUtility; import org.openecomp.sdc.common.util.ValidationUtils; import org.testng.AssertJUnit; -import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/general/BasicHttpAuthenticationTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/general/BasicHttpAuthenticationTest.java index 66bc153e70..c3371493d9 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/general/BasicHttpAuthenticationTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/general/BasicHttpAuthenticationTest.java @@ -52,7 +52,6 @@ import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedAuthenticationAudit import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/general/ManageEcompConsumerCredentials.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/general/ManageEcompConsumerCredentials.java index 9ef8f147be..eea4e8ad5a 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/general/ManageEcompConsumerCredentials.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/general/ManageEcompConsumerCredentials.java @@ -35,7 +35,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedEcomConsumerAudit; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ConsumerRestUtils; import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/CsarUtilsTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/CsarUtilsTest.java index 650ed619b7..6b351c12d0 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/CsarUtilsTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/CsarUtilsTest.java @@ -25,7 +25,6 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.io.ByteArrayInputStream; -import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.Map; @@ -33,7 +32,6 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import org.apache.commons.codec.binary.Base64; -import org.apache.commons.io.FileUtils; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportCsarResourceTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportCsarResourceTest.java index 1b559aaaad..8ea66700cf 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportCsarResourceTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportCsarResourceTest.java @@ -39,8 +39,6 @@ import java.util.stream.Collectors; import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang.WordUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.tinkerpop.gremlin.process.traversal.P; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -49,14 +47,11 @@ import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.ComponentInstance; -import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.GroupDefinition; -import org.openecomp.sdc.be.model.GroupProperty; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; @@ -83,7 +78,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; -import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; import org.openecomp.sdc.common.util.ValidationUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -1522,8 +1516,8 @@ public class ImportCsarResourceTest extends ComponentBaseTest { String cp1Uid = nodes.get("cp1node").getUniqueId(); String cp2Uid = nodes.get("cp2node").getUniqueId(); Map<String, List<RequirementCapabilityRelDef>> mappedByReqOwner = resource.getComponentInstancesRelations().stream().collect(Collectors.groupingBy(e -> e.getFromNode())); - assertEquals(mappedByReqOwner.get(cp1Uid).get(0).getRelationships().get(0).getCapabilityUid(), capabilities.get("virtual_linkable").getUniqueId()); - assertEquals(mappedByReqOwner.get(cp2Uid).get(0).getRelationships().get(0).getCapabilityUid(), capabilities.get("link").getUniqueId()); + assertEquals(mappedByReqOwner.get(cp1Uid).get(0).getRelationships().get(0).getRelation().getCapabilityUid(), capabilities.get("virtual_linkable").getUniqueId()); + assertEquals(mappedByReqOwner.get(cp2Uid).get(0).getRelationships().get(0).getRelation().getCapabilityUid(), capabilities.get("link").getUniqueId()); } @Test(enabled = true) diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportGenericResourceCITest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportGenericResourceCITest.java index 110fa0f53c..873d33979f 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportGenericResourceCITest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportGenericResourceCITest.java @@ -46,7 +46,6 @@ import org.apache.http.entity.mime.content.FileBody; import org.apache.http.entity.mime.content.StringBody; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; - import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.model.LifecycleStateEnum; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportNewResourceCITest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportNewResourceCITest.java index 56deb3e08b..61c846242c 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportNewResourceCITest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportNewResourceCITest.java @@ -38,7 +38,6 @@ import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Resource; @@ -56,12 +55,9 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject; import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.ArtifactUtils; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.Convertor; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ImportRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; @@ -71,7 +67,6 @@ import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.ResourceValidationUtils; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.util.GeneralUtility; -import org.openecomp.sdc.exception.ResponseFormat; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportToscaResourceTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportToscaResourceTest.java index b460b9fce0..9899a8c996 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportToscaResourceTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportToscaResourceTest.java @@ -48,11 +48,12 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.CapReqDef; import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.CapabilityRequirementRelationship; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.RelationshipImpl; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; @@ -94,8 +95,6 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -import aj.org.objectweb.asm.Attribute; - /** * * @author Andrey + Pavel + Shay @@ -1341,7 +1340,7 @@ public class ImportToscaResourceTest extends ComponentBaseTest { requirementDef.setFromNode(riReq.getUniqueId()); requirementDef.setToNode(riCap.getUniqueId()); - RequirementAndRelationshipPair pair = new RequirementAndRelationshipPair(); + RelationshipInfo pair = new RelationshipInfo(); pair.setRequirementOwnerId(riReq.getUniqueId()); pair.setCapabilityOwnerId(riCap.getUniqueId()); pair.setRequirement("VirtualBinding"); @@ -1350,8 +1349,10 @@ public class ImportToscaResourceTest extends ComponentBaseTest { pair.setRelationships(relationship); pair.setCapabilityUid(capbilityUid); pair.setRequirementUid(requirementUid); - List<RequirementAndRelationshipPair> relationships = new ArrayList<>(); - relationships.add(pair); + List<CapabilityRequirementRelationship> relationships = new ArrayList<>(); + CapabilityRequirementRelationship capReqRel = new CapabilityRequirementRelationship(); + relationships.add(capReqRel); + capReqRel.setRelation(pair); requirementDef.setRelationships(relationships); RestResponse associateInstances = ComponentInstanceRestUtils.associateInstances(requirementDef, sdncUserDetails, diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportUpdateResourseCsarTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportUpdateResourseCsarTest.java index 464ebe12ed..9e8b94e5a8 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportUpdateResourseCsarTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportUpdateResourseCsarTest.java @@ -21,7 +21,6 @@ package org.openecomp.sdc.ci.tests.execute.imports; import static org.testng.AssertJUnit.assertTrue; -import static org.testng.AssertJUnit.assertEquals; import java.nio.file.Files; import java.nio.file.Path; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCheckoutTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCheckoutTest.java index efb4a15255..ec1f7ad38d 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCheckoutTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCheckoutTest.java @@ -34,7 +34,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedProductAudit; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.Convertor; import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCreateWithValidationsTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCreateWithValidationsTest.java index 45d3b23983..2796fa8403 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCreateWithValidationsTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCreateWithValidationsTest.java @@ -38,7 +38,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedProductAudit; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.Convertor; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCrudTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCrudTest.java index 2044d213e6..88c0f4d3bb 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCrudTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/product/ProductCrudTest.java @@ -34,13 +34,10 @@ import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.Product; -import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ResourceRespJavaObject; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedProductAudit; @@ -52,13 +49,10 @@ import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; -import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.ProductValidationUtils; -import org.openecomp.sdc.ci.tests.utils.validation.ResourceValidationUtils; import org.openecomp.sdc.common.api.Constants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/property/PropertyApisTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/property/PropertyApisTest.java index 0586269a14..f6f6f23214 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/property/PropertyApisTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/property/PropertyApisTest.java @@ -28,7 +28,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.log4j.lf5.util.ResourceUtils; import org.json.simple.JSONObject; import org.json.simple.JSONValue; import org.junit.Rule; @@ -46,7 +45,6 @@ import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.preRequisites.SimpleOneRsrcOneServiceTest; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.PropertyRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; @@ -57,8 +55,6 @@ import org.testng.AssertJUnit; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import com.google.gson.Gson; - public class PropertyApisTest extends SimpleOneRsrcOneServiceTest { protected static final String RESOURCE_CATEGORY = "Generic/Databases"; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CheckGetResource.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CheckGetResource.java index 0ec6b00fdc..85dfe4e13a 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CheckGetResource.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CheckGetResource.java @@ -25,7 +25,6 @@ import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.common.util.SerializationUtils; -import org.testng.annotations.Test; import fj.data.Either; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ComponentRelationshipInVfTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ComponentRelationshipInVfTest.java index d05dd1039a..675a5883bb 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ComponentRelationshipInVfTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ComponentRelationshipInVfTest.java @@ -39,9 +39,10 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.CapReqDef; import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.CapabilityRequirementRelationship; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.RelationshipImpl; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; @@ -119,7 +120,7 @@ public class ComponentRelationshipInVfTest extends ComponentBaseTest { requirementDef.setFromNode(riReq.getUniqueId()); requirementDef.setToNode(riCap.getUniqueId()); - RequirementAndRelationshipPair pair = new RequirementAndRelationshipPair(); + RelationshipInfo pair = new RelationshipInfo(); pair.setRequirementOwnerId(riReq.getUniqueId()); pair.setCapabilityOwnerId(riCap.getUniqueId()); pair.setRequirement("host"); @@ -128,8 +129,10 @@ public class ComponentRelationshipInVfTest extends ComponentBaseTest { pair.setRelationships(relationship); pair.setCapabilityUid(capbilityUid); pair.setRequirementUid(requirementUid); - List<RequirementAndRelationshipPair> relationships = new ArrayList<>(); - relationships.add(pair); + List<CapabilityRequirementRelationship> relationships = new ArrayList<>(); + CapabilityRequirementRelationship capReqRel = new CapabilityRequirementRelationship(); + relationships.add(capReqRel); + capReqRel.setRelation(pair); requirementDef.setRelationships(relationships); return requirementDef; } @@ -179,7 +182,7 @@ public class ComponentRelationshipInVfTest extends ComponentBaseTest { requirementDef.setFromNode(riReq.getUniqueId()); requirementDef.setToNode(riCap.getUniqueId()); - RequirementAndRelationshipPair pair = new RequirementAndRelationshipPair(); + RelationshipInfo pair = new RelationshipInfo(); pair.setRequirementOwnerId(riReq.getUniqueId()); pair.setCapabilityOwnerId(riCap.getUniqueId()); pair.setRequirement("host"); @@ -188,8 +191,10 @@ public class ComponentRelationshipInVfTest extends ComponentBaseTest { pair.setRelationships(relationship); pair.setCapabilityUid(capList.get(0).getUniqueId()); pair.setRequirementUid(reqList.get(0).getUniqueId()); - List<RequirementAndRelationshipPair> relationships = new ArrayList<>(); - relationships.add(pair); + List<CapabilityRequirementRelationship> relationships = new ArrayList<>(); + CapabilityRequirementRelationship capReqRel = new CapabilityRequirementRelationship(); + relationships.add(capReqRel); + capReqRel.setRelation(pair); requirementDef.setRelationships(relationships); RestResponse associateInstances = ComponentInstanceRestUtils.associateInstances(requirementDef, designerUser, @@ -979,7 +984,7 @@ public class ComponentRelationshipInVfTest extends ComponentBaseTest { RequirementCapabilityRelDef requirementDef = setRelationshipBetweenInstances(riReq, riCap, capReqDefBeforeAssociate); assertTrue(requirementDef.getRelationships().size() == 1); - String requirement = requirementDef.getRelationships().get(0).getRequirement(); + String requirement = requirementDef.getRelationships().get(0).getRelation().getRequirement(); RestResponse associateInstances = ComponentInstanceRestUtils.associateInstances(requirementDef, designerUser, resourceDetailsVF.getUniqueId(), ComponentTypeEnum.RESOURCE); assertEquals("Check response code ", 404, associateInstances.getErrorCode().intValue()); @@ -1122,7 +1127,7 @@ public class ComponentRelationshipInVfTest extends ComponentBaseTest { .getCapabilities(); Map<String, List<RequirementDefinition>> requirementsBeforeAssociate = capReqDefBeforeAssociate .getRequirements(); - String requirementName = requirementDef.getRelationships().get(0).getRequirement(); + String requirementName = requirementDef.getRelationships().get(0).getRelation().getRequirement(); RestResponse dissociateInstances = ComponentInstanceRestUtils.dissociateInstances(requirementDef, designerUser, resourceDetailsVF.getUniqueId(), ComponentTypeEnum.RESOURCE); diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CreateResourceApiTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CreateResourceApiTest.java index 50d1056d76..efa8393548 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CreateResourceApiTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/CreateResourceApiTest.java @@ -23,7 +23,6 @@ package org.openecomp.sdc.ci.tests.execute.resource; import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertNotNull; -import static org.testng.AssertJUnit.assertTrue; import java.util.ArrayList; import java.util.Arrays; @@ -31,18 +30,13 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.validation.constraints.AssertTrue; - -import org.apache.log4j.lf5.util.ResourceUtils; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.api.Urls; @@ -52,7 +46,6 @@ import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ResourceRespJavaObject; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; @@ -65,7 +58,6 @@ import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.DbUtils; import org.openecomp.sdc.ci.tests.utils.Utils; -import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.Convertor; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; @@ -78,7 +70,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.ResourceValidationUtils; -import org.openecomp.sdc.ci.tests.utils.validation.ServiceValidationUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.Test; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetAllResourceVersions.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetAllResourceVersions.java index 25c3242d2c..a3372098a0 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetAllResourceVersions.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetAllResourceVersions.java @@ -27,7 +27,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Map; -import org.apache.log4j.lf5.util.ResourceUtils; import org.junit.rules.TestName; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; @@ -38,7 +37,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetResourceNotAbstractApiTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetResourceNotAbstractApiTest.java index 562150e5e2..ccf6142538 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetResourceNotAbstractApiTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/GetResourceNotAbstractApiTest.java @@ -30,7 +30,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.log4j.lf5.util.ResourceUtils; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.model.User; @@ -45,7 +44,6 @@ import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.execute.imports.ImportGenericResourceCITest; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.slf4j.Logger; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ResourceApiTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ResourceApiTest.java index feb7b6f42e..df8ff58ba8 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ResourceApiTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ResourceApiTest.java @@ -33,7 +33,6 @@ import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; -import org.apache.log4j.lf5.util.ResourceUtils; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.JSONValue; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/UpdateResourceMetadataTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/UpdateResourceMetadataTest.java index 9d519c8b33..2b84af9f1d 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/UpdateResourceMetadataTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/UpdateResourceMetadataTest.java @@ -40,7 +40,6 @@ import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; @@ -432,7 +431,6 @@ public class UpdateResourceMetadataTest extends ComponentBaseTest { return ResourceResponse; } catch (FileNotFoundException e) { - // TODO Auto-generated catch block e.printStackTrace(); } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/VFResourceInstanceNameCRUD.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/VFResourceInstanceNameCRUD.java index 59050103ca..895390f764 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/VFResourceInstanceNameCRUD.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/VFResourceInstanceNameCRUD.java @@ -57,7 +57,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; import org.testng.annotations.BeforeMethod; -import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import com.google.gson.Gson; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ValidateExtendedVfData.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ValidateExtendedVfData.java index 8a17c3c115..37e7539fd9 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ValidateExtendedVfData.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/ValidateExtendedVfData.java @@ -23,7 +23,6 @@ package org.openecomp.sdc.ci.tests.execute.resource; import static org.testng.AssertJUnit.assertNotNull; import static org.testng.AssertJUnit.assertTrue; -import java.io.IOException; import java.util.List; import org.json.simple.JSONArray; @@ -32,8 +31,6 @@ import org.json.simple.JSONValue; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.ArtifactDefinition; -import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; @@ -46,7 +43,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.execute.lifecycle.LCSbaseTest; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/VfComponentInstanceCRUDTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/VfComponentInstanceCRUDTest.java index ea8b89200e..dddab57873 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/VfComponentInstanceCRUDTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/resource/VfComponentInstanceCRUDTest.java @@ -40,10 +40,11 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.CapReqDef; import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.CapabilityRequirementRelationship; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.RelationshipImpl; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; @@ -1686,7 +1687,7 @@ public class VfComponentInstanceCRUDTest extends ComponentInstanceBaseTest { requirementDef.setFromNode(riReq.getUniqueId()); requirementDef.setToNode(riCap.getUniqueId()); - RequirementAndRelationshipPair pair = new RequirementAndRelationshipPair(); + RelationshipInfo pair = new RelationshipInfo(); pair.setRequirementOwnerId(riReq.getUniqueId()); pair.setCapabilityOwnerId(riCap.getUniqueId()); pair.setRequirement("host"); @@ -1695,8 +1696,10 @@ public class VfComponentInstanceCRUDTest extends ComponentInstanceBaseTest { pair.setRelationships(relationship); pair.setCapabilityUid(capList.get(0).getUniqueId()); pair.setRequirementUid(reqList.get(0).getUniqueId()); - List<RequirementAndRelationshipPair> relationships = new ArrayList<>(); - relationships.add(pair); + List<CapabilityRequirementRelationship> relationships = new ArrayList<>(); + CapabilityRequirementRelationship capReqRel = new CapabilityRequirementRelationship(); + relationships.add(capReqRel); + capReqRel.setRelation(pair); requirementDef.setRelationships(relationships); RestResponse associateInstances = ComponentInstanceRestUtils.associateInstances(requirementDef, diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ChangeServiceDistributionStatusApiTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ChangeServiceDistributionStatusApiTest.java index 3d338534d1..c8a20cf44a 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ChangeServiceDistributionStatusApiTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ChangeServiceDistributionStatusApiTest.java @@ -32,7 +32,6 @@ import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.DistributionStatusEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; @@ -45,7 +44,6 @@ import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; @@ -61,8 +59,6 @@ import org.openecomp.sdc.ci.tests.utils.validation.ServiceValidationUtils; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import fj.data.Either; - public class ChangeServiceDistributionStatusApiTest extends ComponentBaseTest { protected ResourceReqDetails resourceDetails; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/CreateServiceMetadataApiTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/CreateServiceMetadataApiTest.java index 8e95a6d02c..56cfeb54ea 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/CreateServiceMetadataApiTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/CreateServiceMetadataApiTest.java @@ -20,7 +20,6 @@ package org.openecomp.sdc.ci.tests.execute.service; -import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertNotNull; @@ -37,7 +36,6 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.LifecycleStateEnum; -import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; @@ -49,7 +47,6 @@ import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject; import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; @@ -63,7 +60,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetAllServiceVersions.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetAllServiceVersions.java index 3460cd6e04..760d002856 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetAllServiceVersions.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetAllServiceVersions.java @@ -28,7 +28,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.cassandra.transport.Event.SchemaChange.Target; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetComponentAuditApiTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetComponentAuditApiTest.java index 5642ce4745..846b5d24d3 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetComponentAuditApiTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetComponentAuditApiTest.java @@ -27,10 +27,8 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; import org.apache.http.HttpStatus; -import org.apache.log4j.lf5.util.ResourceUtils; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; @@ -67,7 +65,6 @@ import org.testng.annotations.Test; import com.google.gson.JsonArray; import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import fj.data.Either; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetServiceLatestVersionTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetServiceLatestVersionTest.java index 55ecf694ee..19bed4d380 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetServiceLatestVersionTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/GetServiceLatestVersionTest.java @@ -46,7 +46,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ReqCapOccurrencesTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ReqCapOccurrencesTest.java index c21deafcd8..fdec8346fc 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ReqCapOccurrencesTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ReqCapOccurrencesTest.java @@ -39,10 +39,11 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.CapReqDef; import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.CapabilityRequirementRelationship; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.RelationshipImpl; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; @@ -1045,7 +1046,7 @@ public class ReqCapOccurrencesTest extends ComponentInstanceBaseTest { requirementDef.setFromNode(riReq.getUniqueId()); requirementDef.setToNode(riCap.getUniqueId()); - RequirementAndRelationshipPair pair = new RequirementAndRelationshipPair(); + RelationshipInfo pair = new RelationshipInfo(); pair.setRequirementOwnerId(riReq.getUniqueId()); pair.setCapabilityOwnerId(riCap.getUniqueId()); pair.setRequirement("host"); @@ -1054,8 +1055,10 @@ public class ReqCapOccurrencesTest extends ComponentInstanceBaseTest { pair.setRelationships(relationship); pair.setCapabilityUid(capbilityUid); pair.setRequirementUid(requirementUid); - List<RequirementAndRelationshipPair> relationships = new ArrayList<>(); - relationships.add(pair); + List<CapabilityRequirementRelationship> relationships = new ArrayList<>(); + CapabilityRequirementRelationship capReqRel = new CapabilityRequirementRelationship(); + relationships.add(capReqRel); + capReqRel.setRelation(pair); requirementDef.setRelationships(relationships); return requirementDef; } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ServiceComponentInstanceCRUDTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ServiceComponentInstanceCRUDTest.java index 7181549a27..b2728ea0da 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ServiceComponentInstanceCRUDTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/ServiceComponentInstanceCRUDTest.java @@ -42,7 +42,6 @@ import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentInstanceBaseTest; -import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ComponentReqDetails; @@ -50,10 +49,8 @@ import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/UpdateServiceMetadataTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/UpdateServiceMetadataTest.java index 262cb65adf..9ab4d0b0dc 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/UpdateServiceMetadataTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/UpdateServiceMetadataTest.java @@ -45,7 +45,6 @@ import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/GovernorWorkspaceApiTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/GovernorWorkspaceApiTest.java index 5dd1abcf24..c7c2fdd998 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/GovernorWorkspaceApiTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/GovernorWorkspaceApiTest.java @@ -47,9 +47,7 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.execute.lifecycle.LCSbaseTest; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest.java index 8bc967c877..a5155021fa 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest.java @@ -35,17 +35,11 @@ import java.util.jar.JarEntry; import java.util.jar.JarFile; import org.apache.log4j.PropertyConfigurator; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.utils.Utils; -//import org.junit.runner.JUnitCore; -//import org.junit.runner.Result; -//import org.junit.runner.notification.Failure; -import org.testng.TestListenerAdapter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.TestNG; -import org.testng.reporters.TestHTMLReporter; -import org.testng.xml.XmlSuite; public class StartTest { @@ -73,7 +67,6 @@ public class StartTest { try { config = Utils.getConfig(); } catch (FileNotFoundException e) { - // TODO Auto-generated catch block e.printStackTrace(); } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest2backup.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest2backup.java index d5b06b396f..c9b1e134ac 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest2backup.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/run/StartTest2backup.java @@ -72,7 +72,6 @@ public class StartTest2backup { try { config = Utils.getConfig(); } catch (FileNotFoundException e) { - // TODO Auto-generated catch block e.printStackTrace(); } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/MultipleResourceUpdate.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/MultipleResourceUpdate.java index a33ee71f9e..33cf6cbb98 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/MultipleResourceUpdate.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/MultipleResourceUpdate.java @@ -20,14 +20,14 @@ package org.openecomp.sdc.ci.tests.sanity; +import static org.testng.AssertJUnit.assertTrue; + import java.util.ArrayList; import java.util.List; -import java.util.Map; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; @@ -43,7 +43,6 @@ import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils; import org.testng.annotations.Test; -import static org.testng.AssertJUnit.assertTrue; public class MultipleResourceUpdate extends ComponentBaseTest { diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java index 0f339b811c..fd2b78d3e9 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java @@ -21,38 +21,34 @@ package org.openecomp.sdc.ci.tests.sanity; -import com.aventstack.extentreports.Status; -import com.clearspring.analytics.util.Pair; -import fj.data.Either; import org.junit.Rule; import org.junit.rules.TestName; -import org.openecomp.sdc.be.datatypes.enums.AssetTypeEnum; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.api.ExtentTestActions; -import org.openecomp.sdc.ci.tests.dataProviders.OnboardingDataProviders; +import org.openecomp.sdc.ci.tests.dataProviders.OnbordingDataProviders; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.CsarToscaTester; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtillViaApis; -import org.openecomp.sdc.ci.tests.utils.rest.AssetRestUtils; -import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; -import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory; +import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Optional; import org.testng.annotations.Parameters; import org.testng.annotations.Test; -import java.io.File; +import com.aventstack.extentreports.Status; +import com.clearspring.analytics.util.Pair; + +import fj.data.Either; public class Onboard extends ComponentBaseTest { @@ -66,80 +62,81 @@ public class Onboard extends ComponentBaseTest { } protected String makeDistributionValue; - protected ISdcCsarHelper fdntCsarHelper; - protected SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance(); - + protected String makeToscaValidationValue; @Parameters({ "makeDistribution" }) @BeforeMethod public void beforeTestReadParams(@Optional("true") String makeDistributionReadValue) { makeDistributionValue = makeDistributionReadValue; + logger.info("makeDistributionReadValue - > " + makeDistributionValue); + } + + @Parameters({ "makeToscaValidation" }) + @BeforeClass + public void makeToscaValidation(@Optional("false") String makeToscaValidationReadValue) { + makeToscaValidationValue = makeToscaValidationReadValue; + logger.info("makeToscaValidationReadValue - > " + makeToscaValidationValue); } - @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "VNF_List") - public void onboardVNFShotFlow(String filepath, String vnfFile) throws Exception, Throwable { + @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List") + public void onboardVNFShotFlow(String filePath, String vnfFile) throws Exception, Throwable { setLog(vnfFile); - logger.info("Onboarding - > " + vnfFile); -// System.out.println("Onboarding - > " + vnfFile); - runOnboardToDistributionFlow(filepath, vnfFile); + System.out.println("print - >" + makeDistributionValue); + runOnboardToDistributionFlow(filePath, vnfFile); } - public void runOnboardToDistributionFlow(String filepath, String vnfFile) throws Exception { + public void runOnboardToDistributionFlow(String filePath, String vnfFile) throws Exception { ExtentTestActions.log(Status.INFO, String.format("Going to onboard the VNF %s", vnfFile)); - User user = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); - - Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct = OnboardingUtillViaApis.createVspViaApis(filepath, vnfFile, user); + User user = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER3); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); + Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct = OnboardingUtillViaApis.createVspViaApis(resourceReqDetails, filePath, vnfFile, user); VendorSoftwareProductObject vendorSoftwareProductObject = createVendorSoftwareProduct.right; - vendorSoftwareProductObject.setVspName(createVendorSoftwareProduct.left); + vendorSoftwareProductObject.setName(createVendorSoftwareProduct.left); // create VF base on VNF imported from previous step - have, resourceReqDetails object include part of resource metadata - ResourceReqDetails resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(vendorSoftwareProductObject, vendorSoftwareProductObject.getVspName()); +// ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); + resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); ExtentTestActions.log(Status.INFO, String.format("Create VF %s From VSP", resourceReqDetails.getName())); - Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails, vendorSoftwareProductObject.getVspName()); + Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails, UserRoleEnum.DESIGNER3); ExtentTestActions.log(Status.INFO, String.format("Certify VF")); - resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER3, LifeCycleStatesEnum.CERTIFY, true).getLeft(); //--------------------------SERVICE-------------------------------- ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(user); ExtentTestActions.log(Status.INFO, String.format("Create Service %s", serviceReqDetails.getName())); - Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); + Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER3, true).left().value(); ExtentTestActions.log(Status.INFO, String.format("add VF to Service")); - Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); + Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER3, true); addComponentInstanceToComponentContainer.left().value(); ExtentTestActions.log(Status.INFO, String.format("Certify Service")); - service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - - -// ExtentTestActions.log(Status.INFO, String.format("Distribute Service")); -// AtomicOperationUtils.distributeService(service, true); - try{ -// HttpResponse assetResponse = AssetRestUtils.getComponentToscaModel(AssetTypeEnum.SERVICES, service.getUUID()); -// InputStream inputStream = assetResponse.getEntity().getContent(); - File csarFile = AssetRestUtils.getToscaModelCsarFile(AssetTypeEnum.SERVICES, service.getUUID(), vnfFile); + service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER3, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - ExtentTestActions.log(Status.INFO, "Tosca parser is going to convert service csar file to ISdcCsarHelper object..."); - fdntCsarHelper = factory.getSdcCsarHelper(csarFile.getAbsolutePath()); - CsarToscaTester.processCsar(fdntCsarHelper); + if (makeDistributionValue.equals("true")) { + ExtentTestActions.log(Status.INFO, String.format("Distribute Service")); + AtomicOperationUtils.distributeService(service, true); + } - ExtentTestActions.log(Status.INFO, String.format("Tosca parser successfully parsed service CSAR")); + if (makeToscaValidationValue.equals("true")) { - ExtentTestActions.log(Status.INFO, String.format("The onboarding %s test is passed ! ", vnfFile)); + ExtentTestActions.log(Status.INFO, String.format("Start tosca validation")); + AtomicOperationUtils.toscaValidation(service ,vnfFile); - }catch(Exception e){ - ExtentTestActions.log(Status.ERROR, "Tosca parser FAILED to convert service csar file to ISdcCsarHelper object..."); - ExtentTestActions.log(Status.FAIL, e); } + + ExtentTestActions.log(Status.INFO, String.format("The onboarding %s test is passed ! ", vnfFile)); } + + } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ParametersDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ParametersDefinition.java index a14dc8c76f..dbdaff3d0f 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ParametersDefinition.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ParametersDefinition.java @@ -20,8 +20,6 @@ package org.openecomp.sdc.ci.tests.tosca.datatypes; -import java.util.List; - public class ParametersDefinition { private String type; @@ -34,7 +32,6 @@ public class ParametersDefinition { public ParametersDefinition() { super(); - // TODO Auto-generated constructor stub } public ParametersDefinition(String type, String description, Object default1, String status, String entry_schema, Object value) { diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaDefinition.java index d7ac4a5676..3a63237e99 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaDefinition.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaDefinition.java @@ -20,6 +20,8 @@ package org.openecomp.sdc.ci.tests.tosca.datatypes; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -28,17 +30,15 @@ import org.yaml.snakeyaml.TypeDescription; public class ToscaDefinition { String tosca_definitions_version; - Map<String, String> metadata; - List<Map<String, ToscaImportsDefinition>> imports; - Map<String, ToscaNodeTypesDefinition> node_types; - ToscaTopologyTemplateDefinition topology_template; + Map<String, String> metadata = new HashMap<>(); + List<Map<String, ToscaImportsDefinition>> imports = new ArrayList<>(); + Map<String, ToscaNodeTypesDefinition> node_types = new HashMap<>(); + ToscaTopologyTemplateDefinition topology_template = new ToscaTopologyTemplateDefinition(); public ToscaDefinition() { super(); } - - public ToscaDefinition(String tosca_definitions_version, Map<String, String> metadata, List<Map<String, ToscaImportsDefinition>> imports, Map<String, ToscaNodeTypesDefinition> node_types, ToscaTopologyTemplateDefinition topology_template) { super(); @@ -49,28 +49,30 @@ public class ToscaDefinition { this.topology_template = topology_template; } + public ToscaDefinition(ToscaDefinition toscaDefinition){ + this.tosca_definitions_version = toscaDefinition.tosca_definitions_version; + this.metadata = new HashMap<>(toscaDefinition.metadata); + this.imports = new ArrayList<>(toscaDefinition.imports); + this.node_types = new HashMap<>(toscaDefinition.node_types); + this.topology_template = new ToscaTopologyTemplateDefinition(toscaDefinition.topology_template); + } + + public List<Map<String, ToscaImportsDefinition>> getImports() { + return imports; + } + public void setImports(List<Map<String, ToscaImportsDefinition>> imports) { + this.imports = imports; + } public Map<String, String> getMetadata() { return metadata; } - - public void setMetadata(Map<String, String> metadata) { this.metadata = metadata; } - - - public List<Map<String, ToscaImportsDefinition>> getImports() { - return imports; - } - - public void setImports(List<Map<String, ToscaImportsDefinition>> imports) { - this.imports = imports; - } - public String getTosca_definitions_version() { return tosca_definitions_version; } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaImportsDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaImportsDefinition.java index a5070b8662..c4324bd987 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaImportsDefinition.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaImportsDefinition.java @@ -32,7 +32,6 @@ public class ToscaImportsDefinition { public ToscaImportsDefinition() { super(); - // TODO Auto-generated constructor stub } public ToscaImportsDefinition(String name, String file, String repository, String namespace_uri, String namespace_prefix) { diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaInputsTopologyTemplateDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaInputsTopologyTemplateDefinition.java index 45feadecca..c3b11f2666 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaInputsTopologyTemplateDefinition.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaInputsTopologyTemplateDefinition.java @@ -20,32 +20,241 @@ package org.openecomp.sdc.ci.tests.tosca.datatypes; +import java.util.ArrayList; +import java.util.List; import java.util.Map; import org.yaml.snakeyaml.TypeDescription; +import com.google.gson.annotations.SerializedName; + public class ToscaInputsTopologyTemplateDefinition { - private Map<String,Map<String,Object>> inputs; + public String name; + public String type; + public String description; + public Boolean required; + public Boolean hidden; + public Boolean immutable; + @SerializedName("default") + public Object Default; - public ToscaInputsTopologyTemplateDefinition() { + public String status; + public List<Object> constraints = new ArrayList<Object>(); + public Map<String, Object> entry_schema; + public Object value; + + public ToscaInputsTopologyTemplateDefinition(String name, String type, String description, Boolean required, Object default1, String status, List<Object> constraints, Map<String, Object> entry_schema, Object value, Boolean immutable, Boolean hidden) { super(); - // TODO Auto-generated constructor stub + this.name = name; + this.type = type; + this.description = description; + this.required = required; + Default = default1; + this.status = status; + this.constraints = constraints; + this.entry_schema = entry_schema; + this.value = value; + this.immutable = immutable; + this.hidden = hidden; } - public Map<String, Map<String,Object>> getInputs() { - return inputs; + public ToscaInputsTopologyTemplateDefinition() { } - - public void setInputs(Map<String, Map<String,Object>> inputs) { - this.inputs = inputs; + public ToscaInputsTopologyTemplateDefinition(ToscaInputsTopologyTemplateDefinition definition){ +// this(definition.getName(), definition.getType(), definition.getDescription(), definition.getRequired(), definition.getDefault(), definition.getStatus(), definition.getConstraints(), definition.getEntry_schema(), definition.getValue()); + this.name = definition.name; + this.type = definition.type; + this.description = definition.description; + this.required = definition.required; + this.Default = definition.Default; + this.status = definition.status; + this.constraints = definition.constraints; + this.entry_schema = definition.entry_schema; + this.value = definition.value; + this.immutable = immutable; + this.hidden = hidden; } - + public Boolean getHidden() { + return hidden; + } + + public void setHidden(Boolean hidden) { + this.hidden = hidden; + } + + public Boolean getImmutable() { + return immutable; + } + + public void setImmutable(Boolean immutable) { + this.immutable = immutable; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Boolean getRequired() { + return required; + } + + public void setRequired(Boolean required) { + this.required = required; + } + + public Object getDefault() { + return Default; + } + + public void setDefault(Object default1) { + Default = default1; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public List<Object> getConstraints() { + return constraints; + } + + public void setConstraints(List<Object> constraints) { + this.constraints = constraints; + } + + public Map<String, Object> getEntry_schema() { + return entry_schema; + } + + public void setEntry_schema(Map<String, Object> entry_schema) { + this.entry_schema = entry_schema; + } + + public Object getValue() { + return value; + } + + public void setValue(Object value) { + this.value = value; + } + //gets Type description for Yaml snake public static TypeDescription getTypeDescription(){ TypeDescription typeDescription = new TypeDescription(ToscaInputsTopologyTemplateDefinition.class); + typeDescription.putListPropertyType("constraints", Object.class); + typeDescription.putMapPropertyType("entry_schema", String.class, Object.class); return typeDescription; } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((Default == null) ? 0 : Default.hashCode()); + result = prime * result + ((constraints == null) ? 0 : constraints.hashCode()); + result = prime * result + ((description == null) ? 0 : description.hashCode()); + result = prime * result + ((entry_schema == null) ? 0 : entry_schema.hashCode()); + result = prime * result + ((hidden == null) ? 0 : hidden.hashCode()); + result = prime * result + ((immutable == null) ? 0 : immutable.hashCode()); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((required == null) ? 0 : required.hashCode()); + result = prime * result + ((status == null) ? 0 : status.hashCode()); + result = prime * result + ((type == null) ? 0 : type.hashCode()); + result = prime * result + ((value == null) ? 0 : value.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ToscaInputsTopologyTemplateDefinition other = (ToscaInputsTopologyTemplateDefinition) obj; + if (Default == null) { + if (other.Default != null) + return false; + } else if (!Default.equals(other.Default)) + return false; + if (constraints == null) { + if (other.constraints != null) + return false; + } else if (!constraints.equals(other.constraints)) + return false; + if (description == null) { + if (other.description != null) + return false; + } else if (!description.equals(other.description)) + return false; + if (entry_schema == null) { + if (other.entry_schema != null) + return false; + } else if (!entry_schema.equals(other.entry_schema)) + return false; + if (hidden == null) { + if (other.hidden != null) + return false; + } else if (!hidden.equals(other.hidden)) + return false; + if (immutable == null) { + if (other.immutable != null) + return false; + } else if (!immutable.equals(other.immutable)) + return false; + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + if (required == null) { + if (other.required != null) + return false; + } else if (!required.equals(other.required)) + return false; + if (status == null) { + if (other.status != null) + return false; + } else if (!status.equals(other.status)) + return false; + if (type == null) { + if (other.type != null) + return false; + } else if (!type.equals(other.type)) + return false; + if (value == null) { + if (other.value != null) + return false; + } else if (!value.equals(other.value)) + return false; + return true; + } + } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaNodeTemplatesTopologyTemplateDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaNodeTemplatesTopologyTemplateDefinition.java index d42ca8e307..168f7c6c56 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaNodeTemplatesTopologyTemplateDefinition.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaNodeTemplatesTopologyTemplateDefinition.java @@ -32,24 +32,32 @@ public class ToscaNodeTemplatesTopologyTemplateDefinition { private String description; private String [] directives; private Map<String, Object> properties; - private List<Map<String, Object>> attributes; + private Map<String, Object> attributes; private List<Map<String, Object>> requirements; - private List<Map<String, Object>> capabilities; - private List<Map<String, Object>> interfaces; - private List<Map<String, Object>> artifacts; - private List<Map<String, Object>> node_filter; - private String copy; - private Map<String, String> metadata; - - + private Object capabilities; +// private List<Map<String, Object>> capabilities; // private Map<String, ToscaPropertiesNodeTemplatesDefinition> properties; // private Map<String, ToscaRequirementsNodeTemplatesDefinition> requirements; // private Map<String, ToscaCapabilitiesNodeTemplatesDefinition> capabilities; + private Map<String, Object> interfaces; + private Map<String, Object> artifacts; + private Map<String, Object> node_filter; + private String copy; + private Map<String, String> metadata; + public ToscaNodeTemplatesTopologyTemplateDefinition() { super(); } + public Object getCapabilities() { + return capabilities; + } + + public void setCapabilities(Object capabilities) { + this.capabilities = capabilities; + } + public Map<String, String> getMetadata() { return metadata; } @@ -100,11 +108,11 @@ public class ToscaNodeTemplatesTopologyTemplateDefinition { this.properties = properties; } - public List<Map<String, Object>> getAttributes() { + public Map<String, Object> getAttributes() { return attributes; } - public void setAttributes(List<Map<String, Object>> attributes) { + public void setAttributes(Map<String, Object> attributes) { this.attributes = attributes; } @@ -116,35 +124,27 @@ public class ToscaNodeTemplatesTopologyTemplateDefinition { this.requirements = requirements; } - public List<Map<String, Object>> getCapabilities() { - return capabilities; - } - - public void setCapabilities(List<Map<String, Object>> capabilities) { - this.capabilities = capabilities; - } - - public List<Map<String, Object>> getInterfaces() { + public Map<String, Object> getInterfaces() { return interfaces; } - public void setInterfaces(List<Map<String, Object>> interfaces) { + public void setInterfaces(Map<String, Object> interfaces) { this.interfaces = interfaces; } - public List<Map<String, Object>> getArtifacts() { + public Map<String, Object> getArtifacts() { return artifacts; } - public void setArtifacts(List<Map<String, Object>> artifacts) { + public void setArtifacts(Map<String, Object> artifacts) { this.artifacts = artifacts; } - public List<Map<String, Object>> getNode_filter() { + public Map<String, Object> getNode_filter() { return node_filter; } - public void setNode_filter(List<Map<String, Object>> node_filter) { + public void setNode_filter(Map<String, Object> node_filter) { this.node_filter = node_filter; } @@ -161,11 +161,12 @@ public class ToscaNodeTemplatesTopologyTemplateDefinition { TypeDescription typeDescription = new TypeDescription(ToscaNodeTemplatesTopologyTemplateDefinition.class); typeDescription.putMapPropertyType("properties", String.class, Object.class); typeDescription.putListPropertyType("requirements", Map.class); - typeDescription.putListPropertyType("capabilities", Map.class); - typeDescription.putListPropertyType("attributes", Map.class); - typeDescription.putListPropertyType("interfaces", Map.class); - typeDescription.putListPropertyType("artifacts", Map.class); - typeDescription.putListPropertyType("node_filter", Map.class); +// typeDescription.putMapPropertyType("capabilities",String.class, Object.class); +// typeDescription.putListPropertyType("capabilities", Object.class); + typeDescription.putMapPropertyType("attributes", String.class, Object.class); + typeDescription.putMapPropertyType("interfaces", String.class, Object.class); + typeDescription.putMapPropertyType("artifacts", String.class, Object.class); + typeDescription.putMapPropertyType("node_filter", String.class, Object.class); typeDescription.putMapPropertyType("metadata", String.class, String.class); return typeDescription; } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaNodeTypesDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaNodeTypesDefinition.java index 07fd223d2c..b9d200a252 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaNodeTypesDefinition.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaNodeTypesDefinition.java @@ -20,6 +20,7 @@ package org.openecomp.sdc.ci.tests.tosca.datatypes; +import java.util.HashMap; import java.util.Map; // spec page 88 @@ -29,12 +30,12 @@ public class ToscaNodeTypesDefinition { private String derived_from; private String version; private String description; - private Map<String, Object> properties; - private Map<String, Object> attributes; - private Map<String, Object> requirements; - private Map<String, Object> capabilities; - private Map<String, Object> interfaces; - private Map<String, Object> artifacts; + private Map<String, Object> properties = new HashMap<>(); + private Map<String, Object> attributes = new HashMap<>(); + private Map<String, Object> requirements = new HashMap<>(); + private Map<String, Object> capabilities = new HashMap<>(); + private Map<String, Object> interfaces = new HashMap<>(); + private Map<String, Object> artifacts = new HashMap<>(); public ToscaNodeTypesDefinition() { super(); diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaOutputsTopologyTemplateDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaOutputsTopologyTemplateDefinition.java index 02ca03dfa5..b370dd3b6d 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaOutputsTopologyTemplateDefinition.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaOutputsTopologyTemplateDefinition.java @@ -28,7 +28,6 @@ public class ToscaOutputsTopologyTemplateDefinition { public ToscaOutputsTopologyTemplateDefinition() { super(); - // TODO Auto-generated constructor stub } public Map<String, Object> getOutputs() { diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaRelationshipTemplatesTopologyTemplateDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaRelationshipTemplatesTopologyTemplateDefinition.java index 392ffc4e42..881f7f587e 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaRelationshipTemplatesTopologyTemplateDefinition.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaRelationshipTemplatesTopologyTemplateDefinition.java @@ -25,7 +25,6 @@ import java.util.Map; public class ToscaRelationshipTemplatesTopologyTemplateDefinition { public ToscaRelationshipTemplatesTopologyTemplateDefinition() { - // TODO Auto-generated constructor stub } private String type; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaServiceGroupsMetadataDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaServiceGroupsMetadataDefinition.java index 86ca8f56cf..4072504296 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaServiceGroupsMetadataDefinition.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaServiceGroupsMetadataDefinition.java @@ -30,7 +30,6 @@ public class ToscaServiceGroupsMetadataDefinition { public ToscaServiceGroupsMetadataDefinition() { super(); - // TODO Auto-generated constructor stub } public String getVfModuleModelName() { diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaSubstitutionMappingsDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaSubstitutionMappingsDefinition.java index 957d988c4d..9b474e9ea6 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaSubstitutionMappingsDefinition.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaSubstitutionMappingsDefinition.java @@ -20,6 +20,7 @@ package org.openecomp.sdc.ci.tests.tosca.datatypes; +import java.util.HashMap; import java.util.Map; import org.yaml.snakeyaml.TypeDescription; @@ -27,12 +28,11 @@ import org.yaml.snakeyaml.TypeDescription; public class ToscaSubstitutionMappingsDefinition { private String node_type; - private Map<String, Object> requirements; - private Map<String, Object> capabilities; + private Map<String, Object> requirements = new HashMap<>(); + private Map<String, Object> capabilities = new HashMap<>(); public ToscaSubstitutionMappingsDefinition() { super(); - // TODO Auto-generated constructor stub } public String getNode_type() { diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaTopologyTemplateDefinition.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaTopologyTemplateDefinition.java index 66672b1d07..97944368e2 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaTopologyTemplateDefinition.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaTopologyTemplateDefinition.java @@ -20,8 +20,9 @@ package org.openecomp.sdc.ci.tests.tosca.datatypes; -import java.util.List; +import java.util.HashMap; import java.util.Map; +import java.util.stream.Collectors; import org.yaml.snakeyaml.TypeDescription; @@ -29,25 +30,52 @@ import org.yaml.snakeyaml.TypeDescription; public class ToscaTopologyTemplateDefinition { String description; - Map<String, Object> inputs; - Map<String,ToscaNodeTemplatesTopologyTemplateDefinition> node_templates; +// Map<String, Map<String, ToscaInputsDefinition>> inputs; + Map<String,ToscaNodeTemplatesTopologyTemplateDefinition> node_templates = new HashMap<>(); // Map<String,ToscaRelationshipTemplatesTopologyTemplateDefinition> relationship_templates; - Map<String,ToscaGroupsTopologyTemplateDefinition> groups; + Map<String,ToscaGroupsTopologyTemplateDefinition> groups = new HashMap<>(); + Map<String, ToscaInputsTopologyTemplateDefinition> inputs = new HashMap<>(); // Map<String,ToscaPoliciesTopologyTemplateDefinition> policies; // Map<String,ToscaOutputsTopologyTemplateDefinition> outputs; ToscaSubstitutionMappingsDefinition substitution_mappings; public ToscaTopologyTemplateDefinition() { super(); - // TODO Auto-generated constructor stub + } + + public ToscaTopologyTemplateDefinition(ToscaTopologyTemplateDefinition definition) { + this.description = definition.description; + this.node_templates = new HashMap<>(definition.node_templates); + this.groups = new HashMap<String,ToscaGroupsTopologyTemplateDefinition>(definition.groups); + this.inputs = definition.inputs.entrySet().stream().collect(Collectors.toMap(e -> e.getKey(), e -> new ToscaInputsTopologyTemplateDefinition(e.getValue()))); + this.substitution_mappings = definition.substitution_mappings; + } + + public ToscaTopologyTemplateDefinition(String description, Map<String, ToscaNodeTemplatesTopologyTemplateDefinition> node_templates, Map<String, ToscaGroupsTopologyTemplateDefinition> groups, + Map<String, ToscaInputsTopologyTemplateDefinition> inputs, ToscaSubstitutionMappingsDefinition substitution_mappings) { + super(); + this.description = description; + this.node_templates = node_templates; + this.groups = groups; + this.inputs = inputs; + this.substitution_mappings = substitution_mappings; +} + + public Map<String, ToscaInputsTopologyTemplateDefinition> getInputs() { + return inputs; } + public void setInputs(Map<String, ToscaInputsTopologyTemplateDefinition> inputs) { + this.inputs = inputs; + } + public void addInputs(Map<String, ToscaInputsTopologyTemplateDefinition> inputs) { + this.inputs.putAll(inputs); + } + public ToscaSubstitutionMappingsDefinition getSubstitution_mappings() { return substitution_mappings; } - - public void setSubstitution_mappings(ToscaSubstitutionMappingsDefinition substitution_mappings) { this.substitution_mappings = substitution_mappings; } @@ -60,18 +88,7 @@ public class ToscaTopologyTemplateDefinition { this.description = description; } - public Map<String, Object> getInputs() { - return inputs; - } - - public void setInputs(Map<String, Object> inputs) { - this.inputs = inputs; - } - public void addInputs(Map<String, Object> inputs) { - this.inputs.putAll(inputs); - } - public Map<String, ToscaNodeTemplatesTopologyTemplateDefinition> getNode_templates() { return node_templates; } @@ -80,14 +97,6 @@ public class ToscaTopologyTemplateDefinition { this.node_templates = node_templates; } -// public Map<String, ToscaRelationshipTemplatesTopologyTemplateDefinition> getRelationship_templates() { -// return relationship_templates; -// } -// -// public void setRelationship_templates(Map<String, ToscaRelationshipTemplatesTopologyTemplateDefinition> relationship_templates) { -// this.relationship_templates = relationship_templates; -// } - public Map<String, ToscaGroupsTopologyTemplateDefinition> getGroups() { return groups; } @@ -95,41 +104,12 @@ public class ToscaTopologyTemplateDefinition { public void setGroups(Map<String, ToscaGroupsTopologyTemplateDefinition> groups) { this.groups = groups; } -// -// public Map<String, ToscaPoliciesTopologyTemplateDefinition> getPolicies() { -// return policies; -// } -// -// public void setPolicies(Map<String, ToscaPoliciesTopologyTemplateDefinition> policies) { -// this.policies = policies; -// } -// -// public Map<String, ToscaOutputsTopologyTemplateDefinition> getOutputs() { -// return outputs; -// } -// -// public void setOutputs(Map<String, ToscaOutputsTopologyTemplateDefinition> outputs) { -// this.outputs = outputs; -// } -// -// public Map<String, ToscaSubstitutionMappingsDefinition> getSubstitution_mappings() { -// return substitution_mappings; -// } -// -// public void setSubstitution_mappings(Map<String, ToscaSubstitutionMappingsDefinition> substitution_mappings) { -// this.substitution_mappings = substitution_mappings; -// } - -// @Override -// public String toString() { -// return "ToscaTopologyTemplateDefinition [description=" + description + ", inputs=" + inputs + ", node_templates=" + node_templates + ", relationship_templates=" + relationship_templates + ", groups=" + groups + ", policies=" -// + policies + ", outputs=" + outputs + ", substitution_mappings=" + substitution_mappings + "]"; -// } + //gets Type description for Yaml snake public static TypeDescription getTypeDescription(){ TypeDescription typeDescription = new TypeDescription(ToscaTopologyTemplateDefinition.class); - typeDescription.putMapPropertyType("inputs", String.class, Object.class); + typeDescription.putMapPropertyType("inputs", String.class, ToscaInputsTopologyTemplateDefinition.class); typeDescription.putMapPropertyType("node_templates", String.class, ToscaNodeTemplatesTopologyTemplateDefinition.class); typeDescription.putMapPropertyType("groups", String.class, ToscaGroupsTopologyTemplateDefinition.class); return typeDescription; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaTopologyTemplateDefinition2.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaTopologyTemplateDefinition2.java index 735c8a0f95..5c750c9670 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaTopologyTemplateDefinition2.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/tosca/datatypes/ToscaTopologyTemplateDefinition2.java @@ -36,7 +36,6 @@ public class ToscaTopologyTemplateDefinition2 { public ToscaTopologyTemplateDefinition2() { super(); - // TODO Auto-generated constructor stub } public String getDescription() { diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/CsarToscaTester.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/CsarToscaTester.java index afdfa43d94..a464eb1bdf 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/CsarToscaTester.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/CsarToscaTester.java @@ -1,5 +1,11 @@ package org.openecomp.sdc.ci.tests.utils; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException; import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory; @@ -8,63 +14,8 @@ import org.openecomp.sdc.toscaparser.api.Group; import org.openecomp.sdc.toscaparser.api.NodeTemplate; import org.openecomp.sdc.toscaparser.api.elements.Metadata; import org.openecomp.sdc.toscaparser.api.parameters.Input; -import org.openecomp.sdc.toscaparser.api.utils.ThreadLocalsHolder; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Map; public class CsarToscaTester { - public static void main(String[] args) throws Exception { - System.out.println("CsarToscaParser - path to CSAR's Directory is " + Arrays.toString(args)); - SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance(); - - File folder = new File(args[0]); - File[] listOfFiles = folder.listFiles(); - Date now = new Date(); - SimpleDateFormat dateFormat = new SimpleDateFormat("d-MM-y-HH_mm_ss"); - String time = dateFormat.format(now); - String csarsDir = args[1] + "/csar-reports-" + time; - File dir = new File(csarsDir); - dir.mkdir(); - - - for (File file : listOfFiles) { - if (file.isFile()) { - System.out.println("File " + file.getAbsolutePath()); - String name = file.getName(); - String currentCsarDir = csarsDir+"/"+name+"-"+time; - dir = new File(currentCsarDir); - dir.mkdir(); - try { - processCsar(factory, file); - } catch (SdcToscaParserException e){ - System.out.println("SdcToscaParserException caught. Code: "+e.getCode()+", message: "+ e.getMessage()); - } - List<String> notAnalyzedReport = ThreadLocalsHolder.getCollector().getNotAnalyzedExceptionsReport(); - System.out.println("NOT ANALYZED during CSAR parsing are: " + (notAnalyzedReport != null ? notAnalyzedReport.toString() : "none")); - List<String> warningsReport = ThreadLocalsHolder.getCollector().getWarningsReport(); - //System.out.println("WARNINGS during CSAR parsing are: " + (warningsReport != null ? warningsReport.toString() : "none")); - List<String> criticalsReport = ThreadLocalsHolder.getCollector().getCriticalsReport(); - System.out.println("CRITICALS during CSAR parsing are: " + (criticalsReport != null ? criticalsReport.toString() : "none")); - - try { - generateReport(time, name, currentCsarDir, criticalsReport, "critical"); - generateReport(time, name, currentCsarDir, warningsReport, "warning"); - generateReport(time, name, currentCsarDir, notAnalyzedReport, "notAnalyzed"); - - } catch (IOException ex) { - ex.printStackTrace(); - } - } - - } - } public static void processCsar(SdcToscaParserFactory factory, File file) throws SdcToscaParserException { ISdcCsarHelper sdcCsarHelper = factory.getSdcCsarHelper(file.getAbsolutePath()); diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/DbUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/DbUtils.java index 8e611a32d7..16266fb03f 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/DbUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/DbUtils.java @@ -29,7 +29,15 @@ import java.util.Map.Entry; import java.util.Set; import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Element; import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; +import org.openecomp.sdc.ci.tests.api.Urls; +import org.openecomp.sdc.ci.tests.config.Config; +import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.users.UserAuditJavaObject; +import org.openecomp.sdc.ci.tests.utils.cassandra.CassandraUtils; import com.google.gson.Gson; import com.google.gson.JsonArray; @@ -43,19 +51,6 @@ import com.thinkaurelius.titan.core.TitanVertex; import fj.data.Either; -import org.apache.tinkerpop.gremlin.structure.Direction; -import org.apache.tinkerpop.gremlin.structure.Edge; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; -import org.openecomp.sdc.ci.tests.api.Urls; -import org.openecomp.sdc.ci.tests.config.Config; -import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; -import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.users.UserAuditJavaObject; -import org.openecomp.sdc.ci.tests.utils.cassandra.CassandraUtils; -import org.apache.tinkerpop.gremlin.structure.Element; -import org.apache.tinkerpop.gremlin.structure.Property; - public class DbUtils { private static String titanConfigFilePath; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/DistributionUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/DistributionUtils.java index 4838d55a3d..35c25b7157 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/DistributionUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/DistributionUtils.java @@ -29,17 +29,30 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import org.codehaus.jettison.json.JSONArray; +import org.codehaus.jettison.json.JSONException; +import org.codehaus.jettison.json.JSONObject; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.api.Urls; +import org.openecomp.sdc.ci.tests.config.Config; +import org.openecomp.sdc.ci.tests.datatypes.DistributionMonitorObject; import org.openecomp.sdc.ci.tests.datatypes.ServiceDistributionStatus; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; +//import org.openecomp.sdc.be.components.distribution.engine.DistributionStatusNotificationEnum; - public class DistributionUtils { +import com.clearspring.analytics.util.Pair; +import com.google.gson.Gson; + + + public class DistributionUtils extends BaseRestUtils{ final static String serviceDistributionSuffix = "/sdc/v1/catalog/services/"; @@ -140,5 +153,112 @@ import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; return distributionArtifactMap; } - + + + public static RestResponse getDistributionStatus(User sdncModifierDetails, String distributionId) throws IOException { + + Config config = Utils.getConfig(); + String url = String.format(Urls.DISTRIBUTION_SERVICE_MONITOR, config.getCatalogBeHost(), config.getCatalogBePort(), distributionId); + return sendGet(url, sdncModifierDetails.getUserId()); + + } + + + /** + * @param response + * @return parsed distribution list of DistributionMonitorObject java objects + * @throws JSONException + */ + public static Map<String, List<DistributionMonitorObject>> getSortedDistributionStatus(RestResponse response) throws JSONException{ + + ArrayList<DistributionMonitorObject> distributionStatusList = new ArrayList<DistributionMonitorObject>(); + String responseString = response.getResponse(); + JSONObject jObject; + JSONArray jsonArray = null; + jObject = new JSONObject(responseString); + jsonArray = jObject.getJSONArray("distributionStatusList"); + + Gson gson = new Gson(); + for(int i=0; i<jsonArray.length(); i++){ + String jsonElement = jsonArray.get(i).toString(); + DistributionMonitorObject distributionStatus = gson.fromJson(jsonElement, DistributionMonitorObject.class); + distributionStatusList.add(distributionStatus); + } + Map<String, List<DistributionMonitorObject>> sortedDistributionMapByConsumer = sortDistributionStatusByConsumer(distributionStatusList); + + return sortedDistributionMapByConsumer; + } + + /** + * @param distributionStatusList + * @return sorted distribution map where key is consumer name and value contains list of corresponded DistributionMonitorObject java object + */ + public static Map<String, List<DistributionMonitorObject>> sortDistributionStatusByConsumer(ArrayList<DistributionMonitorObject> distributionStatusList) { + // sort distribution status list per consumer + Map<String, List<DistributionMonitorObject>> distributionStatusMapByConsumer = new HashMap<String, List<DistributionMonitorObject>>(); + for(DistributionMonitorObject distributionListElement : distributionStatusList){ + String key = distributionListElement.getOmfComponentID(); + List<DistributionMonitorObject> list = new ArrayList<>(); + if(distributionStatusMapByConsumer.get(key) != null){ + list = distributionStatusMapByConsumer.get(key); + list.add(distributionListElement); + distributionStatusMapByConsumer.put(key, list); + }else{ + list.add(distributionListElement); + distributionStatusMapByConsumer.put(key, list); + } + + } + return distributionStatusMapByConsumer; + } + + + /** + * @param pair + * @return consumer Status map: if map is empty - all consumers successes download and deploy the artifacts, + * else - return failed consumer status per url + */ + public static Pair<Boolean, Map<String, List<String>>> verifyDistributionStatus(Map<String, List<DistributionMonitorObject>> map){ + + Map<String, List<String>> consumerStatusMap = new HashMap<>(); + List<Boolean> flag = new ArrayList<>(); + for (Entry<String, List<DistributionMonitorObject>> distributionMonitor : map.entrySet()){ + int notifiedCount = 0, downloadCount = 0, deployCount = 0; + List<String> failedList = new ArrayList<>(); + List<DistributionMonitorObject> listValue = distributionMonitor.getValue(); + for(DistributionMonitorObject distributionStatus : listValue){ + String status = distributionStatus.getStatus(); + switch (status) { + case "NOTIFIED": notifiedCount++; + break; + case "NOT_NOTIFIED": + break; + case "DOWNLOAD_OK": downloadCount++; + break; + case "DEPLOY_OK": deployCount++; + break; + default: + failedList.add("Url " + distributionStatus.getUrl() + " failed with status " + distributionStatus.getStatus()); + break; + } + } + if((notifiedCount != downloadCount || notifiedCount != deployCount) && notifiedCount != 0){ + consumerStatusMap.put(distributionMonitor.getKey(), failedList); + flag.add(false); + } + if(notifiedCount == 0){ + flag.add(true); + } + } + + if(!flag.contains(false)){ + return Pair.create(true, consumerStatusMap); + }else{ + return Pair.create(false, consumerStatusMap); + } + + } + + + } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/ReqCap.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/ReqCap.java index 3f000d750a..9ac02a0092 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/ReqCap.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/ReqCap.java @@ -31,8 +31,8 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.function.Function; import java.util.Set; +import java.util.function.Function; import java.util.stream.Collectors; import org.apache.commons.lang3.tuple.ImmutablePair; @@ -42,7 +42,7 @@ import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Product; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; @@ -580,7 +580,7 @@ public class ReqCap { private static void deleteAssociatedFromExpected(RequirementCapabilityRelDef requirementDef) { // removing from requirements - RequirementAndRelationshipPair relationship = requirementDef.getRelationships().get(0); + RelationshipInfo relationship = requirementDef.getRelationships().get(0).getRelation(); String type = relationship.getRelationship().getType(); String fromId = requirementDef.getFromNode(); List<RequirementDefinition> reqList = expectedContainerRequirements.get(type); @@ -612,7 +612,7 @@ public class ReqCap { private static void addDissociatedToExpected(RequirementCapabilityRelDef requirementDef) { // adding to requirements - RequirementAndRelationshipPair relationship = requirementDef.getRelationships().get(0); + RelationshipInfo relationship = requirementDef.getRelationships().get(0).getRelation(); String type = relationship.getRelationship().getType(); String fromId = requirementDef.getFromNode(); String key = type + " " + fromId; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/ToscaParserUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/ToscaParserUtils.java index 5926798ceb..0c193ad13c 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/ToscaParserUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/ToscaParserUtils.java @@ -143,7 +143,9 @@ public class ToscaParserUtils { toscaDefinition = (ToscaDefinition) yaml.load(payload); } catch (Exception e) { log.debug("Failed to parse tosca yaml file"); + log.debug("Exception: " + e); System.out.println("Exception: " + e); + assertTrue("Exception: " + e, false); } return toscaDefinition; @@ -160,6 +162,7 @@ public class ToscaParserUtils { toscaStructure.addTypeDescription(ToscaImportsDefinition.getTypeDescription()); toscaStructure.addTypeDescription(ToscaMetadataDefinition.getTypeDescription()); toscaStructure.addTypeDescription(ToscaInputsTopologyTemplateDefinition.getTypeDescription()); +// toscaStructure.addTypeDescription(ToscaInputsDefinition.getTypeDescription()); // Skip properties which are found in YAML, but not found in POJO PropertyUtils propertyUtils = new PropertyUtils(); propertyUtils.setSkipMissingProperties(true); diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils.java index e89c6be5df..bd1066a662 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils.java @@ -20,10 +20,10 @@ package org.openecomp.sdc.ci.tests.utils.cassandra; -import com.datastax.driver.core.*; -import com.datastax.driver.core.querybuilder.QueryBuilder; -import com.datastax.driver.core.querybuilder.Select; -import com.datastax.driver.core.querybuilder.Select.Where; +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; import org.javatuples.Pair; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; @@ -32,10 +32,15 @@ import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.FileNotFoundException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; +import com.datastax.driver.core.Cluster; +import com.datastax.driver.core.KeyspaceMetadata; +import com.datastax.driver.core.Metadata; +import com.datastax.driver.core.Row; +import com.datastax.driver.core.Session; +import com.datastax.driver.core.TableMetadata; +import com.datastax.driver.core.querybuilder.QueryBuilder; +import com.datastax.driver.core.querybuilder.Select; +import com.datastax.driver.core.querybuilder.Select.Where; public final class CassandraUtils { private static Logger logger = LoggerFactory.getLogger(CassandraUtils.class.getName()); diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils2.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils2.java index 024389609d..8381bbdd21 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils2.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/cassandra/CassandraUtils2.java @@ -20,10 +20,10 @@ package org.openecomp.sdc.ci.tests.utils.cassandra; -import com.datastax.driver.core.*; -import com.datastax.driver.core.querybuilder.QueryBuilder; -import com.datastax.driver.core.querybuilder.Select; -import com.datastax.driver.core.querybuilder.Select.Where; +import java.io.FileNotFoundException; +import java.util.Collection; +import java.util.List; + import org.javatuples.Pair; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; import org.openecomp.sdc.ci.tests.utils.Utils; @@ -31,9 +31,15 @@ import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.FileNotFoundException; -import java.util.Collection; -import java.util.List; +import com.datastax.driver.core.Cluster; +import com.datastax.driver.core.KeyspaceMetadata; +import com.datastax.driver.core.Metadata; +import com.datastax.driver.core.Row; +import com.datastax.driver.core.Session; +import com.datastax.driver.core.TableMetadata; +import com.datastax.driver.core.querybuilder.QueryBuilder; +import com.datastax.driver.core.querybuilder.Select; +import com.datastax.driver.core.querybuilder.Select.Where; public final class CassandraUtils2 { private static Logger logger = LoggerFactory.getLogger(CassandraUtils2.class.getName()); diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/AtomicOperationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/AtomicOperationUtils.java index 58ab9f353e..56c350f471 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/AtomicOperationUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/AtomicOperationUtils.java @@ -29,16 +29,16 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; - -import javax.xml.bind.helpers.AbstractUnmarshallerImpl; -import javax.xml.ws.Response; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang3.tuple.Pair; -import org.aspectj.apache.bcel.classfile.Code; import org.json.JSONException; import org.openecomp.sdc.be.datatypes.elements.ConsumerDataDefinition; +import org.openecomp.sdc.be.datatypes.enums.AssetTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.ArtifactDefinition; @@ -50,14 +50,18 @@ import org.openecomp.sdc.be.model.Product; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; +import org.openecomp.sdc.ci.tests.api.ExtentTestActions; import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.DistributionMonitorObject; import org.openecomp.sdc.ci.tests.datatypes.ImportReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails; import org.openecomp.sdc.ci.tests.datatypes.PropertyReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.ServiceDistributionStatus; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; @@ -69,8 +73,11 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.utils.CsarToscaTester; +import org.openecomp.sdc.ci.tests.utils.DistributionUtils; import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; +import org.openecomp.sdc.ci.tests.utils.rest.AssetRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ConsumerRestUtils; @@ -81,8 +88,11 @@ import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; +import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; +import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory; import org.testng.SkipException; +import com.aventstack.extentreports.Status; import com.google.gson.Gson; import fj.data.Either; @@ -194,6 +204,25 @@ public final class AtomicOperationUtils { return Either.right(resourceResp); } + public static Either<Resource, RestResponse> updateResource(ResourceReqDetails resourceReqDetails, User defaultUser, Boolean validateState) { + try { + + RestResponse resourceResp = ResourceRestUtils.updateResource(resourceReqDetails, defaultUser, resourceReqDetails.getUniqueId()); + + if (validateState) { + assertTrue(resourceResp.getErrorCode() == ResourceRestUtils.STATUS_CODE_SUCCESS); + } + + if (resourceResp.getErrorCode() == ResourceRestUtils.STATUS_CODE_SUCCESS) { + Resource resourceResponseObject = ResponseParser.convertResourceResponseToJavaObject(resourceResp.getResponse()); + return Either.left(resourceResponseObject); + } + return Either.right(resourceResp); + } catch (Exception e) { + throw new AtomicOperationException(e); + } + } + // *********** SERVICE **************** public static Either<Service, RestResponse> createDefaultService(UserRoleEnum userRole, Boolean validateState) throws Exception { @@ -361,7 +390,7 @@ public final class AtomicOperationUtils { RestResponse distributionService = null; RestResponse approveDistribution = LifecycleRestUtils.changeDistributionStatus(serviceDetails, null, governotUser, "approveService", DistributionStatusEnum.DISTRIBUTION_APPROVED); - if (approveDistribution.getErrorCode() == 200) { + if (approveDistribution.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS) { distributionService = LifecycleRestUtils.changeDistributionStatus(serviceDetails, null, opsUser, "approveService", DistributionStatusEnum.DISTRIBUTED); } @@ -375,6 +404,19 @@ public final class AtomicOperationUtils { } + + public static void toscaValidation(Component component, String vnfFile) throws Exception { + + ISdcCsarHelper fdntCsarHelper; + SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance(); + File csarFile = AssetRestUtils.getToscaModelCsarFile(AssetTypeEnum.SERVICES, component.getUUID() , vnfFile); + ExtentTestActions.log(Status.INFO, "Tosca parser is going to convert service csar file to ISdcCsarHelper object..."); + fdntCsarHelper = factory.getSdcCsarHelper(csarFile.getAbsolutePath()); + CsarToscaTester.processCsar(fdntCsarHelper); + ExtentTestActions.log(Status.INFO, String.format("Tosca parser successfully parsed service CSAR")); + + } + // *********** ARTIFACTS ***************** public static Either<ArtifactDefinition, RestResponse> uploadArtifactByType(ArtifactTypeEnum artifactType, Component component, UserRoleEnum userRole, Boolean deploymentTrue, Boolean validateState) throws Exception { @@ -769,13 +811,88 @@ public final class AtomicOperationUtils { } HttpRequest http = new HttpRequest(); RestResponse response = http.httpSendGet(url, headersMap); - if (response.getErrorCode() != 200 && response.getResponse().getBytes() == null && response.getResponse().getBytes().length == 0) { + if (response.getErrorCode() != BaseRestUtils.STATUS_CODE_SUCCESS && response.getResponse().getBytes() == null && response.getResponse().getBytes().length == 0) { return Either.right(response); } return Either.left(response.getResponse()); } + public static RestResponse getDistributionStatusByDistributionId(String distributionId ,Boolean validateState) { + + try { + User defaultUser = ElementFactory.getDefaultUser(UserRoleEnum.OPS); + RestResponse response = DistributionUtils.getDistributionStatus(defaultUser, distributionId); + + if (validateState) { + assertTrue(response.getErrorCode() == ResourceRestUtils.STATUS_CODE_SUCCESS); + } + return response; + + } catch (Exception e) { + throw new AtomicOperationException(e); + } + } + + public static Either <RestResponse, Map<String, List<DistributionMonitorObject>>> getSortedDistributionStatusMap(Service service ,Boolean validateState) { + + try { + ServiceDistributionStatus serviceDistributionObject = DistributionUtils.getLatestServiceDistributionObject(service); + RestResponse response = getDistributionStatusByDistributionId(serviceDistributionObject.getDistributionID(), true); + + if(validateState) { + assertTrue(response.getErrorCode() == ResourceRestUtils.STATUS_CODE_SUCCESS); + } + if(response.getErrorCode() == ResourceRestUtils.STATUS_CODE_SUCCESS){ + Map<String, List<DistributionMonitorObject>> parsedDistributionStatus = DistributionUtils.getSortedDistributionStatus(response); + return Either.right(parsedDistributionStatus); + } + return Either.left(response); + } catch (Exception e) { + throw new AtomicOperationException(e); + } + + } + /** + * @param service + * @param pollingCount + * @param pollingInterval + * Recommended values for service distribution for pollingCount is 4 and for pollingInterval is 15000ms + * @throws Exception + */ + public static Boolean distributeAndValidateService(Service service, int pollingCount, int pollingInterval) throws Exception { + + Boolean statusFlag = true; + AtomicOperationUtils.distributeService(service, true); + TimeUnit.MILLISECONDS.sleep(pollingInterval); + int timeOut = pollingCount * pollingInterval; + while (timeOut > 0) { + Map<String,List<DistributionMonitorObject>> sortedDistributionStatusMap = AtomicOperationUtils.getSortedDistributionStatusMap(service, true).right().value(); + com.clearspring.analytics.util.Pair<Boolean,Map<String,List<String>>> verifyDistributionStatus = DistributionUtils.verifyDistributionStatus(sortedDistributionStatusMap); + if(verifyDistributionStatus.left.equals(false)){ + if((verifyDistributionStatus.right != null && ! verifyDistributionStatus.right.isEmpty()) && timeOut == 0){ + for(Entry<String, List<String>> entry : verifyDistributionStatus.right.entrySet()){ + if(ComponentBaseTest.getExtendTest() != null){ + ComponentBaseTest.getExtendTest().log(Status.INFO, "Consumer: " + entry.getKey() + " failed on following: "+ entry.getValue()); + statusFlag = false; + }else{ + System.out.println("Consumer: " + entry.getKey() + " failed on following: "+ entry.getValue()); + } + } + } + TimeUnit.MILLISECONDS.sleep(pollingInterval); + timeOut-=pollingInterval; + }else { + timeOut = 0; + } + } + return statusFlag; + } + + public static Boolean distributeAndValidateService(Service service) throws Exception { + return distributeAndValidateService(service, 6, 10000); + } + } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/Convertor.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/Convertor.java index 619d279b62..cbae462d80 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/Convertor.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/Convertor.java @@ -29,7 +29,6 @@ import java.util.List; import org.apache.commons.lang3.StringUtils; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.model.DistributionStatusEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.Product; import org.openecomp.sdc.be.model.User; @@ -40,12 +39,10 @@ import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ResourceRespJavaObject; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo; -import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedProductAudit; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedUserCRUDAudit; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; import org.openecomp.sdc.common.api.Constants; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ElementFactory.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ElementFactory.java index ddca429f2c..8224f08018 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ElementFactory.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ElementFactory.java @@ -33,10 +33,11 @@ import org.openecomp.sdc.be.datatypes.enums.AssetTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.CapabilityRequirementRelationship; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.RelationshipImpl; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; @@ -80,6 +81,20 @@ public class ElementFactory { private static final String RESOURCE_INSTANCE_POS_X = "20"; private static final String RESOURCE_INSTANCE_POS_Y = "20"; private static final String RESOURCE_INSTANCE_DESCRIPTION = "description"; + + // *** Getters *** + + public static String getServicePrefix() { + return CI_SERVICE; + } + + public static String getResourcePrefix() { + return CI_RES; + } + + public static String getProductPrefix() { + return CI_PRODUCT; + } // *** RESOURCE *** @@ -149,6 +164,7 @@ public class ElementFactory { String icon = "defaulticon"; ResourceReqDetails resourceDetails = new ResourceReqDetails(resourceName, description, resourceTags, null, derivedFrom, vendorName, vendorRelease, contactId, icon); resourceDetails.addCategoryChain(category.getCategory(), category.getSubCategory()); + resourceDetails.setResourceVendorModelNumber("vendorNumber-1.5.7"); return resourceDetails; @@ -196,9 +212,15 @@ public class ElementFactory { String icon = "defaulticon"; ResourceReqDetails resourceDetails = new ResourceReqDetails(resourceName, description, resourceTags, null, derivedFrom, vendorName, vendorRelease, contactId, icon, resourceType.toString()); resourceDetails.addCategoryChain(category.getCategory(), category.getSubCategory()); + resourceDetails.setResourceVendorModelNumber("vendorNumber-1.5.7"); return resourceDetails; } - + + public static ResourceReqDetails getRandomCategoryResource() { + ResourceReqDetails resourceDetails = getDefaultResource(ResourceCategoryEnum.getRandomElement()); + return resourceDetails; + } + public static ResourceExternalReqDetails getDefaultResourceByType(String resourceName, ResourceCategoryEnum category, String contactId, String resourceType) { resourceName = (resourceName + resourceType + generateUUIDforSufix()); String description = "Represents a generic software component that can be managed and run by a Compute Node Type."; @@ -278,7 +300,7 @@ public class ElementFactory { return getDefaultService(CI_SERVICE, ServiceCategoriesEnum.MOBILITY, user.getUserId()); } - public static ServiceReqDetails getService(ServiceCategoriesEnum category) { + public static ServiceReqDetails getServiceByCategory(ServiceCategoriesEnum category) { return getDefaultService(CI_SERVICE, category, "al1976"); } @@ -300,6 +322,11 @@ public class ElementFactory { return serviceDetails; } + public static ServiceReqDetails getRandomCategoryService() { + ServiceReqDetails serviceReqDetails = getServiceByCategory(ServiceCategoriesEnum.getRandomElement()); + return serviceReqDetails; + } + // ***** PROPERTY *** public static PropertyReqDetails getDefaultProperty() { @@ -851,7 +878,6 @@ public class ElementFactory { try { errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_CATEGORY_NOT_FOUND.name()); } catch (FileNotFoundException e) { - // TODO Auto-generated catch block e.printStackTrace(); } String desc = (errorInfo.getMessageId() + ": " + errorInfo.getMessage()).replace("%2", "category").replace("%3", category).replace("%1", "resource"); @@ -964,17 +990,19 @@ public class ElementFactory { RequirementCapabilityRelDef requirementDef = new RequirementCapabilityRelDef(); requirementDef.setFromNode(fromCompInstId); requirementDef.setToNode(toCompInstId); - RequirementAndRelationshipPair pair = new RequirementAndRelationshipPair(); - pair.setRequirementOwnerId(reqOwnerId); - pair.setCapabilityOwnerId(capOwnerId); - pair.setRequirement(reqCapName); - RelationshipImpl relationship = new RelationshipImpl(); - relationship.setType(capType); - pair.setRelationships(relationship); - pair.setCapabilityUid(capList.get(0).getUniqueId()); - pair.setRequirementUid(reqList.get(0).getUniqueId()); - List<RequirementAndRelationshipPair> relationships = new ArrayList<>(); - relationships.add(pair); + RelationshipInfo relationInfo = new RelationshipInfo(); + relationInfo.setRequirementOwnerId(reqOwnerId); + relationInfo.setCapabilityOwnerId(capOwnerId); + relationInfo.setRequirement(reqCapName); + RelationshipImpl relationImpl = new RelationshipImpl(); + relationImpl.setType(capType); + relationInfo.setRelationships(relationImpl); + relationInfo.setCapabilityUid(capList.get(0).getUniqueId()); + relationInfo.setRequirementUid(reqList.get(0).getUniqueId()); + List<CapabilityRequirementRelationship> relationships = new ArrayList<>(); + CapabilityRequirementRelationship relationship = new CapabilityRequirementRelationship(); + relationship.setRelation(relationInfo); + relationships.add(relationship); requirementDef.setRelationships(relationships); return requirementDef; } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java index 2c5d985aa5..9759653af2 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java @@ -95,19 +95,22 @@ public class FileHandling { } // ------------------------------------------------------------------------------------------------- + + /** + * @param folder, folder name under "Files" folder + * @return path to given folder from perspective of working directory or sdc-vnfs repository + */ public static String getFilePath(String folder) { - String filepath = System.getProperty("filepath"); - if (filepath == null && System.getProperty("os.name").contains("Windows")) { - filepath = FileHandling.getResourcesFilesPath() + folder + File.separator; - } - - else if(filepath.isEmpty() && !System.getProperty("os.name").contains("Windows")){ - filepath = FileHandling.getBasePath() + "Files" + File.separator + folder + File.separator; + String filepath = System.getProperty("filePath"); + boolean isFilePathEmptyOrNull = (filepath == null || filepath.isEmpty()); + + // return folder from perspective of sdc-vnfs repository + if (isFilePathEmptyOrNull && ( System.getProperty("os.name").contains("Windows") || System.getProperty("os.name").contains("Mac"))) { + return FileHandling.getResourcesFilesPath() + folder + File.separator; } - - System.out.println(filepath); - - return filepath; + + // return folder from perspective of working directory ( in general for nightly run from Linux, should already contain "Files" directory ) + return FileHandling.getBasePath() + "Files" + File.separator + folder + File.separator; } public static String getBasePath() { @@ -152,6 +155,10 @@ public class FileHandling { return getFilePath("VNFs"); } + public static String getPortMirroringRepositoryPath() { + return getFilePath("PortMirroring"); + } + public static File getConfigFile(String configFileName) throws Exception { File configFile = new File(FileHandling.getBasePath() + File.separator + "conf" + File.separator + configFileName); if (!configFile.exists()) { @@ -209,7 +216,7 @@ public class FileHandling { } public static String[] getArtifactsFromZip(String filepath, String zipFilename){ - try{ + try { ZipFile zipFile = new ZipFile(filepath + File.separator + zipFilename); Enumeration<? extends ZipEntry> entries = zipFile.entries(); @@ -227,8 +234,7 @@ public class FileHandling { } zipFile.close(); return artifactNames; - } - catch(ZipException zipEx){ + } catch(ZipException zipEx) { System.err.println("Error in zip file named : " + zipFilename); zipEx.printStackTrace(); } catch (IOException e) { @@ -240,6 +246,34 @@ public class FileHandling { } + public static List<String> getFileNamesFromZip(String zipFileLocation){ + try{ + ZipFile zipFile = new ZipFile(zipFileLocation); + Enumeration<? extends ZipEntry> entries = zipFile.entries(); + + List<String> artifactNames = new ArrayList<>(); + + int i = 0; + while(entries.hasMoreElements()){ + ZipEntry nextElement = entries.nextElement(); + if (!nextElement.isDirectory()){ + String name = nextElement.getName(); + artifactNames.add(name); + } + } + zipFile.close(); + return artifactNames; + } + catch(ZipException zipEx){ + System.err.println("Error in zip file named : " + zipFileLocation); + zipEx.printStackTrace(); + } catch (IOException e) { + System.err.println("Unhandled exception : "); + e.printStackTrace(); + } + return null; + } + // public static Object[] getZipFileNamesFromFolder(String filepath) { // return filterFileNamesFromFolder(filepath, ".zip"); // } @@ -562,4 +596,10 @@ public class FileHandling { return value.replaceAll("\"",""); } + + public static void overWriteExistindDir(String outputCsar) throws IOException { + String basePath = getBasePath(); + String csarDir = FileHandling.getCreateDirByName("outputCsar"); + FileUtils.cleanDirectory(new File(csarDir)); + } } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ImportUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ImportUtils.java index c1f311a91e..7e5a7d69a2 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ImportUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ImportUtils.java @@ -20,16 +20,10 @@ package org.openecomp.sdc.ci.tests.utils.general; -import java.io.File; import java.io.IOException; import java.util.List; -import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.datatypes.ImportReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.utils.Utils; public class ImportUtils { diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtillViaApis.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtillViaApis.java index 12f04e282c..76e4c51b3f 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtillViaApis.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtillViaApis.java @@ -20,11 +20,21 @@ package org.openecomp.sdc.ci.tests.utils.general; -import com.aventstack.extentreports.Status; -import com.clearspring.analytics.util.Pair; -import com.google.gson.Gson; -import fj.data.Either; +import static org.testng.AssertJUnit.assertTrue; +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.codec.binary.Base64; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; @@ -34,9 +44,7 @@ import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; - import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; -import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; @@ -45,14 +53,11 @@ import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; -import java.io.*; -import java.nio.charset.StandardCharsets; -import java.util.*; -import org.apache.commons.codec.binary.Base64; - - +import com.aventstack.extentreports.Status; +import com.clearspring.analytics.util.Pair; +import com.google.gson.Gson; -import static org.testng.AssertJUnit.assertTrue; +import fj.data.Either; public class OnboardingUtillViaApis { @@ -64,13 +69,12 @@ public class OnboardingUtillViaApis { return headersMap; } - public static Pair<String, VendorSoftwareProductObject> createVspViaApis(String filepath, String vnfFile, User user) throws Exception { - + public static Pair<String, VendorSoftwareProductObject> createVspViaApis(ResourceReqDetails resourceReqDetails, String filepath, String vnfFile, User user) throws Exception { + VendorSoftwareProductObject vendorSoftwareProductObject = new VendorSoftwareProductObject(); ExtentTestActions.log(Status.INFO, String.format("Create Vendor License")); AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(user); - ExtentTestActions.log(Status.INFO, String.format("Create Vendor Software Product")); - Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(vnfFile, filepath, user, amdocsLicenseMembers); + Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filepath, user, amdocsLicenseMembers); Map<String, String> map = createVendorSoftwareProduct.right; vendorSoftwareProductObject.setAttContact(map.get("attContact")); vendorSoftwareProductObject.setCategory(map.get("category")); @@ -105,27 +109,17 @@ public class OnboardingUtillViaApis { return resource; }*/ - public static Resource createResourceFromVSP(ResourceReqDetails resourceDetails, String vspName) throws Exception { -// List<String> tags = new ArrayList<>(); -// tags.add(vspName); -// Map<String, String> map = createVendorSoftwareProduct.right; -// ResourceReqDetails resourceDetails = new ResourceReqDetails(); -// resourceDetails.setCsarUUID(map.get("vspId")); -// resourceDetails.setCsarVersion("1.0"); -// resourceDetails.setName(vspName); -// resourceDetails.setTags(tags); -// resourceDetails.setDescription(map.get("description")); -// resourceDetails.setResourceType(map.get("componentType")); -// resourceDetails.addCategoryChain(ResourceCategoryEnum.GENERIC_DATABASE.getCategory(), ResourceCategoryEnum.GENERIC_DATABASE.getSubCategory()); -// resourceDetails.setVendorName(map.get("vendorName")); -// resourceDetails.setVendorRelease("1.0"); -// resourceDetails.setResourceType("VF"); -// resourceDetails.setResourceVendorModelNumber("666"); -// resourceDetails.setContactId(map.get("attContact")); -// resourceDetails.setIcon("defaulticon"); + + public static Resource createResourceFromVSP(ResourceReqDetails resourceDetails, UserRoleEnum user) throws Exception { + Resource resource = AtomicOperationUtils.createResourceByResourceDetails(resourceDetails, user, true).left().value(); + + return resource; + } + + public static Resource createResourceFromVSP(ResourceReqDetails resourceDetails) throws Exception { Resource resource = AtomicOperationUtils.createResourceByResourceDetails(resourceDetails, UserRoleEnum.DESIGNER, true).left().value(); - return resource; + return resource; } public static void downloadToscaCsarToDirectory(Component component, File file) { try { @@ -134,7 +128,6 @@ public class OnboardingUtillViaApis { convertPayloadToFile(componentToscaArtifactPayload.left().value(), file); } } catch (Exception e) { - // TODO Auto-generated catch block e.printStackTrace(); } } @@ -258,25 +251,25 @@ public class OnboardingUtillViaApis { return Either.left(response.getResponse()); } - - public static ResourceReqDetails prepareOnboardedResourceDetailsBeforeCreate(VendorSoftwareProductObject vendorSoftwareProductObject, String vspName) { + + public static ResourceReqDetails prepareOnboardedResourceDetailsBeforeCreate(ResourceReqDetails resourceDetails, VendorSoftwareProductObject vendorSoftwareProductObject) { List<String> tags = new ArrayList<>(); - tags.add(vspName); - ResourceReqDetails resourceDetails = new ResourceReqDetails(); + tags.add(vendorSoftwareProductObject.getName()); +// ResourceReqDetails resourceDetails = new ResourceReqDetails(); resourceDetails.setCsarUUID(vendorSoftwareProductObject.getVspId()); - resourceDetails.setCsarVersion("1.0"); - resourceDetails.setName(vspName); + resourceDetails.setCsarVersion(vendorSoftwareProductObject.getVersion()); + resourceDetails.setName(vendorSoftwareProductObject.getName()); resourceDetails.setTags(tags); resourceDetails.setDescription(vendorSoftwareProductObject.getDescription()); - resourceDetails.addCategoryChain(ResourceCategoryEnum.GENERIC_DATABASE.getCategory(), ResourceCategoryEnum.GENERIC_DATABASE.getSubCategory()); +// resourceDetails.addCategoryChain(ResourceCategoryEnum.GENERIC_DATABASE.getCategory(), ResourceCategoryEnum.GENERIC_DATABASE.getSubCategory()); resourceDetails.setVendorName(vendorSoftwareProductObject.getVendorName()); - resourceDetails.setVendorRelease("1.0"); +// resourceDetails.setVendorRelease("1.0"); resourceDetails.setResourceType("VF"); resourceDetails.setResourceVendorModelNumber("666"); resourceDetails.setContactId(vendorSoftwareProductObject.getAttContact()); - resourceDetails.setIcon("defaulticon"); - +// resourceDetails.setIcon("defaulticon"); + return resourceDetails; } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java index f6d3e58339..dc38d40064 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java @@ -20,8 +20,21 @@ package org.openecomp.sdc.ci.tests.utils.general; -import com.aventstack.extentreports.Status; -import com.clearspring.analytics.util.Pair; +import static org.testng.AssertJUnit.assertEquals; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.nio.file.FileSystems; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.UUID; + import org.apache.commons.io.IOUtils; import org.apache.http.HttpEntity; import org.apache.http.client.ClientProtocolException; @@ -37,72 +50,145 @@ import org.json.simple.JSONArray; import org.json.simple.JSONValue; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; -import org.openecomp.sdc.ci.tests.api.ExtentTestActions; +import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; +import org.openecomp.sdc.ci.tests.datatypes.LicensingData; +import org.openecomp.sdc.ci.tests.datatypes.LicensingVersion; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; +import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObjectReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.CvfcTypeEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.Utils; +import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; -import java.io.*; -import java.nio.file.FileSystems; -import java.util.*; - -import static org.testng.AssertJUnit.assertEquals; +import com.aventstack.extentreports.Status; +import com.clearspring.analytics.util.Pair; +import com.google.gson.Gson; public class OnboardingUtils { - protected static List<String> exludeVnfList = Arrays.asList("2016-197_vscp_vscp-fw_1610_e2e.zip", "2016-281_vProbes_BE_11_1_f_30_1610_e2e.zip", - "2016-282_vProbes_FE_11_1_f_30_1610_e2e.zip", "2016-044_vfw_fnat_30_1607_e2e.zip", "2017-376_vMOG_11_1.zip", "vMOG.zip", - - - "vMRF_USP_AIC3.0_1702.zip", "2016-211_vprobesbe_vprobes_be_30_1610_e2e.zip", "2016-005_vprobesfe_vprobes_fe_30_1607_e2e.zip", - "vMRF_RTT.zip", "2016-006_vvm_vvm_30_1607_e2e.zip", "2016-001_vvm_vvm_30_1607_e2e.zip"); + /** + * excluded VNF file list + */ + protected static List<String> exludeVnfList = +// new ArrayList<String>(); - protected static List<String> exludeVnfListForToscaParser = Arrays.asList("2016-043_vsaegw_fdnt_30_1607_e2e.zip", "vIRC_CC.zip", - "2016-045_vlb_lmsp_30_1607_e2e.zip", "2016-050_vdns_vmdns_30_1607_e2e.zip", - "2016-247_mns_mns_30_1610_e2e.zip", "2016-044_vfw_fcgi_30_1607_e2e.zip"); + Arrays.asList( + +// new VNFs + "Vhss-epc-rdm3-lab-vf-0921-v2.0-MOBILITY-10-20.zip", "Apndns-1710-vf-v3.0-10-20.zip", + "HeatCandidate_2017-09-22_01-48_55Name_2016-182-asbg-nsbg-tsbg-v1.0-(VOIP).zip", "HeatCandidate_2017-09-22_01-47_55Name_2016-182-asbg-nsbg-tsbg-v7.0-(VOIP).zip", + "Efmc-dbe-nin-v24.0-VOIP-10-20.zip", "VF_LMSP_v5-062317-V3.0-(Mobility).zip", "base_bwks_nfm_volume-236262502.zip", + +// newest failed VNFs + "HeatCandidate_2017-09-20_15-07_66Name_2016-20-visbc1vf-v4.0-(VOIP).zip", + "HeatCandidate_2017-09-20_15-06_66Name_2016-20-visbc1vf-v6.0-(VOIP).zip", "1-Vf-zrdm5bpxtc02-092017-(MOBILITY)_v3.0.zip", + "1-2017-491-4vshaken-HTTP-CM-vf-(VOIP)_v2.0.zip" + + ); + + /** + * additional files to exludeVnfList files for tosca parser tests + */ + protected static List<String> exludeVnfListForToscaParser = //new ArrayList<String>(); + Arrays.asList("1-Vvig-062017-(MOBILITY)_v5.1.zip", + "HeatCandidate_2017-09-22_01-43_57Name_2017389vtsbc4vf-v1.0-(VOIP).zip", + "1-Mvm-sbc-1710-092017-(MOBILITY)_v7.0.zip", + "1-2017-492-5vshaken-SIP-AS-vf-(VOIP)_v2.0.zip", + "HeatCandidate_2017-09-20_13-37_70Name_2017-491-4vshaken-HTTP-CM-vf-v1.0-(VOIP)_10202017.zip", "1-201712-488-adiod-vpe-(Layer-0-3)_v2.0.zip", + "2017-502.zip", + "1-2017-505-urlb-vhepe-(Layer-0-3)_v2.0.zip", + "2017-376_vMOG_11_1.zip", + "HeatCandidate_2017-09-22_00-55_62Name_2017-491-6vshaken-http-cm-vf-v1.0-(VOIP).zip", "HeatCandidate_2017-09-22_01-30_60Name_Vdbe-vsp-15.1x49-d50.3-v3.0-(VOIP).zip", + "HeatCandidate_2017-09-22_01-35_59Name_2017-418-afx-v1.0.zip", + "1-2017-488-adiod-vpe-(Layer-0-3)_v-5.0.zip", + "HeatCandidate_2017-09-22_01-42_57Name_2017389vtsbc4vf-v10.0-(VOIP).zip", + "HeatCandidate_2017-09-20_13-47_68Name_2017-492-5vshaken-SIP-AS-vf-v1.0-(VOIP)_10202017.zip", "1-2016-20-visbc3vf-(VOIP)_v2.1.zip", + "1-2017-404_vUSP_vCCF_AIC3.0-(VOIP)_v6.0.zip", "1-2017389vtsbc4vf-(VOIP)_v11.0.zip", + "HeatCandidate_2017-09-22_01-32_60Name_Vdbe-vsp-15.1x49-d50.3-v1.0-(VOIP).zip", "1-2017-418-afx-v1.1.zip"); public OnboardingUtils() { } - public static Pair<String, Map<String, String>> createVendorSoftwareProduct(String HeatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers) + public static Pair<String, Map<String, String>> createVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String heatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers, Map<CvfcTypeEnum, String> cvfcArtifacts) throws Exception { - Pair<String, Map<String, String>> pair = createVSP(HeatFileName, filepath, user, amdocsLicenseMembers); - + + Pair<String, Map<String, String>> pair = createVSP(resourceReqDetails, heatFileName, filepath, user, amdocsLicenseMembers); String vspid = pair.right.get("vspId"); - - prepareVspForUse(user, vspid); - + if(cvfcArtifacts != null && ! cvfcArtifacts.isEmpty()){ + OnboardingUtils.addCvfcArtifacts(cvfcArtifacts, vspid, user, null); + + } + prepareVspForUse(user, vspid, "0.1"); return pair; } - public static void prepareVspForUse(User user, String vspid) throws Exception { - RestResponse checkin = checkinVendorSoftwareProduct(vspid, user); + public static Pair<String, Map<String, String>> createVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String heatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers) + throws Exception { + + Map<CvfcTypeEnum, String> cvfcArtifacts = new HashMap<>(); + return createVendorSoftwareProduct(resourceReqDetails, heatFileName, filepath, user, amdocsLicenseMembers, cvfcArtifacts); + } + +// duplicate function + public static void prepareVspForUse(User user, String vspid, String vspVersion) throws Exception { + + RestResponse checkin = OnboardingUtils.checkinVendorSoftwareProduct(vspid, user, vspVersion); assertEquals("did not succeed to checking new VSP", 200, checkin.getErrorCode().intValue()); - RestResponse submit = submitVendorSoftwareProduct(vspid, user); + RestResponse submit = OnboardingUtils.submitVendorSoftwareProduct(vspid, user, vspVersion); assertEquals("did not succeed to submit new VSP", 200, submit.getErrorCode().intValue()); - RestResponse createPackage = createPackageOfVendorSoftwareProduct(vspid, user); + RestResponse createPackage = OnboardingUtils.createPackageOfVendorSoftwareProduct(vspid, user, vspVersion); assertEquals("did not succeed to create package of new VSP ", 200, createPackage.getErrorCode().intValue()); - ComponentBaseTest.getExtendTest().log(Status.INFO, "Succeeded in creating the vendor software product"); +// ComponentBaseTest.getExtendTest().log(Status.INFO, "Succeeded in creating the vendor software product"); } - public static Pair<String, Map<String, String>> createVSP(String HeatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers) throws Exception { - String vspName = handleFilename(HeatFileName); - - ComponentBaseTest.getExtendTest().log(Status.INFO, "Starting to create the vendor software product"); - - Pair<RestResponse, Map<String, String>> createNewVspPair = createNewVendorSoftwareProduct(vspName, amdocsLicenseMembers, user); + public static VendorSoftwareProductObject createAndFillVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String heatFileName, String filePath, User user, AmdocsLicenseMembers amdocsLicenseMembers, Map<CvfcTypeEnum, String> cvfcArtifacts) + throws Exception { + + Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, heatFileName, filePath, user, amdocsLicenseMembers, cvfcArtifacts); + VendorSoftwareProductObject vendorSoftwareProductObject = fillVendorSoftwareProductObjectWithMetaData(heatFileName, createVendorSoftwareProduct); + return vendorSoftwareProductObject; + + } + + public static void updateVendorLicense(AmdocsLicenseMembers amdocsLicenseMembers, User user, String vlmVersion) throws Exception { + + RestResponse checkoutVendorLicense = checkoutVendorLicense(amdocsLicenseMembers.getVendorId(), user, vlmVersion); + assertEquals("did not succeed to checkout vendor license", 200, checkoutVendorLicense.getErrorCode().intValue()); + + RestResponse checkinVendorLicense = checkinVendorLicense(amdocsLicenseMembers.getVendorId(), user, vlmVersion); + assertEquals("did not succeed to checkin vendor license", 200, checkinVendorLicense.getErrorCode().intValue()); + + RestResponse submitVendorLicense = submitVendorLicense(amdocsLicenseMembers.getVendorId(), user, vlmVersion); + assertEquals("did not succeed to submit vendor license", 200, submitVendorLicense.getErrorCode().intValue()); + + if(ComponentBaseTest.getExtendTest() != null){ + ComponentBaseTest.getExtendTest().log(Status.INFO, "Succeeded in updating the vendor license"); + } + } + + public static Pair<String, Map<String, String>> createVSP(ResourceReqDetails resourceReqDetails, String heatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers) throws Exception { + String vspName = handleFilename(heatFileName); + + if(ComponentBaseTest.getExtendTest() != null){ + ComponentBaseTest.getExtendTest().log(Status.INFO, "Starting to create the vendor software product"); + } + + Pair<RestResponse, Map<String, String>> createNewVspPair = createNewVendorSoftwareProduct(resourceReqDetails, vspName, amdocsLicenseMembers, user); RestResponse createNewVendorSoftwareProduct = createNewVspPair.left; assertEquals("did not succeed to create new VSP", 200,createNewVendorSoftwareProduct.getErrorCode().intValue()); String vspid = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "vspId"); String componentId = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "componentId"); - + Map<String, String> vspMeta = createNewVspPair.right; Map<String, String> vspObject = new HashMap<String, String>(); Iterator<String> iterator = vspMeta.keySet().iterator(); @@ -115,51 +201,63 @@ public class OnboardingUtils { vspObject.put("componentId", componentId); vspObject.put("vendorName", amdocsLicenseMembers.getVendorLicenseName()); vspObject.put("attContact", user.getUserId()); - - RestResponse uploadHeatPackage = uploadHeatPackage(filepath, HeatFileName, vspid, user); + + RestResponse uploadHeatPackage = uploadHeatPackage(filepath, heatFileName, vspid, user, "0.1"); assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue()); - - RestResponse validateUpload = validateUpload(vspid, user); - assertEquals("did not succeed to validate upload process", 200, validateUpload.getErrorCode().intValue()); - + + RestResponse validateUpload = validateUpload(vspid, user, "0.1"); + assertEquals("did not succeed to validate upload process, reason: " + validateUpload.getResponse(), 200, validateUpload.getErrorCode().intValue()); + Pair<String, Map<String, String>> pair = new Pair<String, Map<String, String>>(vspName, vspObject); - + return pair; } - - public static void updateVspWithVfcArtifacts(String filepath, String vspId, String updatedSnmpPoll, String updatedSnmpTrap, String componentId, User user) throws Exception{ - RestResponse checkout = checkoutVendorSoftwareProduct(vspId, user); + + public static void updateVspWithVfcArtifacts(String filepath, String vspId, String updatedSnmpPoll, String updatedSnmpTrap, String componentId, User user, String vspVersion) throws Exception{ + RestResponse checkout = checkoutVendorSoftwareProduct(vspId, user, vspVersion); assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue()); - ExtentTestActions.log(Status.INFO, "Deleting SNMP POLL"); - deleteSnmpArtifact(componentId, vspId, user, SnmpTypeEnum.SNMP_POLL); - ExtentTestActions.log(Status.INFO, "Deleting SNMP TRAP"); - deleteSnmpArtifact(componentId, vspId, user, SnmpTypeEnum.SNMP_TRAP); +// ExtentTestActions.log(Status.INFO, "Deleting SNMP POLL"); + deleteArtifactByType(componentId, vspId, user, CvfcTypeEnum.SNMP_POLL); +// ExtentTestActions.log(Status.INFO, "Deleting SNMP TRAP"); + deleteArtifactByType(componentId, vspId, user, CvfcTypeEnum.SNMP_TRAP); addVFCArtifacts(filepath, updatedSnmpPoll, updatedSnmpTrap, vspId, user, componentId); - prepareVspForUse(user, vspId); + prepareVspForUse(user, vspId, vspVersion); } - - public static String updateVendorSoftwareProduct(String vspId, String HeatFileName, String filepath, User user) - throws Exception, Throwable { - String vspName = handleFilename(HeatFileName); + + private static RestResponse deleteArtifactByType(String componentId, String vspId, User user, CvfcTypeEnum snmpType) throws Exception + { + Config config = Utils.getConfig(); + String url = String.format(Urls.DELETE_AMDOCS_ARTIFACT_BY_TYPE, config.getCatalogBeHost(),config.getCatalogBePort(), vspId, componentId, snmpType.getValue()); + String userId = user.getUserId(); + Map<String, String> headersMap = prepareHeadersMap(userId); + + HttpRequest http = new HttpRequest(); + RestResponse response = http.httpSendDelete(url, headersMap); + return response; + } + +// duplicated method + public static String updateVendorSoftwareProduct(String vspId, String HeatFileName, String filepath, User user, String vspVersion) + throws Exception, Throwable { + String vspName = OnboardingUtils.handleFilename(HeatFileName); ComponentBaseTest.getExtendTest().log(Status.INFO, "Starting to update the vendor software product"); - RestResponse checkout = checkoutVendorSoftwareProduct(vspId, user); + RestResponse checkout = OnboardingUtils.checkoutVendorSoftwareProduct(vspId, user, vspVersion); assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue()); - RestResponse uploadHeatPackage = uploadHeatPackage(filepath, HeatFileName, vspId, user); + RestResponse uploadHeatPackage = OnboardingUtils.uploadHeatPackage(filepath, HeatFileName, vspId, user, vspVersion); assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue()); - - RestResponse validateUpload = validateUpload(vspId, user); + + RestResponse validateUpload = OnboardingUtils.validateUpload(vspId, user, vspVersion); assertEquals("did not succeed to validate upload process", 200, validateUpload.getErrorCode().intValue()); - - RestResponse checkin = checkinVendorSoftwareProduct(vspId, user); - assertEquals("did not succeed to checking VSP", 200, checkin.getErrorCode().intValue()); + RestResponse checkin = OnboardingUtils.checkinVendorSoftwareProduct(vspId, user, vspVersion); + assertEquals("did not succeed to checking VSP", 200, checkin.getErrorCode().intValue()); - RestResponse submit = submitVendorSoftwareProduct(vspId, user); + RestResponse submit = OnboardingUtils.submitVendorSoftwareProduct(vspId, user, vspVersion); assertEquals("did not succeed to submit VSP", 200, submit.getErrorCode().intValue()); - RestResponse createPackage = createPackageOfVendorSoftwareProduct(vspId, user); + RestResponse createPackage = OnboardingUtils.createPackageOfVendorSoftwareProduct(vspId, user, vspVersion); assertEquals("did not succeed to update package of VSP ", 200, createPackage.getErrorCode().intValue()); ComponentBaseTest.getExtendTest().log(Status.INFO, "Succeeded in updating the vendor software product"); @@ -167,6 +265,21 @@ public class OnboardingUtils { return vspName; } + public static void updateVendorSoftwareProductToNextVersion(VendorSoftwareProductObject vendorSoftwareProductObject, String toVspVersion, User user) + throws Exception, Throwable { + + RestResponse checkout = checkoutVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, vendorSoftwareProductObject.getVersion()); + assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue()); + + RestResponse checkin = checkinVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, vendorSoftwareProductObject.getVersion()); + assertEquals("did not succeed to checking VSP", 200, checkin.getErrorCode().intValue()); + + RestResponse submit = submitVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, vendorSoftwareProductObject.getVersion()); + assertEquals("did not succeed to submit VSP", 200, submit.getErrorCode().intValue()); + + vendorSoftwareProductObject.setVersion(toVspVersion); + } + public static String handleFilename(String heatFileName) { final String namePrefix = "ciVFOnboarded-"; final String nameSuffix = "-" + getShortUUID(); @@ -190,12 +303,12 @@ public class OnboardingUtils { vspComponentId = (vspComponentId == null) ? getVSPComponentId(vspid, user) : vspComponentId; if (vspComponentId != null){ if (snmpPoll != null){ - ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type SNMP POLL with the file " + snmpPoll); +// ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type SNMP POLL with the file " + snmpPoll); RestResponse uploadSnmpPollArtifact = uploadSnmpPollArtifact(filepath, snmpPoll, vspid, user, vspComponentId); assertEquals("Did not succeed to add SNMP POLL", 200, uploadSnmpPollArtifact.getErrorCode().intValue()); } if (snmpTrap != null){ - ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type SNMP TRAP with the file " + snmpTrap); +// ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type SNMP TRAP with the file " + snmpTrap); RestResponse uploadSnmpTrapArtifact = uploadSnmpTrapArtifact(filepath, snmpTrap, vspid, user, vspComponentId); assertEquals("Did not succeed to add SNMP TRAP", 200, uploadSnmpTrapArtifact.getErrorCode().intValue()); } @@ -203,24 +316,41 @@ public class OnboardingUtils { return vspComponentId; } - + + public static String addCvfcArtifacts(Map<CvfcTypeEnum, String> componentVfcArtifacts, String vspid, User user, String vspComponentId) throws Exception{ + vspComponentId = (vspComponentId == null) ? getVSPComponentId(vspid, user) : vspComponentId; + if (vspComponentId != null){ + for(Map.Entry<CvfcTypeEnum, String> entry : componentVfcArtifacts.entrySet()){ +// ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type " + entry.getKey().getValue() + " with the file " + entry.getValue()); + RestResponse uploadSnmpPollArtifact = uploadCvfcArtifact(entry.getValue(), entry.getKey().getValue(), vspid, user, vspComponentId); + assertEquals("Did not succeed to add " + entry.getKey().getValue(), BaseRestUtils.STATUS_CODE_SUCCESS, uploadSnmpPollArtifact.getErrorCode().intValue()); + } + } + return vspComponentId; + } + public static String addVFCArtifacts(String filepath, String snmpPoll, String snmpTrap, String vspid, User user) throws Exception{ return addVFCArtifacts(filepath, snmpPoll, snmpTrap, vspid, user, null); } + public static RestResponse uploadCvfcArtifact(String filepath, String cvfcType, String vspid, User user, String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException { + Config config = Utils.getConfig(); + String snmpPollUrl = String.format(Urls.UPLOAD_AMDOCS_ARTIFACT, config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId, cvfcType); + return uploadFile(filepath, null, snmpPollUrl, user); + } + + private static RestResponse uploadSnmpPollArtifact(String filepath, String zipArtifact, String vspid, User user, - String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException { + String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException { Config config = Utils.getConfig(); - String snmpPollUrl = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/monitors/snmp/upload", - config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId); + String snmpPollUrl = String.format(Urls.UPLOAD_SNMP_POLL_ARTIFACT, config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId); return uploadFile(filepath, zipArtifact, snmpPollUrl, user); } - + private static RestResponse uploadSnmpTrapArtifact(String filepath, String zipArtifact, String vspid, User user, - String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException { + String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException { Config config = Utils.getConfig(); - String snmpTrapUrl = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/monitors/snmp-trap/upload", - config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId); + String snmpTrapUrl = String.format(Urls.UPLOAD_SNMP_POLL_ARTIFACT, config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId); return uploadFile(filepath, zipArtifact, snmpTrapUrl, user); } @@ -237,8 +367,6 @@ public class OnboardingUtils { RestResponse response = http.httpSendDelete(url, headersMap); return response; } - - private static String getVSPComponentId(String vspid, User user) throws Exception, JSONException { RestResponse components = getVSPComponents(vspid, user); @@ -252,10 +380,10 @@ public class OnboardingUtils { } return null; } - + private static RestResponse getVSPComponents(String vspid, User user) throws Exception{ Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components", config.getCatalogBeHost(),config.getCatalogBePort(), vspid); + String url = String.format(Urls.GET_VSP_COMPONENTS, config.getCatalogBeHost(),config.getCatalogBePort(), vspid); String userId = user.getUserId(); Map<String, String> headersMap = prepareHeadersMap(userId); @@ -265,53 +393,91 @@ public class OnboardingUtils { return response; } + private static RestResponse getVLMComponentByVersion(String vlmId, String vlmVersion, User user) throws Exception{ + Config config = Utils.getConfig(); + String url = String.format(Urls.GET_VLM_COMPONENT_BY_VERSION, config.getCatalogBeHost(),config.getCatalogBePort(), vlmId,vlmVersion); + String userId = user.getUserId(); + + Map<String, String> headersMap = prepareHeadersMap(userId); + + HttpRequest http = new HttpRequest(); + RestResponse response = http.httpSendGet(url, headersMap); + return response; + } + + public static boolean validateVspExist(String vspId, String vspVersion, User user) throws Exception { + RestResponse restResponse = getVSPComponentByVersion(vspId, vspVersion, user); + assertEquals(String.format("Vsp version not updated, reponse message: %s", restResponse.getResponse()),restResponse.getErrorCode().intValue(),200); + return (restResponse.getErrorCode()==200); + } + + public static boolean validateVlmExist(String vlmId, String vlmVersion, User user) throws Exception { + RestResponse restResponse = getVLMComponentByVersion(vlmId, vlmVersion, user); + assertEquals(String.format("VLM version not updated, reponse code message: %s", restResponse.getResponse()),restResponse.getErrorCode().intValue(),200); + return (restResponse.getErrorCode()==200); + } + + + private static RestResponse getVSPComponentByVersion(String vspId, String vspVersion, User user) throws Exception{ + Config config = Utils.getConfig(); + String url = String.format(Urls.GET_VSP_COMPONENT_BY_VERSION, config.getCatalogBeHost(),config.getCatalogBePort(), vspId,vspVersion); + String userId = user.getUserId(); + + Map<String, String> headersMap = prepareHeadersMap(userId); + + HttpRequest http = new HttpRequest(); + RestResponse response = http.httpSendGet(url, headersMap); + return response; + } + +// Duplicate method public static AmdocsLicenseMembers createVendorLicense(User user) throws Exception { AmdocsLicenseMembers amdocsLicenseMembers; - ComponentBaseTest.getExtendTest().log(Status.INFO, "Starting to create the vendor license"); - String vendorLicenseName = "ciLicense" + getShortUUID(); - RestResponse vendorLicenseResponse = createVendorLicenseModels_1(vendorLicenseName, user); +// ComponentBaseTest.getExtendTest().log(Status.INFO, "Starting to create the vendor license"); + String vendorLicenseName = "ciLicense" + OnboardingUtils.getShortUUID(); + RestResponse vendorLicenseResponse = OnboardingUtils.createVendorLicenseModels_1(vendorLicenseName, user); assertEquals("did not succeed to create vendor license model", 200, vendorLicenseResponse.getErrorCode().intValue()); String vendorId = ResponseParser.getValueFromJsonResponse(vendorLicenseResponse.getResponse(), "value"); - RestResponse vendorKeyGroupsResponse = createVendorKeyGroups_2(vendorId, user); + RestResponse vendorKeyGroupsResponse = OnboardingUtils.createVendorKeyGroups_2(vendorId, user); assertEquals("did not succeed to create vendor key groups", 200, vendorKeyGroupsResponse.getErrorCode().intValue()); String keyGroupId = ResponseParser.getValueFromJsonResponse(vendorKeyGroupsResponse.getResponse(), "value"); - RestResponse vendorEntitlementPool = createVendorEntitlementPool_3(vendorId, user); + RestResponse vendorEntitlementPool = OnboardingUtils.createVendorEntitlementPool_3(vendorId, user); assertEquals("did not succeed to create vendor entitlement pool", 200, vendorEntitlementPool.getErrorCode().intValue()); String entitlementPoolId = ResponseParser.getValueFromJsonResponse(vendorEntitlementPool.getResponse(), "value"); - RestResponse vendorLicenseFeatureGroups = createVendorLicenseFeatureGroups_4(vendorId, keyGroupId, entitlementPoolId, user); + RestResponse vendorLicenseFeatureGroups = OnboardingUtils.createVendorLicenseFeatureGroups_4(vendorId, keyGroupId, entitlementPoolId, user); assertEquals("did not succeed to create vendor license feature groups", 200, vendorLicenseFeatureGroups.getErrorCode().intValue()); String featureGroupId = ResponseParser.getValueFromJsonResponse(vendorLicenseFeatureGroups.getResponse(), "value"); - RestResponse vendorLicenseAgreement = createVendorLicenseAgreement_5(vendorId, featureGroupId, user); + RestResponse vendorLicenseAgreement = OnboardingUtils.createVendorLicenseAgreement_5(vendorId, featureGroupId, user); assertEquals("did not succeed to create vendor license agreement", 200, vendorLicenseAgreement.getErrorCode().intValue()); String vendorLicenseAgreementId = ResponseParser.getValueFromJsonResponse(vendorLicenseAgreement.getResponse(), "value"); - RestResponse checkinVendorLicense = checkinVendorLicense(vendorId, user); + RestResponse checkinVendorLicense = OnboardingUtils.checkinVendorLicense(vendorId, user, "0.1"); assertEquals("did not succeed to checkin vendor license", 200, checkinVendorLicense.getErrorCode().intValue()); - RestResponse submitVendorLicense = submitVendorLicense(vendorId, user); + RestResponse submitVendorLicense = OnboardingUtils.submitVendorLicense(vendorId, user, "0.1"); assertEquals("did not succeed to submit vendor license", 200, submitVendorLicense.getErrorCode().intValue()); - ComponentBaseTest.getExtendTest().log(Status.INFO, "Succeeded in creating the vendor license"); +// ComponentBaseTest.getExtendTest().log(Status.INFO, "Succeeded in creating the vendor license"); amdocsLicenseMembers = new AmdocsLicenseMembers(vendorId, vendorLicenseName, vendorLicenseAgreementId, featureGroupId); - + amdocsLicenseMembers.setVersion("1.0"); // Once object created and submitted, his initial version is 1.0 + return amdocsLicenseMembers; } - private static String getShortUUID() { + public static String getShortUUID() { return UUID.randomUUID().toString().split("-")[0]; } - private static RestResponse actionOnComponent(String vspid, String action, String onboardComponent, User user) + private static RestResponse actionOnComponent(String vspid, String action, String onboardComponent, User user, String componentVersion) throws Exception { Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/" + onboardComponent + "/%s/versions/0.1/actions", - config.getCatalogBeHost(), config.getCatalogBePort(), vspid); + String url = String.format(Urls.ACTION_ON_COMPONENT, config.getCatalogBeHost(), config.getCatalogBePort(), onboardComponent, vspid, componentVersion); String userId = user.getUserId(); JSONObject jObject = new JSONObject(); @@ -324,17 +490,22 @@ public class OnboardingUtils { return response; } - public static RestResponse checkinVendorLicense(String vspid, User user) throws Exception { - return actionOnComponent(vspid, "Checkin", "vendor-license-models", user); + + public static RestResponse checkinVendorLicense(String vspid, User user, String vlmVersion) throws Exception { + return actionOnComponent(vspid, "Checkin", "vendor-license-models", user, vlmVersion); + } + + public static RestResponse checkoutVendorLicense(String vspid, User user, String vlmVersion) throws Exception { + return actionOnComponent(vspid, "Checkout", "vendor-license-models", user, vlmVersion); } - public static RestResponse submitVendorLicense(String vspid, User user) throws Exception { - return actionOnComponent(vspid, "Submit", "vendor-license-models", user); + public static RestResponse submitVendorLicense(String vspid, User user, String vlmVersion) throws Exception { + return actionOnComponent(vspid, "Submit", "vendor-license-models", user, vlmVersion); } public static RestResponse createVendorLicenseModels_1(String name, User user) throws Exception { Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models", config.getCatalogBeHost(), + String url = String.format(Urls.CREATE_VENDOR_LISENCE_MODELS, config.getCatalogBeHost(), config.getCatalogBePort()); String userId = user.getUserId(); @@ -354,8 +525,7 @@ public class OnboardingUtils { public static RestResponse createVendorLicenseAgreement_5(String vspid, String featureGroupId, User user) throws Exception { Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/license-agreements", - config.getCatalogBeHost(), config.getCatalogBePort(), vspid); + String url = String.format(Urls.CREATE_VENDOR_LISENCE_AGREEMENT, config.getCatalogBeHost(), config.getCatalogBePort(), vspid); String userId = user.getUserId(); JSONObject licenseTermpObject = new JSONObject(); @@ -377,10 +547,9 @@ public class OnboardingUtils { } public static RestResponse createVendorLicenseFeatureGroups_4(String vspid, String licenseKeyGroupId, - String entitlementPoolId, User user) throws Exception { + String entitlementPoolId, User user) throws Exception { Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/feature-groups", - config.getCatalogBeHost(), config.getCatalogBePort(), vspid); + String url = String.format(Urls.CREATE_VENDOR_LISENCE_FEATURE_GROUPS, config.getCatalogBeHost(), config.getCatalogBePort(), vspid); String userId = user.getUserId(); JSONObject jObject = new JSONObject(); @@ -401,8 +570,7 @@ public class OnboardingUtils { public static RestResponse createVendorEntitlementPool_3(String vspid, User user) throws Exception { Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/entitlement-pools", - config.getCatalogBeHost(), config.getCatalogBePort(), vspid); + String url = String.format(Urls.CREATE_VENDOR_LISENCE_ENTITLEMENT_POOL, config.getCatalogBeHost(), config.getCatalogBePort(), vspid); String userId = user.getUserId(); JSONObject jEntitlementMetricObject = new JSONObject(); @@ -442,8 +610,7 @@ public class OnboardingUtils { public static RestResponse createVendorKeyGroups_2(String vspid, User user) throws Exception { Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/license-key-groups", - config.getCatalogBeHost(), config.getCatalogBePort(), vspid); + String url = String.format(Urls.CREATE_VENDOR_LISENCE_KEY_GROUPS, config.getCatalogBeHost(), config.getCatalogBePort(), vspid); String userId = user.getUserId(); JSONObject jOperationalScope = new JSONObject(); @@ -463,56 +630,51 @@ public class OnboardingUtils { return response; } - public static Pair<RestResponse, Map<String, String>> createNewVendorSoftwareProduct(String name, AmdocsLicenseMembers amdocsLicenseMembers, User user) throws Exception { + public static Pair<RestResponse, Map<String, String>> createNewVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String vspName, AmdocsLicenseMembers amdocsLicenseMembers, User user) throws Exception { Map<String, String> vspMetadta = new HashMap<String, String>(); - - Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products", - config.getCatalogBeHost(), config.getCatalogBePort()); + Config config = Utils.getConfig(); + String url = String.format(Urls.CREATE_VENDOR_SOFTWARE_PRODUCT, config.getCatalogBeHost(), config.getCatalogBePort()); String userId = user.getUserId(); + VendorSoftwareProductObject vendorSoftwareProductObject = new VendorSoftwareProductObject(); + LicensingData licensingData = new LicensingData(amdocsLicenseMembers.getVendorLicenseAgreementId(), Arrays.asList(amdocsLicenseMembers.getFeatureGroupId())); + LicensingVersion licensingVersion = new LicensingVersion("1.0", "1.0"); + ResourceCategoryEnum resourceCategoryEnum = ResourceCategoryEnum.findEnumNameByValues(resourceReqDetails.getCategories().get(0).getName(), resourceReqDetails.getCategories().get(0).getSubcategories().get(0).getName()); + + vendorSoftwareProductObject.setLicensingVersion(licensingVersion); + + vendorSoftwareProductObject.setName(vspName); + vendorSoftwareProductObject.setDescription(resourceReqDetails.getDescription()); + vendorSoftwareProductObject.setCategory(resourceCategoryEnum.getCategoryUniqeId()); + vendorSoftwareProductObject.setSubCategory(resourceCategoryEnum.getSubCategoryUniqeId()); + vendorSoftwareProductObject.setOnboardingMethod("NetworkPackage"); + vendorSoftwareProductObject.setVendorName(amdocsLicenseMembers.getVendorLicenseName()); + vendorSoftwareProductObject.setVendorId(amdocsLicenseMembers.getVendorId()); + vendorSoftwareProductObject.setIcon("icon"); + vendorSoftwareProductObject.setLicensingData(licensingData); + + vspMetadta.put("description", resourceReqDetails.getDescription()); + vspMetadta.put("category", resourceCategoryEnum.getCategory()); + vspMetadta.put("subCategory", resourceCategoryEnum.getSubCategory()); - JSONObject jlicensingDataObj = new JSONObject(); - jlicensingDataObj.put("licenseAgreement", amdocsLicenseMembers.getVendorLicenseAgreementId()); - jlicensingDataObj.put("featureGroups", Arrays.asList(amdocsLicenseMembers.getFeatureGroupId()).toArray()); - - JSONObject jlicensingVersionObj = new JSONObject(); - jlicensingVersionObj.put("id", "1.0"); - jlicensingVersionObj.put("label", "1.0"); - - JSONObject jObject = new JSONObject(); - jObject.put("name", name); - jObject.put("description", "new VSP description"); - jObject.put("category", "resourceNewCategory.generic"); - jObject.put("subCategory", "resourceNewCategory.generic.database"); - jObject.put("onboardingMethod", "NetworkPackage"); - jObject.put("licensingVersion", jlicensingVersionObj); - jObject.put("vendorName", amdocsLicenseMembers.getVendorLicenseName()); - jObject.put("vendorId", amdocsLicenseMembers.getVendorId()); - jObject.put("icon", "icon"); - jObject.put("licensingData", jlicensingDataObj); - - vspMetadta.put("description", jObject.getString("description")); - vspMetadta.put("category", jObject.getString("category")); - vspMetadta.put("subCategory", jObject.getString("subCategory").split("\\.")[2]); - Map<String, String> headersMap = prepareHeadersMap(userId); HttpRequest http = new HttpRequest(); + Gson gson = new Gson(); + String body = gson.toJson(vendorSoftwareProductObject); - RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap); + RestResponse response = http.httpSendPost(url, body, headersMap); return new Pair<RestResponse, Map<String, String>>(response, vspMetadta); } - - public static RestResponse validateUpload(String vspid, User user) throws Exception { + + public static RestResponse validateUpload(String vspid, User user, String vspVersion) throws Exception { Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/orchestration-template-candidate/process", - config.getCatalogBeHost(), config.getCatalogBePort(), vspid); + String url = String.format(Urls.VALIDATE_UPLOAD, config.getCatalogBeHost(), config.getCatalogBePort(), vspid,vspVersion); String userId = user.getUserId(); Map<String, String> headersMap = prepareHeadersMap(userId); HttpRequest http = new HttpRequest(); - + String body =null; RestResponse response = http.httpSendPut(url, body, headersMap); @@ -520,9 +682,9 @@ public class OnboardingUtils { return response; } - public static RestResponse uploadHeatPackage(String filepath, String filename, String vspid, User user) throws Exception { + public static RestResponse uploadHeatPackage(String filepath, String filename, String vspid, User user, String vspVersion) throws Exception { Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/orchestration-template-candidate", config.getCatalogBeHost(), config.getCatalogBePort(), vspid); + String url = String.format(Urls.UPLOAD_HEAT_PACKAGE, config.getCatalogBeHost(), config.getCatalogBePort(), vspid, vspVersion); return uploadFile(filepath, filename, url, user); } @@ -553,11 +715,10 @@ public class OnboardingUtils { String responseBody = null; if (entity != null) { InputStream instream = entity.getContent(); - StringWriter writer = new StringWriter(); - IOUtils.copy(instream, writer); - responseBody = writer.toString(); try { - + StringWriter writer = new StringWriter(); + IOUtils.copy(instream, writer); + responseBody = writer.toString(); } finally { instream.close(); } @@ -595,27 +756,39 @@ public class OnboardingUtils { } } +// private static File getTestZipFile(String filepath, String filename) throws IOException { +// Config config = Utils.getConfig(); +// String sourceDir = config.getImportResourceTestsConfigDir(); +// java.nio.file.Path filePath = FileSystems.getDefault().getPath(filepath + File.separator + filename); +// return filePath.toFile(); +// } + private static File getTestZipFile(String filepath, String filename) throws IOException { Config config = Utils.getConfig(); String sourceDir = config.getImportResourceTestsConfigDir(); - java.nio.file.Path filePath = FileSystems.getDefault().getPath(filepath + File.separator + filename); + java.nio.file.Path filePath; + if(filename == null){ + filePath = FileSystems.getDefault().getPath(filepath); + }else{ + filePath = FileSystems.getDefault().getPath(filepath + File.separator + filename); + } return filePath.toFile(); } - public static RestResponse checkinVendorSoftwareProduct(String vspid, User user) throws Exception { - return actionOnComponent(vspid, "Checkin", "vendor-software-products", user); + public static RestResponse checkinVendorSoftwareProduct(String vspid, User user, String vspVersion) throws Exception { + return actionOnComponent(vspid, "Checkin", "vendor-software-products", user, vspVersion); } - - private static RestResponse checkoutVendorSoftwareProduct(String vspid, User user) throws Exception { - return actionOnComponent(vspid, "Checkout", "vendor-software-products", user); + + public static RestResponse checkoutVendorSoftwareProduct(String vspid, User user, String vspVersion) throws Exception { + return actionOnComponent(vspid, "Checkout", "vendor-software-products", user, vspVersion); } - public static RestResponse submitVendorSoftwareProduct(String vspid, User user) throws Exception { - return actionOnComponent(vspid, "Submit", "vendor-software-products", user); + public static RestResponse submitVendorSoftwareProduct(String vspid, User user, String vspVersion) throws Exception { + return actionOnComponent(vspid, "Submit", "vendor-software-products", user, vspVersion); } - public static RestResponse createPackageOfVendorSoftwareProduct(String vspid, User user) throws Exception { - return actionOnComponent(vspid, "Create_Package", "vendor-software-products", user); + public static RestResponse createPackageOfVendorSoftwareProduct(String vspid, User user, String vspVersion) throws Exception { + return actionOnComponent(vspid, "Create_Package", "vendor-software-products", user, vspVersion); } protected static Map<String, String> prepareHeadersMap(String userId) { @@ -626,7 +799,55 @@ public class OnboardingUtils { return headersMap; } - + public static VendorSoftwareProductObject updateVSPWithNewVLMParameters(VendorSoftwareProductObject vendorSoftwareProductObject, + AmdocsLicenseMembers amdocsLicenseMembers, User user, String vspCurrentVersion, String vspNextVersion) throws Exception { + + LicensingVersion licensingVersion = new LicensingVersion(amdocsLicenseMembers.getLicenseVersionId(),amdocsLicenseMembers.getLicenseVersionId()); + LicensingData licensingData = new LicensingData(amdocsLicenseMembers.getVendorLicenseAgreementId(), Arrays.asList(amdocsLicenseMembers.getFeatureGroupId())); + vendorSoftwareProductObject.setVendorId(amdocsLicenseMembers.getVendorId()); + vendorSoftwareProductObject.setVendorName(amdocsLicenseMembers.getVendorLicenseName()); + vendorSoftwareProductObject.setLicensingVersion(licensingVersion); + vendorSoftwareProductObject.setLicensingData(licensingData); + + VendorSoftwareProductObjectReqDetails vendorSoftwareProductObjectReqDetails = new VendorSoftwareProductObjectReqDetails( + vendorSoftwareProductObject.getName(), + vendorSoftwareProductObject.getDescription(), + vendorSoftwareProductObject.getCategory(), + vendorSoftwareProductObject.getSubCategory(), + vendorSoftwareProductObject.getVendorId(), + vendorSoftwareProductObject.getVendorName(), + licensingVersion, + licensingData, + vendorSoftwareProductObject.getOnboardingMethod(), + vendorSoftwareProductObject.getNetworkPackageName(), + vendorSoftwareProductObject.getOnboardingOrigin()); + + Gson gson = new Gson(); + String json = gson.toJson(vendorSoftwareProductObjectReqDetails); + + RestResponse checkout = checkoutVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, "1.0"); + assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue()); + + Config config = Utils.getConfig(); + String url = String.format(Urls.UPDATE_VSP, config.getCatalogBeHost(), config.getCatalogBePort(), vendorSoftwareProductObject.getVspId(), vspCurrentVersion); + String userId = user.getUserId(); + + Map<String, String> headersMap = prepareHeadersMap(userId); + HttpRequest http = new HttpRequest(); + + RestResponse response = http.httpSendPut(url, json, headersMap); + + RestResponse checkin = checkinVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, vspCurrentVersion); + assertEquals("did not succeed to checking VSP", 200, checkin.getErrorCode().intValue()); + + RestResponse submit = submitVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, vspCurrentVersion); + assertEquals("did not succeed to submit VSP", 200, submit.getErrorCode().intValue()); + + vendorSoftwareProductObject.setVersion(vspNextVersion); + + return vendorSoftwareProductObject; + } + // private static void importUpdateVSP(Pair<String, Map<String, String>> vsp, boolean isUpdate) throws Exception{ // String vspName = vsp.left; // Map<String, String> vspMetadata = vsp.right; @@ -785,7 +1006,63 @@ public class OnboardingUtils { fileNamesFromFolder.removeAll(exludeVnfListForToscaParser); return fileNamesFromFolder; } - + + public static VendorSoftwareProductObject fillVendorSoftwareProductObjectWithMetaData(String vnfFile, Pair<String, Map<String, String>> createVendorSoftwareProduct) { + VendorSoftwareProductObject vendorSoftwareProductObject = new VendorSoftwareProductObject(); + Map<String, String> map = createVendorSoftwareProduct.right; + vendorSoftwareProductObject.setAttContact(map.get("attContact")); + vendorSoftwareProductObject.setCategory(map.get("category")); + vendorSoftwareProductObject.setComponentId(map.get("componentId")); + vendorSoftwareProductObject.setDescription(map.get("description")); + vendorSoftwareProductObject.setSubCategory(map.get("subCategory")); + vendorSoftwareProductObject.setVendorName(map.get("vendorName")); + vendorSoftwareProductObject.setVspId(map.get("vspId")); + vendorSoftwareProductObject.setName(createVendorSoftwareProduct.left); + String[] arrFileNameAndExtension = vnfFile.split("\\."); + vendorSoftwareProductObject.setOnboardingMethod("NetworkPackage"); + vendorSoftwareProductObject.setNetworkPackageName(arrFileNameAndExtension[0]); + vendorSoftwareProductObject.setOnboardingOrigin(arrFileNameAndExtension[1]); + + return vendorSoftwareProductObject; + } + + public static void updateVendorSoftwareProductToNextVersion(VendorSoftwareProductObject vendorSoftwareProductObject, String toVspVersion, User user, String filepath, String heatFileName) + throws Exception, Throwable { + + RestResponse checkout = checkoutVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, vendorSoftwareProductObject.getVersion()); + assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue()); + + RestResponse uploadHeatPackage = uploadHeatPackage(filepath, heatFileName, vendorSoftwareProductObject.getVspId(), user, "1.1"); + assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue()); + + RestResponse validateUpload = validateUpload(vendorSoftwareProductObject.getVspId(), user, "1.1"); + assertEquals("did not succeed to validate upload process, reason: " + validateUpload.getResponse(), 200, validateUpload.getErrorCode().intValue()); + + prepareVspForUse(user,vendorSoftwareProductObject.getVspId(),toVspVersion); + + vendorSoftwareProductObject.setVersion(toVspVersion); + } + + public static Object[][] filterObjectArrWithExcludedVnfs(Object[][] objectArr) + { + Object[][] filteredArObject = new Object[objectArr.length][]; + + int index = 0; + + for (int i = 0; i < objectArr.length ; i++) { + + String vnfSourceFile = (String) objectArr[i][0]; + String vnfUpdateFile = (String) objectArr[i][1]; + + if(!exludeVnfList.contains(vnfSourceFile) && !exludeVnfList.contains(vnfUpdateFile)) + { + filteredArObject[index] = new Object[]{vnfSourceFile , vnfUpdateFile }; + index++; + } + } + + return filteredArObject; + } }
\ No newline at end of file diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/SnmpTypeEnum.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/SnmpTypeEnum.java index 71038920ae..366962ef0a 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/SnmpTypeEnum.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/SnmpTypeEnum.java @@ -20,56 +20,6 @@ package org.openecomp.sdc.ci.tests.utils.general; -import static org.testng.AssertJUnit.assertEquals; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.StringWriter; -import java.nio.file.FileSystems; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.apache.commons.io.IOUtils; -import org.apache.http.HttpEntity; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.mime.MultipartEntityBuilder; -import org.apache.http.entity.mime.content.FileBody; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.simple.JSONArray; -import org.json.simple.JSONValue; -import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.ci.tests.config.Config; -import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; - -import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; - -import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; -import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; -import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar; - - -import org.openecomp.sdc.ci.tests.utils.Utils; -import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; - -import org.testng.Assert; - -import com.aventstack.extentreports.Status; -import com.clearspring.analytics.util.Pair; - enum SnmpTypeEnum{ SNMP_POLL ("snmp"), SNMP_TRAP ("snmp-trap"); diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/SnmpTypeEnum.java~release_1802E b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/SnmpTypeEnum.java~release_1802E new file mode 100644 index 0000000000..71038920ae --- /dev/null +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/SnmpTypeEnum.java~release_1802E @@ -0,0 +1,88 @@ +/*- + * ============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========================================================= + */ + +package org.openecomp.sdc.ci.tests.utils.general; + +import static org.testng.AssertJUnit.assertEquals; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.nio.file.FileSystems; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; + +import org.apache.commons.io.IOUtils; +import org.apache.http.HttpEntity; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.entity.mime.content.FileBody; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.simple.JSONArray; +import org.json.simple.JSONValue; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.config.Config; +import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; + +import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; + +import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; +import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar; + + +import org.openecomp.sdc.ci.tests.utils.Utils; +import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; + +import org.testng.Assert; + +import com.aventstack.extentreports.Status; +import com.clearspring.analytics.util.Pair; + +enum SnmpTypeEnum{ + SNMP_POLL ("snmp"), + SNMP_TRAP ("snmp-trap"); + + private String value; + + public String getValue() { + return value; + } + + private SnmpTypeEnum(String value) { + this.value = value; +} + +} + diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/AssetRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/AssetRestUtils.java index 71918386d9..4ade9eb16c 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/AssetRestUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/AssetRestUtils.java @@ -26,8 +26,12 @@ import static org.testng.AssertJUnit.assertTrue; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.UUID; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/CatalogRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/CatalogRestUtils.java index 70ed1d51f0..449b6beca5 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/CatalogRestUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/CatalogRestUtils.java @@ -21,7 +21,8 @@ package org.openecomp.sdc.ci.tests.utils.rest; import java.io.IOException; -import java.util.*; +import java.util.HashMap; +import java.util.Map; import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ConsumerRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ConsumerRestUtils.java index 0e0a974885..0aadfdbaeb 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ConsumerRestUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ConsumerRestUtils.java @@ -123,6 +123,7 @@ public class ConsumerRestUtils extends BaseRestUtils { String bodyToParse = restResponse.getResponse(); ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); try { mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); ConsumerDataDefinition component = mapper.readValue(bodyToParse, ConsumerDataDefinition.class); diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ImportRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ImportRestUtils.java index 951831c39d..0be438470d 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ImportRestUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ImportRestUtils.java @@ -34,7 +34,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Properties; import org.apache.commons.io.IOUtils; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ProductRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ProductRestUtils.java index 93c0d05f87..65bc2f5d92 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ProductRestUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ProductRestUtils.java @@ -22,8 +22,6 @@ package org.openecomp.sdc.ci.tests.utils.rest; import java.io.IOException; -import com.google.gson.Gson; - import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.Product; @@ -39,6 +37,8 @@ import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.gson.Gson; + public class ProductRestUtils extends BaseRestUtils { private static Gson gson = new Gson(); private static Logger logger = LoggerFactory.getLogger(ProductRestUtils.class.getName()); diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/PropertyRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/PropertyRestUtils.java index b035694407..33704a5128 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/PropertyRestUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/PropertyRestUtils.java @@ -25,11 +25,14 @@ import static org.testng.AssertJUnit.assertNull; import static org.testng.AssertJUnit.assertTrue; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentInstanceInput; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Resource; @@ -37,10 +40,15 @@ import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; +import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; +import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.common.util.GeneralUtility; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.gson.Gson; + public class PropertyRestUtils extends BaseRestUtils { private static Logger logger = LoggerFactory.getLogger(PropertyRestUtils.class.getName()); @@ -307,4 +315,26 @@ public class PropertyRestUtils extends BaseRestUtils { path.add(componentInstDetails.getUniqueId()); updatePropertyListWithPathParameterOnCompInst(service, path, list); } + + public static RestResponse declareProporties(Component componentObject, Map<String, List<ComponentInstanceInput>> componentInstancesInputs, User sdncModifierDetails) + throws Exception { + Config config = Config.instance(); + String url = String.format(Urls.DECLARE_PROPERTIES, config.getCatalogBeHost(), config.getCatalogBePort(), ComponentTypeEnum.findParamByType(componentObject.getComponentType()), componentObject.getUniqueId()); + String userId = sdncModifierDetails.getUserId(); + Map<String, String> headersMap = prepareHeadersMap(userId); + Map<String, Object> jsonBuilder = new HashMap<>(); + jsonBuilder.put("componentInstanceInputsMap", componentInstancesInputs); + Gson gson = new Gson(); + String userBodyJson = gson.toJson(jsonBuilder); + String calculateMD5 = GeneralUtility.calculateMD5Base64EncodedByString(userBodyJson); + headersMap.put(HttpHeaderEnum.Content_MD5.getValue(), calculateMD5); + HttpRequest http = new HttpRequest(); + // System.out.println(url); + // System.out.println(userBodyJson); + RestResponse declareProportiesResponse = http.httpSendPost(url, userBodyJson, headersMap); + if (declareProportiesResponse.getErrorCode() == STATUS_CODE_GET_SUCCESS) { + + } + return declareProportiesResponse; + } } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtils.java index ec8fd4089a..2f33273319 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtils.java @@ -53,13 +53,13 @@ import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.common.util.GeneralUtility; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonParser; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class ResourceRestUtils extends BaseRestUtils { private static Logger logger = LoggerFactory.getLogger(ResourceRestUtils.class.getName()); diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtilsExternalAPI.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtilsExternalAPI.java index 19d7d728fe..d9b8ec3d4b 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtilsExternalAPI.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResourceRestUtilsExternalAPI.java @@ -26,7 +26,6 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.datatypes.ResourceExternalReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResponseParser.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResponseParser.java index c4b9764c96..6f83ec9d52 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResponseParser.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResponseParser.java @@ -28,15 +28,12 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Optional; import org.apache.commons.codec.binary.Base64; import org.apache.log4j.Logger; -import org.codehaus.jackson.JsonParseException; import org.codehaus.jackson.Version; import org.codehaus.jackson.map.DeserializationConfig; import org.codehaus.jackson.map.JsonDeserializer; -import org.codehaus.jackson.map.JsonMappingException; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.module.SimpleModule; import org.json.JSONArray; @@ -55,14 +52,11 @@ import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation.PropertyConstraintJacksonDeserialiser; import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ResourceAssetStructure; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ResourceRespJavaObject; import org.openecomp.sdc.ci.tests.datatypes.ServiceDistributionStatus; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.Utils; -import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; -import com.fasterxml.jackson.databind.DeserializationFeature; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; @@ -196,7 +190,6 @@ public class ResponseParser { List<Resource> resources = Arrays.asList(mapper.readValue(response.toString(), Resource[].class)); resource = resources.get(0); } catch (Exception e1) { - // TODO Auto-generated catch block e1.printStackTrace(); } } @@ -207,8 +200,7 @@ public class ResponseParser { public static ComponentInstanceProperty convertPropertyResponseToJavaObject(String response) { ObjectMapper mapper = new ObjectMapper(); - final SimpleModule module = new SimpleModule("customerSerializationModule", - new Version(1, 0, 0, "static version")); + final SimpleModule module = new SimpleModule("customerSerializationModule", new Version(1, 0, 0, "static version")); JsonDeserializer<PropertyConstraint> desrializer = new PropertyConstraintJacksonDeserialiser(); addDeserializer(module, PropertyConstraint.class, desrializer); @@ -219,7 +211,6 @@ public class ResponseParser { propertyDefinition = mapper.readValue(response, ComponentInstanceProperty.class); logger.debug(propertyDefinition.toString()); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } return propertyDefinition; @@ -238,7 +229,6 @@ public class ResponseParser { artifactDefinition = mapper.readValue(response, ArtifactDefinition.class); logger.debug(artifactDefinition.toString()); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } @@ -280,7 +270,6 @@ public class ResponseParser { // System.out.println("Class: "+clazz.getSimpleName()+", json: // "+json); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } @@ -313,12 +302,12 @@ public class ResponseParser { mapper.registerModule(module); Service service = null; try { -// TODO Andrey L. uncomment line below in case to ignore on unknown properties, not recommended, added by Matvey +// TODO Andrey L. uncomment line below in case to ignore on unknown properties, not recommended, added by Matvey mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); + service = mapper.readValue(response, Service.class); logger.debug(service.toString()); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } @@ -342,7 +331,6 @@ public class ResponseParser { product = mapper.readValue(response, Product.class); logger.debug(product.toString()); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } @@ -403,29 +391,9 @@ public class ResponseParser { } - public static List<Map<String, Object>> getAuditFromMessage(Map auditingMessage) { + public static List<Map<String, Object>> getAuditFromMessage(Map<String, Object> auditingMessage) { List<Map<String, Object>> auditList = new ArrayList<Map<String, Object>>(); - // JsonElement jElement = new JsonParser().parse(auditingMessage); - // JsonObject jObject = jElement.getAsJsonObject(); - // JsonObject hitsObject = (JsonObject) jObject.get("hits"); - // JsonArray hitsArray = (JsonArray) hitsObject.get("hits"); - // - // Iterator<JsonElement> hitsIterator = hitsArray.iterator(); - // while(hitsIterator.hasNext()) - // { - // JsonElement nextHit = hitsIterator.next(); - // JsonObject jHitObject = nextHit.getAsJsonObject(); - // JsonObject jSourceObject = (JsonObject) jHitObject.get("_source"); - // - // Gson gson=new Gson(); - // String auditUnparsed = jSourceObject.toString(); - // - // Map<String,Object> map = new HashMap<String,Object>(); - // map = (Map<String,Object>) gson.fromJson(auditUnparsed, - // map.getClass()); - auditList.add(auditingMessage); - // } return auditList; } @@ -609,4 +577,5 @@ public class ResponseParser { return null; } + } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ArtifactValidationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ArtifactValidationUtils.java index b211cb723b..a07300671f 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ArtifactValidationUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ArtifactValidationUtils.java @@ -44,9 +44,7 @@ import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.FileUtils; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; -import com.google.gson.Gson; import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import com.google.gson.JsonParser; public class ArtifactValidationUtils { diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/AuditValidationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/AuditValidationUtils.java index 1bef06ac03..4cf712f2fc 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/AuditValidationUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/AuditValidationUtils.java @@ -726,56 +726,22 @@ public class AuditValidationUtils { Map auditingMessage = null; auditingMessage = retrieveAuditMessagesByPattern(action, body, false); - return auditingMessage; } - // public static List<Map<String, Object>> - // parseAuditResourceByActionToList(String action, String body) throws - // Exception { - // - // List<Map<String, Object>> auditList = new ArrayList<Map<String, - // Object>>(); - // - //// String auditingMessage = null; - // - // Map auditingMessage = null; - // auditingMessage = retrieveAuditMessagesByPattern(action); - // - // if (body == null) { - //// String pattern = "/_search?q=ACTION:\"" + action + "\""; - //// auditingMessage = retrieveAuditMessagesByPattern(action); - //// auditingMessage = retrieveAuditMessagesByPattern(pattern); - // } else { - //// auditingMessage = retrieveAuditMessagesUsingBody(body); - // } - // - // return ResponseParser.getAuditFromMessage(auditingMessage); - // - // } - public static List<Map<String, Object>> parseAuditResourceByActionToList(String action, Map<AuditingFieldsKeysEnum, String> body) throws Exception { - List<Map<String, Object>> auditList = new ArrayList<Map<String, Object>>(); - - // String auditingMessage = null; - Map auditingMessage = null; if (body == null || body.isEmpty()) { auditingMessage = retrieveAuditMessagesByPattern(action, null, false); - // String pattern = "/_search?q=ACTION:\"" + action + "\""; - // auditingMessage = retrieveAuditMessagesByPattern(action); - // auditingMessage = retrieveAuditMessagesByPattern(pattern); } else { auditingMessage = retrieveAuditMessagesByPattern(action, body, false); - // auditingMessage = retrieveAuditMessagesUsingBody(body); } return ResponseParser.getAuditFromMessage(auditingMessage); - } public JSONObject buildElasticQueryStringObject(String defaultField, String queryValue) throws JSONException { diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/BaseValidationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/BaseValidationUtils.java index 0d49d97302..eb3ee331ed 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/BaseValidationUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/BaseValidationUtils.java @@ -28,7 +28,6 @@ import java.util.Arrays; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.exception.ResponseFormat; import org.testng.Assert; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CategoryValidationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CategoryValidationUtils.java index d63a514b3a..cd2297fd19 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CategoryValidationUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CategoryValidationUtils.java @@ -20,9 +20,10 @@ package org.openecomp.sdc.ci.tests.utils.validation; +import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertNotNull; import static org.testng.AssertJUnit.assertTrue; -import static org.testng.AssertJUnit.assertEquals; + import org.json.JSONObject; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.GroupingDefinition; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CsarValidationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CsarValidationUtils.java index 7423dbc808..12a5ab8082 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CsarValidationUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/CsarValidationUtils.java @@ -22,25 +22,14 @@ package org.openecomp.sdc.ci.tests.utils.validation; import static org.testng.AssertJUnit.assertTrue; -import java.io.File; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; import java.util.ArrayList; import java.util.List; -import java.util.Map; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.ci.tests.datatypes.GroupHeatMetaDefinition; import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; import org.openecomp.sdc.ci.tests.datatypes.TypeHeatMetaDefinition; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.utils.CsarParserUtils; -import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ImportRestUtils; -import org.openecomp.sdc.common.rest.api.RestResponseAsByteArray; -import org.openecomp.sdc.common.util.ZipUtil; public class CsarValidationUtils { diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ErrorValidationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ErrorValidationUtils.java index b79e4c63fc..ccddc30d6a 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ErrorValidationUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ErrorValidationUtils.java @@ -29,7 +29,6 @@ import java.io.InputStream; import java.util.List; import java.util.Map; -import org.yaml.snakeyaml.Yaml; import org.codehaus.jettison.json.JSONException; import org.codehaus.jettison.json.JSONObject; import org.openecomp.sdc.ci.tests.config.Config; @@ -38,6 +37,7 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.ExceptionEnumType; import org.openecomp.sdc.ci.tests.utils.Utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.yaml.snakeyaml.Yaml; public class ErrorValidationUtils { static Logger logger = LoggerFactory.getLogger(ErrorValidationUtils.class.getName()); diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ServiceValidationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ServiceValidationUtils.java index a7c7b7d34e..2f8a0dffc4 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ServiceValidationUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/ServiceValidationUtils.java @@ -20,8 +20,9 @@ package org.openecomp.sdc.ci.tests.utils.validation; -import static org.testng.AssertJUnit.assertFalse; import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertFalse; + import java.util.LinkedHashSet; import java.util.List; import java.util.Set; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/UserValidationUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/UserValidationUtils.java index 1fa20c19fd..a75434edcf 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/UserValidationUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/validation/UserValidationUtils.java @@ -20,8 +20,8 @@ package org.openecomp.sdc.ci.tests.utils.validation; -import static org.testng.AssertJUnit.assertTrue; import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertTrue; import java.util.List; |