diff options
author | Michael Arrastia <MArrasti@amdocs.com> | 2018-05-01 14:55:56 +0100 |
---|---|---|
committer | Michael Arrastia <MArrasti@amdocs.com> | 2018-05-01 14:55:56 +0100 |
commit | c5331e6fe565e7d0a22d1752e8f793d55dbe7c2e (patch) | |
tree | e0ceba06087abacc484350c46027c74e0f8f6e86 /champ-service | |
parent | e0549f46142bcc54cc3d3c04a465e5e6c54ba90c (diff) |
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 <MArrasti@amdocs.com>
Diffstat (limited to 'champ-service')
14 files changed, 306 insertions, 262 deletions
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. <modelVersion>4.0.0</modelVersion> <parent> - <groupId>com.att.ajsc</groupId> - <artifactId>ajsc-archetype-parent</artifactId> - <version>2.0.0</version> + <groupId>org.onap.oparent</groupId> + <artifactId>oparent</artifactId> + <version>1.1.0</version> </parent> <groupId>org.onap.aai</groupId> @@ -35,32 +35,49 @@ limitations under the License. <name>champ</name> <properties> - <runAjscHome>${basedir}/target/swm/package/nix/dist_files${distFilesRoot}</runAjscHome> - <ajscRuntimeVersion>2.0.0</ajscRuntimeVersion> - - <absoluteDistFilesRoot>/appl/${project.artifactId}</absoluteDistFilesRoot> - - <!-- For NO Versioning, REMOVE the /${project.version} from the <distFilesRoot> - property, below. PLEASE, NOTE: If your ${project.version} is a "-SNAPSHOT" - version, THIS will be used as your directory structure. If you do NOT want - this, simply remove the "-SNAPSHOT" from your <version> declaration at the - top of pom.xml --> - <distFilesRoot>/appl/${project.artifactId}/${project.version}</distFilesRoot> - + <docker.location>${basedir}/target</docker.location> + <onap.nexus.url>https://nexus.onap.org</onap.nexus.url> <common.logging.groupid>org.onap.aai.logging-service</common.logging.groupid> <common.logging.version>1.2.2</common.logging.version> - <org.apache.httpcomponents.httpclient.version>4.5.2</org.apache.httpcomponents.httpclient.version> - <docker.location>${basedir}/target</docker.location> - <onap.nexus.url>https://nexus.onap.org</onap.nexus.url> + <version.com.google.guava>18.0</version.com.google.guava> + <version.org.apache.commons.commons-lang3>3.7</version.org.apache.commons.commons-lang3> <version.org.hamcrest.hamcrest-library>1.3</version.org.hamcrest.hamcrest-library> + <version.org.springframework.boot.spring-boot-dependencies>1.5.12.RELEASE</version.org.springframework.boot.spring-boot-dependencies> </properties> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-dependencies</artifactId> + <version>${version.org.springframework.boot.spring-boot-dependencies}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> <dependency> - <groupId>com.sun.jersey</groupId> - <artifactId>jersey-core</artifactId> - <version>1.18.6</version> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-tomcat</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-jetty</artifactId> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-jersey</artifactId> </dependency> <dependency> @@ -70,12 +87,6 @@ limitations under the License. <scope>provided</scope> </dependency> - <dependency> - <groupId>com.att.aft</groupId> - <artifactId>dme2</artifactId> - <version>3.1.200</version> - <scope>provided</scope> - </dependency> <dependency> <groupId>org.json</groupId> @@ -84,12 +95,6 @@ limitations under the License. </dependency> <dependency> - <groupId>org.glassfish.jersey.core</groupId> - <artifactId>jersey-client</artifactId> - <version>2.23</version> - </dependency> - - <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.4</version> @@ -101,16 +106,30 @@ limitations under the License. <version>2.6.2</version> </dependency> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>${version.com.google.guava}</version> + </dependency> + <dependency> <groupId>${common.logging.groupid}</groupId> <artifactId>common-logging</artifactId> <version>${common.logging.version}</version> - </dependency> - - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-core</artifactId> - <version>1.1.7</version> + <exclusions> + <exclusion> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + </exclusion> + <exclusion> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-core</artifactId> + </exclusion> + <exclusion> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> @@ -120,9 +139,27 @@ limitations under the License. </dependency> <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>3.7</version> + </dependency> + + <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> - <version>${org.apache.httpcomponents.httpclient.version}</version> + <version>4.5.5</version> + </dependency> + + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient-cache</artifactId> + <version>4.5.5</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> @@ -135,13 +172,28 @@ limitations under the License. <groupId>org.apache.hbase</groupId> <artifactId>hbase-client</artifactId> </exclusion> + <exclusion> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + </exclusion> + <exclusion> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + </exclusion> + <exclusion> + <groupId>log4j</groupId> + <artifactId>apache-log4j-extras</artifactId> + </exclusion> + <exclusion> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </exclusion> </exclusions> </dependency> <dependency> <groupId>org.hamcrest</groupId> <artifactId>hamcrest-library</artifactId> - <version>${version.org.hamcrest.hamcrest-library}</version> <scope>test</scope> </dependency> @@ -170,6 +222,21 @@ limitations under the License. <finalName>${project.artifactId}</finalName> <plugins> <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <configuration> + <layout>ZIP</layout> + </configuration> + <executions> + <execution> + <goals> + <goal>repackage</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.7</version> @@ -200,11 +267,18 @@ limitations under the License. <resource> <directory>../champ-service-deps-titan/target/</directory> </resource> + <resource> + <directory>${basedir}</directory> + <includes> + <include>**/dynamic/**/*</include> + </includes> + </resource> </resources> </configuration> </execution> </executions> </plugin> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> @@ -212,7 +286,7 @@ limitations under the License. <skip>true</skip> </configuration> </plugin> - <!-- Uncomment to add a license header to source files + <plugin> <groupId>com.mycila</groupId> <artifactId>license-maven-plugin</artifactId> @@ -221,18 +295,22 @@ limitations under the License. <header>License.txt</header> <includes> <include>src/main/java/**</include> + <include>src/test/java/**</include> + <include>pom.xml</include> </includes> + <skipExistingHeaders>true</skipExistingHeaders> </configuration> <executions> <execution> <goals> - <goal>format</goal> + <!-- Set goal to "format" to auto update license headers --> + <goal>check</goal> </goals> <phase>process-sources</phase> </execution> </executions> </plugin> - --> + <plugin> <groupId>com.spotify</groupId> <artifactId>docker-maven-plugin</artifactId> @@ -248,6 +326,7 @@ limitations under the License. <forceTags>true</forceTags> </configuration> </plugin> + <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> @@ -270,118 +349,4 @@ limitations under the License. </plugin> </plugins> </build> - - <profiles> - <profile> - <id>runAjsc</id> - <build> - <defaultGoal>initialize</defaultGoal> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>exec-maven-plugin</artifactId> - <version>1.3.2</version> - <executions> - <execution> - <phase>initialize</phase> - <goals> - <goal>java</goal> - </goals> - <configuration> - <includeProjectDependencies>false</includeProjectDependencies> - <includePluginDependencies>true</includePluginDependencies> - <executable>java</executable> - <mainClass>com.att.ajsc.runner.Runner</mainClass> - <executableDependency> - <groupId>com.att.ajsc</groupId> - <artifactId>ajsc-runner</artifactId> - </executableDependency> - <additionalClasspathElements> - <additionalClasspathElement>${basedir}/ajsc-shared-config/etc</additionalClasspathElement> - </additionalClasspathElements> - - <environmentVariables> - <AJSC_HOME>${runAjscHome}</AJSC_HOME> - </environmentVariables> - - <!-- Main AJSC System Properties below (necessary for proper startup) --> - <systemProperties> - <systemProperty> - <key>AJSC_HOME</key> - <value>${runAjscHome}</value> - </systemProperty> - <systemProperty> - <key>CONFIG_HOME</key> - <value>${basedir}/appconfig-local/</value> - </systemProperty> - <systemProperty> - <key>AJSC_CONF_HOME</key> - <value>${basedir}/bundleconfig-local</value> - </systemProperty> - <systemProperty> - <key>logback.configurationFile</key> - <value>${basedir}/ajsc-shared-config/etc/logback.xml</value> - </systemProperty> - <systemProperty> - <key>AJSC_SHARED_CONFIG</key> - <value>${basedir}/ajsc-shared-config</value> - </systemProperty> - - <sysproperty> - <key>AJSC_EXTERNAL_LIB_FOLDERS</key> - <value>${basedir}/target/commonLibs</value> - </sysproperty> - <sysproperty> - <key>AJSC_EXTERNAL_PROPERTIES_FOLDERS</key> - <value>${basedir}/ajsc-shared-config/etc</value> - </sysproperty> - - <systemProperty> - <key>AJSC_SERVICE_NAMESPACE</key> - <value>${module.ajsc.namespace.name}</value> - </systemProperty> - <systemProperty> - <key>AJSC_SERVICE_VERSION</key> - <value>${module.ajsc.namespace.version}</value> - </systemProperty> - <systemProperty> - <key>SOACLOUD_SERVICE_VERSION</key> - <value>${project.version}</value> - </systemProperty> - <systemProperty> - <key>server.port</key> - <value>${serverPort}</value> - </systemProperty> - </systemProperties> - - <!-- Command Line Arguments to add to the java command. Here, you - can specify the port as well as the Context you want your service to run - in. Use context=/ to run in an unnamed Context (Root Context). The default - configuration of the AJSC is to run under the / Context. Setting the port - here can aid during the development phase of your service. However, you can - leave this argument out entirely, and the AJSC will default to using an Ephemeral - port. --> - <arguments> - <argument>context=/</argument> - <argument>port=${serverPort}</argument> - <argument>sslport=${sslport}</argument> - </arguments> - </configuration> - </execution> - </executions> - <configuration> - <executable>java</executable> - </configuration> - <dependencies> - <dependency> - <groupId>com.att.ajsc</groupId> - <artifactId>ajsc-runner</artifactId> - <version>${ajscRuntimeVersion}</version> - </dependency> - </dependencies> - </plugin> - </plugins> - </build> - </profile> - </profiles> </project> 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 @@ -<route xmlns="http://camel.apache.org/schema/spring" trace="true"> - <from uri="att-dme2-servlet:///champ-service/v1/?matchOnUriPrefix=true" /> - <to uri="cxfbean:champRestService" /> -</route>
\ 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 @@ -<route xmlns="http://camel.apache.org/schema/spring" trace="true"> - <from uri="att-dme2-servlet:///echo-service/?matchOnUriPrefix=true" /> - <to uri="cxfbean:echoServices" /> -</route> - 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<String, Object> 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 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 @@ <!--<jmxConfigurator /> --> <!-- directory path for all other type logs --> - <property name="logDir" value="${AJSC_HOME}/logs" /> + <property name="logDir" value="${APP_HOME}/logs" /> <!-- specify the component name @@ -155,6 +155,7 @@ <appender-ref ref="asyncEELFDebug" /> </logger> +<!-- <logger name="com.att.eelf.security" level="info" additivity="false"> <appender-ref ref="asyncEELFSecurity" /> </logger> @@ -167,13 +168,15 @@ <logger name="com.att.eelf.policy" level="info" additivity="false"> <appender-ref ref="asyncEELFPolicy" /> </logger> +--> + <logger name="com.att.eelf.audit" level="info" additivity="false"> <appender-ref ref="asyncEELFAudit" /> </logger> <logger name="com.att.eelf.metrics" level="info" additivity="false"> <appender-ref ref="asyncEELFMetrics" /> </logger> - + <!-- Spring related loggers --> <logger name="org.springframework" level="WARN" /> <logger name="org.springframework.beans" level="WARN" /> 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)); + } +} |