aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrenealr <reneal.rogers@amdocs.com>2018-06-12 10:15:26 -0400
committerrenealr <reneal.rogers@amdocs.com>2018-06-12 10:17:12 -0400
commit34aa4984446aeb39b64930baf64058ea22ec9da0 (patch)
tree9c84f5ba375f010bb8dc61592c7be0e8049e2179
parent9fcd2fde2324077ba019cbf845caec4378599613 (diff)
fix ping communication with search to datarouter
Add the fix needed in order for the search ping to communicate with data router as well as add some fixes to the start script and dockerfile Issue-ID: AAI-1224 Change-Id: I74ab3b8def4b85513401b7329d33dc6a3bc518bc Signed-off-by: renealr <reneal.rogers@amdocs.com>
-rw-r--r--pom.xml40
-rw-r--r--src/main/bin/start.sh16
-rw-r--r--src/main/docker/Dockerfile9
-rw-r--r--src/main/java/org/onap/aai/sa/Application.java1
-rw-r--r--src/main/java/org/onap/aai/sa/rest/AnalyzerApi.java5
-rw-r--r--src/main/java/org/onap/aai/sa/searchdbabstraction/JaxrsUserService.java49
-rw-r--r--src/main/java/org/onap/aai/sa/searchdbabstraction/RestEchoService.java (renamed from src/main/java/org/onap/aai/sa/searchdbabstraction/JaxrsEchoService.java)23
-rw-r--r--src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpController.java18
-rw-r--r--src/main/resources/application.properties1
-rw-r--r--version.properties2
10 files changed, 60 insertions, 104 deletions
diff --git a/pom.xml b/pom.xml
index afd2fa5..43391af 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,7 @@ limitations under the License.
</parent>
<groupId>org.onap.aai</groupId>
<artifactId>search-data-service</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.3.1-SNAPSHOT</version>
<name>aai-search-data-service</name>
<properties>
@@ -125,12 +125,6 @@ limitations under the License.
</dependency>
<dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>javax.ws.rs-api</artifactId>
- <version>2.0</version>
- </dependency>
-
- <dependency>
<groupId>org.apache.directory.studio</groupId>
<artifactId>org.apache.commons.lang</artifactId>
<version>2.6</version>
@@ -154,10 +148,31 @@ limitations under the License.
<version>20180130</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
- </dependency>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-jetty</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-jersey</artifactId>
+ </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -169,12 +184,7 @@ limitations under the License.
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
-
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-security</artifactId>
- </dependency>
-
+
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
diff --git a/src/main/bin/start.sh b/src/main/bin/start.sh
index 3d6036f..69550c6 100644
--- a/src/main/bin/start.sh
+++ b/src/main/bin/start.sh
@@ -12,28 +12,14 @@ fi
if [ -z "$KEY_STORE_PASSWORD" ]; then
echo "KEY_STORE_PASSWORD must be set in order to start up process"
exit 1
-else
- ## Extract java jar to DEOBFUSCATE the password.
- CURR_D=`pwd`
- cd $BASEDIR
- jar xf search-data-service-package.jar
- sudo java -cp ./BOOT-INF/lib/jetty-util-9.4.8.v20171121.jar org.eclipse.jetty.util.security.Password $KEY_STORE_PASSWORD > pass.txt 2>> pass.txt
- PASS=`sed "2q;d" pass.txt`
- sudo rm pass.txt
- cd $CURR_D
fi
-## tomcat_keystore to p12
-keytool -importkeystore -noprompt -deststorepass $PASS -destkeypass $PASS -srckeystore $BASEDIR/config/auth/tomcat_keystore -destkeystore $BASEDIR/config/auth/onap.p12 -deststoretype PKCS12 -srcstorepass $PASS
-
-## import into cacerts
-sudo keytool -importkeystore -noprompt -deststorepass changeit -destkeypass changeit -destkeystore /$JAVA_HOME/jre/lib/security/cacerts -srckeystore $BASEDIR/config/auth/onap.p12 -srcstoretype PKCS12 -srcstorepass $PASS -alias tomcat
-
PROPS="-DAJSC_HOME=$AJSC_HOME"
PROPS="$PROPS -DAJSC_CONF_HOME=$AJSC_CONF_HOME"
PROPS="$PROPS -Dlogging.config=$BASEDIR/bundleconfig/etc/logback.xml"
PROPS="$PROPS -DCONFIG_HOME=$CONFIG_HOME"
PROPS="$PROPS -DKEY_STORE_PASSWORD=$KEY_STORE_PASSWORD"
+
JVM_MAX_HEAP=${MAX_HEAP:-1024}
java $PROPS -jar $BASEDIR/search-data-service-package.jar \ No newline at end of file
diff --git a/src/main/docker/Dockerfile b/src/main/docker/Dockerfile
index 8578ef6..27073a5 100644
--- a/src/main/docker/Dockerfile
+++ b/src/main/docker/Dockerfile
@@ -22,6 +22,15 @@ COPY bundleconfig-local/etc/logback.xml $MICRO_HOME/bundleconfig/etc
RUN chmod 755 $BIN_HOME/*
RUN ln -s /logs $MICRO_HOME/logs
+# Create the aai user
+RUN mkdir /opt/aaihome && \
+ groupadd -g 492381 aaiadmin && \
+ useradd -r -u 341790 -g 492381 -ms /bin/bash -d /opt/aaihome/aaiadmin aaiadmin && \
+ chown -R aaiadmin:aaiadmin $MICRO_HOME
+RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
+RUN sudo usermod -a -G sudo aaiadmin
+USER aaiadmin
+
EXPOSE 9509 9509
CMD ["/opt/app/search-data-service/bin/start.sh"]
diff --git a/src/main/java/org/onap/aai/sa/Application.java b/src/main/java/org/onap/aai/sa/Application.java
index 69dab1e..03f8690 100644
--- a/src/main/java/org/onap/aai/sa/Application.java
+++ b/src/main/java/org/onap/aai/sa/Application.java
@@ -21,7 +21,6 @@
package org.onap.aai.sa;
import org.eclipse.jetty.util.security.Password;
-import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
diff --git a/src/main/java/org/onap/aai/sa/rest/AnalyzerApi.java b/src/main/java/org/onap/aai/sa/rest/AnalyzerApi.java
index 8db9a42..86be0fd 100644
--- a/src/main/java/org/onap/aai/sa/rest/AnalyzerApi.java
+++ b/src/main/java/org/onap/aai/sa/rest/AnalyzerApi.java
@@ -30,11 +30,8 @@ import org.onap.aai.sa.rest.AnalyzerSchema;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.Context;
-import org.springframework.beans.factory.annotation.Autowired;
+
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
diff --git a/src/main/java/org/onap/aai/sa/searchdbabstraction/JaxrsUserService.java b/src/main/java/org/onap/aai/sa/searchdbabstraction/JaxrsUserService.java
deleted file mode 100644
index 5452ce3..0000000
--- a/src/main/java/org/onap/aai/sa/searchdbabstraction/JaxrsUserService.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ================================================================================
- * 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.onap.aai.sa.searchdbabstraction;
-
-import java.util.HashMap;
-import java.util.Map;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-
-@Path("/user")
-public class JaxrsUserService {
-
- private static final Map<String, String> userIdToNameMap;
-
- static {
- userIdToNameMap = new HashMap<String, String>();
- userIdToNameMap.put("dw113c", "Doug Wait");
- userIdToNameMap.put("so401q", "Stuart O'Day");
- }
-
- @GET
- @Path("/{userId}")
- @Produces("text/plain")
- public String lookupUser(@PathParam("userId") String userId) {
- String name = userIdToNameMap.get(userId);
- return name != null ? name : "unknown id";
- }
-
-} \ No newline at end of file
diff --git a/src/main/java/org/onap/aai/sa/searchdbabstraction/JaxrsEchoService.java b/src/main/java/org/onap/aai/sa/searchdbabstraction/RestEchoService.java
index 7334fd9..1cbebc9 100644
--- a/src/main/java/org/onap/aai/sa/searchdbabstraction/JaxrsEchoService.java
+++ b/src/main/java/org/onap/aai/sa/searchdbabstraction/RestEchoService.java
@@ -20,17 +20,20 @@
*/
package org.onap.aai.sa.searchdbabstraction;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
+
+
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
/**
* Exposes REST endpoints for a simple echo service.
*/
-@Path("/jaxrs-services")
-public class JaxrsEchoService {
+@RestController
+@RequestMapping("/services/search-data-service/v1")
+public class RestEchoService {
/**
* REST endpoint for a simple echo service.
@@ -38,11 +41,9 @@ public class JaxrsEchoService {
* @param input - The value to be echoed back.
* @return - The input value.
*/
- @GET
- @Path("/echo/{input}")
- @Produces("text/plain")
- public String ping(@PathParam("input") String input) {
+ @RequestMapping(value = "/echo/{input}", method = {RequestMethod.GET})
+ public String ping(@PathVariable("input") String input) {
return "[Search Database Abstraction Micro Service] - Echo Service: " + input + ".";
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpController.java b/src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpController.java
index 019d867..626ea8c 100644
--- a/src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpController.java
+++ b/src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpController.java
@@ -79,7 +79,9 @@ import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicBoolean;
-import javax.ws.rs.core.Response.Status;
+
+import org.springframework.http.HttpStatus;
+
/**
@@ -440,7 +442,7 @@ public class ElasticSearchHttpController implements DocumentStoreInterface {
if ((indexExistsResult.getResultCode() < 200) || (indexExistsResult.getResultCode() >= 300)) {
DocumentOperationResult opResult = new DocumentOperationResult();
- opResult.setResultCode(Status.NOT_FOUND.getStatusCode());
+ opResult.setResultCode(HttpStatus.NOT_FOUND.value());
opResult.setResult("Document Index '" + indexName + "' does not exist.");
opResult.setFailureCause("Document Index '" + indexName + "' does not exist.");
return opResult;
@@ -461,13 +463,13 @@ public class ElasticSearchHttpController implements DocumentStoreInterface {
DocumentOperationResult opResult = checkDocumentExistence(indexName, document.getId());
- if (opResult.getResultCode() != Status.NOT_FOUND.getStatusCode()) {
- if (opResult.getResultCode() == Status.OK.getStatusCode()) {
+ if (opResult.getResultCode() != HttpStatus.NOT_FOUND.value()) {
+ if (opResult.getResultCode() == HttpStatus.CONFLICT.value()) {
opResult.setFailureCause("A document with the same id already exists.");
} else {
opResult.setFailureCause("Failed to verify a document with the specified id does not already exist.");
}
- opResult.setResultCode(Status.CONFLICT.getStatusCode());
+ opResult.setResultCode(HttpStatus.CONFLICT.value());
return opResult;
}
@@ -626,7 +628,7 @@ public class ElasticSearchHttpController implements DocumentStoreInterface {
if ((indexExistsResult.getResultCode() < 200) || (indexExistsResult.getResultCode() >= 300)) {
DocumentOperationResult opResult = new DocumentOperationResult();
- opResult.setResultCode(Status.NOT_FOUND.getStatusCode());
+ opResult.setResultCode(HttpStatus.NOT_FOUND.value());
opResult.setResult("Document Index '" + indexName + "' does not exist.");
opResult.setFailureCause("Document Index '" + indexName + "' does not exist.");
return opResult;
@@ -979,8 +981,8 @@ public class ElasticSearchHttpController implements DocumentStoreInterface {
throw new DocumentStoreOperationException("Failed getting the response body payload.", e);
}
- if (resultCode == Status.CONFLICT.getStatusCode()) {
- opResult.setResultCode(Status.PRECONDITION_FAILED.getStatusCode());
+ if (resultCode == HttpStatus.CONFLICT.value()) {
+ opResult.setResultCode(HttpStatus.PRECONDITION_FAILED.value());
} else {
opResult.setResultCode(resultCode);
}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 6106535..20dc028 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -2,3 +2,4 @@ server.ssl.key-store=/opt/app/search-data-service/config/auth/tomcat_keystore
server.ssl.enabled=true
server.port=9509
server.ssl.client-auth=need
+server.ssl.enabled-protocols=TLSv1.1,TLSv1.2
diff --git a/version.properties b/version.properties
index a254b21..fb21064 100644
--- a/version.properties
+++ b/version.properties
@@ -4,7 +4,7 @@
major=1
minor=3
-patch=0
+patch=1
base_version=${major}.${minor}.${patch}