diff options
31 files changed, 791 insertions, 326 deletions
diff --git a/onboarding/pom.xml b/onboarding/pom.xml index eb23f1e7d0..b49b7801df 100644 --- a/onboarding/pom.xml +++ b/onboarding/pom.xml @@ -35,7 +35,7 @@ <mvn.war.version>2.1.1</mvn.war.version> <!-- Onboarding artifacts version --> - <openecomp.sdc.common.version>1.1.0-SNAPSHOT</openecomp.sdc.common.version> + <openecomp.sdc.common.version>${project.version}</openecomp.sdc.common.version> <!-- Onboarding 3rd party versions --> <jtosca.version>1.1.10-SNAPSHOT</jtosca.version> @@ -7,7 +7,6 @@ <version>1.1.0-SNAPSHOT</version> <packaging>pom</packaging> <name>sdc</name> - <properties> <!-- ==================== --> diff --git a/sdc-os-chef/pom.xml b/sdc-os-chef/pom.xml index 654284741c..62769b62d5 100644 --- a/sdc-os-chef/pom.xml +++ b/sdc-os-chef/pom.xml @@ -1,43 +1,45 @@ <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"> + 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> + <modelVersion>4.0.0</modelVersion> - <artifactId>sdc-os-chef</artifactId> + <artifactId>sdc-os-chef</artifactId> - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>sdc-main</artifactId> + <parent> + <groupId>org.openecomp.sdc</groupId> + <artifactId>sdc-main</artifactId> <version>1.1.0-SNAPSHOT</version> - </parent> + </parent> - <properties> - <docker.tag>${project.version}-${maven.build.timestamp}</docker.tag> - <docker.latest.tag>${project.version}-latest</docker.latest.tag> - </properties> + <properties> + <docker.tag>${project.version}-${maven.build.timestamp}</docker.tag> + <docker.latest.tag>${project.version}-latest</docker.latest.tag> + </properties> - <build> - <plugins> - <plugin> - <artifactId>maven-clean-plugin</artifactId> - <version>3.0.0</version> - <executions> - <execution> - <id>clean.tosca.chef.os.folder</id> - <phase>clean</phase> - <goals> - <goal>clean</goal> - </goals> - <configuration> - <filesets> - <fileset> - <directory>${project.basedir}\sdc-cassandra\chef-repo\cookbooks\cassandra-actions\attributes\</directory> - <followSymlinks>false</followSymlinks> - <includes> - <include>**/default.rb</include> - </includes> - </fileset> + <build> + <plugins> + <plugin> + <artifactId>maven-clean-plugin</artifactId> + <version>3.0.0</version> + <executions> + <execution> + <id>clean.tosca.chef.os.folder</id> + <phase>clean</phase> + <goals> + <goal>clean</goal> + </goals> + <configuration> + <filesets> + <fileset> + <directory> + ${project.basedir}\sdc-cassandra\chef-repo\cookbooks\cassandra-actions\attributes\ + </directory> + <followSymlinks>false</followSymlinks> + <includes> + <include>**/default.rb</include> + </includes> + </fileset> <!-- static configuration files --> <fileset> <directory>${project.parent.basedir}/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default</directory> @@ -48,77 +50,83 @@ <include>logback.xml</include> </includes> </fileset> - </filesets> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>ru.yaal.maven</groupId> - <artifactId>write-text-files-maven-plugin</artifactId> - <version>1.1</version> - <configuration> - <charset>UTF-8</charset> - <files> - <file> - <path>${project.basedir}\sdc-cassandra\chef-repo\cookbooks\cassandra-actions\attributes\default.rb</path> - <lines> - <line>normal['version'] = "${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}"</line> - </lines> - </file> - </files> - </configuration> - <executions> - <execution> - <id>write-text-files</id> - <phase>prepare-package</phase> - <goals> - <goal>write-text-files</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> + </filesets> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>ru.yaal.maven</groupId> + <artifactId>write-text-files-maven-plugin</artifactId> + <version>1.1</version> + <configuration> + <charset>UTF-8</charset> + <files> + <file> + <path> + ${project.basedir}\sdc-cassandra\chef-repo\cookbooks\cassandra-actions\attributes\default.rb + </path> + <lines> + <line>normal['version'] = + "${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}" + </line> + </lines> + </file> + </files> + </configuration> + <executions> + <execution> + <id>write-text-files</id> + <phase>prepare-package</phase> + <goals> + <goal>write-text-files</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> - <profiles> - <profile> - <id>docker-staging</id> - <properties> - <docker.tag>${project.version}-STAGING-${maven.build.timestamp}</docker.tag> - <docker.latest.tag>${project.version}-STAGING-latest</docker.latest.tag> - </properties> - </profile> + <profiles> + <profile> + <id>docker-staging</id> + <properties> + <docker.tag>${project.version}-STAGING-${maven.build.timestamp}</docker.tag> + <docker.latest.tag>${project.version}-STAGING-latest</docker.latest.tag> + </properties> + </profile> - <profile> - <id>docker</id> - <activation> - <activeByDefault>false</activeByDefault> - </activation> - <build> - <plugins> - <plugin> - <artifactId>maven-resources-plugin</artifactId> - <version>3.0.2</version> - <executions> - <execution> - <id>copy-resources-apidocs</id> - <phase>validate</phase> - <goals> - <goal>copy-resources</goal> - </goals> - <configuration> - <outputDirectory>${basedir}/sdc-backend</outputDirectory> - <resources> - <resource> - <directory>${project.parent.basedir}/openecomp-be/tools/swagger-ui/api-docs</directory> - <includes> - <include>api-docs.war</include> - </includes> - </resource> - </resources> - </configuration> - </execution> + <profile> + <id>docker</id> + <activation> + <activeByDefault>false</activeByDefault> + </activation> + <build> + <plugins> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <version>3.0.2</version> + <executions> + <execution> + <id>copy-resources-apidocs</id> + <phase>validate</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${basedir}/sdc-backend</outputDirectory> + <resources> + <resource> + <directory> + ${project.parent.basedir}/openecomp-be/tools/swagger-ui/api-docs + </directory> + <includes> + <include>api-docs.war</include> + </includes> + </resource> + </resources> + </configuration> + </execution> <execution> <id>copy-static-configuration-files</id> @@ -142,185 +150,224 @@ </configuration> </execution> - <execution> - <id>copy-resources-be</id> - <phase>validate</phase> - <goals> - <goal>copy-resources</goal> - </goals> - <configuration> - <outputDirectory>${basedir}/sdc-backend</outputDirectory> - <resources> - <resource> - <directory>${project.parent.basedir}/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/target</directory> - <includes> - <include>onboarding-be-${project.version}.war</include> - </includes> - </resource> - </resources> - </configuration> - </execution> - <execution> - <id>copy-resources-fe</id> - <phase>validate</phase> - <goals> - <goal>copy-resources</goal> - </goals> - <configuration> - <outputDirectory>${basedir}/sdc-frontend</outputDirectory> - <resources> - <resource> - <directory>${project.parent.basedir}/openecomp-ui/target</directory> - <includes> - <include>onboarding-fe-${project.version}.war</include> - </includes> - </resource> - </resources> - </configuration> - </execution> - </executions> - </plugin> - + <execution> + <id>copy-resources-be</id> + <phase>validate</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${basedir}/sdc-backend</outputDirectory> + <resources> + <resource> + <directory> + ${project.parent.basedir}/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/target + </directory> + <includes> + <include>onboarding-be-${project.version}.war</include> + </includes> + </resource> + </resources> + </configuration> + </execution> + <execution> + <id>copy-resources-fe</id> + <phase>validate</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${basedir}/sdc-frontend</outputDirectory> + <resources> + <resource> + <directory>${project.parent.basedir}/openecomp-ui/target</directory> + <includes> + <include>onboarding-fe-${project.version}.war</include> + </includes> + </resource> + </resources> + </configuration> + </execution> + <execution> + <id>copy-tests-suites</id> + <phase>validate</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/testSuites</outputDirectory> + <resources> + <resource> + <directory>${project.parent.basedir}/test-apis-ci/src/main/resources/ci/testSuites</directory> + <includes> + <include>*</include> + </includes> + </resource> + </resources> + </configuration> + </execution> + <execution> + <id>copy-resources-test-apis-ci</id> + <phase>validate</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${basedir}/sdc-sanity</outputDirectory> + <resources> + <resource> + <directory>${project.parent.basedir}/test-apis-ci/target</directory> + <includes> + <include>test-apis-ci-${project.version}-jar-with-dependencies.jar</include> + </includes> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> - <plugin> - <groupId>io.fabric8</groupId> - <artifactId>docker-maven-plugin</artifactId> - <version>0.22.1</version> + <plugin> + <groupId>io.fabric8</groupId> + <artifactId>docker-maven-plugin</artifactId> + <version>0.19.1</version> - <configuration> - <verbose>false</verbose> - <apiVersion>1.23</apiVersion> + <configuration> + <verbose>true</verbose> + <apiVersion>1.23</apiVersion> - <images> + <images> - <!-- Build backend image --> - <image> - <name>openecomp/sdc-backend</name> - <alias>sdc-backend</alias> - <build> - <cleanup>try</cleanup> - <dockerFileDir>${project.basedir}/sdc-backend</dockerFileDir> - <tags> - <tag>${docker.tag}</tag> - <tag>${docker.latest.tag}</tag> - <tag>1.1-STAGING-latest</tag> - </tags> - </build> - </image> + <!-- Build backend image --> + <image> + <name>openecomp/sdc-backend</name> + <alias>sdc-backend</alias> + <build> + <cleanup>try</cleanup> + <dockerFileDir>${project.basedir}/sdc-backend</dockerFileDir> + <tags> + <tag>${docker.tag}</tag> + <tag>${docker.latest.tag}</tag><tag>$sedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest</tag> + <tag>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest</tag> + </tags> + </build> + </image> - <!-- Build frontend image --> - <image> - <name>openecomp/sdc-frontend</name> - <alias>sdc-frontend</alias> - <build> - <cleanup>try</cleanup> - <dockerFileDir>${project.basedir}/sdc-frontend</dockerFileDir> - <tags> - <tag>${docker.tag}</tag> - <tag>${docker.latest.tag}</tag> - <tag>1.1-STAGING-latest</tag> - </tags> - </build> - </image> + <!-- Build frontend image --> + <image> + <name>openecomp/sdc-frontend</name> + <alias>sdc-frontend</alias> + <build> + <cleanup>try</cleanup> + <dockerFileDir>${project.basedir}/sdc-frontend</dockerFileDir> + <tags> + <tag>${docker.tag}</tag> + <tag>${docker.latest.tag}</tag> + <tag>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest</tag> + </tags> + </build> + </image> - <!-- Build elastic search image --> - <image> - <name>openecomp/sdc-elasticsearch</name> - <alias>sdc-elasticsearch</alias> - <build> - <cleanup>try</cleanup> - <dockerFileDir>${project.basedir}/sdc-elasticsearch</dockerFileDir> - <tags> - <tag>${docker.tag}</tag> - <tag>${docker.latest.tag}</tag> - <tag>1.1-STAGING-latest</tag> - </tags> - </build> - </image> + <!-- Build elastic search image --> + <image> + <name>openecomp/sdc-elasticsearch</name> + <alias>sdc-elasticsearch</alias> + <build> + <cleanup>try</cleanup> + <dockerFileDir>${project.basedir}/sdc-elasticsearch</dockerFileDir> + <tags> + <tag>${docker.tag}</tag> + <tag>${docker.latest.tag}</tag> + <tag>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest</tag> + </tags> + </build> + </image> - <!-- Build kibana image --> - <image> - <name>openecomp/sdc-kibana</name> - <alias>sdc-kibana</alias> - <build> - <cleanup>try</cleanup> - <dockerFileDir>${project.basedir}/sdc-kibana</dockerFileDir> - <tags> - <tag>${docker.tag}</tag> - <tag>${docker.latest.tag}</tag> - <tag>1.1-STAGING-latest</tag> - </tags> - </build> - </image> + <!-- Build kibana image --> + <image> + <name>openecomp/sdc-kibana</name> + <alias>sdc-kibana</alias> + <build> + <cleanup>try</cleanup> + <dockerFileDir>${project.basedir}/sdc-kibana</dockerFileDir> + <tags> + <tag>${docker.tag}</tag> + <tag>${docker.latest.tag}</tag> + <tag>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest</tag> + </tags> + </build> + </image> - <!-- Build cassandra image --> - <image> - <name>openecomp/sdc-cassandra</name> - <alias>sdc-cassandra</alias> - <build> - <cleanup>try</cleanup> - <dockerFileDir>${project.basedir}/sdc-cassandra</dockerFileDir> - <tags> - <tag>${docker.tag}</tag> - <tag>${docker.latest.tag}</tag> - <tag>1.1-STAGING-latest</tag> - </tags> - </build> - </image> + <!-- Build cassandra image --> + <image> + <name>openecomp/sdc-cassandra</name> + <alias>sdc-cassandra</alias> + <build> + <cleanup>try</cleanup> + <dockerFileDir>${project.basedir}/sdc-cassandra</dockerFileDir> + <tags> + <tag>${docker.tag}</tag> + <tag>${docker.latest.tag}</tag> + <tag>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest</tag> + </tags> + </build> + </image> - <!-- Build sanity image --> - <!-- <image> - <name>openecomp/sdc-sanity</name> - <alias>sdc-sanity</alias> - <build> - <cleanup>try</cleanup> - <dockerFileDir>${project.basedir}/sdc-sanity</dockerFileDir> - <tags> - <tag>${docker.tag}</tag> - <tag>${docker.latest.tag}</tag> - <tag>1.1-STAGING-latest</tag> - </tags> - </build> - </image> --> + <!-- Build sanity image --> + <image> + <name>openecomp/sdc-sanity</name> + <alias>sdc-sanity</alias> + <build> + <cleanup>try</cleanup> + <dockerFileDir>${project.basedir}/sdc-sanity</dockerFileDir> + <tags> + <tag>${docker.tag}</tag> + <tag>${docker.latest.tag}</tag> + <tag>1.1-STAGING-latest</tag> + </tags> + </build> + </image> - </images> - </configuration> - <executions> - <execution> + </images> + </configuration> + <executions> + <execution> <id>clean-images</id> <phase>pre-clean</phase> <goals> - <goal>remove</goal> + <goal>remove</goal> </goals> <configuration> - <removeAll>true</removeAll> + <removeAll>true</removeAll> + <image>openecomp/sdc-backend,openecomp/sdc-frontend,openecomp/sdc-elasticsearch,openecomp/sdc-kibana,openecomp/sdc-sanity<!-- ,openecomp/sdc-sanity --></image> </configuration> - </execution> + </execution> - <execution> - <id>generate-images</id> - <phase>package</phase> - <goals> - <goal>build</goal> - </goals> - </execution> + <execution> + <id>generate-images</id> + <phase>package</phase> + <goals> + <goal>build</goal> + </goals> + </execution> - <execution> + <execution> <id>push-images</id> <phase>deploy</phase> <goals> - <goal>build</goal> - <goal>push</goal> + <goal>build</goal> + <goal>push</goal> </goals> <configuration> - <image>openecomp/sdc-backend,openecomp/sdc-frontend,openecomp/sdc-elasticsearch,openecomp/sdc-kibana,openecomp/sdc-cassandra<!--,openecomp/sdc-sanity--></image> + <image> + openecomp/sdc-backend,openecomp/sdc-frontend,openecomp/sdc-elasticsearch,openecomp/sdc-kibana,openecomp/sdc-sanity<!-- ,openecomp/sdc-sanity --></image> </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - </profiles> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> </project> diff --git a/sdc-os-chef/scripts/docker_run.sh b/sdc-os-chef/scripts/docker_run.sh index c79dad2d56..d645f94b93 100755 --- a/sdc-os-chef/scripts/docker_run.sh +++ b/sdc-os-chef/scripts/docker_run.sh @@ -2,7 +2,7 @@ function usage { - echo "usage: docker_run.sh [ -r|--release <RELEASE-NAME> ] [ -e|--environment <ENV-NAME> ] [ -p|--port <Docker-hub-port>] [ -l|--local <Run-without-pull>] [ -h|--help ]" + echo "usage: docker_run.sh [ -r|--release <RELEASE-NAME> ] [ -e|--environment <ENV-NAME> ] [ -p|--port <Docker-hub-port>] [ -l|--local <Run-without-pull>] [ -s|--skipTests <Run-without-sanityDocker>] [ -h|--help ]" } @@ -25,6 +25,7 @@ function dir_perms { RELEASE=latest LOCAL=false +SKIPTESTS=false [ -f /opt/config/env_name.txt ] && DEP_ENV=$(cat /opt/config/env_name.txt) || DEP_ENV=__ENV-NAME__ [ -f /opt/config/nexus_username.txt ] && NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) || NEXUS_USERNAME=release [ -f /opt/config/nexus_password.txt ] && NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) || NEXUS_PASSWD=sfWU3DFVdBr7GVxB85mTYgAW @@ -48,6 +49,10 @@ while [ "$1" != "" ]; do shift LOCAL=true ;; + -s | --skipTests ) + shift + SKIPTESTS=true + ;; -h | --help ) usage exit @@ -157,3 +162,12 @@ if [ $? -ne 0 ]; then exit 1 fi +# sanityDocker +echo "docker run sdc-frontend..." +if [ ${SKIPTESTS} = false ]; then +echo "Triger sanity docker, please wait..." + if [ ${LOCAL} = false ]; then + docker pull ${PREFIX}/sdc-sanity:${RELEASE} + fi + docker run --detach --name sdc-sanity --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env http_proxy=${http_proxy} --env https_proxy=${https_proxy} --env no_proxy=${no_proxy} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --memory 512m --memory-swap=512m --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume /data/logs/sdc-sanity/target:/var/lib/tests/target --volume /data/logs/sdc-sanity/ExtentReport:/var/lib/tests/ExtentReport --volume /data/environments:/root/chef-solo/environments --publish 9560:9560 ${PREFIX}/sdc-sanity:${RELEASE} +fi diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/attributes/default.rb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/attributes/default.rb index c7f408f294..dac5853353 100644 --- a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/attributes/default.rb +++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/attributes/default.rb @@ -1 +1,2 @@ -normal['version'] = "1.1.0" +normal['version'] = + "1.1.0" diff --git a/sdc-os-chef/sdc-sanity/Dockerfile b/sdc-os-chef/sdc-sanity/Dockerfile index ea137b401b..38bf26641e 100644 --- a/sdc-os-chef/sdc-sanity/Dockerfile +++ b/sdc-os-chef/sdc-sanity/Dockerfile @@ -4,6 +4,13 @@ COPY chef-solo /root/chef-solo/ COPY chef-repo/cookbooks/. /root/chef-solo/cookbooks/ + +ENV TESTS_BASE /var/lib/tests +RUN mkdir -p "$TESTS_BASE" +WORKDIR $TESTS_BASE + +ADD test-apis-ci-*.jar ${TESTS_BASE}/ + COPY startup.sh /root/ RUN chmod 770 /root/startup.sh diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/infra.zip b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/infra.zip Binary files differnew file mode 100644 index 0000000000..09eb9cd648 --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/infra.zip diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vbng.zip b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vbng.zip Binary files differnew file mode 100644 index 0000000000..ab5163d9ed --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vbng.zip diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vbrgemu.zip b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vbrgemu.zip Binary files differnew file mode 100644 index 0000000000..28c69a570f --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vbrgemu.zip diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vgmux.zip b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vgmux.zip Binary files differnew file mode 100644 index 0000000000..56de952150 --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vgmux.zip diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vgw.zip b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vgw.zip Binary files differnew file mode 100644 index 0000000000..7a14718c2c --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/Files/VNFs/vgw.zip diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/conf/attsdc-packages.yaml b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/conf/attsdc-packages.yaml new file mode 100644 index 0000000000..5d1a3e1537 --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/conf/attsdc-packages.yaml @@ -0,0 +1,12 @@ +packages: + - org.openecomp.sdc.ci.tests.execute.general + - org.openecomp.sdc.ci.tests.execute.user + - org.openecomp.sdc.ci.tests.execute.property + - org.openecomp.sdc.ci.tests.execute.lifecycle + - org.openecomp.sdc.ci.tests.execute.resource + - org.openecomp.sdc.ci.tests.execute.service + - org.openecomp.sdc.ci.tests.execute.artifacts + - org.openecomp.sdc.ci.tests.execute.imports + - org.openecomp.sdc.ci.tests.execute.category + - org.openecomp.sdc.ci.tests.execute.distribution + - org.openecomp.sdc.ci.tests.execute.product
\ No newline at end of file diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/conf/credentials.yaml b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/conf/credentials.yaml new file mode 100644 index 0000000000..ab37f7bee8 --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/conf/credentials.yaml @@ -0,0 +1,48 @@ + designer: { + username: cs0008, + password: 123123a, + firstname: ASDC, + lastname: KASPIN + } + admin: { + username: jh0003, + password: 123123a, + firstname: ASDC, + lastname: KASPIN + } + ops: { + username: af0006, + password: 123123a, + firstname: ASDC, + lastname: KASPIN + } + tester: { + username: kb0004, + password: 123123a, + firstname: ASDC, + lastname: KASPIN + } + governor: { + username: ah0002, + password: 123123a, + firstname: ASDC, + lastname: KASPIN + } + product_strategist: { + username: m99126, + password: 1910-FruitGum, + firstname: ASDC, + lastname: KASPIN + } + product_manager: { + username: m99127, + password: 747-Airplane, + firstname: ASDC, + lastname: KASPIN + } + product_local: { + username: pm0001, + password: 123123a, + firstname: ASDC, + lastname: KASPIN + }
\ No newline at end of file diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/conf/log4j.properties b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/conf/log4j.properties new file mode 100644 index 0000000000..d313e92b55 --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/conf/log4j.properties @@ -0,0 +1,34 @@ +# Define the root logger with appender file +log4j.rootLogger = INFO, FILE, stdout + +# Define the file appender +log4j.appender.FILE=org.apache.log4j.RollingFileAppender +log4j.appender.FILE.File=${targetlog}logs/ci-log.out + +# Define the layout for file appender +log4j.appender.FILE.layout=org.apache.log4j.PatternLayout +log4j.appender.FILE.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p [%10c] : %m%n + +# Set the maximum file size before rollover +log4j.appender.FILE.maxFileSize=5MB + +# Set the the backup index +log4j.appender.FILE.maxBackupIndex=10 + + +############################################################# + +# Direct log messages to stdout +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +#log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n +log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p %10c:%L - %m%n + +log4j.logger.org.apache.cassandra.service.StorageProxy=INFO +log4j.logger.com.thinkaurelius.titan.diskstorage.cassandra.CassandraTransaction=INFO, FILE, stdout + +log4j.logger.org.openecomp.sdc.ci.tests.utils=INFO, FILE, stdout +log4j.additivity.org.openecomp.sdc.ci.tests.utils=false + + diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/startTest.sh b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/startTest.sh new file mode 100644 index 0000000000..933f9af6e4 --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/startTest.sh @@ -0,0 +1,129 @@ +#!/bin/bash +REMOTE_DEBUG=false +RERUN=false +JAVA_OPTION="" +debug_port=8000 +TEST_SUITES=testSuites +fileName=testng-failed.xml + +function help_usage () +{ + echo + echo "$0 (<jar_file_name> <suite file name>) [-r/rerun <true/false> -d/debug <true/false>]" + echo "nohup ./startTest.sh ui-ci-1707.0.5-SNAPSHOT-jar-with-dependencies.jar extendedSanity.xml -r false -d true &" + echo "by default rerun is true and remote debug is false." + echo + exit 2 +} + +function isBoolean () +{ + PARAM_NAME=$1 + VALUE=$2 + if [[ ${VALUE} != "true" ]] && [[ ${VALUE} != "false" ]]; then + echo "Valid parameter" ${PARAM_NAME} "values are: true/false" + help_usage + fi +} + +function prepareFailedXmlFile () +{ + echo "1="$1 "2="$2 "fileName="${fileName} + PATTERN=`grep -w "test name=" ${FULL_PATH}/${TEST_SUITES}/$2 | awk -F'"' '{print $2}'` + sed '/<test name="'${PATTERN}'"/,/<!-- '${PATTERN}' --/d' $1 > ${FULL_PATH}/${TEST_SUITES}/${fileName} + sed -i 's/thread-count="[0-9]\+"/thread-count="1"/g' ${FULL_PATH}/${TEST_SUITES}/${fileName} +} + +#main +[ $# -lt 2 ] && help_usage + +JAR_FILE=$1 +SUITE_FILE=$2 + +while [ $# -ne 0 ]; do + case $1 in + -r|rerun) + RERUN=$2 + isBoolean $1 ${RERUN} + shift 1 + shift 1 + ;; + -d|debug) + REMOTE_DEBUG=$2 + isBoolean $1 ${REMOTE_DEBUG} + shift 1 + shift 1 + ;; + *) + shift 1 + ;; + esac +done + +CURRENT_DIR=`pwd` +BASEDIR=$(dirname $0) + +if [ ${BASEDIR:0:1} = "/" ] +then + FULL_PATH=$BASEDIR +else + FULL_PATH=$CURRENT_DIR/$BASEDIR +fi +LOGS_PROP_FILE=file:${FULL_PATH}/conf/log4j.properties +############################################# +TARGET_DIR=${FULL_PATH}/target +CONF_FILE=${FULL_PATH}/conf/sdc.yaml + +DEBUG=true +MainClass=org.openecomp.sdc.ci.tests.run.StartTest + +TESTS_DIR=/opt/app/sdc/ci/resources/tests +COMPONENTS_DIR=/opt/app/sdc/ci/resources/components + + +TARGET_LOG_DIR="${TARGET_DIR}/" + +######ADD USERS################ + +BE_IP=`cat conf/attsdc.yaml | grep catalogBeHost| awk '{print $2}'` + + +if [ ${REMOTE_DEBUG} == "true" ]; then + echo "Debug mode, Listen on port $debug_port"; + JAVA_OPTION="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${debug_port}" ; +fi + +cmd="java $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -Dfilepath=${FILES_TEST} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -cp $JAR_FILE ${MainClass} $SUITE_FILE &" + + +if [ $DEBUG == "true" ] +then + $cmd +else + $cmd >> /dev/null +fi + +if [ ${RERUN} == "true" ]; then + if [ -f ${TARGET_DIR}/${fileName} ]; then + echo "Prepare" ${TARGET_DIR}/${fileName} "file to rerun all failed tests ..."; + prepareFailedXmlFile ${TARGET_DIR}/${fileName} $SUITE_FILE; + SUITE_FILE=${fileName}; + cmd="java $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -Dfilepath=${FILES_TEST} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -cp $JAR_FILE ${MainClass} $SUITE_FILE &" + $cmd; + fi +fi + +status=`echo $?` + +source ExtentReport/versions.info +now=$(date +'%Y-%m-%d_%H_%M') +REPORT_NAME=${now} +VERSION=${osVersion} + + + +echo "##################################################" +echo "################# status is ${status} #################" +echo "##################################################" + +exit $status
\ No newline at end of file diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/SDC_Simulator_3_logback.rb b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/SDC_Simulator_3_logback.rb new file mode 100644 index 0000000000..0d9282b28a --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/SDC_Simulator_3_logback.rb @@ -0,0 +1,10 @@ +jetty_base="/var/lib/jetty" + + +cookbook_file "logback.xml" do + path "#{jetty_base}/config/sdc-simulator/logback.xml" + source "logback.xml" + owner "jetty" + group "jetty" + mode "0755" +end
\ No newline at end of file diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/SDC_Simulator_4_locate_keystore.rb b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/SDC_Simulator_4_locate_keystore.rb new file mode 100644 index 0000000000..3bb482d89a --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/SDC_Simulator_4_locate_keystore.rb @@ -0,0 +1,16 @@ +jetty_base="/var/lib/jetty" + +directory "Jetty_etcdir_creation" do + path "/#{jetty_base}/etc" + owner 'jetty' + group 'jetty' + mode '0755' + action :create +end + +cookbook_file "/#{jetty_base}/etc/keystore" do + source "keystore" + owner "jetty" + group "jetty" + mode 0755 +end
\ No newline at end of file diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/SDC_Simulator_5_create_jetty_modules.rb b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/SDC_Simulator_5_create_jetty_modules.rb new file mode 100644 index 0000000000..38b87fa65d --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/SDC_Simulator_5_create_jetty_modules.rb @@ -0,0 +1,14 @@ +jetty_base="/var/lib/jetty" +jetty_home="/usr/local/jetty" + +###### create Jetty modules +bash "create-jetty-modules" do +cwd "#{jetty_base}" +code <<-EOH + cd "#{jetty_base}" + java -jar "/#{jetty_home}"/start.jar --add-to-start=deploy + java -jar "/#{jetty_home}"/start.jar --add-to-startd=http,https,logging,setuid +EOH +not_if "ls /#{jetty_base}/start.d/https.ini" +end + diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/sanityTests_1_cleanup_jettydir.rb b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/sanityTests_1_cleanup_jettydir.rb new file mode 100644 index 0000000000..112cc4c2e7 --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/sanityTests_1_cleanup_jettydir.rb @@ -0,0 +1,49 @@ +tests_base="/var/lib/tests" + + remote_directory '/var/lib/tests/testSuites' do + source 'testSuites' + owner 'root' + group 'root' + mode '0755' + action :create + end + + remote_directory '/var/lib/tests/Files' do + source 'Files' + owner 'root' + group 'root' + mode '0755' + action :create + end + + remote_directory '/var/lib/tests/conf' do + source 'conf' + owner 'root' + group 'root' + mode '0755' + action :create + end + + directory "create_target_dir" do + path "/var/lib/tests/target" + owner 'root' + group 'root' + mode '0755' + action :create + end + + directory "create_ExtentReport_dir" do + path "/var/lib/tests/ExtentReport" + owner 'root' + group 'root' + mode '0755' + action :create + end + + cookbook_file '/var/lib/tests/startTest.sh' do + source 'startTest.sh' + owner 'root' + group 'root' + mode '0755' + action :create + end
\ No newline at end of file diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/sanityTests_2_setup_configuration.rb b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/sanityTests_2_setup_configuration.rb new file mode 100644 index 0000000000..cf6875746e --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/sanityTests_2_setup_configuration.rb @@ -0,0 +1,43 @@ +tests_base="/var/lib/tests" + +template "sdc-yaml-config" do + path "#{tests_base}/conf/sdc.yaml" + source "sdc-sanity.yaml.erb" + owner "root" + group "root" + mode "0755" + variables ({ + :target_path => "#{tests_base}/target", + :catalogBE_ip => node['Nodes']['BE'], + :catalogBE_port => node['BE'][:http_port], + :webportal_ip => node['Nodes']['FE'], + :webportal_port => node['FE'][:http_port], + :titan_file => "#{tests_base}/conf/titan.properties", + :tests_base_ci => "#{tests_base}/CI/tests", + :components_path => "#{tests_base}/CI/components", + :importResourceConfigDir => "#{tests_base}/CI/importResource", + :importTypesDir => "#{tests_base}/CI/importTypesTest", + :importResourceTestsConfigDir => "#{tests_base}/CI/importResourceTests", + :ConfigurationFile => "#{tests_base}/conf/configuration.yaml", + :errorConfigurationFile => "#{tests_base}/conf/error-configuration.yaml", + :CASSANDRA_IP => node['Nodes']['CS'], + :CASSANDRA_PWD => node['cassandra'][:cassandra_password], + :CASSANDRA_USR => node['cassandra'][:cassandra_user] + }) +end + +replication_factor=1 +template "titan.properties" do + path "/#{tests_base}/conf/titan.properties" + source "BE-titan.properties.erb" + owner "root" + group "root" + mode "0755" + variables({ + :CASSANDRA_IP => node['Nodes']['CS'], + :CASSANDRA_PWD => node['cassandra'][:cassandra_password], + :CASSANDRA_USR => node['cassandra'][:cassandra_user], + :rep_factor => replication_factor, + :DC_NAME => node['cassandra'][:cluster_name]+node.chef_environment + }) +end
\ No newline at end of file diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/sanityTests_3_sanity_execution.rb b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/sanityTests_3_sanity_execution.rb new file mode 100644 index 0000000000..6f10a33dd6 --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/sanityTests_3_sanity_execution.rb @@ -0,0 +1,13 @@ +tests_base="/var/lib/tests" +ci_test_suite="onap.xml" + +bash "run asdc ci sanity tests" do +cwd "#{tests_base}" +code <<-EOH + cd "#{tests_base}" + jar_file=`ls test-apis*-jar-with-dependencies.jar` + ./startTest.sh $jar_file #{ci_test_suite} + echo "return code from startTest.sh = [$?]" +EOH +timeout 72000 +end
\ No newline at end of file diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/templates/default/BE-titan.properties.erb b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/templates/default/BE-titan.properties.erb index 27386d47ef..a42c7bf206 100644 --- a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/templates/default/BE-titan.properties.erb +++ b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/templates/default/BE-titan.properties.erb @@ -4,6 +4,7 @@ storage.port=9160 storage.username=<%= @CASSANDRA_USR %> storage.password=<%= @CASSANDRA_PWD %> storage.connection-timeout=10000 +storage.cassandra.keyspace=sdctitan storage.cassandra.ssl.enabled=false storage.cassandra.ssl.truststore.location=/var/lib/jetty/config/.truststore diff --git a/sdc-os-chef/sdc-sanity/chef-solo/roles/sanityTests.json b/sdc-os-chef/sdc-sanity/chef-solo/roles/sanityTests.json new file mode 100644 index 0000000000..74f12c7cc6 --- /dev/null +++ b/sdc-os-chef/sdc-sanity/chef-solo/roles/sanityTests.json @@ -0,0 +1,23 @@ +{ + "name": "sanityTests", + "description": "Execute sanity tests", + "json_class": "Chef::Role", + "default_attributes": { + + }, + "override_attributes": { + + }, + "chef_type": "role", + "run_list": [ + "recipe[sdc-sanity::sanityTests_1_cleanup_jettydir]", + "recipe[sdc-sanity::sanityTests_2_setup_configuration]", + "recipe[sdc-sanity::sanityTests_3_sanity_execution]" +// "recipe[sdc-simulator::SDC_Simulator_3_logback]", +// "recipe[sdc-simulator::SDC_Simulator_4_locate_keystore]", +// "recipe[sdc-simulator::SDC_Simulator_5_create_jetty_modules]" + ], + "env_run_lists": { + } +} + diff --git a/sdc-os-chef/sdc-sanity/chef-solo/solo.json b/sdc-os-chef/sdc-sanity/chef-solo/solo.json index 5bd228127d..6487d4cc4e 100644 --- a/sdc-os-chef/sdc-sanity/chef-solo/solo.json +++ b/sdc-os-chef/sdc-sanity/chef-solo/solo.json @@ -1,4 +1,6 @@ { - "run_list": [ "recipe[sdc-sanity::setup_sanity]" ] + "run_list": [ + "role[sanityTests]" + ] } diff --git a/sdc-os-chef/sdc-sanity/startup.sh b/sdc-os-chef/sdc-sanity/startup.sh index 374a0e8c34..d4316c383f 100644 --- a/sdc-os-chef/sdc-sanity/startup.sh +++ b/sdc-os-chef/sdc-sanity/startup.sh @@ -6,13 +6,15 @@ chef-solo -c solo.rb -E ${CHEFNAME} rc=$? -if [[ $rc != 0 ]]; then - echo "Sanity failed !!!" - exit $rc -else - echo "completed successfully :-)" - exit 0 -fi +#if [[ $rc != 0 ]]; then +# echo "Sanity failed !!!" +# exit $rc +#else +# echo "completed successfully :-)" +# exit 0 +#fi -#/docker-entrypoint.sh +while true; do sleep 2; done + +##/docker-entrypoint.sh diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java index cfd132d5d0..ad1e8dd37d 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/ComponentBaseTest.java @@ -20,20 +20,13 @@ package org.openecomp.sdc.ci.tests.api; -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertNotNull; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.function.Consumer; -import java.util.stream.Collectors; - +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.LoggerContext; +import com.aventstack.extentreports.ExtentTest; +import com.aventstack.extentreports.Status; +import com.thinkaurelius.titan.core.TitanFactory; +import com.thinkaurelius.titan.core.TitanGraph; +import com.thinkaurelius.titan.core.TitanVertex; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.ImmutableTriple; @@ -46,11 +39,7 @@ import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.Product; -import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.Service; -import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.model.*; import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; @@ -59,26 +48,21 @@ import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.cassandra.CassandraUtils; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; -import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; +import org.openecomp.sdc.ci.tests.utils.rest.*; import org.slf4j.LoggerFactory; import org.testng.ITestContext; import org.testng.ITestResult; import org.testng.annotations.*; -import com.aventstack.extentreports.ExtentTest; -import com.aventstack.extentreports.Status; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.TitanVertex; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.*; +import java.util.function.Consumer; +import java.util.stream.Collectors; -import ch.qos.logback.classic.Level; -import ch.qos.logback.classic.LoggerContext; +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertNotNull; public abstract class ComponentBaseTest { @@ -138,18 +122,22 @@ public abstract class ComponentBaseTest { @BeforeMethod(alwaysRun = true) public void setBrowserBeforeTest(java.lang.reflect.Method method, ITestContext context) throws Exception { - - boolean emptyDataProvider = method.getAnnotation(Test.class).dataProvider().isEmpty(); - String className = method.getDeclaringClass().getName(); - if (emptyDataProvider && !className.contains("ToscaValidationTest") ) { - System.out.println("ExtentReport instance started from BeforeMethod..."); - String suiteName = ExtentManager.getSuiteName(context); + + String suiteName = ExtentManager.getSuiteName(context); ExtentTestManager.startTest(method.getName()); ExtentTestManager.assignCategory(this.getClass()); - - } else { - System.out.println("ExtentReport instance started from Test..."); - } + +// boolean emptyDataProvider = method.getAnnotation(Test.class).dataProvider().isEmpty(); +// String className = method.getDeclaringClass().getName(); +// if (emptyDataProvider) { +// System.out.println("ExtentReport instance started from BeforeMethod..."); +// String suiteName = ExtentManager.getSuiteName(context); +// ExtentTestManager.startTest(method.getName()); +// ExtentTestManager.assignCategory(this.getClass()); +// +// } else { +// System.out.println("ExtentReport instance started from Test..."); +// } } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java index 2b341f5cbf..ec83b05be9 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java @@ -115,8 +115,8 @@ public class Onboard extends ComponentBaseTest { ExtentTestActions.log(Status.INFO, String.format("Certify Service")); service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - ExtentTestActions.log(Status.INFO, String.format("Distribute Service")); - AtomicOperationUtils.distributeService(service, true); +// ExtentTestActions.log(Status.INFO, String.format("Distribute Service")); +// AtomicOperationUtils.distributeService(service, true); ExtentTestActions.log(Status.INFO, String.format("The onboarding %s test is passed ! ", vnfFile)); } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java index 77be6df729..b82e6a0f52 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/FileHandling.java @@ -284,7 +284,7 @@ public class FileHandling { public static void deleteDirectory(String directoryPath) { File dir = new File(directoryPath); try { - FileUtils.deleteDirectory(dir); + FileUtils.cleanDirectory(dir); } catch (IOException e) { System.out.println("Failed to delete " + dir); ComponentBaseTest.getExtendTest().log(Status.INFO, "Failed to delete " + dir); diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java index a1838b66d1..f6d3e58339 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java @@ -39,24 +39,16 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.api.ExtentTestActions; import org.openecomp.sdc.ci.tests.config.Config; - import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; -import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; - import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar; - import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; -import org.testng.Assert; - import java.io.*; import java.nio.file.FileSystems; import java.util.*; -import java.util.stream.Collectors; import static org.testng.AssertJUnit.assertEquals; @@ -493,7 +485,7 @@ public class OnboardingUtils { jObject.put("description", "new VSP description"); jObject.put("category", "resourceNewCategory.generic"); jObject.put("subCategory", "resourceNewCategory.generic.database"); - jObject.put("onboardingMethod", "HEAT"); + jObject.put("onboardingMethod", "NetworkPackage"); jObject.put("licensingVersion", jlicensingVersionObj); jObject.put("vendorName", amdocsLicenseMembers.getVendorLicenseName()); jObject.put("vendorId", amdocsLicenseMembers.getVendorId()); diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/LifecycleRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/LifecycleRestUtils.java index 22a352cbfe..39afff9022 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/LifecycleRestUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/LifecycleRestUtils.java @@ -372,7 +372,7 @@ public class LifecycleRestUtils extends BaseRestUtils { String userRemarks, DistributionStatusEnum reqDistributionStatus) throws Exception { String uniqueId = serviceDetails.getUniqueId(); Config config = Utils.getConfig(); - String environmentName = "PROD-Andreys-Only"; + String environmentName = "AUTO"; // String environmentName = ConfigurationManager.getConfigurationManager().getDistributionEngineConfiguration().getEnvironments().get(0); DistributionStatusEnum distributionStatusEnum = DistributionStatusEnum.findState(reqDistributionStatus.getValue()); switch(distributionStatusEnum){ diff --git a/test-apis-ci/src/main/resources/ci/testSuites/onap.xml b/test-apis-ci/src/main/resources/ci/testSuites/onap.xml new file mode 100644 index 0000000000..c075f10b11 --- /dev/null +++ b/test-apis-ci/src/main/resources/ci/testSuites/onap.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> +<suite name="externalApis" configfailurepolicy="continue" verbose="2" parallel="methods" thread-count="2" data-provider-thread-count="2"> + <test name="ExternalApis"> + <classes> + + <class name="org.openecomp.sdc.ci.tests.sanity.Onboard"/> + +<!-- <class name="org.openecomp.sdc.ci.tests.execute.product.ChangeServiceInstanceVersionTest"/> + <class name="org.openecomp.sdc.ci.tests.execute.product.ProductCheckinTest"/> + <class name="org.openecomp.sdc.ci.tests.execute.product.ProductCheckoutTest"/> + <class name="org.openecomp.sdc.ci.tests.execute.product.ProductComponentInstanceCRUDTest"/> + <class name="org.openecomp.sdc.ci.tests.execute.product.ProductCreateWithValidationsTest"/> + <class name="org.openecomp.sdc.ci.tests.execute.product.ProductCrudTest"/> + <class name="org.openecomp.sdc.ci.tests.execute.product.ProductGetFollowedTest"/> + <class name="org.openecomp.sdc.ci.tests.execute.product.ProductUndoCheckoutTest"/> --> + + + </classes> + </test> +</suite>
\ No newline at end of file |