Replace shell build scripts with Maven solution 63/51063/3
authorPiotr Bochenski <piotr.bochenski@nokia.com>
Fri, 8 Jun 2018 15:49:58 +0000 (17:49 +0200)
committerPiotr Bochenski <piotr.bochenski@nokia.com>
Tue, 12 Jun 2018 15:58:15 +0000 (17:58 +0200)
Remove dead bash code that is being executed during Maven build
phases and reimplement Docker interaction using plain Maven
solution.

This change simplifies build procedure and allows developers to
easily build, run and test their own self-built VES image on
local machine.

Issue-ID: DCAEGEN2-534

Change-Id: I63eb150406b78a71a55fdc728a4fbb4e1a4e6554
Signed-off-by: Piotr Bochenski <piotr.bochenski@nokia.com>
Dockerfile [deleted file]
docker-compose.yml [new file with mode: 0644]
mvn-phase-lib.sh [deleted file]
mvn-phase-script.sh [deleted file]
pom.xml
src/assembly/dep.xml
src/main/scripts/VESrestfulCollector.sh

diff --git a/Dockerfile b/Dockerfile
deleted file mode 100644 (file)
index 259ac98..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-FROM openjdk:8-jre-slim
-
-MAINTAINER vv770d@att.com
-
-WORKDIR /opt/app/VESCollector
-
-ENV HOME /opt/app/VESCollector
-ENV JAVA_HOME /usr
-ENV HOSTALIASES /etc/host.aliases
-
-COPY opt /opt
-
-EXPOSE 8080 8443
-
-CMD [ "/opt/app/docker-entry.sh" ]
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644 (file)
index 0000000..1d7484b
--- /dev/null
@@ -0,0 +1,8 @@
+version: '3'
+services:
+  ves:
+    container_name: ves
+    image: onap/org.onap.dcaegen2.collectors.ves.vescollector:latest
+    ports:
+      - "8080:8080"
+      - "8443:8443"
diff --git a/mvn-phase-lib.sh b/mvn-phase-lib.sh
deleted file mode 100755 (executable)
index ac53722..0000000
+++ /dev/null
@@ -1,296 +0,0 @@
-#!/bin/bash
-
-# ================================================================================
-# Copyright (c) 2017 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=========================================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-
-
-clean_templated_files() 
-{
-  TEMPLATE_FILES=$(find . -name "*-template")
-  for F in $TEMPLATE_FILES; do
-    F2=$(echo "$F" | sed 's/-template$//')
-    rm -f "$F2"
-  done
-}
-clean_tox_files() 
-{
-  TOX_FILES=$(find . -name ".tox")
-  TOX_FILES="$TOX_FILES $(find . -name 'venv-tox')"
-  for F in $TOX_FILES; do
-    rm -rf "$F"
-  done
-}
-
-expand_templates() 
-{
-  # set up env variables, get ready for template resolution
-  # NOTE: CCSDK artifacts do not distinguish REALESE vs SNAPSHOTs
-  export ONAPTEMPLATE_RAWREPOURL_org_onap_ccsdk_platform_plugins_releases="$MVN_RAWREPO_BASEURL_DOWNLOAD/org.onap.ccsdk.platform.plugins"
-  export ONAPTEMPLATE_RAWREPOURL_org_onap_ccsdk_platform_plugins_snapshots="$MVN_RAWREPO_BASEURL_DOWNLOAD/org.onap.ccsdk.platform.plugins"
-  export ONAPTEMPLATE_RAWREPOURL_org_onap_ccsdk_platform_blueprints_releases="$MVN_RAWREPO_BASEURL_DOWNLOAD/org.onap.ccsdk.platform.blueprints"
-  export ONAPTEMPLATE_RAWREPOURL_org_onap_ccsdk_platform_blueprints_snapshots="$MVN_RAWREPO_BASEURL_DOWNLOAD/org.onap.ccsdk.platform.blueprints"
-  export ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_releases="$MVN_RAWREPO_BASEURL_DOWNLOAD/org.onap.dcaegen2/releases"
-  export ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_snapshots="$MVN_RAWREPO_BASEURL_DOWNLOAD/org.onap.dcaegen2/snapshots"
-  export ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases="$MVN_RAWREPO_BASEURL_DOWNLOAD/org.onap.dcaegen2.platform.plugins/releases"
-  export ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_snapshots="$MVN_RAWREPO_BASEURL_DOWNLOAD/org.onap.dcaegen2.platform.plugins/snapshots"
-  export ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_blueprints_releases="$MVN_RAWREPO_BASEURL_DOWNLOAD/org.onap.dcaegen2.platform.blueprints/releases"
-  export ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_blueprints_snapshots="$MVN_RAWREPO_BASEURL_DOWNLOAD/org.onap.dcaegen2.platform.blueprints/snapshots"
-
-  export ONAPTEMPLATE_PYPIURL_org_onap_dcaegen2="${MVN_NEXUSPROXY}/content/sites/pypi"
-
-  export ONAPTEMPLATE_DOCKERREGURL_org_onap_dcaegen2_releases="$MVN_DOCKERREGISTRY_DAILY"
-  export ONAPTEMPLATE_DOCKERREGURL_org_onap_dcaegen2_snapshots="$MVN_DOCKERREGISTRY_DAILY/snapshots"
-
-
-  TEMPLATE_FILES=$(find . -name "*-template")
-  for F in $TEMPLATE_FILES; do
-    F2=$(echo "$F" | sed 's/-template$//')
-    cp "$F" "$F2"
-    MOD=$(stat --format '%a' "$F")
-    chmod "$MOD" "$F2"
-  done
-   
-
-  TEMPLATES=$(env |grep ONAPTEMPLATE)
-  if [ -z "$TEMPLATES" ]; then
-    return 0
-  fi
-
-  echo "====> Resolving the following temaplate from environment variables "
-  echo "[$TEMPLATES]"
-  SELFFILE=$(echo "$0" | rev | cut -f1 -d '/' | rev)
-  for TEMPLATE in $TEMPLATES; do
-    KEY=$(echo "$TEMPLATE" | cut -f1 -d'=')
-    VALUE=$(echo "$TEMPLATE" | cut -f2 -d'=')
-    VALUE2=$(echo "$TEMPLATE" | cut -f2 -d'=' |sed 's/\//\\\//g')
-    set +e
-    FILES=$(grep -rl "$KEY")
-    set -e
-
-    if [ -z "$FILES" ]; then
-      continue
-    fi
-
-    # assuming FILES is not longer than 2M bytes, the limit for variable value max size on this VM
-    for F in $FILES; do
-      if [[ $F == *"$SELFFILE" ]]; then
-        continue
-      fi
-      if [[ "$F" == *-template ]]; then
-        continue
-      fi
-
-      echo "======> Resolving template $KEY to value $VALUE for file $F"
-      sed -i "s/{{[[:space:]]*$KEY[[:space:]]*}}/$VALUE2/g" "$F"
-      #cat "$F"
-    done
-
-    #if [ ! -z "$FILES" ]; then
-    #   echo "====> Resolving template $VALUE to value $VALUE"
-    #   #CMD="grep -rl \"$VALUE\" | tr '\n' '\0' | xargs -0 sed -i \"s/{{[[:space:]]*$VALUE[[:space:]]*}}/$VALUE/g\""
-    #   grep -rl "$KEY" | tr '\n' '\0' | xargs -0 sed -i 's/$KEY/$VALUE2/g'
-    #   #echo $CMD
-    #   #eval $CMD
-    #fi
-  done
-  echo "====> Done template reolving"
-}
-
-
-run_tox_test() 
-{ 
-  set -x
-  CURDIR=$(pwd)
-  TOXINIS=$(find . -name "tox.ini")
-  for TOXINI in "${TOXINIS[@]}"; do
-    DIR=$(echo "$TOXINI" | rev | cut -f2- -d'/' | rev)
-    cd "${CURDIR}/${DIR}"
-    rm -rf ./venv-tox ./.tox
-    virtualenv ./venv-tox
-    source ./venv-tox/bin/activate
-    pip install --upgrade pip
-    pip install --upgrade tox argparse
-    pip freeze
-    tox
-    deactivate
-    rm -rf ./venv-tox ./.tox
-  done
-}
-
-build_wagons() 
-{
-  rm -rf ./*.wgn venv-pkg
-
-  SETUPFILES=$(find . -name "setup.py")
-  for SETUPFILE in $SETUPFILES; do
-    PLUGIN_DIR=$(echo "$SETUPFILE" |rev | cut -f 2- -d '/' |rev)
-    PLUGIN_NAME=$(grep 'name' "$SETUPFILE" | cut -f2 -d'=' | sed 's/[^0-9a-zA-Z\.]*//g')
-    PLUGIN_VERSION=$(grep 'version' "$SETUPFILE" | cut -f2 -d'=' | sed 's/[^0-9\.]*//g')
-
-    echo "In $PLUGIN_DIR, $PLUGIN_NAME, $PLUGIN_VERSION"
-
-    virtualenv ./venv-pkg
-    source ./venv-pkg/bin/activate
-    pip install --upgrade pip
-    pip install wagon
-    wagon create --format tar.gz "$PLUGIN_DIR"
-    deactivate
-    rm -rf venv-pkg
-
-    PKG_FILE_NAMES=( "${PLUGIN_NAME}-${PLUGIN_VERSION}"*.wgn )
-    echo Built package: "${PKG_FILE_NAMES[@]}"
-  done
-}
-
-
-upload_raw_file() 
-{
-  # Extract the username and password to the nexus repo from the settings file
-  USER=$(xpath -q -e "//servers/server[id='$MVN_RAWREPO_SERVERID']/username/text()" "$SETTINGS_FILE")
-  PASS=$(xpath -q -e "//servers/server[id='$MVN_RAWREPO_SERVERID']/password/text()" "$SETTINGS_FILE")
-  NETRC=$(mktemp)
-  echo "machine $MVN_RAWREPO_HOST login $USER password $PASS" > "$NETRC"
-
-  REPO="$MVN_RAWREPO_BASEURL_UPLOAD"
-
-  OUTPUT_FILE=$1
-  EXT=$(echo "$OUTPUT_FILE" | rev |cut -f1 -d '.' |rev)
-  if [ "$EXT" == 'yaml' ]; then
-    OUTPUT_FILE_TYPE='text/x-yaml'
-  elif [ "$EXT" == 'sh' ]; then
-    OUTPUT_FILE_TYPE='text/x-shellscript'
-  elif [ "$EXT" == 'gz' ]; then
-    OUTPUT_FILE_TYPE='application/gzip'
-  elif [ "$EXT" == 'wgn' ]; then
-    OUTPUT_FILE_TYPE='application/gzip'
-  else
-    OUTPUT_FILE_TYPE='application/octet-stream'
-  fi
-
-
-  if [ "$MVN_DEPLOYMENT_TYPE" == 'SNAPSHOT' ]; then
-    SEND_TO="${REPO}/${FQDN}/snapshots"
-  elif [ "$MVN_DEPLOYMENT_TYPE" == 'STAGING' ]; then
-    SEND_TO="${REPO}/${FQDN}/releases"
-  else
-    echo "Unreconfnized deployment type, quit"
-    exit
-  fi
-  if [ ! -z "$MVN_PROJECT_MODULEID" ]; then
-    SEND_TO="$SEND_TO/$MVN_PROJECT_MODULEID"
-  fi
-
-  echo "Sending ${OUTPUT_FILE} to Nexus: ${SEND_TO}"
-  curl -vkn --netrc-file "${NETRC}" --upload-file "${OUTPUT_FILE}" -X PUT -H "Content-Type: $OUTPUT_FILE_TYPE" "${SEND_TO}/${OUTPUT_FILE}-${MVN_PROJECT_VERSION}-${TIMESTAMP}"
-  curl -vkn --netrc-file "${NETRC}" --upload-file "${OUTPUT_FILE}" -X PUT -H "Content-Type: $OUTPUT_FILE_TYPE" "${SEND_TO}/${OUTPUT_FILE}-${MVN_PROJECT_VERSION}"
-  curl -vkn --netrc-file "${NETRC}" --upload-file "${OUTPUT_FILE}" -X PUT -H "Content-Type: $OUTPUT_FILE_TYPE" "${SEND_TO}/${OUTPUT_FILE}"
-}
-
-
-
-upload_wagons_and_type_yamls()
-{
-  WAGONS=$(ls -1 ./*.wgn)
-  for WAGON in $WAGONS ; do
-    WAGON_NAME=$(echo "$WAGON" | cut -f1 -d '-')
-    WAGON_VERSION=$(echo "$WAGON" | cut -f2 -d '-')
-    WAGON_TYPEFILE=$(grep -rl "$WAGON_NAME" | grep yaml | head -1)
-   
-    upload_raw_file "$WAGON"
-    upload_raw_file "$WAGON_TYPEFILE"
-  done
-}
-
-upload_files_of_extension()
-{
-  FILES=$(ls -1 ./*."$1")
-  for F in $FILES ; do
-    upload_raw_file "$F"
-  done
-}
-
-
-
-build_and_push_docker()
-{
-  IMAGENAME="onap/${FQDN}.${MVN_PROJECT_MODULEID}"
-  IMAGENAME=$(echo "$IMAGENAME" | sed -e 's/_*$//g' -e 's/\.*$//g')
-  IMAGENAME=$(echo "$IMAGENAME" | tr '[:upper:]' '[:lower:]')
-
-  # use the major and minor version of the MVN artifact version as docker image version
-  VERSION="${MVN_PROJECT_VERSION//[^0-9.]/}"
-  VERSION2=$(echo "$VERSION" | cut -f1-2 -d'.')
-
-  LFQI="${IMAGENAME}:${VERSION}-${TIMESTAMP}"Z
-  # build a docker image
-  docker build --rm -f ./Dockerfile -t "${LFQI}" ./
-
-  REPO=""
-  if [ $MVN_DEPLOYMENT_TYPE == "SNAPSHOT" ]; then
-     REPO=$MVN_DOCKERREGISTRY_DAILY
-  elif [ $MVN_DEPLOYMENT_TYPE == "STAGING" ]; then
-     # there seems to be no staging docker registry?  set to use SNAPSHOT also
-     #REPO=$MVN_DOCKERREGISTRY_RELEASE
-     REPO=$MVN_DOCKERREGISTRY_DAILY
-  else
-     echo "Fail to determine DEPLOYMENT_TYPE"
-     REPO=$MVN_DOCKERREGISTRY_DAILY
-  fi
-  echo "DEPLOYMENT_TYPE is: $MVN_DEPLOYMENT_TYPE, repo is $REPO"
-
-  if [ ! -z "$REPO" ]; then
-    USER=$(xpath -e "//servers/server[id='$REPO']/username/text()" "$SETTINGS_FILE")
-    PASS=$(xpath -e "//servers/server[id='$REPO']/password/text()" "$SETTINGS_FILE")
-    if [ -z "$USER" ]; then
-      echo "Error: no user provided"
-    fi
-    if [ -z "$PASS" ]; then
-      echo "Error: no password provided"
-    fi
-    [ -z "$PASS" ] && PASS_PROVIDED="<empty>" || PASS_PROVIDED="<password>"
-    echo docker login "$REPO" -u "$USER" -p "$PASS_PROVIDED"
-    docker login "$REPO" -u "$USER" -p "$PASS"
-
-    if [ $MVN_DEPLOYMENT_TYPE == "SNAPSHOT" ]; then
-      REPO="$REPO/snapshots"
-    elif [ $MVN_DEPLOYMENT_TYPE == "STAGING" ]; then
-      # there seems to be no staging docker registry?  set to use SNAPSHOT also
-      #REPO=$MVN_DOCKERREGISTRY_RELEASE
-      REPO="$REPO"
-    else
-      echo "Fail to determine DEPLOYMENT_TYPE"
-      REPO="$REPO/unknown"
-    fi
-
-    OLDTAG="${LFQI}"
-    PUSHTAGS="${REPO}/${IMAGENAME}:${VERSION}-SNAPSHOT-${TIMESTAMP}Z ${REPO}/${IMAGENAME}:${VERSION} ${REPO}/${IMAGENAME}:latest"
-    for NEWTAG in ${PUSHTAGS}
-    do
-      echo "tagging ${OLDTAG} to ${NEWTAG}"
-      docker tag "${OLDTAG}" "${NEWTAG}"
-      echo "pushing ${NEWTAG}"
-      docker push "${NEWTAG}"
-      OLDTAG="${NEWTAG}"
-    done
-  fi
-
-}
-
-
-
diff --git a/mvn-phase-script.sh b/mvn-phase-script.sh
deleted file mode 100755 (executable)
index ea045de..0000000
+++ /dev/null
@@ -1,203 +0,0 @@
-#!/bin/bash
-
-# ================================================================================
-# Copyright (c) 2017 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=========================================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-
-set -ex
-
-
-echo "running script: [$0] for module [$1] at stage [$2]"
-
-MVN_PROJECT_MODULEID="$1"
-MVN_PHASE="$2"
-
-
-PROJECT_ROOT=$(dirname $0)
-if [ -z "$WORKSPACE" ]; then
-  export WORKSPACE="$PROJECT_ROOT"
-fi
-
-
-FQDN="${MVN_PROJECT_GROUPID}.${MVN_PROJECT_ARTIFACTID}"
-if [ "$MVN_PROJECT_MODULEID" == "__" ]; then
-  MVN_PROJECT_MODULEID=""
-fi
-
-if [[ "$MVN_PROJECT_VERSION" == *SNAPSHOT ]]; then
-  echo "=> for SNAPSHOT artifact build"
-  MVN_DEPLOYMENT_TYPE='SNAPSHOT'
-else
-  echo "=> for STAGING/RELEASE artifact build"
-  MVN_DEPLOYMENT_TYPE='STAGING'
-fi
-echo "MVN_DEPLOYMENT_TYPE is             [$MVN_DEPLOYMENT_TYPE]"
-
-
-TIMESTAMP=$(date +%C%y%m%dT%H%M%S)
-
-# expected environment variables
-if [ -z "${MVN_NEXUSPROXY}" ]; then
-    echo "MVN_NEXUSPROXY environment variable not set.  Cannot proceed"
-    exit
-fi
-MVN_NEXUSPROXY_HOST=$(echo "$MVN_NEXUSPROXY" |cut -f3 -d'/' | cut -f1 -d':')
-echo "=> Nexus Proxy at $MVN_NEXUSPROXY_HOST, $MVN_NEXUSPROXY"
-
-if [ -z "$WORKSPACE" ]; then
-    WORKSPACE=$(pwd)
-fi
-
-if [ -z "$SETTINGS_FILE" ]; then
-    echo "SETTINGS_FILE environment variable not set.  Cannot proceed"
-    exit
-fi
-   
-
-
-# mvn phase in life cycle
-MVN_PHASE="$2"
-
-
-echo "MVN_PROJECT_MODULEID is            [$MVN_PROJECT_MODULEID]"
-echo "MVN_PHASE is                       [$MVN_PHASE]"
-echo "MVN_PROJECT_GROUPID is             [$MVN_PROJECT_GROUPID]"
-echo "MVN_PROJECT_ARTIFACTID is          [$MVN_PROJECT_ARTIFACTID]"
-echo "MVN_PROJECT_VERSION is             [$MVN_PROJECT_VERSION]"
-echo "MVN_NEXUSPROXY is                  [$MVN_NEXUSPROXY]"
-echo "MVN_RAWREPO_BASEURL_UPLOAD is      [$MVN_RAWREPO_BASEURL_UPLOAD]"
-echo "MVN_RAWREPO_BASEURL_DOWNLOAD is    [$MVN_RAWREPO_BASEURL_DOWNLOAD]"
-MVN_RAWREPO_HOST=$(echo "$MVN_RAWREPO_BASEURL_UPLOAD" | cut -f3 -d'/' |cut -f1 -d':')
-echo "MVN_RAWREPO_HOST is                [$MVN_RAWREPO_HOST]"
-echo "MVN_RAWREPO_SERVERID is            [$MVN_RAWREPO_SERVERID]"
-echo "MVN_DOCKERREGISTRY_DAILY is        [$MVN_DOCKERREGISTRY_DAILY]"
-echo "MVN_DOCKERREGISTRY_RELEASE is      [$MVN_DOCKERREGISTRY_RELEASE]"
-
-
-source "${PROJECT_ROOT}"/mvn-phase-lib.sh 
-
-
-# Customize the section below for each project
-case $MVN_PHASE in
-clean)
-  echo "==> clean phase script"
-  clean_templated_files
-  clean_tox_files
-  rm -rf ./venv-* ./*.wgn ./site
-  ;;
-generate-sources)
-  echo "==> generate-sources phase script"
-  expand_templates
-  ;;
-compile)
-  echo "==> compile phase script"
-  ;;
-test)
-  echo "==> test phase script"
-  ;;
-package)
-  echo "==> package phase script"
-  ;;
-install)
-  echo "==> install phase script"
-  ;;
-deploy)
-  echo "==> deploy phase script"
-  
-  case $MVN_DEPLOYMENT_TYPE in
-    SNAPSHOT)
-      phase='merge'
-      ;;
-    STAGING)
-      phase='release'
-      ;;
-    *)
-      exit 1
-      ;;
-  esac
-
-  VERSION=$(xpath -e '//project/version/text()' 'pom.xml')
-  VERSION=${VERSION//\"/}
-  EXT=$(echo "$VERSION" | rev | cut -s -f1 -d'-' | rev)
-  if [ -z "$EXT" ]; then
-    EXT="STAGING"
-  fi
-  case $phase in
-    verify|merge)
-      if [ "$EXT" != 'SNAPSHOT' ]; then
-        echo "$phase job only takes SNAPSHOT version, got \"$EXT\" instead"
-        exit 1
-      fi
-      ;;
-    release)
-      if [ ! -z "$EXT" ] && [ "$EXT" != 'STAGING' ]; then
-        echo "$phase job only takes STAGING or pure numerical version, got \"$EXT\" instead"
-        exit 1
-      fi
-      ;;
-    *)
-      echo "Unknown phase \"$phase\""
-      exit 1
-  esac
-  echo "Running \"$phase\" job for version \"$VERSION\""
-
-  # unarchive the service manager
-  TARGET="${WORKSPACE}/target"
-  #STAGE="${TARGET}/stage"
-  STAGE=.
-  BASE_DIR="${STAGE}/opt/app"
-
-  # unarchive the collector
-  AR=${WORKSPACE}/target/VESCollector-${VERSION}-bundle.tar.gz
-  APP_DIR=${STAGE}/opt/app/VESCollector
-
-  [ -d "${STAGE}/opt/app/VESCollector-${VERSION}" ] && rm -rf "${STAGE}/opt/app/VESCollector-${VERSION}"
-
-  [ ! -f "${APP_DIR}" ] && mkdir -p "${APP_DIR}"
-
-  gunzip -c "${AR}" | tar xvf - -C "${APP_DIR}" --strip-components=1
-
-
-  if [ ! -f "${APP_DIR}/bin/docker-entry.sh" ]
-  then
-    echo "FATAL error cannot locate ${APP_DIR}/bin/docker-entry.sh"
-    exit 2
-  fi
-  cp -p ${APP_DIR}/bin/docker-entry.sh ${BASE_DIR}/docker-entry.sh
-  chmod 755 "${BASE_DIR}/docker-entry.sh"
-
-
-
-
-  #
-  # generate docker file
-  #
-  if [ ! -f "${APP_DIR}/Dockerfile" ]
-  then
-    echo "FATAL error cannot locate ${APP_DIR}/Dockerfile"
-    exit 2
-  fi
-  cp -p ${APP_DIR}/Dockerfile ${STAGE}/Dockerfile
-
-  BUILD_PATH="${WORKSPACE}/target/stage" 
-  build_and_push_docker 
-  ;;
-*)
-  echo "==> unprocessed phase"
-  ;;
-esac
-
diff --git a/pom.xml b/pom.xml
index 9c559c6..5aae85c 100644 (file)
--- a/pom.xml
+++ b/pom.xml
-<!--\r
-================================================================================\r
-Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved.\r
-Copyright (c) 2018 Nokia. All rights reserved.\r
-================================================================================\r
-Licensed under the Apache License, Version 2.0 (the "License");\r
-you may not use this file except in compliance with the License.\r
-You may obtain a copy of the License at\r
-\r
-    http://www.apache.org/licenses/LICENSE-2.0\r
-\r
-Unless required by applicable law or agreed to in writing, software\r
-distributed under the License is distributed on an "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-See the License for the specific language governing permissions and\r
-limitations under the License.\r
-============LICENSE_END=========================================================\r
-\r
--->\r
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">\r
-    <modelVersion>4.0.0</modelVersion>\r
-\r
-    <parent>\r
-        <groupId>org.onap.oparent</groupId>\r
-        <artifactId>oparent</artifactId>\r
-        <version>0.1.1</version>\r
-        <relativePath/>\r
-    </parent>\r
-\r
-    <groupId>org.onap.dcaegen2.collectors.ves</groupId>\r
-    <artifactId>VESCollector</artifactId>\r
-    <version>1.3.0-SNAPSHOT</version>\r
-\r
-    <name>dcaegen2-collectors-ves</name>\r
-    <description>VESCollector</description>\r
-\r
-    <properties>\r
-        <main.basedir>${project.basedir}</main.basedir>\r
-\r
-        <!-- CODE COMPILATION VERSIONS -->\r
-        <compiler.source.version>1.8</compiler.source.version>\r
-        <compiler.target.version>1.8</compiler.target.version>\r
-\r
-        <!-- PLUGINS VERSIONS -->\r
-        <compiler.plugin.version>3.3</compiler.plugin.version>\r
-        <jar.plugin.version>2.4</jar.plugin.version>\r
-        <deploy.plugin.version>2.8</deploy.plugin.version>\r
-        <source.plugin.version>2.4</source.plugin.version>\r
-        <javadoc.plugin.version>2.10.4</javadoc.plugin.version>\r
-        <project.info.reports.plugin.version>2.6</project.info.reports.plugin.version>\r
-        <assembly.plugin.version>2.4.1</assembly.plugin.version>\r
-        <exec.plugin.version>1.2.1</exec.plugin.version>\r
-\r
-        <!--TEST SETTINGS -->\r
-        <surefire.redirectTestOutputToFile>true</surefire.redirectTestOutputToFile>\r
-\r
-        <!--PLUGIN SETTINGS -->\r
-        <dependency.locations.enabled>false</dependency.locations.enabled>\r
-\r
-        <!-- NEXUS RELATED SETTINGS -->\r
-        <nexusproxy>https://nexus.onap.org</nexusproxy>\r
-        <snapshots.path>content/repositories/snapshots/</snapshots.path>\r
-        <releases.path>content/repositories/releases/</releases.path>\r
-        <site.path>content/sites/site/org/onap/dcaegen2/collectors/ves/${project.artifactId}/${project.version}\r
-        </site.path>\r
-    </properties>\r
-\r
-    <build>\r
-        <pluginManagement>\r
-            <plugins>\r
-                <plugin>\r
-                    <groupId>org.apache.maven.plugins</groupId>\r
-                    <artifactId>maven-compiler-plugin</artifactId>\r
-                    <version>${compiler.plugin.version}</version>\r
-                    <configuration>\r
-                        <source>${compiler.target.version}</source>\r
-                        <target>${compiler.source.version}</target>\r
-                    </configuration>\r
-                </plugin>\r
-                <plugin>\r
-                    <groupId>org.apache.maven.plugins</groupId>\r
-                    <artifactId>maven-source-plugin</artifactId>\r
-                    <version>${source.plugin.version}</version>\r
-                    <configuration>\r
-                        <excludeResources>true</excludeResources>\r
-                    </configuration>\r
-                    <executions>\r
-                        <execution>\r
-                            <id>attach-sources</id>\r
-                            <phase>verify</phase>\r
-                            <goals>\r
-                                <goal>jar-no-fork</goal>\r
-                            </goals>\r
-                        </execution>\r
-                    </executions>\r
-                </plugin>\r
-                <plugin>\r
-                    <groupId>org.apache.maven.plugins</groupId>\r
-                    <artifactId>maven-jar-plugin</artifactId>\r
-                    <version>${jar.plugin.version}</version>\r
-                    <configuration>\r
-                        <archive>\r
-                            <manifest>\r
-                                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>\r
-                            </manifest>\r
-                            <manifestEntries>\r
-                                <Implementation-Build-Version>${project.version}</Implementation-Build-Version>\r
-                            </manifestEntries>\r
-                        </archive>\r
-                    </configuration>\r
-                </plugin>\r
-                <plugin>\r
-                    <artifactId>maven-assembly-plugin</artifactId>\r
-                    <version>${assembly.plugin.version}</version>\r
-                    <configuration>\r
-                        <descriptors>\r
-                            <descriptor>src/assembly/dep.xml</descriptor>\r
-                        </descriptors>\r
-                    </configuration>\r
-                    <executions>\r
-                        <execution>\r
-                            <id>make-assembly</id> <!-- this is used for inheritance merges -->\r
-                            <phase>package</phase> <!-- bind to the packaging phase -->\r
-                            <goals>\r
-                                <goal>single</goal>\r
-                            </goals>\r
-                        </execution>\r
-                    </executions>\r
-                </plugin>\r
-                <plugin>\r
-                    <groupId>org.apache.maven.plugins</groupId>\r
-                    <artifactId>maven-javadoc-plugin</artifactId>\r
-                    <version>${javadoc.plugin.version}</version>\r
-                    <configuration>\r
-                        <!-- minimize console output messages -->\r
-                        <quiet>true</quiet>\r
-                        <verbose>false</verbose>\r
-                        <useStandardDocletOptions>false</useStandardDocletOptions>\r
-                    </configuration>\r
-                    <executions>\r
-                        <execution>\r
-                            <id>aggregate</id>\r
-                            <phase>site</phase>\r
-                            <goals>\r
-                                <goal>aggregate</goal>\r
-                            </goals>\r
-                        </execution>\r
-                        <execution>\r
-                            <id>attach-javadoc</id>\r
-                            <goals>\r
-                                <goal>jar</goal>\r
-                            </goals>\r
-                        </execution>\r
-                    </executions>\r
-                </plugin>\r
-                <plugin>\r
-                    <groupId>org.codehaus.mojo</groupId>\r
-                    <artifactId>exec-maven-plugin</artifactId>\r
-                    <version>${exec.plugin.version}</version>\r
-                    <configuration>\r
-                        <executable>${session.executionRootDirectory}/mvn-phase-script.sh</executable>\r
-                        <environmentVariables>\r
-                            <!-- make mvn properties as env for our script -->\r
-                            <MVN_PROJECT_GROUPID>${project.groupId}</MVN_PROJECT_GROUPID>\r
-                            <MVN_PROJECT_ARTIFACTID>${project.artifactId}</MVN_PROJECT_ARTIFACTID>\r
-                            <MVN_PROJECT_VERSION>${project.version}</MVN_PROJECT_VERSION>\r
-                            <MVN_NEXUSPROXY>${onap.nexus.url}</MVN_NEXUSPROXY>\r
-                            <MVN_RAWREPO_BASEURL_UPLOAD>${onap.nexus.rawrepo.baseurl.upload}\r
-                            </MVN_RAWREPO_BASEURL_UPLOAD>\r
-                            <MVN_RAWREPO_BASEURL_DOWNLOAD>${onap.nexus.rawrepo.baseurl.download}\r
-                            </MVN_RAWREPO_BASEURL_DOWNLOAD>\r
-                            <MVN_RAWREPO_SERVERID>${onap.nexus.rawrepo.serverid}</MVN_RAWREPO_SERVERID>\r
-                            <MVN_DOCKERREGISTRY_DAILY>${onap.nexus.dockerregistry.daily}</MVN_DOCKERREGISTRY_DAILY>\r
-                            <MVN_DOCKERREGISTRY_RELEASE>${onap.nexus.dockerregistry.release}\r
-                            </MVN_DOCKERREGISTRY_RELEASE>\r
-                        </environmentVariables>\r
-                    </configuration>\r
-                </plugin>\r
-            </plugins>\r
-        </pluginManagement>\r
-        <plugins>\r
-            <plugin>\r
-                <groupId>org.apache.maven.plugins</groupId>\r
-                <artifactId>maven-compiler-plugin</artifactId>\r
-            </plugin>\r
-            <plugin>\r
-                <groupId>org.apache.maven.plugins</groupId>\r
-                <artifactId>maven-jar-plugin</artifactId>\r
-            </plugin>\r
-            <plugin>\r
-                <groupId>org.apache.maven.plugins</groupId>\r
-                <artifactId>maven-source-plugin</artifactId>\r
-            </plugin>\r
-            <plugin>\r
-                <groupId>org.apache.maven.plugins</groupId>\r
-                <artifactId>maven-javadoc-plugin</artifactId>\r
-            </plugin>\r
-            <plugin>\r
-                <artifactId>maven-assembly-plugin</artifactId>\r
-            </plugin>\r
-            <plugin>\r
-                <groupId>org.codehaus.mojo</groupId>\r
-                <artifactId>exec-maven-plugin</artifactId>\r
-                <version>${exec.plugin.version}</version>\r
-                <executions>\r
-                    <execution>\r
-                        <id>deploy script</id>\r
-                        <phase>deploy</phase>\r
-                        <goals>\r
-                            <goal>exec</goal>\r
-                        </goals>\r
-                        <configuration>\r
-                            <arguments>\r
-                                <argument>__</argument>\r
-                                <argument>deploy</argument>\r
-                            </arguments>\r
-                        </configuration>\r
-                    </execution>\r
-                    <execution>\r
-                        <id>install script</id>\r
-                        <phase>install</phase>\r
-                        <goals>\r
-                            <goal>exec</goal>\r
-                        </goals>\r
-                        <configuration>\r
-                            <arguments>\r
-                                <argument>__</argument>\r
-                                <argument>install</argument>\r
-                            </arguments>\r
-                        </configuration>\r
-                    </execution>\r
-                </executions>\r
-            </plugin>\r
-        </plugins>\r
-    </build>\r
-\r
-    <dependencyManagement>\r
-        <dependencies>\r
-            <dependency>\r
-                <groupId>com.github.fge</groupId>\r
-                <artifactId>json-schema-core</artifactId>\r
-                <version>1.2.5</version>\r
-            </dependency>\r
-            <dependency>\r
-                <groupId>javax.mail</groupId>\r
-                <artifactId>mail</artifactId>\r
-                <version>1.4.7</version>\r
-            </dependency>\r
-            <dependency>\r
-                <groupId>commons-collections</groupId>\r
-                <artifactId>commons-collections</artifactId>\r
-                <version>3.2.2</version>\r
-            </dependency>\r
-            <dependency>\r
-                <groupId>org.apache.httpcomponents</groupId>\r
-                <artifactId>httpclient</artifactId>\r
-                <version>4.5.3</version>\r
-            </dependency>\r
-            <dependency>\r
-                <groupId>com.fasterxml.jackson.core</groupId>\r
-                <artifactId>jackson-databind</artifactId>\r
-                <version>2.8.11</version>\r
-            </dependency>\r
-        </dependencies>\r
-    </dependencyManagement>\r
-\r
-    <dependencies>\r
-        <!-- JSON RELATED -->\r
-        <dependency>\r
-            <groupId>com.googlecode.json-simple</groupId>\r
-            <artifactId>json-simple</artifactId>\r
-            <version>1.1.1</version>\r
-        </dependency>\r
-        <dependency>\r
-            <groupId>com.github.fge</groupId>\r
-            <artifactId>json-schema-validator</artifactId>\r
-            <version>2.2.6</version>\r
-        </dependency>\r
-        <dependency>\r
-            <groupId>com.google.code.gson</groupId>\r
-            <artifactId>gson</artifactId>\r
-            <version>2.3.1</version>\r
-        </dependency>\r
-        <dependency>\r
-            <groupId>org.json</groupId>\r
-            <artifactId>json</artifactId>\r
-            <version>20160810</version>\r
-        </dependency>\r
-\r
-        <!-- REST API EXPOSURE RELATED -->\r
-        <dependency>\r
-            <groupId>org.apache.tomcat.embed</groupId>\r
-            <artifactId>tomcat-embed-core</artifactId>\r
-            <version>8.5.23</version>\r
-        </dependency>\r
-        <dependency>\r
-            <groupId>org.apache.tomcat</groupId>\r
-            <artifactId>tomcat-catalina</artifactId>\r
-            <version>8.5.23</version>\r
-        </dependency>\r
-        <dependency>\r
-            <groupId>org.apache.tomcat</groupId>\r
-            <artifactId>tomcat-coyote</artifactId>\r
-            <version>8.5.23</version>\r
-        </dependency>\r
-        <dependency>\r
-            <groupId>com.att.nsa</groupId>\r
-            <artifactId>nsaServerLibrary</artifactId>\r
-            <version>1.0.10</version>\r
-        </dependency>\r
-\r
-        <!-- LOGGING RELATED -->\r
-        <dependency>\r
-            <groupId>org.slf4j</groupId>\r
-            <artifactId>slf4j-log4j12</artifactId>\r
-            <version>1.7.21</version>\r
-        </dependency>\r
-        <dependency>\r
-            <groupId>log4j</groupId>\r
-            <artifactId>apache-log4j-extras</artifactId>\r
-            <version>1.2.17</version>\r
-        </dependency>\r
-\r
-        <!-- MISCELLANEOUS -->\r
-        <dependency>\r
-            <groupId>commons-configuration</groupId>\r
-            <artifactId>commons-configuration</artifactId>\r
-            <version>1.10</version>\r
-        </dependency>\r
-        <dependency>\r
-            <groupId>com.google.guava</groupId>\r
-            <artifactId>guava</artifactId>\r
-            <version>18.0</version>\r
-        </dependency>\r
-\r
-        <!-- TESTING -->\r
-        <dependency>\r
-            <groupId>org.mockito</groupId>\r
-            <artifactId>mockito-core</artifactId>\r
-            <version>2.18.0</version>\r
-            <scope>test</scope>\r
-        </dependency>\r
-        <dependency>\r
-            <groupId>org.assertj</groupId>\r
-            <artifactId>assertj-core</artifactId>\r
-            <version>3.8.0</version>\r
-            <scope>test</scope>\r
-        </dependency>\r
-    </dependencies>\r
-\r
-    <reporting>\r
-        <plugins>\r
-            <plugin>\r
-                <groupId>org.apache.maven.plugins</groupId>\r
-                <artifactId>maven-project-info-reports-plugin</artifactId>\r
-                <version>${project.info.reports.plugin.version}</version>\r
-                <reportSets>\r
-                    <reportSet>\r
-                        <reports>\r
-                            <report>dependencies</report>\r
-                            <report>license</report>\r
-                        </reports>\r
-                    </reportSet>\r
-                </reportSets>\r
-            </plugin>\r
-            <plugin>\r
-                <groupId>org.apache.maven.plugins</groupId>\r
-                <artifactId>maven-javadoc-plugin</artifactId>\r
-                <version>${javadoc.plugin.version}</version>\r
-                <configuration>\r
-                    <failOnError>false</failOnError>\r
-                    <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>\r
-                    <docletArtifact>\r
-                        <groupId>org.umlgraph</groupId>\r
-                        <artifactId>umlgraph</artifactId>\r
-                        <version>5.6</version>\r
-                    </docletArtifact>\r
-                    <additionalparam>-views</additionalparam>\r
-                    <useStandardDocletOptions>true</useStandardDocletOptions>\r
-                </configuration>\r
-            </plugin>\r
-        </plugins>\r
-    </reporting>\r
-\r
-    <repositories>\r
-        <repository>\r
-            <id>external-repository</id>\r
-            <url>https://oss.sonatype.org/content/repositories</url>\r
-        </repository>\r
-    </repositories>\r
-\r
-    <pluginRepositories>\r
-        <!-- Black Duck plugin dependencies -->\r
-        <pluginRepository>\r
-            <id>JCenter</id>\r
-            <name>JCenter Repository</name>\r
-            <url>http://jcenter.bintray.com</url>\r
-        </pluginRepository>\r
-        <pluginRepository>\r
-            <id>Restlet</id>\r
-            <name>Restlet Repository</name>\r
-            <url>http://maven.restlet.com</url>\r
-        </pluginRepository>\r
-    </pluginRepositories>\r
-\r
-</project>\r
+<!--
+================================================================================
+Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved.
+Copyright (c) 2018 Nokia. 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=========================================================
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.onap.oparent</groupId>
+        <artifactId>oparent</artifactId>
+        <version>0.1.1</version>
+        <relativePath/>
+    </parent>
+
+    <groupId>org.onap.dcaegen2.collectors.ves</groupId>
+    <artifactId>VESCollector</artifactId>
+    <version>1.3.0-SNAPSHOT</version>
+
+    <name>dcaegen2-collectors-ves</name>
+    <description>VESCollector</description>
+
+    <properties>
+        <!-- PROJECT SETTINGS -->
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <java.version>8</java.version>
+        <docker.image.name>onap/org.onap.dcaegen2.collectors.ves.vescollector</docker.image.name>
+
+        <!-- TEST SETTINGS -->
+        <surefire.redirectTestOutputToFile>true</surefire.redirectTestOutputToFile>
+
+        <!-- PLUGIN SETTINGS -->
+        <dependency.locations.enabled>false</dependency.locations.enabled>
+
+        <!-- NEXUS RELATED SETTINGS -->
+        <nexusproxy>https://nexus.onap.org</nexusproxy>
+        <snapshots.path>content/repositories/snapshots/</snapshots.path>
+        <releases.path>content/repositories/releases/</releases.path>
+        <site.path>
+            content/sites/site/org/onap/dcaegen2/collectors/ves/${project.artifactId}/${project.version}
+        </site.path>
+    </properties>
+
+    <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <artifactId>maven-compiler-plugin</artifactId>
+                    <version>3.7.0</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-source-plugin</artifactId>
+                    <version>3.0.1</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-jar-plugin</artifactId>
+                    <version>3.1.0</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-assembly-plugin</artifactId>
+                    <version>3.1.0</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-javadoc-plugin</artifactId>
+                    <version>3.0.1</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-project-info-reports-plugin</artifactId>
+                    <version>2.9</version>
+                </plugin>
+                <plugin>
+                    <groupId>com.spotify</groupId>
+                    <artifactId>docker-maven-plugin</artifactId>
+                    <version>1.1.1</version>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+
+        <plugins>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>${java.version}</source>
+                    <target>${java.version}</target>
+                    <showWarnings>true</showWarnings>
+                    <showDeprecation>true</showDeprecation>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <artifactId>maven-source-plugin</artifactId>
+                <configuration>
+                    <excludeResources>true</excludeResources>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>attach-sources</id>
+                        <phase>verify</phase>
+                        <goals>
+                            <goal>jar-no-fork</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <archive>
+                        <manifest>
+                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+                        </manifest>
+                        <manifestEntries>
+                            <Implementation-Build-Version>${project.version}</Implementation-Build-Version>
+                        </manifestEntries>
+                    </archive>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <configuration>
+                    <descriptors>
+                        <descriptor>src/assembly/dep.xml</descriptor>
+                    </descriptors>
+                    <attach>false</attach>
+                    <appendAssemblyId>false</appendAssemblyId>
+                    <updateOnly>true</updateOnly>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>make-assembly</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <configuration>
+                    <!-- minimize console output messages -->
+                    <quiet>true</quiet>
+                    <verbose>false</verbose>
+                    <useStandardDocletOptions>false</useStandardDocletOptions>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>aggregate</id>
+                        <phase>site</phase>
+                        <goals>
+                            <goal>aggregate</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>attach-javadoc</id>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>com.spotify</groupId>
+                <artifactId>docker-maven-plugin</artifactId>
+                <configuration>
+                    <serverId>${onap.nexus.dockerregistry.daily}</serverId>
+                    <imageName>${docker.image.name}</imageName>
+                    <imageTags>
+                        <tag>latest</tag>
+                    </imageTags>
+
+                    <baseImage>openjdk:8-jre-slim</baseImage>
+                    <env>
+                        <HOSTALIASES>/etc/host.aliases</HOSTALIASES>
+                    </env>
+                    <workdir>/opt/app/VESCollector</workdir>
+                    <resources>
+                        <resource>
+                            <targetPath>.</targetPath>
+                            <directory>${project.build.directory}/${project.artifactId}-${project.version}</directory>
+                        </resource>
+                    </resources>
+                    <runs>
+                        <run>chmod +x bin/*.sh</run> <!-- Maven is loosing file permissions during artifacts copy -->
+                    </runs>
+                    <exposes>
+                        <expose>8080</expose>
+                        <expose>8443</expose>
+                    </exposes>
+                    <cmd>bin/docker-entry.sh</cmd>
+                </configuration>
+
+                <executions>
+                    <execution>
+                        <id>build-image</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>build</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>tag-and-push-image-latest</id>
+                        <phase>deploy</phase>
+                        <goals>
+                            <goal>tag</goal>
+                        </goals>
+                        <configuration>
+                            <image>${docker.image.name}:latest</image>
+                            <newName>${onap.nexus.dockerregistry.daily}/${docker.image.name}:latest</newName>
+                            <pushImage>true</pushImage>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>tag-and-push-image-with-version</id>
+                        <phase>deploy</phase>
+                        <goals>
+                            <goal>tag</goal>
+                        </goals>
+                        <configuration>
+                            <image>${docker.image.name}:latest</image>
+                            <newName>${onap.nexus.dockerregistry.daily}/${docker.image.name}:${project.version}</newName>
+                            <pushImage>true</pushImage>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>tag-and-push-image-with-version-and-date</id>
+                        <phase>deploy</phase>
+                        <goals>
+                            <goal>tag</goal>
+                        </goals>
+                        <configuration>
+                            <image>${docker.image.name}:latest</image>
+                            <newName>${onap.nexus.dockerregistry.daily}/${docker.image.name}:${project.version}-${maven.build.timestamp}Z</newName>
+                            <pushImage>true</pushImage>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <reporting>
+        <plugins>
+            <plugin>
+                <artifactId>maven-project-info-reports-plugin</artifactId>
+                <reportSets>
+                    <reportSet>
+                        <reports>
+                            <report>dependencies</report>
+                            <report>license</report>
+                        </reports>
+                    </reportSet>
+                </reportSets>
+            </plugin>
+
+            <plugin>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <configuration>
+                    <failOnError>false</failOnError>
+                    <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
+                    <docletArtifact>
+                        <groupId>org.umlgraph</groupId>
+                        <artifactId>umlgraph</artifactId>
+                        <version>5.6</version>
+                    </docletArtifact>
+                    <additionalparam>-views</additionalparam>
+                    <useStandardDocletOptions>true</useStandardDocletOptions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </reporting>
+
+    <dependencies>
+        <!-- JSON RELATED -->
+        <dependency>
+            <groupId>com.googlecode.json-simple</groupId>
+            <artifactId>json-simple</artifactId>
+            <version>1.1.1</version>
+        </dependency>
+        <dependency>
+            <groupId>com.github.fge</groupId>
+            <artifactId>json-schema-validator</artifactId>
+            <version>2.2.6</version>
+        </dependency>
+        <dependency>
+            <groupId>com.github.fge</groupId>
+            <artifactId>json-schema-core</artifactId>
+            <version>1.2.5</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.3.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.json</groupId>
+            <artifactId>json</artifactId>
+            <version>20160810</version>
+        </dependency>
+
+        <!-- REST API RELATED -->
+        <dependency>
+            <groupId>org.apache.tomcat.embed</groupId>
+            <artifactId>tomcat-embed-core</artifactId>
+            <version>8.5.23</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-catalina</artifactId>
+            <version>8.5.23</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-coyote</artifactId>
+            <version>8.5.23</version>
+        </dependency>
+        <dependency>
+            <groupId>com.att.nsa</groupId>
+            <artifactId>nsaServerLibrary</artifactId>
+            <version>1.0.10</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.5.3</version>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+            <version>2.8.11</version>
+        </dependency>
+
+        <!-- LOGGING RELATED -->
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <version>1.7.21</version>
+        </dependency>
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>apache-log4j-extras</artifactId>
+            <version>1.2.17</version>
+        </dependency>
+
+        <!-- MISCELLANEOUS -->
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+            <version>18.0</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-collections</groupId>
+            <artifactId>commons-collections</artifactId>
+            <version>3.2.2</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-configuration</groupId>
+            <artifactId>commons-configuration</artifactId>
+            <version>1.10</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.mail</groupId>
+            <artifactId>mail</artifactId>
+            <version>1.4.7</version>
+        </dependency>
+
+        <!-- TESTING -->
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+            <version>2.18.0</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+            <version>3.8.0</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <repositories>
+        <repository>
+            <id>external-repository</id>
+            <url>https://oss.sonatype.org/content/repositories</url>
+        </repository>
+    </repositories>
+
+    <pluginRepositories>
+        <!-- Black Duck plugin dependencies -->
+        <pluginRepository>
+            <id>JCenter</id>
+            <name>JCenter Repository</name>
+            <url>http://jcenter.bintray.com</url>
+        </pluginRepository>
+        <pluginRepository>
+            <id>Restlet</id>
+            <name>Restlet Repository</name>
+            <url>http://maven.restlet.com</url>
+        </pluginRepository>
+    </pluginRepositories>
+
+</project>
index b322fba..7d72f84 100644 (file)
@@ -1,86 +1,79 @@
 <!--
-  ============LICENSE_START=======================================================
-  PROJECT
-  ================================================================================
-  Copyright (C) 2017 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=========================================================
-  -->
+================================================================================
+Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved.
+Copyright (c) 2018 Nokia. 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
 
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" 
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
-  <id>bundle</id>
-  <formats>
-    <format>tar.gz</format>
-  </formats>
-  <files>
-       <file>
-               <source>target/${project.artifactId}-${project.version}.jar</source>
-               <outputDirectory>lib</outputDirectory>
-       </file>
-  </files>
-  <fileSets>
-    <fileSet>
-        <directory>src/main/scripts</directory>
-        <outputDirectory>bin</outputDirectory>
-        <includes>
-               <include>**/*.sh</include>
-        </includes>
-        <fileMode>0755</fileMode>
-        <lineEnding>unix</lineEnding>
-    </fileSet>
-    <fileSet>
-        <directory>etc</directory>
-        <outputDirectory>etc</outputDirectory>
-    </fileSet>
-    <fileSet>
-        <directory>src/main/resources</directory>
-                <includes>
-               <include>**/*.conf</include>
-        </includes>
-        <outputDirectory>etc</outputDirectory>
-    </fileSet>
-    <fileSet>
-        <directory>dpo/data-formats</directory>
-                <includes>
-               <include>**/*.json</include>
-        </includes>
-        <outputDirectory>specs</outputDirectory>
-    </fileSet>
-    <fileSet>
-        <directory>dpo/spec</directory>
-                <includes>
-               <include>**/*.json</include>
-        </includes>
-        <outputDirectory>specs</outputDirectory>
-    </fileSet>
-    <fileSet>
-        <directory>./</directory>
-         <includes>
-               <include>Dockerfile</include>
-        </includes>
-        <outputDirectory>./</outputDirectory>
-    </fileSet>
-  </fileSets>
-  <dependencySets>
-       <dependencySet>
-               <includes>
-                       <include>*:jar</include>
-               </includes>
-               <outputDirectory>lib</outputDirectory>
-       </dependencySet>
-  </dependencySets>
-</assembly>
+    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=========================================================
+-->
+
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/2.0.0"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
+
+    <id>bundle</id>
+    <includeBaseDirectory>false</includeBaseDirectory>
+    <formats>
+        <format>dir</format>
+    </formats>
+
+    <fileSets>
+        <fileSet>
+            <directory>src/main/scripts</directory>
+            <outputDirectory>bin</outputDirectory>
+            <includes>
+                <include>**/*.sh</include>
+            </includes>
+            <fileMode>0755</fileMode>
+            <lineEnding>unix</lineEnding>
+        </fileSet>
 
+        <fileSet>
+            <directory>etc</directory>
+            <outputDirectory>etc</outputDirectory>
+        </fileSet>
+
+        <fileSet>
+            <directory>src/main/resources</directory>
+            <includes>
+                <include>**/*.conf</include>
+            </includes>
+            <outputDirectory>etc</outputDirectory>
+        </fileSet>
+
+        <fileSet>
+            <directory>dpo/data-formats</directory>
+            <includes>
+                <include>**/*.json</include>
+            </includes>
+            <outputDirectory>specs</outputDirectory>
+        </fileSet>
+
+        <fileSet>
+            <directory>dpo/spec</directory>
+            <includes>
+                <include>**/*.json</include>
+            </includes>
+            <outputDirectory>specs</outputDirectory>
+        </fileSet>
+    </fileSets>
+
+    <dependencySets>
+        <dependencySet>
+            <scope>runtime</scope>
+            <useProjectArtifact>true</useProjectArtifact>
+            <unpack>false</unpack>
+            <outputDirectory>lib</outputDirectory>
+        </dependencySet>
+    </dependencySets>
+</assembly>
index 4e3fd83..c883f6d 100644 (file)
@@ -32,7 +32,7 @@ BASEDIR=/opt/app/VESCollector/
 \r
 collector_start() {\r
         echo `date +"%Y%m%d.%H%M%S%3N"` - collector_start | tee -a ${BASEDIR}/logs/console.txt\r
-        collectorPid=`pgrep -f org.onap.dcae.commonFunction`\r
+        collectorPid=`pidof org.onap.dcae.commonFunction`\r
 \r
         if [ ! -z "$collectorPid" ]; then\r
                 echo  "WARNING: VES Restful Collector already running as PID $collectorPid" | tee -a ${BASEDIR}/logs/console.txt\r
@@ -56,13 +56,13 @@ collector_start() {
 \r
 collector_stop() {\r
          echo `date +"%Y%m%d.%H%M%S%3N"` - collector_stop\r
-         collectorPid=`pgrep -f org.onap.dcae.commonFunction`\r
+         collectorPid=`pidof org.onap.dcae.commonFunction`\r
          if [ ! -z "$collectorPid" ]; then\r
                 echo "Stopping PID $collectorPid"\r
 \r
                 kill -9 $collectorPid\r
                 sleep 5\r
-                if [ ! "$(pgrep -f org.onap.dcae.commonFunction)" ]; then\r
+                if [ ! "$(pidof org.onap.dcae.commonFunction)" ]; then\r
                          echo "VES Restful Collector has been stopped!!!"\r
                 else\r
                          echo "VES Restful Collector is being stopped!!!"\r
@@ -107,16 +107,16 @@ collector_configupdate() {
                     else\r
                         echo "INFO: Dynamic config updated successfully into VESCollector configuration!"\r
                     fi\r
-                    \r
+\r
                                        # Identify alias names from keystore and password provided\r
-         \r
+\r
                        paramName="collector.keystore.alias"\r
                                        localpropertyfile="/opt/app/VESCollector/etc/collector.properties"\r
                                        tmpfile="/opt/app/VESCollector/etc/collector.properties.tmp"\r
-                                       \r
+\r
                                        keystore=`grep collector.keystore.file.location $localpropertyfile | tr -d '[:space:]' | cut -d"=" -f2`\r
                                        keypwdfile=`grep collector.keystore.passwordfile $localpropertyfile | tr -d '[:space:]' | cut -d"=" -f2`\r
-                                               \r
+\r
                                        echo "/usr/bin/keytool -list -keystore $keystore < $keypwdfile | grep "PrivateKeyEntry" | cut -d"," -f1"\r
                     tmpalias=`/usr/bin/keytool -list -keystore $keystore < $keypwdfile | grep "PrivateKeyEntry" | cut -d"," -f1`\r
                     echo "tmpalias:" $tmpalias\r
@@ -126,7 +126,7 @@ collector_configupdate() {
                     echo `cat $tmpfile > $localpropertyfile`\r
                     rm $tmpfile\r
                        echo "INFO: Keystore alias updated into configuration"\r
-                  \r
+\r
             else\r
                 echo "ERROR: Configuration file /opt/app/KV-Configuration.json missing"\r
             fi\r