summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManor, Yanir (ym903w) <ym903w@intl.att.com>2018-09-27 07:46:36 +0300
committerManor, Yanir (ym903w) <ym903w@intl.att.com>2018-09-27 07:46:36 +0300
commit4d998424a05d78cec88ece0bd010350c21fcd0c1 (patch)
treed75b39226bff962a9736ecea7a79e46a0ad08cb9
parent607afd80037616635919465e5c62388cee3a8aac (diff)
upgrade dace-d ci pom version
upgrade dace-d ci pom version Change-Id: I7a64ba5e13fc463a2505f0654487ee6f2fd0b278 Issue-ID: DCAEGEN2-838 Signed-off-by: Manor, Yanir (ym903w) <ym903w@intl.att.com>
-rw-r--r--pom.xml244
-rw-r--r--src/main/java/org/onap/dcae/ci/api/tests/ruleEditor/RuleEditorControllerTest.java37
-rw-r--r--src/main/java/org/onap/dcae/ci/utilities/DcaeRestClient.java19
3 files changed, 159 insertions, 141 deletions
diff --git a/pom.xml b/pom.xml
index 5158b67..43e5dac 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,42 +1,42 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.onap.sdc.dcae-d.ci</groupId>
- <artifactId>dcae-ci-tests</artifactId>
- <version>1.2.0-SNAPSHOT</version>
- <name>dcae-d ci tests</name>
- <packaging>jar</packaging>
- <description>Tests for DCAE Designer </description>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.onap.sdc.dcae-d.ci</groupId>
+ <artifactId>dcae-ci-tests</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ <name>dcae-d ci tests</name>
+ <packaging>jar</packaging>
+ <description>Tests for DCAE Designer </description>
- <properties>
- <maven.compiler.source>1.8</maven.compiler.source>
- <maven.compiler.target>1.8</maven.compiler.target>
+ <properties>
+ <maven.compiler.source>1.8</maven.compiler.source>
+ <maven.compiler.target>1.8</maven.compiler.target>
<maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <nexus.proxy>https://nexus.onap.org</nexus.proxy>
- <staging.profile.id>176c31dfe190a</staging.profile.id>
- <httpclient.version>4.5.5</httpclient.version>
- <snakeyaml.version>1.21</snakeyaml.version>
- <slf4j.version>1.7.25</slf4j.version>
- <sonar.branch>${project.version}</sonar.branch>
- <sonar.coverage.exclusions>**</sonar.coverage.exclusions>
- </properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <nexus.proxy>https://nexus.onap.org</nexus.proxy>
+ <staging.profile.id>176c31dfe190a</staging.profile.id>
+ <httpclient.version>4.5.5</httpclient.version>
+ <snakeyaml.version>1.21</snakeyaml.version>
+ <slf4j.version>1.7.25</slf4j.version>
+ <sonar.branch>${project.version}</sonar.branch>
+ <sonar.coverage.exclusions>**</sonar.coverage.exclusions>
+ </properties>
- <dependencies>
+ <dependencies>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>3.8.0</version>
- <scope>compile</scope>
- </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <version>3.8.0</version>
+ <scope>compile</scope>
+ </dependency>
- <dependency>
- <groupId>org.onap.sdc.dcae-d.dt-be-property</groupId>
- <artifactId>DCAE-DT-PROPERTY</artifactId>
- <version>1.2.0-SNAPSHOT</version>
- </dependency>
+ <dependency>
+ <groupId>org.onap.sdc.dcae-d.dt-be-property</groupId>
+ <artifactId>DCAE-DT-PROPERTY</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ </dependency>
<!-- Snake Yaml -->
<dependency>
@@ -114,8 +114,8 @@
</dependencies>
- <build>
- <plugins>
+ <build>
+ <plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
@@ -129,77 +129,77 @@
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.5.5</version>
- <executions>
- <execution>
- <id>create.jar.with.dependencies</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <archive>
- <manifest>
- <mainClass>org.onap.dcae.ci.run.RunTestSuite</mainClass>
- </manifest>
- </archive>
- <descriptorRefs>
- <descriptorRef>jar-with-dependencies</descriptorRef>
- </descriptorRefs>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <!-- Site Plugin -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-site-plugin</artifactId>
- <version>3.4</version>
- <dependencies>
- <dependency>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-webdav-jackrabbit</artifactId>
- <version>2.10</version>
- </dependency>
- </dependencies>
- </plugin>
- <!-- Staging Plugin -->
- <plugin>
- <groupId>org.sonatype.plugins</groupId>
- <artifactId>nexus-staging-maven-plugin</artifactId>
- <version>1.6.7</version>
- <extensions>true</extensions>
- <configuration>
- <nexusUrl>${nexus.proxy}</nexusUrl>
- <stagingProfileId>${staging.profile.id}</stagingProfileId>
- <serverId>ecomp-staging</serverId>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.5.5</version>
+ <executions>
+ <execution>
+ <id>create.jar.with.dependencies</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>org.onap.dcae.ci.run.RunTestSuite</mainClass>
+ </manifest>
+ </archive>
+ <descriptorRefs>
+ <descriptorRef>jar-with-dependencies</descriptorRef>
+ </descriptorRefs>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- Site Plugin -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>3.4</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-webdav-jackrabbit</artifactId>
+ <version>2.10</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <!-- Staging Plugin -->
+ <plugin>
+ <groupId>org.sonatype.plugins</groupId>
+ <artifactId>nexus-staging-maven-plugin</artifactId>
+ <version>1.6.7</version>
+ <extensions>true</extensions>
+ <configuration>
+ <nexusUrl>${nexus.proxy}</nexusUrl>
+ <stagingProfileId>${staging.profile.id}</stagingProfileId>
+ <serverId>ecomp-staging</serverId>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
- <repositories>
- <!-- LF repositories -->
- <repository>
- <id>ecomp-releases</id>
- <name>Release Repository</name>
- <url>${nexus.proxy}/content/repositories/releases/</url>
- </repository>
- <repository>
- <id>ecomp-snapshots</id>
- <name>Snapshots Repository</name>
- <url>${nexus.proxy}/content/repositories/snapshots/</url>
- </repository>
- <repository>
- <id>ecomp-public</id>
- <name>Public Repository</name>
- <url>${nexus.proxy}/content/repositories/public/</url>
- </repository>
- <!-- LF repositories END-->
- </repositories>
+ <repositories>
+ <!-- LF repositories -->
+ <repository>
+ <id>ecomp-releases</id>
+ <name>Release Repository</name>
+ <url>${nexus.proxy}/content/repositories/releases/</url>
+ </repository>
+ <repository>
+ <id>ecomp-snapshots</id>
+ <name>Snapshots Repository</name>
+ <url>${nexus.proxy}/content/repositories/snapshots/</url>
+ </repository>
+ <repository>
+ <id>ecomp-public</id>
+ <name>Public Repository</name>
+ <url>${nexus.proxy}/content/repositories/public/</url>
+ </repository>
+ <!-- LF repositories END-->
+ </repositories>
<profiles>
<profile>
@@ -283,21 +283,21 @@
</profile>
</profiles>
- <distributionManagement>
- <repository>
- <id>ecomp-releases</id>
- <name>Release Repository</name>
- <url>${nexus.proxy}/content/repositories/releases/</url>
- </repository>
- <snapshotRepository>
- <id>ecomp-snapshots</id>
- <name>Snapshot Repository</name>
- <url>${nexus.proxy}/content/repositories/snapshots/</url>
- </snapshotRepository>
- <site>
- <id>ecomp-site</id>
- <url>dav:${nexus.proxy}${sitePath}</url>
- </site>
- </distributionManagement>
+ <distributionManagement>
+ <repository>
+ <id>ecomp-releases</id>
+ <name>Release Repository</name>
+ <url>${nexus.proxy}/content/repositories/releases/</url>
+ </repository>
+ <snapshotRepository>
+ <id>ecomp-snapshots</id>
+ <name>Snapshot Repository</name>
+ <url>${nexus.proxy}/content/repositories/snapshots/</url>
+ </snapshotRepository>
+ <site>
+ <id>ecomp-site</id>
+ <url>dav:${nexus.proxy}${sitePath}</url>
+ </site>
+ </distributionManagement>
</project>
diff --git a/src/main/java/org/onap/dcae/ci/api/tests/ruleEditor/RuleEditorControllerTest.java b/src/main/java/org/onap/dcae/ci/api/tests/ruleEditor/RuleEditorControllerTest.java
index 8d91ce7..df0c8fa 100644
--- a/src/main/java/org/onap/dcae/ci/api/tests/ruleEditor/RuleEditorControllerTest.java
+++ b/src/main/java/org/onap/dcae/ci/api/tests/ruleEditor/RuleEditorControllerTest.java
@@ -10,9 +10,7 @@ import org.onap.dcae.ci.entities.RestResponse;
import org.onap.dcae.ci.entities.rule_editor.SaveRuleError;
import org.onap.dcae.ci.report.Report;
import org.onap.dcae.ci.utilities.DcaeRestClient;
-import org.onap.sdc.dcae.composition.restmodels.ruleeditor.MappingRules;
-import org.onap.sdc.dcae.composition.restmodels.ruleeditor.Rule;
-import org.onap.sdc.dcae.composition.restmodels.ruleeditor.TranslateRequest;
+import org.onap.sdc.dcae.composition.restmodels.ruleeditor.*;
import org.onap.sdc.dcae.composition.services.Artifact;
import org.onap.sdc.dcae.composition.util.DcaeBeConstants;
import org.onap.sdc.dcae.composition.vfcmt.Vfcmt;
@@ -71,9 +69,7 @@ public class RuleEditorControllerTest extends DcaeRestBaseTest {
Vfcmt vfcmt = createVfcmt();
String name = vfcmt.getName();
saveCompositionAndFirstRuleSuccess(vfcmt, "map", "map", "param1", ruleRequestBody);
- TranslateRequest request = new TranslateRequest(vfcmt.getUuid(),"map", "map", "param1", null);
- request.setPublishPhase("map_publish");
- request.setEntryPhase("foi_map");
+ TranslateRequest request = new TranslateRequest(vfcmt.getUuid(),"map", "map", "param1", null, "foi_map", "map_publish");
RestResponse res = DcaeRestClient.translateRules(gson.toJson(request));
Report.log(Status.INFO, "translateRules response= "+res);
assertThat(res.getStatusCode()).isEqualTo(200);
@@ -98,13 +94,22 @@ public class RuleEditorControllerTest extends DcaeRestBaseTest {
Vfcmt vfcmt = createVfcmt();
String name = vfcmt.getName();
saveCompositionAndFirstRuleSuccess(vfcmt, "map", "map", "param1", ruleRequestBody);
- TranslateRequest request = new TranslateRequest(vfcmt.getUuid(), "map", "map", "param1", notifyOid);
- request.setEntryPhase("snmp_map");
- request.setPublishPhase("snmp_publish");
- RestResponse res = DcaeRestClient.translateRules(gson.toJson(request));
+ //1810 apply global filter
+ String filter = "{id:idc,level:0,name:elvis,left:\"${notify OID}\",operator:startswith,right:["+notifyOid+"]}";
+ BaseCondition condition = gson.fromJson(filter, BaseCondition.class);
+ ApplyFilterRequest request = new ApplyFilterRequest(vfcmt.getUuid(), "map", "map", "param1", null, "snmp_map", "snmp_publish", condition);
+ String requestBody = new Gson().toJson(request);
+ RestResponse res = DcaeRestClient.applyFilter(requestBody);
+ assertThat(res.getStatusCode()).isEqualTo(200);
+ res = DcaeRestClient.translateRules(requestBody);
Report.log(Status.INFO, "translateRules response= "+res);
assertThat(res.getStatusCode()).isEqualTo(200);
assertThat(res.getResponse()).isEqualTo(String.format(expectedTranslation, name, name, name));
+ res = DcaeRestClient.deleteFilter(requestBody);
+ assertThat(res.getStatusCode()).isEqualTo(200);
+ res = DcaeRestClient.translateRules(requestBody);
+ assertThat(res.getStatusCode()).isEqualTo(200);
+ assertThat(res.getResponse()).isNotEqualTo(String.format(expectedTranslation, name, name, name));
}
@Test
@@ -137,9 +142,7 @@ public class RuleEditorControllerTest extends DcaeRestBaseTest {
String thirdRulePhase1 = "{groupId:group_3,phase:phase_1,description:newRule,actions:[{actionType:\"Clear NSF\",id:id86,from:{state:closed,values:[{value:single_input}]}},{actionType:\"hp metric\",id:7788876,selectedHpMetric:xxxxxx}]}";
res = DcaeRestClient.saveRule(vfcmt.getUuid(), "map", "map", "param1", thirdRulePhase1);
assertThat(res.getStatusCode()).isEqualTo(200);
- TranslateRequest request = new TranslateRequest(vfcmt.getUuid(),"map", "map", "param1", null);
- request.setPublishPhase("map_publish");
- request.setEntryPhase("foi_map");
+ TranslateRequest request = new TranslateRequest(vfcmt.getUuid(),"map", "map", "param1", null, "foi_map", "map_publish");
res = DcaeRestClient.translateRules(gson.toJson(request));
Report.log(Status.INFO, "translateRules response= "+res);
assertThat(res.getStatusCode()).isEqualTo(200);
@@ -294,14 +297,14 @@ public class RuleEditorControllerTest extends DcaeRestBaseTest {
// get all rules should return both
assertThat(actualRules.getRules()).hasSize(2);
assertThat(actualRules.getRules().keySet()).containsOnly(uid1, uid2);
- // delete a rule
+ // delete a group of rules
res = DcaeRestClient.deleteGroupOfRules(vfcmt.getUuid(),"map", "map", "param1", "group_0");
Report.log(Status.INFO, "deleteGroup response= "+res);
assertThat(res.getStatusCode()).isEqualTo(200);
// no more rules - artifact should be deleted
String expectedArtifactName = "map_map_param1_MappingRules.json";
Artifact savedArtifact = fetchVfcmtArtifactMetadataByName(vfcmt.getUuid(), expectedArtifactName);
- Report.log(Status.INFO, "savedArtifact= "+savedArtifact);
+ Report.log(Status.INFO, "save6dArtifact= "+savedArtifact);
assertThat(savedArtifact).isNull();
// get rules should return empty
res = DcaeRestClient.getRules(vfcmt.getUuid(),"map", "map", "param1");
@@ -430,7 +433,7 @@ public class RuleEditorControllerTest extends DcaeRestBaseTest {
@Test
public void translateWithoutPhasesFailureTest() throws Exception {
- TranslateRequest translateRequest = new TranslateRequest("someId","map", "map", "param1", "xxx");
+ TranslateRequest translateRequest = new TranslateRequest("someId","map", "map", "param1", "xxx", "", "");
String expectedError = "{\"requestError\":{\"serviceException\":{\"messageId\":\"SVC6116\",\"text\":\"Translation failed. Reason: %1\",\"variables\":[\"please enter valid request parameters\"],\"formattedErrorMessage\":\"Translation failed. Reason: please enter valid request parameters\"}},\"notes\":\"\"}";
RestResponse res = DcaeRestClient.translateRules(gson.toJson(translateRequest));
assertThat(res.getStatusCode()).isEqualTo(400);
@@ -506,7 +509,7 @@ public class RuleEditorControllerTest extends DcaeRestBaseTest {
assertThat(existingTargets[0]).isEqualTo(param1);
Rule rule = gson.fromJson(ruleRequestBody, Rule.class);
MappingRules inputRules = new MappingRules(rule);
- res = DcaeRestClient.importRules(vfcmt.getUuid(), dcaeCompName, nid, param2, new Gson().toJson(inputRules));
+ res = DcaeRestClient.importRules(vfcmt.getUuid(), dcaeCompName, nid, param2, new Gson().toJson(inputRules), false);
assertThat(res.getStatusCode()).isEqualTo(200);
Report.log(Status.INFO, "verifying that after import success rule definition exists for both 'param1' and 'param2'");
res = DcaeRestClient.getExistingRuleTargets(vfcmt.getUuid(),dcaeCompName,nid);
diff --git a/src/main/java/org/onap/dcae/ci/utilities/DcaeRestClient.java b/src/main/java/org/onap/dcae/ci/utilities/DcaeRestClient.java
index 687a256..d754dfd 100644
--- a/src/main/java/org/onap/dcae/ci/utilities/DcaeRestClient.java
+++ b/src/main/java/org/onap/dcae/ci/utilities/DcaeRestClient.java
@@ -235,8 +235,23 @@ public class DcaeRestClient extends BaseRestUtils {
return sendGet(url, designerDefaultId, new SingletonMap<>(HttpHeaderEnum.ACCEPT.getValue(), "application/octet-stream"));
}
- public static RestResponse importRules(String vfcmtUuid, String dcaeCompName, String nid, String configParam, String request) throws IOException {
- String url = getApiUrl(String.format("/rule-editor/import/%s/%s/%s/%s", vfcmtUuid, dcaeCompName, nid, configParam));
+ public static RestResponse importRules(String vfcmtUuid, String dcaeCompName, String nid, String configParam, String request, boolean supportGroups) throws IOException {
+ String url = getApiUrl(String.format("/rule-editor/import/%s/%s/%s/%s/%s", vfcmtUuid, dcaeCompName, nid, configParam, supportGroups));
+ return sendPost(url, request, designerDefaultId, "application/json");
+ }
+
+ public static RestResponse importPhase(String request) throws IOException {
+ String url = getApiUrl("/rule-editor/importPhase");
+ return sendPost(url, request, designerDefaultId, "application/json");
+ }
+
+ public static RestResponse applyFilter(String request) throws IOException {
+ String url = getApiUrl("/rule-editor/applyFilter");
+ return sendPost(url, request, designerDefaultId, "application/json");
+ }
+
+ public static RestResponse deleteFilter(String request) throws IOException {
+ String url = getApiUrl("/rule-editor/deleteFilter");
return sendPost(url, request, designerDefaultId, "application/json");
}