diff options
Diffstat (limited to 'aai-service/provider')
5 files changed, 177 insertions, 163 deletions
diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 441143263..cbf161d6f 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -1,157 +1,168 @@ <?xml version="1.0" encoding="UTF-8"?> -<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> +<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> - <parent> - <groupId>org.onap.ccsdk.parent</groupId> - <artifactId>binding-parent</artifactId> - <version>1.2.0-SNAPSHOT</version> - <relativePath /> - </parent> + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>binding-parent</artifactId> + <version>1.2.1-SNAPSHOT</version> + <relativePath/> + </parent> - <groupId>org.onap.ccsdk.sli.adaptors</groupId> - <artifactId>aai-service-provider</artifactId> - <version>0.4.0-SNAPSHOT</version> - <packaging>bundle</packaging> + <groupId>org.onap.ccsdk.sli.adaptors</groupId> + <artifactId>aai-service-provider</artifactId> + <version>0.4.1-SNAPSHOT</version> + <packaging>bundle</packaging> - <name>ccsdk-sli-adaptors :: aai-service :: ${project.artifactId}</name> - <url>http://maven.apache.org</url> + <name>ccsdk-sli-adaptors :: aai-service :: ${project.artifactId}</name> + <url>http://maven.apache.org</url> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <ccsdk.sli.adaptors.version>${project.version}</ccsdk.sli.adaptors.version> + </properties> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-core-artifacts</artifactId> + <version>${ccsdk.sli.core.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.onap.ccsdk.sli.core</groupId> - <artifactId>sli-common</artifactId> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.onap.ccsdk.sli.core</groupId> - <artifactId>sli-provider</artifactId> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.onap.ccsdk.sli.core</groupId> - <artifactId>utils-provider</artifactId> - <version>${sdnctl.sli.version}</version> - </dependency> - <dependency> - <groupId>org.osgi</groupId> - <artifactId>org.osgi.core</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jcl-over-slf4j</artifactId> - </dependency> - <dependency> - <groupId>com.sun.jersey</groupId> - <artifactId>jersey-client</artifactId> - </dependency> - <dependency> - <groupId>com.sun.jersey</groupId> - <artifactId>jersey-core</artifactId> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpcore</artifactId> - <version>${apache.httpcomponents.core.version}</version> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - <version>${apache.httpcomponents.client.version}</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.module</groupId> - <artifactId>jackson-module-jaxb-annotations</artifactId> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-annotations</artifactId> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-core</artifactId> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - </dependency> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-common</artifactId> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-provider</artifactId> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>utils-provider</artifactId> + <version>${sdnctl.sli.version}</version> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.core</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jcl-over-slf4j</artifactId> + </dependency> + <dependency> + <groupId>com.sun.jersey</groupId> + <artifactId>jersey-client</artifactId> + </dependency> + <dependency> + <groupId>com.sun.jersey</groupId> + <artifactId>jersey-core</artifactId> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpcore</artifactId> + <version>${apache.httpcomponents.core.version}</version> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + <version>${apache.httpcomponents.client.version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.module</groupId> + <artifactId>jackson-module-jaxb-annotations</artifactId> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + </dependency> - <dependency> - <groupId>org.jsoup</groupId> - <artifactId>jsoup</artifactId> - <version>1.8.3</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-core</artifactId> - <version>4.3.5.RELEASE</version> - <scope>test</scope> - </dependency> - </dependencies> + <dependency> + <groupId>org.jsoup</groupId> + <artifactId>jsoup</artifactId> + <version>1.8.3</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + <version>4.3.5.RELEASE</version> + <scope>test</scope> + </dependency> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.jvnet.jaxb2.maven2</groupId> - <artifactId>maven-jaxb2-plugin</artifactId> - <version>0.13.1</version> - <executions> - <execution> - <id>gen-xjc</id> - <goals> - <goal>generate</goal> - </goals> - </execution> - </executions> - <configuration> - <schemaDirectory>${project.basedir}/src/main/resources</schemaDirectory> - <schemaIncludes> - <value>aai_schema_v14.xsd</value> - </schemaIncludes> - <bindingIncludes> - <include>aai-schema-bindings.xjb</include> - </bindingIncludes> - <generateDirectory>${project.build.directory}/generated-sources/main/java</generateDirectory> - <generatePackage>org.onap.aai.inventory.v14</generatePackage> - <extension>true</extension> - <args> - <arg>-Xannotate</arg> - </args> - <plugins> - <plugin> - <groupId>org.jvnet.jaxb2_commons</groupId> - <artifactId>jaxb2-basics-annotate</artifactId> - <version>0.6.4</version> - </plugin> - </plugins> - </configuration> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>org.jvnet.jaxb2.maven2</groupId> + <artifactId>maven-jaxb2-plugin</artifactId> + <version>0.13.1</version> + <executions> + <execution> + <id>gen-xjc</id> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + <configuration> + <schemaDirectory>${project.basedir}/src/main/resources</schemaDirectory> + <schemaIncludes> + <value>aai_schema_v14.xsd</value> + </schemaIncludes> + <bindingIncludes> + <include>aai-schema-bindings.xjb</include> + </bindingIncludes> + <generateDirectory>${project.build.directory}/generated-sources/main/java</generateDirectory> + <generatePackage>org.onap.aai.inventory.v14</generatePackage> + <extension>true</extension> + <args> + <arg>-Xannotate</arg> + </args> + <plugins> + <plugin> + <groupId>org.jvnet.jaxb2_commons</groupId> + <artifactId>jaxb2-basics-annotate</artifactId> + <version>0.6.4</version> + </plugin> + </plugins> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java index cf1392f67..a3aecda14 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java @@ -44,7 +44,6 @@ import java.security.NoSuchAlgorithmException; import java.text.SimpleDateFormat; import java.util.Properties; -import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; @@ -82,6 +81,7 @@ public class AAIClientRESTExecutor implements AAIExecutorInterface { private String userPassword; private final String applicationId; private static final String HTTP_URL_CONNECTION_RESULT="HttpURLConnection result: {} : {}"; + private static final String ENTRY_DOESNT_EXIST="Entry does not exist."; /** * class Constructor @@ -281,7 +281,7 @@ public class AAIClientRESTExecutor implements AAIExecutorInterface { LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, responseMessage, mapper.writeValueAsString(response)); } } else if (responseCode == HttpURLConnection.HTTP_NOT_FOUND) { - LOGwriteEndingTrace(responseCode, responseMessage, "Entry does not exist."); + LOGwriteEndingTrace(responseCode, responseMessage, ENTRY_DOESNT_EXIST); ErrorResponse errorresponse = null; try { errorresponse = mapper.readValue(reader, ErrorResponse.class); @@ -289,7 +289,7 @@ public class AAIClientRESTExecutor implements AAIExecutorInterface { errorresponse = new ErrorResponse(); RequestError requestError = new RequestError(); ServiceException serviceException = new ServiceException(); - serviceException.setText("Entry does not exist."); + serviceException.setText(ENTRY_DOESNT_EXIST); requestError.setServiceException(serviceException); errorresponse.setRequestError(requestError ); } @@ -501,7 +501,7 @@ public class AAIClientRESTExecutor implements AAIExecutorInterface { LOGwriteEndingTrace(responseCode, responseMessage, stringBuilder.toString()); response = true; } else if(responseCode == HttpURLConnection.HTTP_NOT_FOUND ) { - LOGwriteEndingTrace(responseCode, responseMessage, "Entry does not exist."); + LOGwriteEndingTrace(responseCode, responseMessage, ENTRY_DOESNT_EXIST); response = false; } else { ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class); @@ -574,7 +574,7 @@ public class AAIClientRESTExecutor implements AAIExecutorInterface { response = mapper.readValue(reader, clas); LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, "SUCCESS", mapper.writeValueAsString(response)); } else if (responseCode == HttpURLConnection.HTTP_NOT_FOUND) { - LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", "Entry does not exist."); + LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", ENTRY_DOESNT_EXIST); return response; } else { BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) ); diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java index 82df69818..c66ae06f4 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java @@ -433,8 +433,7 @@ public abstract class AAIRequest { if(clazz == null) { return null; } - GenericRequest request = new GenericRequest(clazz); - return request; + return new GenericRequest(clazz); } public static Map<String, String> splitQuery(String query) throws UnsupportedEncodingException { diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequest.java index 515359602..35f190e52 100644 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequest.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequest.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights * reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -104,19 +106,19 @@ public class GenericQueryRequest extends AAIRequest { String encoded_vnf = encodeQuery(requestProperties.getProperty(key)); request_url = request_url.replace("{identifier}", encoded_vnf) ; - aaiService.LOGwriteDateTrace("identifier", requestProperties.getProperty(key)); + aaiService.LOGwriteDateTrace(IDENTIFIER, requestProperties.getProperty(key)); key = VALUE; encoded_vnf = encodeQuery(requestProperties.getProperty(key)); request_url = request_url.replace("{value}", encoded_vnf) ; - aaiService.LOGwriteDateTrace("value", requestProperties.getProperty(key)); + aaiService.LOGwriteDateTrace(VALUE, requestProperties.getProperty(key)); key = START_NODE_TYPE; encoded_vnf = encodeQuery(requestProperties.getProperty(key)); request_url = request_url.replace("{start-node-type}", encoded_vnf) ; - aaiService.LOGwriteDateTrace("start-node-type", requestProperties.getProperty(key)); + aaiService.LOGwriteDateTrace(START_NODE_TYPE, requestProperties.getProperty(key)); return request_url; } diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java index 691ae27a3..d1995f04f 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights * reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -107,7 +109,7 @@ public class NamedQueryRequest extends AAIRequest { if(innerChild != null) { if(innerChild instanceof ObjectNode) { ObjectNode on = ObjectNode.class.cast(innerChild); - List<String> namesToDelete = new ArrayList<String>(); + List<String> namesToDelete = new ArrayList<>(); Iterator<String> names = on.fieldNames(); while(names.hasNext()) { String name = names.next(); @@ -125,7 +127,7 @@ public class NamedQueryRequest extends AAIRequest { if(innerChild != null) { if(innerChild instanceof ObjectNode) { ObjectNode on = ObjectNode.class.cast(innerChild); - List<String> namesToDelete = new ArrayList<String>(); + List<String> namesToDelete = new ArrayList<>(); Iterator<String> names = on.fieldNames(); while(names.hasNext()) { String name = names.next(); @@ -143,7 +145,7 @@ public class NamedQueryRequest extends AAIRequest { if(innerChild != null) { if(innerChild instanceof ObjectNode) { ObjectNode on = ObjectNode.class.cast(innerChild); - List<String> namesToDelete = new ArrayList<String>(); + List<String> namesToDelete = new ArrayList<>(); Iterator<String> names = on.fieldNames(); while(names.hasNext()) { String name = names.next(); @@ -194,7 +196,7 @@ public class NamedQueryRequest extends AAIRequest { if(requestProperties.containsKey(key)) { encoded_vnf = encodeQuery(requestProperties.getProperty(key)); request_url = request_url.replace("{named-query-uuid}", encoded_vnf) ; - aaiService.LOGwriteDateTrace("named-query-uuid", requestProperties.getProperty(key)); + aaiService.LOGwriteDateTrace(NAMED_QUERY_UUID, requestProperties.getProperty(key)); } key = PREFIX; @@ -202,7 +204,7 @@ public class NamedQueryRequest extends AAIRequest { if(requestProperties.containsKey(key)) { encoded_vnf = encodeQuery(requestProperties.getProperty(key)); request_url = request_url.replace("{prefix}", encoded_vnf) ; - aaiService.LOGwriteDateTrace("prefix", requestProperties.getProperty(key)); + aaiService.LOGwriteDateTrace(PREFIX, requestProperties.getProperty(key)); } return request_url; |