From c5331e6fe565e7d0a22d1752e8f793d55dbe7c2e Mon Sep 17 00:00:00 2001 From: Michael Arrastia Date: Tue, 1 May 2018 14:55:56 +0100 Subject: [PATCH] Replace AJSC with Spring Boot 1.5.12.RELEASE Updates include: Remove AJSC references Use PropertiesLoader (loader.path) to allow loading external janus or titan deps Fix dependency conflicts between janus/titan deps and Spring Boot deps Use Jetty container Use Jersey registration of Champ REST interface Change-Id: Ic33b886b0b039cce0366c0f0910cc5a3fe5bfd9b Issue-ID: AAI-1041 Signed-off-by: Michael Arrastia --- .gitignore | 3 + champ-service-deps-janus/pom.xml | 134 ++++++++++ champ-service-deps-titan/pom.xml | 162 ++++++++++++ champ-service/pom.xml | 281 +++++++++------------ .../champ-service/v1/conf/jaxrsBeans.groovy | 11 - .../champ-service/v1/docs/README.txt | 1 - .../champ-service/v1/lib/README.txt | 1 - .../champ-service/v1/routes/champ.route | 4 - .../champ-service/v1/routes/jaxrsExample.route | 5 - champ-service/src/main/bin/start.sh | 81 ++---- .../main/java/org/onap/champ/ChampApplication.java | 46 ++++ .../src/main/java/org/onap/champ/ChampRESTAPI.java | 7 +- .../src/main/java/org/onap/champ/JerseyConfig.java | 35 +++ .../src/main/resources/application.properties | 11 + .../etc => src/main/resources}/logback.xml | 7 +- .../onap/champ/event/GraphEventEnvelopeTest.java | 20 ++ .../test/java/org/onap/champ/util/TestUtil.java | 58 +++-- 17 files changed, 605 insertions(+), 262 deletions(-) delete mode 100644 champ-service/src/main/ajsc/champ-service_v1/champ-service/v1/conf/jaxrsBeans.groovy delete mode 100644 champ-service/src/main/ajsc/champ-service_v1/champ-service/v1/docs/README.txt delete mode 100644 champ-service/src/main/ajsc/champ-service_v1/champ-service/v1/lib/README.txt delete mode 100644 champ-service/src/main/ajsc/champ-service_v1/champ-service/v1/routes/champ.route delete mode 100644 champ-service/src/main/ajsc/champ-service_v1/champ-service/v1/routes/jaxrsExample.route create mode 100644 champ-service/src/main/java/org/onap/champ/ChampApplication.java create mode 100644 champ-service/src/main/java/org/onap/champ/JerseyConfig.java create mode 100644 champ-service/src/main/resources/application.properties rename champ-service/{ajsc-shared-config/etc => src/main/resources}/logback.xml (99%) diff --git a/.gitignore b/.gitignore index 9210958..f484ef3 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,6 @@ # Maven target/ jacoco.exec + +# Misc +.checkstyle diff --git a/champ-service-deps-janus/pom.xml b/champ-service-deps-janus/pom.xml index eaee1e9..398437f 100644 --- a/champ-service-deps-janus/pom.xml +++ b/champ-service-deps-janus/pom.xml @@ -38,6 +38,96 @@ limitations under the License. org.onap.aai champ-janus 1.2.0-SNAPSHOT + + + ch.qos.logback + logback-classic + + + ch.qos.logback + logback-core + + + org.apache.httpcomponents + httpclient + + + org.apache.httpcomponents + httpclient-cache + + + org.slf4j + slf4j-api + + + log4j + log4j + + + org.onap.aai.logging-service + logging-api + + + org.glassfish.jersey.core + jersey-client + + + org.glassfish.jersey.core + jersey-common + + + com.sun.jersey + jersey-core + + + org.glassfish.jersey.ext + jersey-entity-filtering + + + org.glassfish.jersey.bundles.repackaged + jersey-guava + + + com.sun.jersey.contribs + jersey-guice + + + com.sun.jersey + jersey-json + + + org.glassfish.jersey.media + jersey-media-json-jackson + + + com.sun.jersey + jersey-server + + + commons-logging + commons-logging + + + org.mortbay.jetty + jetty-util + + + net.jpountz.lz4 + lz4 + + + org.onap.aai.event-client + event-client-api + + + org.onap.aai.event-client + event-client-dmaap + + + org.onap.aai.event-client + event-client-kafka + + org.janusgraph @@ -61,6 +151,46 @@ limitations under the License. org.apache.tinkerpop gremlin-groovy + + ch.qos.logback + logback-core + + + org.apache.httpcomponents + httpclient + + + org.apache.httpcomponents + httpcore + + + org.slf4j + slf4j-api + + + commons-logging + commons-logging + + + com.google.guava + guava + + + javax.validation + validation-api + + + xml-apis + xml-apis + + + org.hibernate + hibernate-validator + + + net.jpountz.lz4 + lz4 + @@ -85,6 +215,10 @@ limitations under the License. org.apache.tinkerpop gremlin-core + + org.slf4j + slf4j-api + diff --git a/champ-service-deps-titan/pom.xml b/champ-service-deps-titan/pom.xml index 0aebf37..f979969 100644 --- a/champ-service-deps-titan/pom.xml +++ b/champ-service-deps-titan/pom.xml @@ -38,6 +38,108 @@ limitations under the License. org.onap.aai champ-titan 1.2.0-SNAPSHOT + + + ch.qos.logback + logback-classic + + + org.apache.httpcomponents + httpclient + + + org.apache.httpcomponents + httpclient-cache + + + org.slf4j + slf4j-api + + + org.slf4j + slf4j-log4j12 + + + org.onap.aai.logging-service + logging-api + + + org.glassfish.jersey.core + jersey-client + + + org.glassfish.jersey.core + jersey-common + + + com.sun.jersey + jersey-core + + + org.glassfish.jersey.ext + jersey-entity-filtering + + + org.glassfish.jersey.bundles.repackaged + jersey-guava + + + com.sun.jersey.contribs + jersey-guice + + + com.sun.jersey + jersey-json + + + org.glassfish.jersey.media + jersey-media-json-jackson + + + com.sun.jersey + jersey-server + + + commons-logging + commons-logging + + + net.jpountz.lz4 + lz4 + + + org.mortbay.jetty + jetty-util + + + log4j + log4j + + + ch.qos.logback + logback-core + + + org.codehaus.groovy + groovy + + + jline + jline + + + org.onap.aai.event-client + event-client-api + + + org.onap.aai.event-client + event-client-dmaap + + + org.onap.aai.event-client + event-client-kafka + + com.thinkaurelius.titan @@ -60,6 +162,58 @@ limitations under the License. org.apache.tinkerpop gremlin-core + + org.apache.httpcomponents + httpclient + + + org.slf4j + slf4j-api + + + commons-logging + commons-logging + + + net.jpountz.lz4 + lz4 + + + org.apache.httpcomponents + httpcore + + + javax.validation + validation-api + + + org.hibernate + hibernate-validator + + + ch.qos.logback + logback-core + + + org.apache.commons + commons-lang3 + + + org.javassist + javassist + + + jline + jline + + + xml-apis + xml-apis + + + com.google.guava + guava + @@ -83,6 +237,14 @@ limitations under the License. org.apache.tinkerpop gremlin-core + + org.slf4j + slf4j-api + + + log4j + log4j + diff --git a/champ-service/pom.xml b/champ-service/pom.xml index 108e6a2..71bf9fb 100644 --- a/champ-service/pom.xml +++ b/champ-service/pom.xml @@ -24,9 +24,9 @@ limitations under the License. 4.0.0 - com.att.ajsc - ajsc-archetype-parent - 2.0.0 + org.onap.oparent + oparent + 1.1.0 org.onap.aai @@ -35,32 +35,49 @@ limitations under the License. champ - ${basedir}/target/swm/package/nix/dist_files${distFilesRoot} - 2.0.0 - - /appl/${project.artifactId} - - - /appl/${project.artifactId}/${project.version} - + ${basedir}/target + https://nexus.onap.org org.onap.aai.logging-service 1.2.2 - 4.5.2 - ${basedir}/target - https://nexus.onap.org + 18.0 + 3.7 1.3 + 1.5.12.RELEASE + + + + org.springframework.boot + spring-boot-dependencies + ${version.org.springframework.boot.spring-boot-dependencies} + pom + import + + + + - com.sun.jersey - jersey-core - 1.18.6 + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.springframework.boot + spring-boot-starter-jersey @@ -70,12 +87,6 @@ limitations under the License. provided - - com.att.aft - dme2 - 3.1.200 - provided - org.json @@ -83,12 +94,6 @@ limitations under the License. 20160212 - - org.glassfish.jersey.core - jersey-client - 2.23 - - commons-io commons-io @@ -101,16 +106,30 @@ limitations under the License. 2.6.2 + + com.google.guava + guava + ${version.com.google.guava} + + ${common.logging.groupid} common-logging ${common.logging.version} - - - - ch.qos.logback - logback-core - 1.1.7 + + + ch.qos.logback + logback-classic + + + ch.qos.logback + logback-core + + + org.slf4j + slf4j-api + + @@ -119,10 +138,28 @@ limitations under the License. 2.6.2 + + org.apache.commons + commons-lang3 + 3.7 + + org.apache.httpcomponents httpclient - ${org.apache.httpcomponents.httpclient.version} + 4.5.5 + + + + org.apache.httpcomponents + httpclient-cache + 4.5.5 + + + commons-logging + commons-logging + + @@ -135,13 +172,28 @@ limitations under the License. org.apache.hbase hbase-client + + org.apache.httpcomponents + httpclient + + + log4j + log4j + + + log4j + apache-log4j-extras + + + org.slf4j + slf4j-api + org.hamcrest hamcrest-library - ${version.org.hamcrest.hamcrest-library} test @@ -169,6 +221,21 @@ limitations under the License. ${project.artifactId} + + org.springframework.boot + spring-boot-maven-plugin + + ZIP + + + + + repackage + + + + + org.apache.maven.plugins maven-resources-plugin @@ -200,11 +267,18 @@ limitations under the License. ../champ-service-deps-titan/target/ + + ${basedir} + + **/dynamic/**/* + + + org.apache.maven.plugins maven-deploy-plugin @@ -212,7 +286,7 @@ limitations under the License. true - + check process-sources - --> + com.spotify docker-maven-plugin @@ -248,6 +326,7 @@ limitations under the License. true + org.jacoco jacoco-maven-plugin @@ -270,118 +349,4 @@ limitations under the License. - - - - runAjsc - - initialize - - - org.codehaus.mojo - exec-maven-plugin - 1.3.2 - - - initialize - - java - - - false - true - java - com.att.ajsc.runner.Runner - - com.att.ajsc - ajsc-runner - - - ${basedir}/ajsc-shared-config/etc - - - - ${runAjscHome} - - - - - - AJSC_HOME - ${runAjscHome} - - - CONFIG_HOME - ${basedir}/appconfig-local/ - - - AJSC_CONF_HOME - ${basedir}/bundleconfig-local - - - logback.configurationFile - ${basedir}/ajsc-shared-config/etc/logback.xml - - - AJSC_SHARED_CONFIG - ${basedir}/ajsc-shared-config - - - - AJSC_EXTERNAL_LIB_FOLDERS - ${basedir}/target/commonLibs - - - AJSC_EXTERNAL_PROPERTIES_FOLDERS - ${basedir}/ajsc-shared-config/etc - - - - AJSC_SERVICE_NAMESPACE - ${module.ajsc.namespace.name} - - - AJSC_SERVICE_VERSION - ${module.ajsc.namespace.version} - - - SOACLOUD_SERVICE_VERSION - ${project.version} - - - server.port - ${serverPort} - - - - - - context=/ - port=${serverPort} - sslport=${sslport} - - - - - - java - - - - com.att.ajsc - ajsc-runner - ${ajscRuntimeVersion} - - - - - - - diff --git a/champ-service/src/main/ajsc/champ-service_v1/champ-service/v1/conf/jaxrsBeans.groovy b/champ-service/src/main/ajsc/champ-service_v1/champ-service/v1/conf/jaxrsBeans.groovy deleted file mode 100644 index 17d80a4..0000000 --- a/champ-service/src/main/ajsc/champ-service_v1/champ-service/v1/conf/jaxrsBeans.groovy +++ /dev/null @@ -1,11 +0,0 @@ -beans{ - xmlns cxf: "http://camel.apache.org/schema/cxf" - xmlns jaxrs: "http://cxf.apache.org/jaxrs" - xmlns util: "http://www.springframework.org/schema/util" - - echoService(org.onap.champ.service.EchoService) - - util.list(id: 'echoServices') { - ref(bean:'echoService') - } -} \ No newline at end of file diff --git a/champ-service/src/main/ajsc/champ-service_v1/champ-service/v1/docs/README.txt b/champ-service/src/main/ajsc/champ-service_v1/champ-service/v1/docs/README.txt deleted file mode 100644 index 3707179..0000000 --- a/champ-service/src/main/ajsc/champ-service_v1/champ-service/v1/docs/README.txt +++ /dev/null @@ -1 +0,0 @@ -Place any docs here that you want to access within the ajsc upon deployment of your service. diff --git a/champ-service/src/main/ajsc/champ-service_v1/champ-service/v1/lib/README.txt b/champ-service/src/main/ajsc/champ-service_v1/champ-service/v1/lib/README.txt deleted file mode 100644 index 639e21b..0000000 --- a/champ-service/src/main/ajsc/champ-service_v1/champ-service/v1/lib/README.txt +++ /dev/null @@ -1 +0,0 @@ -3rd party JAR's needed by your jars (if any) for a ajsc deployment package go here... \ No newline at end of file diff --git a/champ-service/src/main/ajsc/champ-service_v1/champ-service/v1/routes/champ.route b/champ-service/src/main/ajsc/champ-service_v1/champ-service/v1/routes/champ.route deleted file mode 100644 index cf8d115..0000000 --- a/champ-service/src/main/ajsc/champ-service_v1/champ-service/v1/routes/champ.route +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/champ-service/src/main/ajsc/champ-service_v1/champ-service/v1/routes/jaxrsExample.route b/champ-service/src/main/ajsc/champ-service_v1/champ-service/v1/routes/jaxrsExample.route deleted file mode 100644 index a132030..0000000 --- a/champ-service/src/main/ajsc/champ-service_v1/champ-service/v1/routes/jaxrsExample.route +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/champ-service/src/main/bin/start.sh b/champ-service/src/main/bin/start.sh index de8a4fb..d82d438 100644 --- a/champ-service/src/main/bin/start.sh +++ b/champ-service/src/main/bin/start.sh @@ -21,74 +21,43 @@ # ECOMP is a trademark and service mark of AT&T Intellectual Property. # - -BASEDIR="/opt/app/champ-service/" -AJSC_HOME="$BASEDIR" -AJSC_CONF_HOME="$AJSC_HOME/bundleconfig/" +APP_HOME="/opt/app/champ-service" +GRAPH_DEPS_HOME="${APP_HOME}/graph-deps" if [ -z "$CONFIG_HOME" ]; then - echo "CONFIG_HOME must be set in order to start up process" - exit 1 + echo "CONFIG_HOME must be set in order to start up process" + exit 1 fi if [ -z "$KEY_STORE_PASSWORD" ]; then - echo "KEY_STORE_PASSWORD must be set in order to start up process" - exit 1 -else - echo "KEY_STORE_PASSWORD=$KEY_STORE_PASSWORD\n" >> $AJSC_CONF_HOME/etc/sysprops/sys-props.properties -fi - -if [ -z "$KEY_MANAGER_PASSWORD" ]; then - echo "KEY_MANAGER_PASSWORD must be set in order to start up process" - exit 1 -else - echo "KEY_MANAGER_PASSWORD=$KEY_MANAGER_PASSWORD\n" >> $AJSC_CONF_HOME/etc/sysprops/sys-props.properties + echo "KEY_STORE_PASSWORD must be set in order to start up process" + exit 1 fi -# Add any spring bean configuration files to the Gizmo deployment -if [ -n "$SERVICE_BEANS" ]; then - echo "Adding the following dynamic service beans to the deployment: " - mkdir -p /tmp/champ-service/v1/conf - for f in `ls $SERVICE_BEANS` - do - cp $SERVICE_BEANS/$f /tmp/champ-service/v1/conf - echo "Adding dynamic service bean $SERVICE_BEANS/$f" - done - jar uf /opt/app/champ-service/services/champ-service_v1.zip* -C /tmp/ champ-service - rm -rf /tmp/champ-service +if [ -z "$SERVICE_BEANS" ]; then + echo "SERVICE_BEANS must be set in order to start up process" + exit 1 fi -CLASSPATH="$AJSC_HOME/lib/*" -CLASSPATH="$CLASSPATH:$AJSC_HOME/extJars/" -CLASSPATH="$CLASSPATH:$AJSC_HOME/etc/" - -# Check to see if the provided implementation exists in the image and add it to the classpath -for file in $( find ${BASEDIR}graph-deps/* -maxdepth 0 -type d ); do - CURRIMPL=$(echo $file | cut -d"/" -f6) - if [ "x$GRAPHIMPL" = "x$CURRIMPL" ]; then - CLASSPATH_GRAPHIMPL=$file - echo "Setting up graph implementation of $GRAPHIMPL" - else - SUPPORTED_GRAPHIMPL="$SUPPORTED_GRAPHIMPL $CURRIMPL" - fi +for dir in $( find ${GRAPH_DEPS_HOME}/* -maxdepth 0 -type d ); do + CURRIMPL=$(basename $dir) + if [ "x$GRAPHIMPL" = "x$CURRIMPL" ]; then + GRAPHIMPL_DEPS="${GRAPH_DEPS_HOME}/${GRAPHIMPL}" + echo "Setting up graph implementation to $GRAPHIMPL" + else + SUPPORTED_GRAPHIMPL="$SUPPORTED_GRAPHIMPL $CURRIMPL" + fi done -if [ -n "$CLASSPATH_GRAPHIMPL" ]; then - cp $CLASSPATH_GRAPHIMPL/* $AJSC_HOME/extJars/ -else - echo "Configured graph implementation '$GRAPHIMPL' is not supported. Acceptable implementations are one of: $SUPPORTED_GRAPHIMPL" - exit 1 + +if [ -z "$GRAPHIMPL_DEPS" ]; then + echo "Configured graph implementation '$GRAPHIMPL' is not supported. Acceptable implementations are one of: $SUPPORTED_GRAPHIMPL" + exit 1 fi -PROPS="-DAJSC_HOME=$AJSC_HOME" -PROPS="$PROPS -DAJSC_CONF_HOME=$BASEDIR/bundleconfig/" -PROPS="$PROPS -Dlogback.configurationFile=$BASEDIR/bundleconfig/etc/logback.xml" -PROPS="$PROPS -DAJSC_SHARED_CONFIG=$AJSC_CONF_HOME" -PROPS="$PROPS -DAJSC_SERVICE_NAMESPACE=champ-service" -PROPS="$PROPS -DAJSC_SERVICE_VERSION=v1" -PROPS="$PROPS -Dserver.port=9522" +PROPS="-DAPP_HOME=$APP_HOME" PROPS="$PROPS -DCONFIG_HOME=$CONFIG_HOME" +PROPS="$PROPS -DKEY_STORE_PASSWORD=$KEY_STORE_PASSWORD" JVM_MAX_HEAP=${MAX_HEAP:-1024} -echo $CLASSPATH - -exec java -Xmx${JVM_MAX_HEAP}m $PROPS -classpath $CLASSPATH com.att.ajsc.runner.Runner context=// sslport=9522 +set -x +exec java -Xmx${JVM_MAX_HEAP}m $PROPS -Dloader.path="${GRAPHIMPL_DEPS}" -jar "${APP_HOME}/champ-service.jar" diff --git a/champ-service/src/main/java/org/onap/champ/ChampApplication.java b/champ-service/src/main/java/org/onap/champ/ChampApplication.java new file mode 100644 index 0000000..bc74469 --- /dev/null +++ b/champ-service/src/main/java/org/onap/champ/ChampApplication.java @@ -0,0 +1,46 @@ +/** + * ============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.champ; + +import java.util.HashMap; +import java.util.Map; +import org.eclipse.jetty.util.security.Password; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.support.SpringBootServletInitializer; +import org.springframework.context.annotation.ImportResource; + +@SpringBootApplication +@ImportResource({"file:${SERVICE_BEANS}/*.xml"}) +public class ChampApplication extends SpringBootServletInitializer { + + public static void main(String[] args) { + String keyStorePassword = System.getProperty("KEY_STORE_PASSWORD"); + if (keyStorePassword == null || keyStorePassword.isEmpty()) { + throw new RuntimeException("Environment property KEY_STORE_PASSWORD not set"); + } + + Map props = new HashMap<>(); + props.put("server.ssl.key-store-password", Password.deobfuscate(keyStorePassword)); + new ChampApplication().configure(new SpringApplicationBuilder(ChampApplication.class).properties(props)) + .run(args); + } +} diff --git a/champ-service/src/main/java/org/onap/champ/ChampRESTAPI.java b/champ-service/src/main/java/org/onap/champ/ChampRESTAPI.java index b75ba53..1a68027 100644 --- a/champ-service/src/main/java/org/onap/champ/ChampRESTAPI.java +++ b/champ-service/src/main/java/org/onap/champ/ChampRESTAPI.java @@ -27,7 +27,6 @@ import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Timer; - import javax.servlet.http.HttpServletRequest; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -44,7 +43,6 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; - import org.json.JSONException; import org.json.JSONObject; import org.onap.aai.champcore.ChampTransaction; @@ -67,12 +65,11 @@ import org.onap.champ.service.logging.ChampMsgs; import org.onap.champ.service.logging.LoggingUtil; import org.onap.champ.util.ChampProperties; import org.onap.champ.util.ChampServiceConstants; - import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.module.SimpleModule; -@Path(value = "/") +@Path(value = "/services/champ-service/v1/") public class ChampRESTAPI { private ObjectMapper mapper; @@ -88,7 +85,7 @@ public class ChampRESTAPI { public ChampRESTAPI(ChampDataService champDataService, ChampAsyncRequestProcessor champAsyncRequestProcessor) { this.champDataService = champDataService; - // Async request handling is optional. + // Async request handling is optional. if (champAsyncRequestProcessor != null) { timer = new Timer("ChampAsyncRequestProcessor-1"); timer.schedule(champAsyncRequestProcessor, champAsyncRequestProcessor.getRequestPollingTimeSeconds(), diff --git a/champ-service/src/main/java/org/onap/champ/JerseyConfig.java b/champ-service/src/main/java/org/onap/champ/JerseyConfig.java new file mode 100644 index 0000000..f72a2e4 --- /dev/null +++ b/champ-service/src/main/java/org/onap/champ/JerseyConfig.java @@ -0,0 +1,35 @@ +/** + * ============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.champ; + +import org.glassfish.jersey.server.ResourceConfig; +import org.springframework.stereotype.Component; + +/** + * Registers Crud Rest interface as JAX-RS endpoints. + */ +@Component +public class JerseyConfig extends ResourceConfig { + + public JerseyConfig(ChampRESTAPI champRestApi) { + register(champRestApi); + } +} diff --git a/champ-service/src/main/resources/application.properties b/champ-service/src/main/resources/application.properties new file mode 100644 index 0000000..07d7e08 --- /dev/null +++ b/champ-service/src/main/resources/application.properties @@ -0,0 +1,11 @@ +server.port=9522 + +SERVICE_BEANS=dynamic/conf + +server.ssl.key-store=${CONFIG_HOME}/auth/tomcat_keystore +server.ssl.key-store-type=JKS +server.ssl.enabled=true +server.ssl.client-auth=need +server.ssl.key-store-password=${KEY_STORE_PASSWORD} + +logging.config=classpath:logback.xml diff --git a/champ-service/ajsc-shared-config/etc/logback.xml b/champ-service/src/main/resources/logback.xml similarity index 99% rename from champ-service/ajsc-shared-config/etc/logback.xml rename to champ-service/src/main/resources/logback.xml index 12ed478..497adb6 100644 --- a/champ-service/ajsc-shared-config/etc/logback.xml +++ b/champ-service/src/main/resources/logback.xml @@ -25,7 +25,7 @@ - + + - + diff --git a/champ-service/src/test/java/org/onap/champ/event/GraphEventEnvelopeTest.java b/champ-service/src/test/java/org/onap/champ/event/GraphEventEnvelopeTest.java index 5c39f99..4d30901 100644 --- a/champ-service/src/test/java/org/onap/champ/event/GraphEventEnvelopeTest.java +++ b/champ-service/src/test/java/org/onap/champ/event/GraphEventEnvelopeTest.java @@ -1,3 +1,23 @@ +/** + * ============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.champ.event; import static org.hamcrest.Matchers.is; diff --git a/champ-service/src/test/java/org/onap/champ/util/TestUtil.java b/champ-service/src/test/java/org/onap/champ/util/TestUtil.java index b9924e4..65597fe 100644 --- a/champ-service/src/test/java/org/onap/champ/util/TestUtil.java +++ b/champ-service/src/test/java/org/onap/champ/util/TestUtil.java @@ -1,3 +1,23 @@ +/** + * ============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.champ.util; import java.io.File; @@ -10,25 +30,25 @@ import java.nio.file.Paths; public class TestUtil { - public static Path getPath(String resourceFilename) throws URISyntaxException { - URL resource = ClassLoader.getSystemResource(resourceFilename); - if (resource != null) { - return Paths.get(resource.toURI()); - } + public static Path getPath(String resourceFilename) throws URISyntaxException { + URL resource = ClassLoader.getSystemResource(resourceFilename); + if (resource != null) { + return Paths.get(resource.toURI()); + } - // If the resource is not found relative to the classpath, try to get it from the file system directly. - File file = new File(resourceFilename); - if (!file.exists()) { - throw new RuntimeException("Resource does not exist: " + resourceFilename); - } - return file.toPath(); - } + // If the resource is not found relative to the classpath, try to get it from the file system directly. + File file = new File(resourceFilename); + if (!file.exists()) { + throw new RuntimeException("Resource does not exist: " + resourceFilename); + } + return file.toPath(); + } - public static String getContentUtf8(Path filePath) throws IOException { - return new String(Files.readAllBytes(filePath)); - } + public static String getContentUtf8(Path filePath) throws IOException { + return new String(Files.readAllBytes(filePath)); + } - public static String getFileAsString(String resourceFilename) throws IOException, URISyntaxException { - return getContentUtf8(getPath(resourceFilename)); - } -} \ No newline at end of file + public static String getFileAsString(String resourceFilename) throws IOException, URISyntaxException { + return getContentUtf8(getPath(resourceFilename)); + } +} -- 2.16.6