diff options
author | Arthur Martella <arthur.martella.1@att.com> | 2019-03-15 12:23:26 -0400 |
---|---|---|
committer | Arthur Martella <arthur.martella.1@att.com> | 2019-03-15 12:24:46 -0400 |
commit | 271147710dcf111f802503b6b34ff5cb9a3eb2cf (patch) | |
tree | 65f0f2be12a96c11ed53f3d7e9d0042ee2dfb244 | |
parent | 41656784593420d919be18951579be5df733ab0b (diff) |
Initial upload of F-GPS seed code 10/21
Includes:
API base dir
API sample config files
Change-Id: I4331271af3bffdf00c8766e690aef6f9b3592f97
Issue-ID: OPTFRA-440
Signed-off-by: arthur.martella.1@att.com
-rw-r--r-- | .gitignore | 25 | ||||
-rw-r--r-- | valetapi/Jenkinsfile | 276 | ||||
-rw-r--r-- | valetapi/LICENSE.txt | 45 | ||||
-rw-r--r-- | valetapi/opt/etc/config/application.properties | 50 | ||||
-rw-r--r-- | valetapi/opt/etc/config/logback.xml | 25 | ||||
-rw-r--r-- | valetapi/opt/etc/config/system.properties | 48 | ||||
-rw-r--r-- | valetapi/pom.xml | 515 |
7 files changed, 984 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6000f78 --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +/target/ +*.class + +/.classpath +/.project +/.settings/ + +*.pyc +.DS_Store + +# Java Compiled class file +*.class + +# Log files +Valet-Engine/log/* + +# junk directories +.old + +# pycharm directory +src/.idea + +.checkstyle +.project +.pydevproject diff --git a/valetapi/Jenkinsfile b/valetapi/Jenkinsfile new file mode 100644 index 0000000..cc778d7 --- /dev/null +++ b/valetapi/Jenkinsfile @@ -0,0 +1,276 @@ +#!/usr/bin/env groovy + + +properties([[$class: 'ParametersDefinitionProperty', parameterDefinitions: [ +[$class: 'hudson.model.StringParameterDefinition', name: 'PHASE', defaultValue: "BUILD_DEPLOY"], +[$class: 'hudson.model.StringParameterDefinition', name: 'TARGET_ENV', defaultValue: "DEV"], +[$class: 'hudson.model.StringParameterDefinition', name: 'K8S_CLUSTER_URL',defaultValue: "https://k8s.onap.org"], +[$class: 'hudson.model.StringParameterDefinition', name: 'K8S_CONTEXT',defaultValue: "default"], +[$class: 'hudson.model.StringParameterDefinition', name: 'K8S_USERNAME',defaultValue: "root"], +[$class: 'hudson.model.PasswordParameterDefinition', name: 'K8S_PASSWORD',defaultValue: "k8s_password"], +[$class: 'hudson.model.PasswordParameterDefinition', name: 'K8S_TOKEN',defaultValue: "k8suser@fgps.onap.org:enc:dfxissWKLGRuldTwXuAuK-WAT-b-f-wS"], +[$class: 'hudson.model.StringParameterDefinition', name: 'K8S_NAME',defaultValue: "DEV"], +[$class: 'hudson.model.StringParameterDefinition', name: 'K8S_PODS_REPLICAS',defaultValue: "1"], +[$class: 'hudson.model.StringParameterDefinition', name: 'K8S_SERVICE_ACCOUNT',defaultValue: "default"], +[$class: 'hudson.model.BooleanParameterDefinition', name: 'USE_ROOT_NS',defaultValue: false], +[$class: 'hudson.model.StringParameterDefinition', name: 'BROKER_URL',defaultValue: "http://broker.onap.org:30120"], +[$class: 'hudson.model.StringParameterDefinition', name: 'PACT_USERNAME', defaultValue: "pactadmin"], +[$class: 'hudson.model.PasswordParameterDefinition', name: 'PACT_PASSWORD', defaultValue: "pactadmin"], +[$class: 'hudson.model.StringParameterDefinition', name: 'CONSUMER', defaultValue: ""], +[$class: 'hudson.model.StringParameterDefinition', name: 'GIT_REPO_FOLDER',defaultValue: ""], +[$class: 'hudson.model.StringParameterDefinition', name: 'DEV_TEST_GIT_APP',defaultValue: ""], +[$class: 'hudson.model.StringParameterDefinition', name: 'DEV_TEST_SERVER_URL',defaultValue: ""], +[$class: 'hudson.model.StringParameterDefinition', name: 'LISA_PATH', defaultValue: "/opt/app/workload/tools/itko/server/9.5.1/Projects/"], +[$class: 'hudson.model.StringParameterDefinition', name: 'TEST_CASE_PATH',defaultValue: "/Tests/HelloTest.tst"], +[$class: 'hudson.model.StringParameterDefinition', name: 'SUITE_CASE_PATH', defaultValue: "/Tests/Suites/AllTestsSuite.ste"], +[$class: 'hudson.model.StringParameterDefinition', name: 'CONFIG_PATH', defaultValue: "/Configs/project.config"], +[$class: 'hudson.model.StringParameterDefinition', name: 'STAGING_DOC_PATH',defaultValue: "/Tests/StagingDocs/Run1User1Cycle.stg"], + +[$class: 'hudson.model.StringParameterDefinition', name: 'ANS_ROLE',defaultValue: ""], +[$class: 'hudson.model.StringParameterDefinition', name: 'ANS_INVENTORY',defaultValue: "inventory/dev/hosts"], +[$class: 'hudson.model.StringParameterDefinition', name: 'GITPlaybookPATH', defaultValue: ""], +[$class: 'hudson.model.StringParameterDefinition', name: 'GITConfigRolePATH', defaultValue: ""], +[$class: 'hudson.model.StringParameterDefinition', name: 'SONAR_BREAKER_SKIP',defaultValue: "True"], +[$class: 'hudson.model.StringParameterDefinition', name: 'SONAR_BREAKER_QRY_INTERVAL',defaultValue: "7000"], +[$class: 'hudson.model.StringParameterDefinition', name: 'SONAR_BREAKER_QRY_MAXATTEMPTS',defaultValue: "100"], +[$class: 'hudson.model.StringParameterDefinition', name: 'ECO_PIPELINE_ID',defaultValue: ""], +[$class: 'hudson.model.StringParameterDefinition', name: 'BUILD_VERSION',defaultValue: ""] +]]]) + + +/** + jdk1.8 = fixed name for java + M3 = fixed name for maven + general_maven_settings = fixed name for maven settings Jenkins managed file +*/ + +echo "Build branch: ${env.BRANCH_NAME}" + +node("docker") { + stage 'Checkout' + checkout scm + + pom = readMavenPom file: 'pom.xml' + PROJECT_NAME = pom.properties['namespace'] + ":" + pom.artifactId; +// env.SERVICE_NAME=pom.artifactId; + env.APP_NAME=pom.artifactId; + + env.SERVICE_NAME=pom.properties['serviceArtifactName'] + env.VERSION=pom.version; + + env.ANS_ROLE=SERVICE_NAME+"_configrole" + env.BUILDNUMBER_TIMESTAMP="${BUILD_NUMBER}"+"-"+"${currentBuild.timeInMillis}" + + echo "ANS_ROLE: ${ANS_ROLE}" + + LABEL_VERSION=pom.version.replaceAll(".", "-"); + echo "LabelVerion: " + LABEL_VERSION + NAMESPACE=pom.properties['namespace'] + + TARGET_ENV=TARGET_ENV.toLowerCase() + if(params.USE_ROOT_NS) + { + env.KUBE_NAMESPACE=pom.properties['kube.namespace'] + }else{ + env.KUBE_NAMESPACE=pom.properties['kube.namespace']+"-"+TARGET_ENV + } + + if(TARGET_ENV!="dev"){ + env.ANS_INVENTORY="inventory/"+TARGET_ENV+"/hosts" + echo "ANS_INVENTORY: ${ANS_INVENTORY}" + } + + env.TARGET_ENV=TARGET_ENV + REPLICA_COUNT="${params.K8S_PODS_REPLICAS}" + env.IMAGE_NAME=pom.properties['docker.registry']+"/"+NAMESPACE+"/"+SERVICE_NAME+":latest" + if (env.TARGET_ENV == "prod") { + env.IMAGE_NAME=pom.properties['docker.registry']+"/"+NAMESPACE+"/"+SERVICE_NAME+":release" + } + echo "Artifact: " + PROJECT_NAME + env.DOCKER_HOST="tcp://localhost:4243" + env.DOCKER_CONFIG="${WORKSPACE}/.docker" + def branchName + //This value can ideally come from pom as in IMAGE_NAME + def dockerRegistry = "nexus.onap.org:5100" + + if(params.BUILD_VERSION != "") + { + echo "BUILD VERSION Set : " + BUILD_VERSION + currentBuild.displayName = "VERSION-${BUILD_VERSION}" + currentBuild.description = "${BUILD_VERSION} ${ECO_PIPELINE_ID} ${PHASE}" + }else{ + echo "BUILD VERSION Not Set, Use pom version: " + VERSION + currentBuild.displayName = "VERSION-" +VERSION + currentBuild.description = "${VERSION} ${ECO_PIPELINE_ID} ${PHASE}" + } + + env.KUBECTL_OPTS="--server=${K8S_CLUSTER_URL} --insecure-skip-tls-verify=true --password=${K8S_PASSWORD} --username=${K8S_USERNAME}" + env.K8S_SERVER_CREDENTIALS = " k8server=${K8S_CLUSTER_URL}:6443 k8susername=${K8S_USERNAME} k8spassword=${K8S_PASSWORD} k8stoken=${K8S_TOKEN}" + if ("${K8S_TOKEN}" != "" ) { + env.KUBECTL_OPTS = "--server=${K8S_CLUSTER_URL} --insecure-skip-tls-verify=true --token=${K8S_TOKEN}" + env.K8S_SERVER_CREDENTIALS =" k8server=${K8S_CLUSTER_URL}:6443 k8susername= k8spassword= k8stoken=${K8S_TOKEN}" + } + + //echo "env.KUBECTL_OPTS=${KUBECTL_OPTS}" + //echo "K8S_SERVER_CREDENTIALS=${K8S_SERVER_CREDENTIALS}" + + //IST Variable + LISA_PATH_NEW="${LISA_PATH}"+SERVICE_NAME + + // Create kubectl.conf file here from Pipeline properties provided. + + withEnv(["PATH=${env.PATH}:${tool 'M3'}/bin:${tool 'jdk1.8'}/bin", "JAVA_HOME=${tool 'jdk1.8'}", "MAVEN_HOME=${tool 'M3'}"]) { + + echo "JAVA_HOME=${env.JAVA_HOME}" + echo "MAVEN_HOME=${env.MAVEN_HOME}" + echo "PATH=${env.PATH}" + + wrap([$class: 'ConfigFileBuildWrapper', managedFiles: [ + [fileId: 'maven-settings.xml', variable: 'MAVEN_SETTINGS'], + [fileId: 'sonar-secret.txt', variable: 'SONAR_SECRET'], + [fileId: 'sonar.properties', variable: 'SONAR_PROPERTIES'] + ]]) { + + branchName = (env.BRANCH_NAME ?: "master").replaceAll(/[^0-9a-zA-Z_]/, "-") + + + if ("${PHASE}" == "BUILD" || "${PHASE}" == "BUILD_DEPLOY" ) { + + stage 'Compile' + sh 'mvn -DskipTests -Dmaven.test.skip=true -s $MAVEN_SETTINGS -Ddummy.prop=$SONAR_PROPERTIES clean compile' + + stage 'Unit Test' + sh 'mvn -s $MAVEN_SETTINGS verify -P all-tests' + + stage 'Package' + sh 'mvn -DskipTests -Dmaven.test.skip=true -s $MAVEN_SETTINGS package' + + stage 'Verify' + sh 'mvn -DskipTests -Dmaven.test.skip=true -s $MAVEN_SETTINGS verify' + + + if ("${DEV_TEST_GIT_APP}" != "") { + + stage("CADev Repo Update") { + def GitinvokeURL = "${DEV_TEST_GIT_APP}/gitapp/service/git/push?gitUrl=${GIT_REPO_FOLDER}/${SERVICE_NAME}" + sh "curl -i -X GET \'${GitinvokeURL}\'" + } + + stage("Component Test Using CA DEV TEST") { + + def invokeURL = "${DEV_TEST_SERVER_URL}/lisa-invoke/runTest?testCasePath=${LISA_PATH_NEW}${TEST_CASE_PATH}&stagingDocPath=${LISA_PATH_NEW}${STAGING_DOC_PATH}" + sh "curl -i \'${invokeURL}\'" + invokeURL = "${DEV_TEST_SERVER_URL}/lisa-invoke/runSuite?suitePath=${LISA_PATH_NEW}${SUITE_CASE_PATH}&configPath=${LISA_PATH_NEW}${CONFIG_PATH}" + sh "curl -i \'${invokeURL}\'" + } + } + + stage 'Component Test Using Mockito' + sh 'mvn -s $MAVEN_SETTINGS -Dtest=ITComponentTest test' + + stage 'Publish Artifact' + //sh 'docker ps' + sh 'mvn -DskipTests -Dmaven.test.skip=true -Dhttps.protocols="TLSv1" -Djavax.net.ssl.trustStore="/opt/app/etc/cacerts.jks" -Djavax.net.ssl.trustStorePassword="password" -Djavax.net.ssl.keyStore="/opt/app/etc/cacerts.jks" -Djavax.net.ssl.keyStorePassword="password" -s $MAVEN_SETTINGS -U docker:build docker:push' + + } + + if ("${PHASE}" == "BUILD_DEPLOY" || "${PHASE}" == "DEPLOY" || "${PHASE}" == "CONFIG") { + // deploy to k8s + + stage ('Clone playbook and configrole') { + + // read values captured at the generate time + env.REPO_PROJECT = readFile './repoproject.txt' + env.REPO_PROJECT= "${REPO_PROJECT.trim()}" + // put some if conditions to use below values if empty above. + if(params.GITPlaybookPATH==""){ + GITPlaybookPATH="https://git.onap.org/scm/"+"${REPO_PROJECT}"+"/"+SERVICE_NAME+"_playbook.git" + } + echo "GITPlaybookPATH: ${GITPlaybookPATH}" + if(params.GITConfigRolePATH==""){ + GITConfigRolePATH="https://git.onap.org/scm/"+"${REPO_PROJECT}"+"/"+SERVICE_NAME+"_configrole.git" + } + echo "GITConfigRolePATH: ${GITConfigRolePATH}" + + env.dockermechid = readFile './dockerbuilduser.txt' + env.dockermechid = "${dockermechid.trim()}" + env.repogitid = readFile './repogitid.txt' + env.repogitid = "${repogitid.trim()}" + echo "repogitid : ${repogitid}" + + withCredentials([usernamePassword(credentialsId: env.repogitid, usernameVariable: 'ITS_SECRET_USERNAME', passwordVariable: 'ITS_SECRET_PASSWORD')]) { + env.DOCKER_HOST='unix:///var/run/docker.sock' + env.ANS_HOST = params.ANS_HOST ?: new URL("${params.K8S_CLUSTER_URL}").getHost() + + sh 'rm -rf playbook' + + dir('playbook') { + git url: "${GITPlaybookPATH}", credentialsId: "${repogitid}" + } + + + dir("playbook/roles/${ANS_ROLE}") { + if (branchName != 'master'){ + echo "branchName: ${branchName}" + git url: "${GITConfigRolePATH}", credentialsId: "${repogitid}", branch: "${branchName}" + } + else{ + echo "else branchName: ${branchName}" + git url: "${GITConfigRolePATH}", credentialsId: "${repogitid}" + } + } + } + } + + } + + if ( "${PHASE}" == "CONTRACT_GENERATE") { + stage 'Contract Generate Publish and QG2' + sh 'mvn -s $MAVEN_SETTINGS -Dtest=PactTestSuit test -DBROKER_URL=${BROKER_URL} -DuserName=${PACT_USERNAME} -Dpassword=${PACT_PASSWORD}' + sh 'mvn -s $MAVEN_SETTINGS pact:publish -DBROKER_URL=${BROKER_URL} -DuserName=${PACT_USERNAME} -Dpassword=${PACT_PASSWORD}' + } + + if ("${PHASE}" == "CONTRACT_VERIFY" ) { + stage ('Contract Verify' ){ + withEnv([ + "APP_NAME=${SERVICE_NAME}", + "K8S_CTX=${K8S_CONTEXT}", + "APP_NS=${KUBE_NAMESPACE}", + "KUBECTL=/opt/app/kubernetes/v1.5.2/bin/kubectl", + ]) { + def CLUSTER_URL=K8S_CLUSTER_URL.substring(8) + + NODE_PORT = sh ( + script: '${KUBECTL} get service ${APP_NAME} --namespace ${APP_NS} --context ${K8S_CTX} ${KUBECTL_OPTS} --output jsonpath={.spec.ports[*].nodePort}', + returnStdout: true + ).trim() + if( "${CONSUMER}" == "") { + sh "mvn -s $MAVEN_SETTINGS pact:verify -DBROKER_URL=${BROKER_URL} -DuserName=${PACT_USERNAME} -Dpassword=${PACT_PASSWORD} -DAPP_URL=${CLUSTER_URL} -DAPP_PORT=${NODE_PORT}" + } else { + sh "mvn -s $MAVEN_SETTINGS pact:verify -Dpact.filter.consumers=${CONSUMER} -DBROKER_URL=${BROKER_URL} -DuserName=${PACT_USERNAME} -Dpassword=${PACT_PASSWORD} -DAPP_URL=${CLUSTER_URL} -DAPP_PORT=${NODE_PORT}" + } + } + } + } + + if ("${PHASE}" == "INTEGRATION_TEST" || "${PHASE}" == "IST" || "${PHASE}" == "DEPLOY_IST" ) { + + stage("CADev Repo Update") { + def GitinvokeURL = "${DEV_TEST_GIT_APP}/gitapp/service/git/push?gitUrl=${GIT_REPO_FOLDER}/${SERVICE_NAME}" + sh "curl -i -X GET \'${GitinvokeURL}\'" + } + + stage("Functional Test") { + + def invokeURL = "${DEV_TEST_SERVER_URL}/lisa-invoke/runTest?testCasePath=${LISA_PATH_NEW}${TEST_CASE_PATH}&stagingDocPath=${LISA_PATH_NEW}${STAGING_DOC_PATH}" + sh "curl -i \'${invokeURL}\'" + invokeURL = "${DEV_TEST_SERVER_URL}/lisa-invoke/runSuite?suitePath=${LISA_PATH_NEW}${SUITE_CASE_PATH}&configPath=${LISA_PATH_NEW}${CONFIG_PATH}" + sh "curl -i \'${invokeURL}\'" + + + } + } + + } +} +}
\ No newline at end of file diff --git a/valetapi/LICENSE.txt b/valetapi/LICENSE.txt new file mode 100644 index 0000000..2bc081c --- /dev/null +++ b/valetapi/LICENSE.txt @@ -0,0 +1,45 @@ + +The following licence applies to all files in this and subdirectories. Licences +are included in individual source files where appropriate, and if it differs +from this text, it supersedes this. Any file that does not have licence text +defaults to being covered by this text; not all files support the addition of +licenses. + +/* +* ============LICENSE_START========================================== +* ONAP - F-GPS API +* =================================================================== +* Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. +* =================================================================== +* +* Unless otherwise specified, all software contained herein is licensed +* under the Apache License, Version 2.0 (the "License"); +* you may not use this software 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. +* +* +* +* Unless otherwise specified, all documentation contained herein is licensed +* under the Creative Commons License, Attribution 4.0 Intl. (the "License"); +* you may not use this documentation except in compliance with the License. +* You may obtain a copy of the License at +* +* https://creativecommons.org/licenses/by/4.0/ +* +* Unless required by applicable law or agreed to in writing, documentation +* 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============================================ +* +*/ diff --git a/valetapi/opt/etc/config/application.properties b/valetapi/opt/etc/config/application.properties new file mode 100644 index 0000000..b13b815 --- /dev/null +++ b/valetapi/opt/etc/config/application.properties @@ -0,0 +1,50 @@ + +# ============LICENSE_START======================================================= +# ONAP - F-GPS +# ================================================================================ +# Copyright (C) 2019 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# 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============================================ +# =================================================================== +# +### + +#Valet service +server.contextPath=/api/valet/ +logging.pattern.console= +logging.path=logs +logging.file=${logging.path}/log.log +logging.pattern.file=%d{dd-MM-yyyy HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M - %msg%n +# If it is true it will print all logs for ping or else it will print only error logs in api.log file +#logging.ping=true +# To enable SSL, uncomment the following lines: +server.port=8443 +server.ssl.enabled=true +server.ssl.key-store=classpath:keystore.p12 +server.ssl.key-store-type=PKCS12 +server.ssl.key-store-password=password +server.ssl.key-alias=tomcat + +# To enable HTTP while SSL is enabled, uncomment the following line: +server.http.port=8080 + +valet.dark=false + +aaf.url.base=https://aaf.onap.org:8095/proxy + +#If authentication flags are false, then credentials are not required. Otherwise, they are required. +#authentication.aaf=false +#authentication.basic=false + diff --git a/valetapi/opt/etc/config/logback.xml b/valetapi/opt/etc/config/logback.xml new file mode 100644 index 0000000..44cf2f8 --- /dev/null +++ b/valetapi/opt/etc/config/logback.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<configuration> + <appender name="FILE-AUDIT" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>/api/debug.log</file> + <encoder + class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> + <Pattern> %d{yyyy-MM-dd HH:mm:ss} - %msg%n </Pattern> + </encoder> + <rollingPolicy + class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!-- rollover daily --> + <fileNamePattern>/api/archived/api.%d{yyyy-MM-dd}.%i.log</fileNamePattern> + <timeBasedFileNamingAndTriggeringPolicy + class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> + <maxFileSize>10MB</maxFileSize> + </timeBasedFileNamingAndTriggeringPolicy> + </rollingPolicy> + </appender> + <logger name="com.valet" level="info" additivity="false"> + <appender-ref ref="FILE-AUDIT" /> + </logger> + <root level="INFO"> + <appender-ref ref="FILE-AUDIT" /> + </root> +</configuration> diff --git a/valetapi/opt/etc/config/system.properties b/valetapi/opt/etc/config/system.properties new file mode 100644 index 0000000..0cb3218 --- /dev/null +++ b/valetapi/opt/etc/config/system.properties @@ -0,0 +1,48 @@ + +# ============LICENSE_START======================================================= +# ONAP - F-GPS +# ================================================================================ +# Copyright (C) 2019 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# 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============================================ +# =================================================================== +# +### + +# If the environment property system_properties_path contains a path to a file , System properties created using the file. If the environment variable not present, system.properties in the class path is used for system property creation + +org.onap.eelf.logging.file=logback.xml + +# change as per logback.xml path +org.onap.eelf.logging.path=opt/etc/config +logging.config=opt/etc/config/logback.xml + + +# Default parameters during application startup. +info.build.artifact= ValetApi +info.build.name=org.onap.fgps +info.build.version=0.0.1-SNAPSHOT + +# Spring configuration files +spring.config.location=opt/etc/config/ +spring.config.name=application + +kubernetes.namespace=org-onap-fgps + +routeoffer=DEFAULT + +app_display_name = Valet API +instance_uuid=2768f67b-fdd6-4dc6-9ecb-8325d214a36e +application_name = ValetApi diff --git a/valetapi/pom.xml b/valetapi/pom.xml new file mode 100644 index 0000000..8b86c35 --- /dev/null +++ b/valetapi/pom.xml @@ -0,0 +1,515 @@ +<?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>
+
+ <groupId>org.onap.fgps</groupId>
+ <artifactId>ValetApi</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+
+ <properties>
+ <swagger.directory>${basedir}/target/classes/META-INF/resources/swagger</swagger.directory>
+ <java.version>1.8</java.version>
+ <docker.registry>nexus.onap.org:5100</docker.registry>
+ <build.number>local</build.number>
+ <kube.namespace>org-onap-fgps</kube.namespace>
+ <service.account>svc-account</service.account>
+ <namespace>org.onap.fgps</namespace>
+ <maven.compiler.source>1.8</maven.compiler.source>
+ <maven.compiler.target>1.8</maven.compiler.target>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <sdk.java.rest>6.2.0.11</sdk.java.rest>
+ <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
+ <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
+ <sonar.surefire.reportsPath>${basedir}/target/surefire-reports</sonar.surefire.reportsPath>
+ <sonar.failsafe.reportsPath>${basedir}/target/failsafe-reports</sonar.failsafe.reportsPath>
+ <jacoco.path>${basedir}/target/jacoco_report</jacoco.path>
+ <jacoco.itPath>${basedir}/target/jacoco_itReport</jacoco.itPath>
+ <sonar.jacoco.reportPath>${basedir}/target/jacoco-ut.exec</sonar.jacoco.reportPath>
+ <sonar.jacoco.itReportPath>${basedir}/target/jacoco-it.exec</sonar.jacoco.itReportPath>
+ <sonar.language>java</sonar.language>
+ <serviceArtifactName>valetapi</serviceArtifactName>
+
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <java.version>1.8</java.version>
+ </properties>
+ <!-- Used during verify stage in Jenkins -->
+ <profiles>
+ <profile>
+ <id>all-tests</id>
+ <properties>
+ <build.profile.id>all-tests</build.profile.id>
+
+ <!-- All tests are run. -->
+ <skip.integration.tests>false</skip.integration.tests>
+ <skip.unit.tests>false</skip.unit.tests>
+ </properties>
+ </profile>
+ <profile>
+ <id>dev</id>
+ </profile>
+ <profile>
+ <id>integration-test</id>
+ <properties>
+ <!-- Only integration tests are run. -->
+ <build.profile.id>integration-test</build.profile.id>
+ <skip.integration.tests>false</skip.integration.tests>
+ <skip.unit.tests>true</skip.unit.tests>
+ </properties>
+ </profile>
+ </profiles>
+
+ <repositories>
+ <repository>
+ <id>central</id>
+ <name>nexus central repo</name>
+ <url>${nexusurl}/${centralPath}</url>
+ </repository>
+ <repository>
+ <id>atlassian</id>
+ <name>nexus atlassian repo</name>
+ <url>${nexusurl}/${atlassianPath}</url>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>central</id>
+ <name>nexus central plugin repo</name>
+ <url>${nexusurl}/${pluginPath}</url>
+ </pluginRepository>
+ <pluginRepository>
+ <id>atlassian</id>
+ <name>nexus central atlassian plugin repo</name>
+ <url>${nexusurl}/${atlassianPluginPath}</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <parent>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-parent</artifactId>
+ <version>2.1.2.RELEASE</version>
+ <relativePath /> <!-- lookup parent from repository -->
+ </parent>
+
+ <developers>
+ <developer>
+ <id>${userId}</id>
+ </developer>
+ </developers>
+
+ <dependencies>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.12.0</version>
+ </dependency>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-codec-http</artifactId>
+ <version>4.0.40.Final</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.2.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <version>2.4.13</version>
+ </dependency>
+ <dependency>
+ <groupId>au.com.dius</groupId>
+ <artifactId>pact-jvm-consumer-junit_2.11</artifactId>
+ <version>3.3.9</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>au.com.dius</groupId>
+ <artifactId>pact-jvm-provider-junit_2.11</artifactId>
+ <version>3.3.9</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jmockit</groupId>
+ <artifactId>jmockit</artifactId>
+ <version>1.38</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-yaml</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.uuid</groupId>
+ <artifactId>java-uuid-generator</artifactId>
+ <version>3.1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.4</version>
+ </dependency>
+ <dependency>
+ <groupId>com.googlecode.json-simple</groupId>
+ <artifactId> json-simple</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-core</artifactId>
+ <version>1.2.3</version><!--$NO-MVN-MAN-VER$-->
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>1.2.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.10</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ </dependency>
+<!--
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-client</artifactId>
+ <version>4.0.0.Beta3</version>
+ </dependency>
+-->
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-core</artifactId>
+ <version>1.5.20</version>
+ </dependency>
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-annotations</artifactId>
+ <version>1.5.20</version>
+ </dependency>
+ <!-- <dependency>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-client</artifactId>
+ <version>2.24</version>
+ </dependency> -->
+ <!-- <dependency>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-common</artifactId>
+ <version>2.24</version>
+ </dependency> -->
+ <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-actuator</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-tomcat</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aop</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjrt</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjweaver</artifactId>
+ </dependency>
+ <!-- csi-logging-dependencies goes here -->
+ <!-- csi-logging-dependency-addon -->
+ </dependencies>
+ <build>
+ <finalName>ValetApi</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <version>0.7.5.201505241946</version>
+ <executions>
+ <!-- Prepares the property pointing to the JaCoCo runtime agent which
+ is passed as VM argument when Maven the Surefire plugin is executed. -->
+ <execution>
+ <id>pre-unit-test</id>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ <configuration>
+ <!-- Sets the path to the file which contains the execution data. -->
+ <destFile>${sonar.jacoco.reportPath}</destFile>
+ <propertyName>surefireArgLine</propertyName>
+ </configuration>
+ </execution>
+ <!-- Ensures that the code coverage report for unit tests is created
+ after unit tests have been run. -->
+ <execution>
+ <id>post-unit-test</id>
+ <phase>test</phase>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ <configuration>
+ <!-- Sets the path to the file which contains the execution data. -->
+ <dataFile>${sonar.jacoco.reportPath}</dataFile>
+ <!-- Sets the output directory for the code coverage report. -->
+ <outputDirectory>${jacoco.path}</outputDirectory>
+ </configuration>
+ </execution>
+ <!-- Prepares the property pointing to the JaCoCo runtime agent which
+ is passed as VM argument when Maven the Failsafe plugin is executed. -->
+ <execution>
+ <id>pre-integration-test</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ <configuration>
+ <!-- Sets the path to the file which contains the execution data. -->
+ <destFile>${sonar.jacoco.itReportPath}</destFile>
+ <!-- Sets the name of the property containing the settings for JaCoCo
+ runtime agent. -->
+ <propertyName>failsafeArgLine</propertyName>
+ </configuration>
+ </execution>
+ <!-- Ensures that the code coverage report for integration tests after
+ integration tests have been run. -->
+ <execution>
+ <id>post-integration-test</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ <configuration>
+ <!-- Sets the path to the file which contains the execution data. -->
+ <dataFile>${sonar.jacoco.itReportPath}/</dataFile>
+ <!-- Sets the output directory for the code coverage report. -->
+ <outputDirectory>${jacoco.itPath}</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- Used for unit tests -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.15</version>
+ <configuration>
+ <!-- Sets the VM argument line used when unit tests are run. -->
+ <argLine>${surefireArgLine}</argLine>
+
+ <!-- Skips unit tests if the value of skip.unit.tests property is true -->
+ <skipTests>${skip.unit.tests}</skipTests>
+ <!-- Excludes integration tests when unit tests are run. -->
+ <excludes>
+
+ <exclude>**/IT*.java</exclude>
+
+ </excludes>
+ </configuration>
+ </plugin>
+ <!-- Used for integration tests -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>2.15</version>
+ <executions>
+ <!-- Ensures that both integration-test and verify goals of the Failsafe
+ Maven plugin are executed. -->
+ <execution>
+ <id>integration-tests</id>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ <configuration>
+ <!-- Sets the VM argument line used when integration tests are run. -->
+ <argLine>${failsafeArgLine}</argLine>
+
+ <!-- Skips integration tests if the value of skip.integration.tests
+ property is true -->
+ <skipTests>${skip.integration.tests}</skipTests>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>au.com.dius</groupId>
+ <artifactId>pact-jvm-provider-maven_2.11</artifactId>
+ <version>3.3.9</version>
+ <configuration>
+ <!--pactBrokerUrl,user name,password and project version required only
+ for consumer -->
+ <pactBrokerUrl>${BROKER_URL}</pactBrokerUrl>
+ <pactBrokerUsername>${userName}</pactBrokerUsername>
+ <pactBrokerPassword>${password}</pactBrokerPassword>
+ <projectVersion>0.0.1</projectVersion>
+ <!-- service provider required only for producer -->
+ <serviceProviders>
+ <serviceProvider>
+ <name>ValetApi</name>
+ <protocol>http</protocol>
+ <host>${APP_URL}</host>
+ <port>${APP_PORT}</port>
+ <path>/</path>
+ <pactBroker>
+ <url>${BROKER_URL}</url>
+ <authentication>
+ <username>${userName}</username>
+ <password>${password}</password>
+ </authentication>
+ </pactBroker>
+ <!-- If you want to test specific PACT and specific port uncomment
+ the consumers section and comment the pact broker in the service provider -->
+ <!-- <consumers> <consumer> <name>pactconsumer</name> <pactUrl>${brokerUrl}/pacts/provider/pactdemo/consumer/pactdemo/latest</pactUrl>
+ <pactUrl>${brokerUrl}/pacts/provider/pactdemo/consumer/pactconsumer2/version/0.0.1</pactUrl>
+ </consumer> </consumers> -->
+ </serviceProvider>
+ </serviceProviders>
+ </configuration>
+ </plugin>
+<plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>com.github.kongchen</groupId>
+ <artifactId>swagger-maven-plugin</artifactId>
+ <version>3.1.3</version>
+ <configuration>
+ <apiSources>
+ <apiSource>
+ <locations>org.onap.fgps.api.service.rs</locations>
+ <basePath>/api</basePath>
+ <info>
+ <title>${project.artifactId} Service</title>
+ <version>${project.version}</version>
+ </info>
+ <swaggerDirectory>${swagger.directory}</swaggerDirectory>
+ </apiSource>
+ </apiSources>
+ </configuration>
+ <executions>
+ <execution>
+ <!-- <phase>compile</phase> -->
+ <phase>package</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>exec-maven-plugin</artifactId>
+ <groupId>org.codehaus.mojo</groupId>
+ </plugin>
+ <plugin>
+ <groupId>com.spotify</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>0.4.11</version>
+ <configuration>
+ <imageName>${docker.registry}/${namespace}/${serviceArtifactName}</imageName>
+ <dockerDirectory>src/main/docker</dockerDirectory>
+ <serverId>docker-hub</serverId>
+ <registryUrl>https://${docker.registry}</registryUrl>
+ <imageTags>
+ <imageTag>${project.version}</imageTag>
+ <imageTag>latest</imageTag>
+ </imageTags>
+ <forceTags>true</forceTags>
+ <resources>
+ <resource>
+ <targetPath>/</targetPath>
+ <directory>${project.build.directory}</directory>
+ <include>${project.build.finalName}.jar</include>
+ </resource>
+ <resource>
+ <targetPath>/</targetPath>
+ <directory>${project.build.directory}</directory>
+ <include>opt/etc/config/*</include>
+ </resource>
+ </resources>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <layout>ZIP</layout>
+ </configuration>
+ </plugin>
+ </plugins>
+ <!-- mention the logback.xml location through system property or environment
+ variable to edit logback.xml at run time -->
+ <resources>
+ <!-- <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource> -->
+ <!-- <resource>
+ <directory>opt/etc/config</directory>
+ <targetPath>../opt/etc/config</targetPath>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource> -->
+ <!-- csi-logging-target-resources-goes here -->
+ <!-- csi-logging-target-resources-addon -->
+ </resources>
+ </build>
+ </project>
|