diff options
7 files changed, 19 insertions, 6 deletions
diff --git a/cps-dependencies/pom.xml b/cps-dependencies/pom.xml index 16a6532a92..afe4de0597 100755 --- a/cps-dependencies/pom.xml +++ b/cps-dependencies/pom.xml @@ -45,8 +45,8 @@ <spock-core.version>2.0-M5-groovy-3.0</spock-core.version> <spock-spring.version>2.0-M5-groovy-3.0</spock-spring.version> <spotbugs.version>4.2.0</spotbugs.version> - <springboot.version>2.3.8.RELEASE</springboot.version> - <springboot.cloud.version>Hoxton.SR9</springboot.cloud.version> + <springboot.version>2.5.0</springboot.version> + <springboot.cloud.version>2020.0.2</springboot.cloud.version> <springfox.version>3.0.0</springfox.version> <swagger.version>2.1.4</swagger.version> <testcontainers.version>1.15.1</testcontainers.version> diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java index bdb71bf625..5aadb3f0fe 100755 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java @@ -60,7 +60,7 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService @Override public void createDataNode(final String cmHandle, final String parentNodeXpath, final String jsonData) { - if (StringUtils.isEmpty(parentNodeXpath) || "/".equals(parentNodeXpath)) { + if (!StringUtils.hasText(parentNodeXpath) || "/".equals(parentNodeXpath)) { cpsDataService.saveData(getDataspaceName(), cmHandle, jsonData); } else { cpsDataService.saveData(getDataspaceName(), cmHandle, parentNodeXpath, jsonData); diff --git a/cps-parent/pom.xml b/cps-parent/pom.xml index 18addd7dc8..78a89f0aca 100755 --- a/cps-parent/pom.xml +++ b/cps-parent/pom.xml @@ -62,8 +62,12 @@ ../cps-service/target/site/jacoco-aggregate/jacoco.xml, ../cps-rest/target/site/jacoco-ut/jacoco.xml, ../cps-rest/target/site/jacoco-aggregate/jacoco.xml, + ../cps-ncmp-service/target/site/jacoco-ut/jacoco.xml, + ../cps-ncmp-service/target/site/jacoco-aggregate/jacoco.xml, ../cps-ncmp-rest/target/site/jacoco-ut/jacoco.xml, ../cps-ncmp-rest/target/site/jacoco-aggregate/jacoco.xml, + ../cps-path-parser/target/site/jacoco-ut/jacoco.xml, + ../cps-path-parser/target/site/jacoco-aggregate/jacoco.xml, ../cps-application/target/site/jacoco-ut/jacoco.xml, ../cps-application/target/site/jacoco-aggregate/jacoco.xml </sonar.coverage.jacoco.xmlReportPaths> diff --git a/cps-path-parser/src/main/antlr4/org/onap/cps/cpspath/parser/antlr4/CpsPath.g4 b/cps-path-parser/src/main/antlr4/org/onap/cps/cpspath/parser/antlr4/CpsPath.g4 index 86095459ee..a4fd58e9c0 100644 --- a/cps-path-parser/src/main/antlr4/org/onap/cps/cpspath/parser/antlr4/CpsPath.g4 +++ b/cps-path-parser/src/main/antlr4/org/onap/cps/cpspath/parser/antlr4/CpsPath.g4 @@ -25,7 +25,7 @@ ancestorAxis: SLASH KW_ANCESTOR COLONCOLON ancestorPath ; ancestorPath: yangElement (SLASH yangElement)* ; -cpsPathWithSingleLeafCondition: prefix singleValueCondition ; +cpsPathWithSingleLeafCondition: prefix singleValueCondition postfix? ; /* No need to ditinguish between cpsPathWithDescendant | cpsPathWithDescendantAndLeafConditions really! @@ -40,6 +40,8 @@ descendant: SLASH prefix ; prefix: (SLASH yangElement)* SLASH containerName ; +postfix: (SLASH yangElement)+ ; + yangElement: containerName listElementRef? ; containerName: QName ; diff --git a/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathBuilder.java b/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathBuilder.java index 83e076d53d..afe01f644c 100644 --- a/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathBuilder.java +++ b/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathBuilder.java @@ -1,4 +1,3 @@ -package org.onap.cps.cpspath.parser; /* * ============LICENSE_START======================================================= * Copyright (C) 2021 Nordix Foundation @@ -18,6 +17,8 @@ package org.onap.cps.cpspath.parser; * ============LICENSE_END========================================================= */ +package org.onap.cps.cpspath.parser; + import java.util.HashMap; import java.util.Map; import org.onap.cps.cpspath.parser.antlr4.CpsPathBaseListener; @@ -27,6 +28,7 @@ import org.onap.cps.cpspath.parser.antlr4.CpsPathParser.CpsPathWithDescendantCon import org.onap.cps.cpspath.parser.antlr4.CpsPathParser.CpsPathWithSingleLeafConditionContext; import org.onap.cps.cpspath.parser.antlr4.CpsPathParser.LeafConditionContext; import org.onap.cps.cpspath.parser.antlr4.CpsPathParser.MultipleValueConditionsContext; +import org.onap.cps.cpspath.parser.antlr4.CpsPathParser.PostfixContext; import org.onap.cps.cpspath.parser.antlr4.CpsPathParser.PrefixContext; import org.onap.cps.cpspath.parser.antlr4.CpsPathParser.SingleValueConditionContext; @@ -42,6 +44,11 @@ public class CpsPathBuilder extends CpsPathBaseListener { } @Override + public void exitPostfix(final PostfixContext ctx) { + throw new IllegalStateException(String.format("Unsupported postfix %s encountered in CpsPath.", ctx.getText())); + } + + @Override public void exitLeafCondition(final LeafConditionContext ctx) { Object comparisonValue = null; if (ctx.IntegerLiteral() != null) { diff --git a/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathQuery.java b/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathQuery.java index 32fe0cbb74..1774e03e13 100644 --- a/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathQuery.java +++ b/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathQuery.java @@ -19,7 +19,6 @@ package org.onap.cps.cpspath.parser; - import java.util.Map; import lombok.AccessLevel; import lombok.Getter; diff --git a/cps-path-parser/src/test/groovy/org/onap/cps/cpspath/parser/CpsPathQuerySpec.groovy b/cps-path-parser/src/test/groovy/org/onap/cps/cpspath/parser/CpsPathQuerySpec.groovy index 0e7fc35cf4..116c9168e8 100644 --- a/cps-path-parser/src/test/groovy/org/onap/cps/cpspath/parser/CpsPathQuerySpec.groovy +++ b/cps-path-parser/src/test/groovy/org/onap/cps/cpspath/parser/CpsPathQuerySpec.groovy @@ -84,6 +84,7 @@ class CpsPathQuerySpec extends Specification { 'end with descendant and more than one attribute separated by "or"' | '//child[@int-leaf=5 or @leaf-name="leaf value"]' 'missing attribute value' | '//child[@int-leaf=5 and @name]' 'incomplete ancestor value' | '//books/ancestor::' + 'unsupported postfix after single value condition (JIRA CPS-450)' | '/parent/child[@id=1]/somePostFix' } def 'Parse cps path using ancestor by schema node identifier with a #scenario.'() { |