summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAgarwal, Ruchira (ra1926) <ra1926@att.com>2019-11-05 18:16:50 +0000
committerAgarwal, Ruchira (ra1926) <ra1926@att.com>2019-11-05 18:16:50 +0000
commit83559ddc77a0217391212f2abcdcba2c3ff56937 (patch)
tree4a74c900ba401be5099d08371d6e2c79967d0555
parent5c6b2000726e657eb6a1ed468ae14f95e9df0ce4 (diff)
minor updates to clean up code
clean up code to sync with internal Issue-ID: CCSDK-1873 Signed-off-by: Agarwal, Ruchira (ra1926) <ra1926@att.com> Change-Id: Idcc7186d5aaa783c527de3986e7a1ecd9bfcf651
-rwxr-xr-xaai-service/provider/pom.xml8
-rwxr-xr-xaai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClient.java5
-rwxr-xr-xaai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java1
-rwxr-xr-xaai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequest.java10
-rwxr-xr-xaai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequestTest.java22
-rw-r--r--ansible-adapter/ansible-adapter-bundle/pom.xml2
-rw-r--r--ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml1
-rw-r--r--base/http/provider/pom.xml1
-rw-r--r--base/http/provider/src/main/java/org/onap/ccsdk/sli/adaptors/base/http/BasicAuthFilter.java6
-rw-r--r--base/http/provider/src/test/java/org/onap/ccsdk/sli/adaptors/base/http/BasicAuthFilterTest.java2
-rw-r--r--mdsal-resource/features/ccsdk-mdsal-resource/pom.xml1
-rw-r--r--mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/RestService.java5
-rw-r--r--netbox-client/features/ccsdk-netbox-client/pom.xml8
-rw-r--r--netbox-client/provider/pom.xml8
-rwxr-xr-xsql-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/SqlResource.java29
15 files changed, 70 insertions, 39 deletions
diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml
index 9650087e5..f63bc424e 100755
--- a/aai-service/provider/pom.xml
+++ b/aai-service/provider/pom.xml
@@ -97,10 +97,6 @@
<artifactId>spring-core</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpcore</artifactId>
- </dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
@@ -112,7 +108,7 @@
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
- <version>0.13.1</version>
+ <version>0.14.0</version>
<executions>
<execution>
<id>gen-xjc</id>
@@ -139,7 +135,7 @@
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-annotate</artifactId>
- <version>0.6.4</version>
+ <version>0.6.5</version>
</plugin>
</plugins>
</configuration>
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClient.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClient.java
index 4b4c439a9..28b4955a4 100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClient.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClient.java
@@ -37,6 +37,9 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
import org.onap.ccsdk.sli.core.sli.SvcLogicResource;
import org.onap.ccsdk.sli.adaptors.aai.data.notify.NotifyEvent;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+
public interface AAIClient extends SvcLogicResource, SvcLogicJavaPlugin {
public SearchResults requestServiceInstanceURL(String svcInstanceId) throws AAIServiceException;
@@ -76,7 +79,7 @@ public interface AAIClient extends SvcLogicResource, SvcLogicJavaPlugin {
public void logKeyError(String keys);
- public QueryStatus processResponseData(String rv, String resource, AAIRequest request, String prefix, SvcLogicContext ctx, Map<String, String> nameValues, String modifier) throws IOException, AAIServiceException ;
+ public QueryStatus processResponseData(String rv, String resource, AAIRequest request, String prefix, SvcLogicContext ctx, Map<String, String> nameValues, String modifier) throws JsonParseException, JsonMappingException, IOException, AAIServiceException ;
public String getPathTemplateForResource(String resoourceName, String join, SvcLogicContext ctx) throws MalformedURLException;
public boolean isDeprecatedFormat(String resource, Map<String, String> nameValues);
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java
index c57b3a45d..8b8aaaab6 100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java
@@ -1636,6 +1636,7 @@ public abstract class AAIDeclarations implements AAIClient {
try {
obj = getMetadataMethod.invoke(instance);
} catch (InvocationTargetException x) {
+ Throwable cause = x.getCause();
}
}
if(obj != null && obj instanceof Metadata){
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequest.java
index 7c6234e5c..7f15c03f5 100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequest.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequest.java
@@ -189,9 +189,13 @@ public class GenericRequest extends AAIRequest {
queryParams.put(splitKey[1], encodeQuery(value));
} else {
- String token = String.format("%s/{%s}", splitKey[0], splitKey[1]);
- String encoded_vnf = encodeQuery(value);
- request_url = request_url.replace(token, String.format("%s/%s", splitKey[0], encoded_vnf));
+ String encoded_vnf = encodeQuery(value);
+ if(!resourceName.equals(splitKey[0]) && resourceName.contains(splitKey[0])) {
+ queryParams.put(splitKey[1], encoded_vnf);
+ } else {
+ String token = String.format("%s/{%s}", splitKey[0], splitKey[1]);
+ request_url = request_url.replace(token, String.format("%s/%s", splitKey[0], encoded_vnf));
+ }
}
}
diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequestTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequestTest.java
index 69541301b..3e0a72f3a 100755
--- a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequestTest.java
+++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequestTest.java
@@ -34,6 +34,8 @@ import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum;
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
+import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -111,4 +113,24 @@ public class EchoRequestTest {
}
}
+
+// @Test
+ public void EchoTest() {
+ LOG.info("----------------------- Test: " + new Object(){}.getClass().getEnclosingMethod().getName() + " -----------------------");
+ try
+ {
+ SvcLogicContext ctx = new SvcLogicContext();
+
+ QueryStatus resp = null;
+
+// (String resource, boolean localOnly, String select, String key, String prefix, String orderBy, SvcLogicContext ctx)
+ resp = aaiService.query("echo", false, null, "", "aaidata", null, ctx);
+ assert(resp == QueryStatus.SUCCESS);
+ }
+ catch (Throwable e)
+ {
+ LOG.error("Caught exception", e);
+// fail("Caught exception");
+ }
+ }
}
diff --git a/ansible-adapter/ansible-adapter-bundle/pom.xml b/ansible-adapter/ansible-adapter-bundle/pom.xml
index c73018b28..614fe6d57 100644
--- a/ansible-adapter/ansible-adapter-bundle/pom.xml
+++ b/ansible-adapter/ansible-adapter-bundle/pom.xml
@@ -90,11 +90,13 @@
<dependency>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>sli-common</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>sli-provider</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
diff --git a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml
index bf0b5b543..523d45069 100644
--- a/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml
+++ b/ansible-adapter/ansible-adapter-features/ccsdk-ansible-adapter/pom.xml
@@ -28,6 +28,7 @@
<version>${ccsdk.sli.core.version}</version>
<type>xml</type>
<classifier>features</classifier>
+ <scope>provided</scope>
</dependency>
<dependency>
diff --git a/base/http/provider/pom.xml b/base/http/provider/pom.xml
index aabeca268..642238cd2 100644
--- a/base/http/provider/pom.xml
+++ b/base/http/provider/pom.xml
@@ -28,7 +28,6 @@
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
- <version>${jersey.version}</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/base/http/provider/src/main/java/org/onap/ccsdk/sli/adaptors/base/http/BasicAuthFilter.java b/base/http/provider/src/main/java/org/onap/ccsdk/sli/adaptors/base/http/BasicAuthFilter.java
index 48d996ef3..5d3d463c9 100644
--- a/base/http/provider/src/main/java/org/onap/ccsdk/sli/adaptors/base/http/BasicAuthFilter.java
+++ b/base/http/provider/src/main/java/org/onap/ccsdk/sli/adaptors/base/http/BasicAuthFilter.java
@@ -6,13 +6,9 @@ import javax.ws.rs.client.ClientRequestContext;
import javax.ws.rs.client.ClientRequestFilter;
import javax.ws.rs.core.MultivaluedMap;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
public class BasicAuthFilter implements ClientRequestFilter {
private final String basicAuthValue;
-
public BasicAuthFilter(String basicAuthValue) {
this.basicAuthValue = basicAuthValue;
}
@@ -21,4 +17,6 @@ public class BasicAuthFilter implements ClientRequestFilter {
MultivaluedMap<String, Object> headers = requestContext.getHeaders();
headers.add("Authorization", basicAuthValue);
}
+
+
}
diff --git a/base/http/provider/src/test/java/org/onap/ccsdk/sli/adaptors/base/http/BasicAuthFilterTest.java b/base/http/provider/src/test/java/org/onap/ccsdk/sli/adaptors/base/http/BasicAuthFilterTest.java
index b9565ba67..d9d552dac 100644
--- a/base/http/provider/src/test/java/org/onap/ccsdk/sli/adaptors/base/http/BasicAuthFilterTest.java
+++ b/base/http/provider/src/test/java/org/onap/ccsdk/sli/adaptors/base/http/BasicAuthFilterTest.java
@@ -8,7 +8,7 @@ public class BasicAuthFilterTest {
@Test
public void notNullParameters() throws Exception {
- BasicAuthFilter myFilter = new BasicAuthFilter("helloworld");
+ BasicAuthFilter myFilter = new BasicAuthFilter("hello");
assertNotNull(myFilter);
}
diff --git a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml
index 41b0ef326..ab512ed63 100644
--- a/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml
+++ b/mdsal-resource/features/ccsdk-mdsal-resource/pom.xml
@@ -29,6 +29,7 @@
<version>${ccsdk.sli.core.version}</version>
<type>xml</type>
<classifier>features</classifier>
+ <scope>provided</scope>
</dependency>
<dependency>
diff --git a/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/RestService.java b/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/RestService.java
index 2991e6bef..30859a492 100644
--- a/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/RestService.java
+++ b/mdsal-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/RestService.java
@@ -34,6 +34,7 @@ import java.net.URL;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLSession;
+import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -180,9 +181,11 @@ public class RestService {
LOG.info("Response body :\n"+respString);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ dbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
+ dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
DocumentBuilder db = dbf.newDocumentBuilder();
-
response = db.parse(new ByteArrayInputStream(respString.getBytes()));
} catch (Exception e) {
diff --git a/netbox-client/features/ccsdk-netbox-client/pom.xml b/netbox-client/features/ccsdk-netbox-client/pom.xml
index e006b1976..13dc8bf97 100644
--- a/netbox-client/features/ccsdk-netbox-client/pom.xml
+++ b/netbox-client/features/ccsdk-netbox-client/pom.xml
@@ -38,12 +38,6 @@
<dependencies>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>odl-mdsal-broker</artifactId>
- <type>xml</type>
- <classifier>features</classifier>
- </dependency>
<dependency>
<groupId>org.onap.ccsdk.sli.core</groupId>
@@ -51,6 +45,7 @@
<version>${ccsdk.sli.core.version}</version>
<type>xml</type>
<classifier>features</classifier>
+ <scope>provided</scope>
</dependency>
<dependency>
@@ -59,6 +54,7 @@
<version>${ccsdk.sli.core.version}</version>
<type>xml</type>
<classifier>features</classifier>
+ <scope>provided</scope>
</dependency>
<dependency>
diff --git a/netbox-client/provider/pom.xml b/netbox-client/provider/pom.xml
index 475eeb593..b8fa494ad 100644
--- a/netbox-client/provider/pom.xml
+++ b/netbox-client/provider/pom.xml
@@ -71,13 +71,13 @@
<dependency>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>sli-common</artifactId>
- <scope>compile</scope>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>sliPluginUtils-provider</artifactId>
- <version>${project.version}</version>
- <scope>compile</scope>
+ <version>${ccsdk.sli.core.version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
@@ -101,7 +101,7 @@
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock</artifactId>
- <version>2.23.2</version>
+ <version>2.23.2</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/sql-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/SqlResource.java b/sql-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/SqlResource.java
index 767fdac79..69965d101 100755
--- a/sql-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/SqlResource.java
+++ b/sql-resource/provider/src/main/java/org/onap/ccsdk/sli/adaptors/resource/sql/SqlResource.java
@@ -100,7 +100,7 @@ public class SqlResource implements SvcLogicResource, SvcLogicJavaPlugin {
return (QueryStatus.FAILURE);
}
- String theStmt = resolveCtxVars(key, ctx);
+ String theStmt = resolveCtxVars(key, ctx, resource);
try {
CachedRowSet results = dblibSvc.getData(theStmt, null, null);
@@ -131,8 +131,9 @@ public class SqlResource implements SvcLogicResource, SvcLogicJavaPlugin {
if (dblibSvc == null) {
return (QueryStatus.FAILURE);
}
+
+ String sqlQuery = resolveCtxVars(key, ctx, resource);
- String sqlQuery = resolveCtxVars(key, ctx);
try {
@@ -230,7 +231,7 @@ public class SqlResource implements SvcLogicResource, SvcLogicJavaPlugin {
return (QueryStatus.FAILURE);
}
- String sqlStmt = resolveCtxVars(key, ctx);
+ String sqlStmt = resolveCtxVars(key, ctx, "");
LOG.debug("key = [" + key + "]; sqlStmt = [" + sqlStmt + "]");
try {
@@ -247,7 +248,7 @@ public class SqlResource implements SvcLogicResource, SvcLogicJavaPlugin {
}
- private String resolveCtxVars(String key, SvcLogicContext ctx) {
+ private String resolveCtxVars(String key, SvcLogicContext ctx, String resource) {
if (key == null) {
return (null);
}
@@ -257,16 +258,20 @@ public class SqlResource implements SvcLogicResource, SvcLogicJavaPlugin {
LOG.debug("Stripped outer single quotes - key is now [" + key + "]");
}
- String[] keyTerms = key.split("\\s+");
+ //"SQL-TRUE" allows for the key to be used as is.
+ if (!resource.equals("SQL-TRUE")) {
+ String[] keyTerms = key.split("\\s+");
- StringBuffer sqlBuffer = new StringBuffer();
+ StringBuffer sqlBuffer = new StringBuffer();
- for (int i = 0; i < keyTerms.length; i++) {
- sqlBuffer.append(resolveTerm(keyTerms[i], ctx));
- sqlBuffer.append(" ");
- }
+ for (int i = 0; i < keyTerms.length; i++) {
+ sqlBuffer.append(resolveTerm(keyTerms[i], ctx));
+ sqlBuffer.append(" ");
+ }
+ key = sqlBuffer.toString();
+ }
- return (sqlBuffer.toString());
+ return (key);
}
private String resolveTerm(String term, SvcLogicContext ctx) {
@@ -441,7 +446,7 @@ public class SqlResource implements SvcLogicResource, SvcLogicJavaPlugin {
return (strValue);
} else {
ResultSet results = null;
- try (Connection conn = dblibSvc.getConnection();
+ try (Connection conn = dblibSvc.getConnection();
PreparedStatement stmt = conn.prepareStatement("SELECT CAST(AES_DECRYPT(?, ?) AS CHAR(50)) FROM DUAL")) {
stmt.setBytes(1, colValue);