diff options
author | Stern, Ittay (is9613) <ittay.stern@att.com> | 2018-11-27 13:22:35 +0200 |
---|---|---|
committer | Ittay Stern <ittay.stern@att.com> | 2018-11-27 18:53:16 +0200 |
commit | f22f824ea86725f85b2e1c3636b69489dee9943d (patch) | |
tree | ec21d6ac6c6734d975c5d26481c65b52c75e3cb8 /vid-app-common | |
parent | d0e33a075713cb711d97a4186f858b931ff793ef (diff) |
Upgrade mockito to v2; drop incompatible powermock
Note that anyString() is not matching null values, therefore replaced
with any() where relevant.
Change-Id: If64944e1edc62013953e41b2645a2b78c578bbe8
Issue-ID: VID-359
Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-app-common')
25 files changed, 743 insertions, 827 deletions
diff --git a/vid-app-common/pom.xml b/vid-app-common/pom.xml index ddb4bb94..658bf71d 100755 --- a/vid-app-common/pom.xml +++ b/vid-app-common/pom.xml @@ -1,583 +1,595 @@ -<?xml version="1.0"?>
-<project
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
-
- <!-- This is the Maven project object model (POM) file for VID web application
- based on the ECOMP SDK distribution. This file stands alone; it does not
- inherit from a parent maven module. -->
- <groupId>org.onap.vid</groupId>
- <artifactId>vid-app-common</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <packaging>war</packaging>
- <name>VID Common</name>
- <description>VID Common code for opensource version</description>
-
- <properties>
- <encoding>UTF-8</encoding>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <epsdk.version>2.4.0</epsdk.version>
- <springframework.version>4.2.9.RELEASE</springframework.version>
- <hibernate.version>4.3.11.Final</hibernate.version>
- <!-- Skip assembling the zip by default -->
- <skipassembly>true</skipassembly>
- <!-- Tests usually require some setup that maven cannot do, so skip. -->
- <skiptests>false</skiptests>
- <nexusproxy>https://nexus.onap.org</nexusproxy>
- <snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>
- <releaseNexusPath>/content/repositories/releases/</releaseNexusPath>
- <stagingNexusPath>/content/repositories/staging/</stagingNexusPath>
- <sitePath>/content/sites/site/org/onap/vid/${project.version}</sitePath>
- </properties>
-
-
- <!-- this should be commented for local debugging -->
- <!-- <deployenv>local</deployenv> -->
-
- <repositories>
- <repository>
- <id>ecomp-releases</id>
- <name>VID Release Repository</name>
- <url>${nexusproxy}${releaseNexusPath}</url>
- </repository>
- <repository>
- <id>ecomp-snapshots</id>
- <name>VID Snapshot Repository</name>
- <url>${nexusproxy}${snapshotNexusPath}</url>
- </repository>
- <repository>
- <id>ecomp-staging</id>
- <name>VID Staging Repository</name>
- <url>${nexusproxy}${stagingNexusPath}</url>
- </repository>
- <repository>
- <!-- Snapshots repository has ECOMP snapshot artifacts -->
- <id>oss-snapshots</id>
- <name>oss Central - Snapshots</name>
- <url>https://oss.sonatype.org/service/local/repositories/releases/content/</url>
- </repository>
-
- </repositories>
- <distributionManagement>
- <repository>
- <id>ecomp-releases</id>
- <name>VID Release Repository</name>
- <url>${nexusproxy}/${releaseNexusPath}</url>
- </repository>
- <snapshotRepository>
- <id>ecomp-snapshots</id>
- <name>VID Snapshot Repository</name>
- <url>${nexusproxy}/${snapshotNexusPath}</url>
- </snapshotRepository>
- <!-- added for javadoc -->
- <site>
- <id>ecomp-site</id>
- <url>dav:${nexusproxy}${sitePath}</url>
- </site>
- </distributionManagement>
-
- <build>
- <finalName>vid-common</finalName>
-
- <plugins>
- <plugin>
- <groupId>org.sonatype.plugins</groupId>
- <artifactId>nexus-staging-maven-plugin</artifactId>
- <version>1.6.7</version>
- <extensions>true</extensions>
- <configuration>
- <nexusUrl>${nexusproxy}</nexusUrl>
- <stagingProfileId>176c31dfe190a</stagingProfileId>
- <serverId>ecomp-staging</serverId>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <version>0.7.9</version>
- <executions>
- <execution>
- <id>default-prepare-agent</id>
- <goals>
- <goal>prepare-agent</goal>
- </goals>
- </execution>
- <execution>
- <id>default-report</id>
- <goals>
- <goal>report</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.tomcat.maven</groupId>
- <artifactId>tomcat6-maven-plugin</artifactId>
- <version>2.2</version>
- </plugin>
- <plugin>
- <groupId>org.apache.tomcat.maven</groupId>
- <artifactId>tomcat7-maven-plugin</artifactId>
- <version>2.2</version>
- </plugin>
-
- <!-- Generate POJOs from MSO json schema -->
- <plugin>
- <groupId>org.jsonschema2pojo</groupId>
- <artifactId>jsonschema2pojo-maven-plugin</artifactId>
- <version>0.4.23</version>
- <configuration>
- <sourceDirectory>${basedir}/src/main/resources/json/mso</sourceDirectory>
- <targetPackage>org.onap.vid.domain.mso</targetPackage>
- <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>generate</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.1</version>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.19.1</version>
- <configuration>
- <skipTests>${skiptests}</skipTests>
- <includes>
- <include>**/Test*.java</include>
- <include>**/*Test.java</include>
- <include>**/*TestCase.java</include>
- </includes>
- <excludes>
- <exclude>**/selenium/*.java</exclude>
- <exclude>**/integrationTest/*.java</exclude>
- </excludes>
- <additionalClasspathElements>
- <additionalClasspathElement>${basedir}/war</additionalClasspathElement>
- </additionalClasspathElements>
- <systemPropertyVariables>
- <container.classpath>classpath:</container.classpath>
- </systemPropertyVariables>
- </configuration>
- </plugin>
-
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <skipAssembly>${skipassembly}</skipAssembly>
- <descriptors>
- <descriptor>${basedir}/distribution.xml</descriptor>
- </descriptors>
- </configuration>
- <executions>
- <execution>
- <id>make-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <version>3.0.0</version>
- <configuration>
- <!-- Build a jar with all the Java classes -->
- <attachClasses>true</attachClasses>
- <!-- Do not put any jars in the war -->
- <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-site-plugin</artifactId>
- <version>3.6</version>
- <dependencies>
- <dependency>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-webdav-jackrabbit</artifactId>
- <version>2.10</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <groupId>pl.project13.maven</groupId>
- <artifactId>git-commit-id-plugin</artifactId>
- <version>2.2.4</version>
- <executions>
- <execution>
- <id>get-the-git-infos</id>
- <goals>
- <goal>revision</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
- <dateFormat>yyyy-MM-dd'T'HH:mm:ssZ</dateFormat>
- <dateFormatTimeZone>${user.timezone}</dateFormatTimeZone>
- <generateGitPropertiesFile>true</generateGitPropertiesFile>
- <generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
- <includeOnlyProperties>
- <includeOnlyProperty>^git.commit.id$</includeOnlyProperty>
- <includeOnlyProperty>^git.commit.message.short$</includeOnlyProperty>
- <includeOnlyProperty>^git.commit.time$</includeOnlyProperty>
- </includeOnlyProperties>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.10.4</version>
- <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>
-
- <dependency>
- <groupId>com.opencsv</groupId>
- <artifactId>opencsv</artifactId>
- <version>4.1</version>
- </dependency>
-
- <!-- HTTP client -->
-
- <dependency>
- <groupId>io.joshworks.unirest</groupId>
- <artifactId>unirest-java</artifactId>
- <version>0.2.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- <version>4.3.6</version>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpasyncclient</artifactId>
- <version>4.0.2</version>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpmime</artifactId>
- <version>4.3.6</version>
- </dependency>
- <dependency>
- <groupId>com.xebialabs.restito</groupId>
- <artifactId>restito</artifactId>
- <version>0.9.3</version>
- <scope>test</scope>
- </dependency>
-
- <!-- Helpers -->
- <dependency>
- <groupId>io.vavr</groupId>
- <artifactId>vavr</artifactId>
- <version>0.9.2</version>
- </dependency>
-
- <!-- SDK overlay war -->
- <dependency>
- <groupId>org.onap.portal.sdk</groupId>
- <artifactId>epsdk-app-overlay</artifactId>
- <version>${epsdk.version}</version>
- <type>war</type>
- </dependency>
- <dependency>
- <groupId>org.onap.portal.sdk</groupId>
- <artifactId>epsdk-app-common</artifactId>
- <version>${epsdk.version}</version>
- <type>jar</type>
- </dependency>
-
- <dependency>
- <groupId>org.onap.portal.sdk</groupId>
- <artifactId>epsdk-core</artifactId>
- <version>${epsdk.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.portal.sdk</groupId>
- <artifactId>epsdk-analytics</artifactId>
- <version>${epsdk.version}</version>
- <exclusions>
- <exclusion>
- <groupId>com.lowagie</groupId>
- <artifactId>itext</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.onap.portal.sdk</groupId>
- <artifactId>epsdk-workflow</artifactId>
- <version>${epsdk.version}</version>
- </dependency>
- <dependency>
- <groupId>com.att.eelf</groupId>
- <artifactId>eelf-core</artifactId>
- <version>1.0.0</version>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-core</artifactId>
- <version>1.2.3</version>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <version>1.2.3</version>
- </dependency>
-
- <!-- Mapper -->
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- <version>2.6.3</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>2.8.6</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>2.6.7.1</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-mapper-asl</artifactId>
- <version>1.9.13</version>
- </dependency>
- <dependency>
- <groupId>com.mchange</groupId>
- <artifactId>c3p0</artifactId>
- <version>0.9.5.2</version>
- </dependency>
- <dependency>
- <groupId>io.searchbox</groupId>
- <artifactId>jest</artifactId>
- <version>2.0.0</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <version>3.1.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>2.4</version>
- <!--<scope>test</scope>-->
- </dependency>
- <dependency>
- <groupId>com.google.code.bean-matchers</groupId>
- <artifactId>bean-matchers</artifactId>
- <version>0.11</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.json</groupId>
- <artifactId>json</artifactId>
- <version>20160212</version>
- </dependency>
- <dependency>
- <groupId>org.quartz-scheduler</groupId>
- <artifactId>quartz</artifactId>
- <version>2.2.1</version>
- <exclusions>
- <!-- exclude 0.9.1.1 to avoid dupe of com.mchange:c3p0:0.9.2.1 -->
- <exclusion>
- <groupId>c3p0</groupId>
- <artifactId>c3p0</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <!-- bridge to implement commons-logging using slf4j -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- <version>1.7.12</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context-support</artifactId>
- <version>${springframework.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- <version>${springframework.version}</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <version>${springframework.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-tx</artifactId>
- <version>${springframework.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- <version>${springframework.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-webmvc</artifactId>
- <version>${springframework.version}</version>
- </dependency>
- <dependency>
- <groupId>org.glassfish.jersey.core</groupId>
- <artifactId>jersey-client</artifactId>
- <version>2.23.1</version>
- </dependency>
- <dependency>
- <groupId>org.glassfish.jersey.connectors</groupId>
- <artifactId>jersey-jetty-connector</artifactId>
- <version>2.23.1</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.jaxrs</groupId>
- <artifactId>jackson-jaxrs-json-provider</artifactId>
- <version>2.6.3</version>
- </dependency>
- <dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- <version>1.9.3</version>
- </dependency>
- <dependency>
- <groupId>com.googlecode.json-simple</groupId>
- <artifactId>json-simple</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.seleniumhq.selenium</groupId>
- <artifactId>selenium-java</artifactId>
- <version>2.53.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.seleniumhq.selenium</groupId>
- <artifactId>selenium-api</artifactId>
- <version>2.53.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <version>6.8</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.seleniumhq.selenium</groupId>
- <artifactId>selenium-firefox-driver</artifactId>
- <version>2.53.1</version>
- </dependency>
- <dependency>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- <version>1.4.01</version>
- </dependency>
- <dependency>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
- <version>1.16</version>
- </dependency>
- <dependency>
- <groupId>org.skyscreamer</groupId>
- <artifactId>jsonassert</artifactId>
- <version>1.5.0</version>
- </dependency>
- <dependency>
- <groupId>org.onap.sdc.sdc-tosca</groupId>
- <artifactId>sdc-tosca</artifactId>
- <version>1.4.1</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>net.javacrumbs.json-unit</groupId>
- <artifactId>json-unit</artifactId>
- <version>1.23.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-text</artifactId>
- <version>1.1</version>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>java-hamcrest</artifactId>
- <version>2.0.0.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.togglz</groupId>
- <artifactId>togglz-spring-core</artifactId>
- <version>2.5.0.Final</version>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>3.10.0</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
-</project>
+<?xml version="1.0"?> +<project + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + + <!-- This is the Maven project object model (POM) file for VID web application + based on the ECOMP SDK distribution. This file stands alone; it does not + inherit from a parent maven module. --> + <groupId>org.onap.vid</groupId> + <artifactId>vid-app-common</artifactId> + <version>4.0.0-SNAPSHOT</version> + <packaging>war</packaging> + <name>VID Common</name> + <description>VID Common code for opensource version</description> + + <properties> + <encoding>UTF-8</encoding> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <epsdk.version>2.4.0</epsdk.version> + <springframework.version>4.2.9.RELEASE</springframework.version> + <hibernate.version>4.3.11.Final</hibernate.version> + <!-- Skip assembling the zip by default --> + <skipassembly>true</skipassembly> + <!-- Tests usually require some setup that maven cannot do, so skip. --> + <skiptests>false</skiptests> + <nexusproxy>https://nexus.onap.org</nexusproxy> + <snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath> + <releaseNexusPath>/content/repositories/releases/</releaseNexusPath> + <stagingNexusPath>/content/repositories/staging/</stagingNexusPath> + <sitePath>/content/sites/site/org/onap/vid/${project.version}</sitePath> + </properties> + + + <!-- this should be commented for local debugging --> + <!-- <deployenv>local</deployenv> --> + + <repositories> + <repository> + <id>ecomp-releases</id> + <name>VID Release Repository</name> + <url>${nexusproxy}${releaseNexusPath}</url> + </repository> + <repository> + <id>ecomp-snapshots</id> + <name>VID Snapshot Repository</name> + <url>${nexusproxy}${snapshotNexusPath}</url> + </repository> + <repository> + <id>ecomp-staging</id> + <name>VID Staging Repository</name> + <url>${nexusproxy}${stagingNexusPath}</url> + </repository> + <repository> + <!-- Snapshots repository has ECOMP snapshot artifacts --> + <id>oss-snapshots</id> + <name>oss Central - Snapshots</name> + <url>https://oss.sonatype.org/service/local/repositories/releases/content/</url> + </repository> + + </repositories> + <distributionManagement> + <repository> + <id>ecomp-releases</id> + <name>VID Release Repository</name> + <url>${nexusproxy}/${releaseNexusPath}</url> + </repository> + <snapshotRepository> + <id>ecomp-snapshots</id> + <name>VID Snapshot Repository</name> + <url>${nexusproxy}/${snapshotNexusPath}</url> + </snapshotRepository> + <!-- added for javadoc --> + <site> + <id>ecomp-site</id> + <url>dav:${nexusproxy}${sitePath}</url> + </site> + </distributionManagement> + + <build> + <finalName>vid-common</finalName> + + <plugins> + <plugin> + <groupId>org.sonatype.plugins</groupId> + <artifactId>nexus-staging-maven-plugin</artifactId> + <version>1.6.7</version> + <extensions>true</extensions> + <configuration> + <nexusUrl>${nexusproxy}</nexusUrl> + <stagingProfileId>176c31dfe190a</stagingProfileId> + <serverId>ecomp-staging</serverId> + </configuration> + </plugin> + <plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <version>0.7.9</version> + <executions> + <execution> + <id>default-prepare-agent</id> + <goals> + <goal>prepare-agent</goal> + </goals> + </execution> + <execution> + <id>default-report</id> + <goals> + <goal>report</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.tomcat.maven</groupId> + <artifactId>tomcat6-maven-plugin</artifactId> + <version>2.2</version> + </plugin> + <plugin> + <groupId>org.apache.tomcat.maven</groupId> + <artifactId>tomcat7-maven-plugin</artifactId> + <version>2.2</version> + </plugin> + + <!-- Generate POJOs from MSO json schema --> + <plugin> + <groupId>org.jsonschema2pojo</groupId> + <artifactId>jsonschema2pojo-maven-plugin</artifactId> + <version>0.4.23</version> + <configuration> + <sourceDirectory>${basedir}/src/main/resources/json/mso</sourceDirectory> + <targetPackage>org.onap.vid.domain.mso</targetPackage> + <outputDirectory>${project.build.directory}/generated-sources</outputDirectory> + </configuration> + <executions> + <execution> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.1</version> + <configuration> + <source>1.8</source> + <target>1.8</target> + </configuration> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.19.1</version> + <configuration> + <skipTests>${skiptests}</skipTests> + <includes> + <include>**/Test*.java</include> + <include>**/*Test.java</include> + <include>**/*TestCase.java</include> + </includes> + <excludes> + <exclude>**/selenium/*.java</exclude> + <exclude>**/integrationTest/*.java</exclude> + </excludes> + <additionalClasspathElements> + <additionalClasspathElement>${basedir}/war</additionalClasspathElement> + </additionalClasspathElements> + <systemPropertyVariables> + <container.classpath>classpath:</container.classpath> + </systemPropertyVariables> + </configuration> + </plugin> + + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <configuration> + <skipAssembly>${skipassembly}</skipAssembly> + <descriptors> + <descriptor>${basedir}/distribution.xml</descriptor> + </descriptors> + </configuration> + <executions> + <execution> + <id>make-assembly</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + </execution> + </executions> + </plugin> + + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <version>3.0.0</version> + <configuration> + <!-- Build a jar with all the Java classes --> + <attachClasses>true</attachClasses> + <!-- Do not put any jars in the war --> + <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-site-plugin</artifactId> + <version>3.6</version> + <dependencies> + <dependency> + <groupId>org.apache.maven.wagon</groupId> + <artifactId>wagon-webdav-jackrabbit</artifactId> + <version>2.10</version> + </dependency> + </dependencies> + </plugin> + <plugin> + <groupId>pl.project13.maven</groupId> + <artifactId>git-commit-id-plugin</artifactId> + <version>2.2.4</version> + <executions> + <execution> + <id>get-the-git-infos</id> + <goals> + <goal>revision</goal> + </goals> + </execution> + </executions> + <configuration> + <dotGitDirectory>${project.basedir}/.git</dotGitDirectory> + <dateFormat>yyyy-MM-dd'T'HH:mm:ssZ</dateFormat> + <dateFormatTimeZone>${user.timezone}</dateFormatTimeZone> + <generateGitPropertiesFile>true</generateGitPropertiesFile> + <generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename> + <includeOnlyProperties> + <includeOnlyProperty>^git.commit.id$</includeOnlyProperty> + <includeOnlyProperty>^git.commit.message.short$</includeOnlyProperty> + <includeOnlyProperty>^git.commit.time$</includeOnlyProperty> + </includeOnlyProperties> + </configuration> + </plugin> + </plugins> + </build> + + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>2.10.4</version> + <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> + + <dependency> + <groupId>com.opencsv</groupId> + <artifactId>opencsv</artifactId> + <version>4.1</version> + </dependency> + + <!-- HTTP client --> + + <dependency> + <groupId>io.joshworks.unirest</groupId> + <artifactId>unirest-java</artifactId> + <version>0.2.1</version> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + <version>4.3.6</version> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpasyncclient</artifactId> + <version>4.0.2</version> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpmime</artifactId> + <version>4.3.6</version> + </dependency> + <dependency> + <groupId>com.xebialabs.restito</groupId> + <artifactId>restito</artifactId> + <version>0.9.3</version> + <scope>test</scope> + </dependency> + + <!-- Helpers --> + <dependency> + <groupId>io.vavr</groupId> + <artifactId>vavr</artifactId> + <version>0.9.2</version> + </dependency> + + <!-- SDK overlay war --> + <dependency> + <groupId>org.onap.portal.sdk</groupId> + <artifactId>epsdk-app-overlay</artifactId> + <version>${epsdk.version}</version> + <type>war</type> + </dependency> + <dependency> + <groupId>org.onap.portal.sdk</groupId> + <artifactId>epsdk-app-common</artifactId> + <version>${epsdk.version}</version> + <type>jar</type> + </dependency> + + <dependency> + <groupId>org.onap.portal.sdk</groupId> + <artifactId>epsdk-core</artifactId> + <version>${epsdk.version}</version> + </dependency> + <dependency> + <groupId>org.onap.portal.sdk</groupId> + <artifactId>epsdk-analytics</artifactId> + <version>${epsdk.version}</version> + <exclusions> + <exclusion> + <groupId>com.lowagie</groupId> + <artifactId>itext</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.onap.portal.sdk</groupId> + <artifactId>epsdk-workflow</artifactId> + <version>${epsdk.version}</version> + </dependency> + <dependency> + <groupId>com.att.eelf</groupId> + <artifactId>eelf-core</artifactId> + <version>1.0.0</version> + <exclusions> + <exclusion> + <artifactId>powermock-api-mockito</artifactId> + <groupId>org.powermock</groupId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-core</artifactId> + <version>1.2.3</version> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>1.2.3</version> + </dependency> + + <!-- Mapper --> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + <version>2.6.3</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + <version>2.8.6</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>2.6.7.1</version> + </dependency> + <dependency> + <groupId>org.codehaus.jackson</groupId> + <artifactId>jackson-mapper-asl</artifactId> + <version>1.9.13</version> + </dependency> + <dependency> + <groupId>com.mchange</groupId> + <artifactId>c3p0</artifactId> + <version>0.9.5.2</version> + </dependency> + <dependency> + <groupId>io.searchbox</groupId> + <artifactId>jest</artifactId> + <version>2.0.0</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + <version>3.1.0</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>2.4</version> + <!--<scope>test</scope>--> + </dependency> + <dependency> + <groupId>com.google.code.bean-matchers</groupId> + <artifactId>bean-matchers</artifactId> + <version>0.11</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.json</groupId> + <artifactId>json</artifactId> + <version>20160212</version> + </dependency> + <dependency> + <groupId>org.quartz-scheduler</groupId> + <artifactId>quartz</artifactId> + <version>2.2.1</version> + <exclusions> + <!-- exclude 0.9.1.1 to avoid dupe of com.mchange:c3p0:0.9.2.1 --> + <exclusion> + <groupId>c3p0</groupId> + <artifactId>c3p0</artifactId> + </exclusion> + </exclusions> + </dependency> + <!-- bridge to implement commons-logging using slf4j --> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jcl-over-slf4j</artifactId> + <version>1.7.12</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context-support</artifactId> + <version>${springframework.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + <version>${springframework.version}</version> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-test</artifactId> + <version>${springframework.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-tx</artifactId> + <version>${springframework.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + <version>${springframework.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-webmvc</artifactId> + <version>${springframework.version}</version> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.core</groupId> + <artifactId>jersey-client</artifactId> + <version>2.23.1</version> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.connectors</groupId> + <artifactId>jersey-jetty-connector</artifactId> + <version>2.23.1</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.jaxrs</groupId> + <artifactId>jackson-jaxrs-json-provider</artifactId> + <version>2.6.3</version> + </dependency> + <dependency> + <groupId>commons-beanutils</groupId> + <artifactId>commons-beanutils</artifactId> + <version>1.9.3</version> + </dependency> + <dependency> + <groupId>com.googlecode.json-simple</groupId> + <artifactId>json-simple</artifactId> + <version>1.1.1</version> + </dependency> + <dependency> + <groupId>org.seleniumhq.selenium</groupId> + <artifactId>selenium-java</artifactId> + <version>2.53.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.seleniumhq.selenium</groupId> + <artifactId>selenium-api</artifactId> + <version>2.53.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <version>6.8</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <version>2.23.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.seleniumhq.selenium</groupId> + <artifactId>selenium-firefox-driver</artifactId> + <version>2.53.1</version> + </dependency> + <dependency> + <groupId>xml-apis</groupId> + <artifactId>xml-apis</artifactId> + <version>1.4.01</version> + </dependency> + <dependency> + <groupId>org.yaml</groupId> + <artifactId>snakeyaml</artifactId> + <version>1.16</version> + </dependency> + <dependency> + <groupId>org.skyscreamer</groupId> + <artifactId>jsonassert</artifactId> + <version>1.5.0</version> + </dependency> + <dependency> + <groupId>org.onap.sdc.sdc-tosca</groupId> + <artifactId>sdc-tosca</artifactId> + <version>1.4.1</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>net.javacrumbs.json-unit</groupId> + <artifactId>json-unit</artifactId> + <version>1.23.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-text</artifactId> + <version>1.1</version> + </dependency> + <dependency> + <groupId>org.hamcrest</groupId> + <artifactId>java-hamcrest</artifactId> + <version>2.0.0.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.togglz</groupId> + <artifactId>togglz-spring-core</artifactId> + <version>2.5.0.Final</version> + </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>3.10.0</version> + <scope>compile</scope> + </dependency> + </dependencies> +</project> diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/AaiClientTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/AaiClientTest.java index 43ac2899..201ec098 100644 --- a/vid-app-common/src/test/java/org/onap/vid/aai/AaiClientTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/aai/AaiClientTest.java @@ -72,15 +72,12 @@ import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; +import static org.apache.commons.lang3.StringUtils.equalsIgnoreCase; import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.equalToIgnoringCase; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.*; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import static org.testng.Assert.*; @ContextConfiguration(classes = {LocalWebConfig.class, SystemProperties.class}) @@ -114,7 +111,7 @@ public class AaiClientTest { when(aaiClientMock.getLogicalLink(any(String.class))).thenCallRealMethod(); aaiClientMock.getLogicalLink(link); - Mockito.verify(aaiClientMock).doAaiGet(argThat(equalToIgnoringCase(expectedUrl)), any(Boolean.class)); + Mockito.verify(aaiClientMock).doAaiGet(argThat(s -> equalsIgnoreCase(s, expectedUrl)), any(Boolean.class)); } @DataProvider @@ -217,7 +214,7 @@ public class AaiClientTest { @Test public void getTenants_Arguments_Are_Null_Or_Empty() { - when(aaiClientMock.getTenants(any(String.class), any(String.class))).thenCallRealMethod(); + when(aaiClientMock.getTenants(any(), any())).thenCallRealMethod(); AaiResponse response = aaiClientMock.getTenants("", ""); diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/AaiOverTLSClientServerTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/AaiOverTLSClientServerTest.java index 7ae8ac83..d4f59e7d 100644 --- a/vid-app-common/src/test/java/org/onap/vid/aai/AaiOverTLSClientServerTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/aai/AaiOverTLSClientServerTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.xebialabs.restito.semantics.Action; import io.joshworks.restclient.http.HttpResponse; import io.joshworks.restclient.http.mapper.ObjectMapper; -import java.io.IOException; import org.assertj.core.api.Assertions; import org.glassfish.grizzly.http.util.HttpStatus; import org.json.simple.parser.JSONParser; @@ -34,13 +33,15 @@ import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.vid.aai.model.AaiNodeQueryResponse; import org.onap.vid.aai.model.ResourceType; import org.onap.vid.client.SyncRestClient; import org.onap.vid.model.SubscriberList; import org.onap.vid.testUtils.StubServerUtil; +import java.io.IOException; + @RunWith(MockitoJUnitRunner.class) public class AaiOverTLSClientServerTest { diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/AaiOverTLSClientTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/AaiOverTLSClientTest.java index 4e0e70e8..f281e84b 100644 --- a/vid-app-common/src/test/java/org/onap/vid/aai/AaiOverTLSClientTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/aai/AaiOverTLSClientTest.java @@ -21,20 +21,23 @@ package org.onap.vid.aai; import com.google.common.collect.ImmutableMap; -import java.util.Collections; -import java.util.Map; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.vid.aai.model.AaiNodeQueryResponse; import org.onap.vid.aai.model.ResourceType; import org.onap.vid.client.SyncRestClient; import org.onap.vid.model.SubscriberList; +import java.util.Collections; +import java.util.Map; + +import static org.mockito.ArgumentMatchers.contains; +import static org.mockito.ArgumentMatchers.eq; + @RunWith(MockitoJUnitRunner.class) public class AaiOverTLSClientTest { @@ -57,8 +60,8 @@ public class AaiOverTLSClientTest { mockPropertyReader(); aaiRestClient.searchNodeTypeByName("name", ResourceType.GENERIC_VNF); - Mockito.verify(syncRestClient).get(Matchers.contains(SEARCH_NODES_QUERY_SEARCH_NODE_TYPE), - Matchers.eq(getHeaders()), Matchers.eq(Collections.emptyMap()), Matchers.eq(AaiNodeQueryResponse.class)); + Mockito.verify(syncRestClient).get(contains(SEARCH_NODES_QUERY_SEARCH_NODE_TYPE), + eq(getHeaders()), eq(Collections.emptyMap()), eq(AaiNodeQueryResponse.class)); } @Test @@ -66,8 +69,8 @@ public class AaiOverTLSClientTest { mockPropertyReader(); aaiRestClient.getAllSubscribers(); - Mockito.verify(syncRestClient).get(Matchers.contains(SUBSCRIBERS), - Matchers.eq(getHeaders()), Matchers.eq(Collections.emptyMap()), Matchers.eq(SubscriberList.class)); + Mockito.verify(syncRestClient).get(contains(SUBSCRIBERS), + eq(getHeaders()), eq(Collections.emptyMap()), eq(SubscriberList.class)); } private void mockPropertyReader() { diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/util/HttpsAuthClientTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/util/HttpsAuthClientTest.java index f000dc80..ce957ab6 100644 --- a/vid-app-common/src/test/java/org/onap/vid/aai/util/HttpsAuthClientTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/aai/util/HttpsAuthClientTest.java @@ -21,21 +21,11 @@ package org.onap.vid.aai.util; -import org.junit.Before; -import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; -import org.onap.vid.aai.exceptions.HttpClientBuilderException; +import org.mockito.junit.MockitoJUnitRunner; import javax.net.ssl.SSLContext; -import java.util.Optional; - -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) public class HttpsAuthClientTest { diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/util/SingleAAIRestInterfaceTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/util/SingleAAIRestInterfaceTest.java index cd2b8ff2..7fad9019 100644 --- a/vid-app-common/src/test/java/org/onap/vid/aai/util/SingleAAIRestInterfaceTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/aai/util/SingleAAIRestInterfaceTest.java @@ -25,7 +25,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.vid.aai.exceptions.InvalidPropertyException; import org.testng.Assert; diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/rest/SdcRestClientTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/rest/SdcRestClientTest.java index c1d6ab78..642569c7 100644 --- a/vid-app-common/src/test/java/org/onap/vid/asdc/rest/SdcRestClientTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/rest/SdcRestClientTest.java @@ -25,7 +25,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.vid.asdc.AsdcCatalogException; import org.onap.vid.asdc.beans.Service; import org.onap.vid.client.SyncRestClient; @@ -37,9 +37,7 @@ import java.util.UUID; import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyMapOf; -import static org.mockito.Matchers.matches; +import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) @@ -82,7 +80,7 @@ public class SdcRestClientTest { @Test public void shouldReturnServiceForGivenUUID() throws AsdcCatalogException { String url = String.format(METADATA_URL_REGEX, randomId); - when(mockedSyncRestClient.get(matches(url), anyMapOf(String.class, String.class), anyMapOf(String.class, String.class), any())).thenReturn(httpResponse); + when(mockedSyncRestClient.get(matches(url), anyMap(), anyMap(), any())).thenReturn(httpResponse); when(httpResponse.getBody()).thenReturn(sampleService); Service service = restClient.getService(randomId); @@ -94,7 +92,7 @@ public class SdcRestClientTest { @Test(expected = AsdcCatalogException.class) public void shouldRaiseAsdcExceptionWhenClientFails() throws AsdcCatalogException { String url = String.format(METADATA_URL_REGEX, randomId); - when(mockedSyncRestClient.get(matches(url), anyMapOf(String.class, String.class), anyMapOf(String.class, String.class), any())).thenThrow(new RuntimeException()); + when(mockedSyncRestClient.get(matches(url), anyMap(), anyMap(), any())).thenThrow(new RuntimeException()); restClient.getService(randomId); } @@ -119,7 +117,7 @@ public class SdcRestClientTest { @Test(expected = AsdcCatalogException.class) public void shouldRaiseAsdcExceptionWhenDownloadFails() throws AsdcCatalogException { String url = String.format(MODEL_URL_REGEX, randomId); - when(mockedSyncRestClient.getStream(matches(url), anyMapOf(String.class, String.class), anyMapOf(String.class, String.class))).thenThrow(new RuntimeException()); + when(mockedSyncRestClient.getStream(matches(url), anyMap(), anyMap())).thenThrow(new RuntimeException()); restClient.getServiceToscaModel(randomId); diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/ClientCredentialsFilterTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/ClientCredentialsFilterTest.java index 61f18f54..113bf2bf 100644 --- a/vid-app-common/src/test/java/org/onap/vid/controller/ClientCredentialsFilterTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/controller/ClientCredentialsFilterTest.java @@ -13,7 +13,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; /** @@ -71,7 +71,7 @@ public class ClientCredentialsFilterTest { FilterChain chain = Mockito.mock(FilterChain.class); - Mockito.when(filter.verifyClientCredentials(any(String.class),any(String.class))).thenReturn(clientVerified); + Mockito.when(filter.verifyClientCredentials(any(),any())).thenReturn(clientVerified); Mockito.doNothing().when(response).sendError(401); Mockito.doCallRealMethod().when(filter).doFilter(request,response,chain); diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/PromiseEcompRequestIdFilterTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/PromiseEcompRequestIdFilterTest.java index 3bcb2d00..4f42171b 100644 --- a/vid-app-common/src/test/java/org/onap/vid/controller/PromiseEcompRequestIdFilterTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/controller/PromiseEcompRequestIdFilterTest.java @@ -19,11 +19,12 @@ import java.io.IOException; import java.util.*; import java.util.function.Function; +import static org.apache.commons.lang3.StringUtils.equalsIgnoreCase; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.argThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.argThat; import static org.onap.portalsdk.core.util.SystemProperties.ECOMP_REQUEST_ID; @Test @@ -130,8 +131,8 @@ public class PromiseEcompRequestIdFilterTest { private HttpServletRequest createMockedHttpServletRequest(Map<String, String> requestHeaders) { HttpServletRequest servletRequest = Mockito.mock(HttpServletRequest.class); requestHeaders.forEach((k, v) -> { - Mockito.when(servletRequest.getHeader(argThat(equalToIgnoringCase(k)))).thenReturn(v); - Mockito.when(servletRequest.getHeaders(argThat(equalToIgnoringCase(k)))).then(returnEnumerationAnswer(v)); + Mockito.when(servletRequest.getHeader(argThat(s -> equalsIgnoreCase(s, k)))).thenReturn(v); + Mockito.when(servletRequest.getHeaders(argThat(s -> equalsIgnoreCase(s, k)))).then(returnEnumerationAnswer(v)); }); Mockito.when(servletRequest.getHeaderNames()).then(returnEnumerationAnswer(requestHeaders.keySet())); return servletRequest; diff --git a/vid-app-common/src/test/java/org/onap/vid/controllers/ChangeManagementControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controllers/ChangeManagementControllerTest.java index 317bd978..58406a66 100644 --- a/vid-app-common/src/test/java/org/onap/vid/controllers/ChangeManagementControllerTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/controllers/ChangeManagementControllerTest.java @@ -1,23 +1,19 @@ package org.onap.vid.controllers; -import java.util.Collection; - -import javax.servlet.http.HttpServletRequest; - -import org.codehaus.jackson.map.ObjectMapper; import org.json.simple.JSONArray; import org.junit.Test; import org.onap.vid.changeManagement.ChangeManagementRequest; import org.onap.vid.changeManagement.GetVnfWorkflowRelationRequest; import org.onap.vid.changeManagement.VnfWorkflowRelationRequest; import org.onap.vid.mso.MsoResponseWrapperInterface; -import org.onap.vid.services.ChangeManagementService; import org.onap.vid.services.ChangeManagementServiceImpl; -import org.onap.vid.services.WorkflowService; import org.onap.vid.services.WorkflowServiceImpl; import org.springframework.http.ResponseEntity; import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletRequest; +import java.util.Collection; + public class ChangeManagementControllerTest { private ChangeManagementController createTestSubject() { diff --git a/vid-app-common/src/test/java/org/onap/vid/controllers/HealthCheckControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controllers/HealthCheckControllerTest.java index da9cdaa6..4894f35e 100644 --- a/vid-app-common/src/test/java/org/onap/vid/controllers/HealthCheckControllerTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/controllers/HealthCheckControllerTest.java @@ -5,7 +5,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.vid.dao.FnAppDoaImpl; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; @@ -13,8 +13,8 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders; import java.sql.SQLException; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.BDDMockito.given; -import static org.mockito.Matchers.anyString; import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR; import static org.springframework.http.HttpStatus.OK; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; diff --git a/vid-app-common/src/test/java/org/onap/vid/controllers/MaintenanceControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controllers/MaintenanceControllerTest.java index 7bdd6b86..3a9d88f0 100644 --- a/vid-app-common/src/test/java/org/onap/vid/controllers/MaintenanceControllerTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/controllers/MaintenanceControllerTest.java @@ -22,22 +22,8 @@ package org.onap.vid.controllers; * ============LICENSE_END========================================================= */ -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.then; -import static org.mockito.BDDMockito.willThrow; -import static org.mockito.Matchers.argThat; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.times; -import static org.onap.vid.model.CategoryParameter.Family.PARAMETER_STANDARDIZATION; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import java.util.Collections; -import java.util.function.BiFunction; -import javax.ws.rs.ForbiddenException; import org.apache.log4j.BasicConfigurator; import org.codehaus.jackson.map.ObjectMapper; import org.junit.Before; @@ -45,7 +31,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentMatcher; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.vid.category.AddCategoryOptionResponse; import org.onap.vid.category.AddCategoryOptionsRequest; import org.onap.vid.category.CategoryParameterOptionRep; @@ -61,6 +47,19 @@ import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilde import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import javax.ws.rs.ForbiddenException; +import java.util.Collections; +import java.util.function.BiFunction; + +import static org.mockito.ArgumentMatchers.argThat; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.BDDMockito.*; +import static org.mockito.Mockito.times; +import static org.onap.vid.model.CategoryParameter.Family.PARAMETER_STANDARDIZATION; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + @RunWith(MockitoJUnitRunner.class) public class MaintenanceControllerTest { diff --git a/vid-app-common/src/test/java/org/onap/vid/controllers/PromiseEcompRequestIdFilterTest.java b/vid-app-common/src/test/java/org/onap/vid/controllers/PromiseEcompRequestIdFilterTest.java index 77dba37e..f1740395 100644 --- a/vid-app-common/src/test/java/org/onap/vid/controllers/PromiseEcompRequestIdFilterTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/controllers/PromiseEcompRequestIdFilterTest.java @@ -19,11 +19,12 @@ import java.io.IOException; import java.util.*; import java.util.function.Function; +import static org.apache.commons.lang3.StringUtils.equalsIgnoreCase; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.argThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.argThat; import static org.onap.portalsdk.core.util.SystemProperties.ECOMP_REQUEST_ID; @Test @@ -130,8 +131,8 @@ public class PromiseEcompRequestIdFilterTest { private HttpServletRequest createMockedHttpServletRequest(Map<String, String> requestHeaders) { HttpServletRequest servletRequest = Mockito.mock(HttpServletRequest.class); requestHeaders.forEach((k, v) -> { - Mockito.when(servletRequest.getHeader(argThat(equalToIgnoringCase(k)))).thenReturn(v); - Mockito.when(servletRequest.getHeaders(argThat(equalToIgnoringCase(k)))).then(returnEnumerationAnswer(v)); + Mockito.when(servletRequest.getHeader(argThat(s -> equalsIgnoreCase(s, k)))).thenReturn(v); + Mockito.when(servletRequest.getHeaders(argThat(s -> equalsIgnoreCase(s, k)))).then(returnEnumerationAnswer(v)); }); Mockito.when(servletRequest.getHeaderNames()).then(returnEnumerationAnswer(requestHeaders.keySet())); return servletRequest; diff --git a/vid-app-common/src/test/java/org/onap/vid/controllers/VidControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controllers/VidControllerTest.java index 168d9009..198680af 100644 --- a/vid-app-common/src/test/java/org/onap/vid/controllers/VidControllerTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/controllers/VidControllerTest.java @@ -21,26 +21,8 @@ package org.onap.vid.controllers; -import static java.util.stream.Collectors.toMap; -import static org.assertj.core.api.Assertions.assertThat; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.hamcrest.Matchers.not; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.then; -import static org.mockito.Mockito.times; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.stream.IntStream; -import javax.ws.rs.core.MediaType; import org.apache.log4j.BasicConfigurator; import org.codehaus.jackson.map.ObjectMapper; import org.junit.Assert; @@ -49,21 +31,14 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.vid.asdc.AsdcCatalogException; import org.onap.vid.asdc.beans.SecureServices; import org.onap.vid.asdc.beans.Service; import org.onap.vid.asdc.beans.ServiceBuilder; -import org.onap.vid.model.CR; -import org.onap.vid.model.Network; -import org.onap.vid.model.Node; +import org.onap.vid.model.*; import org.onap.vid.model.PombaInstance.PombaRequest; import org.onap.vid.model.PombaInstance.ServiceInstance; -import org.onap.vid.model.ServiceModel; -import org.onap.vid.model.ServiceProxy; -import org.onap.vid.model.VNF; -import org.onap.vid.model.VfModule; -import org.onap.vid.model.VolumeGroup; import org.onap.vid.roles.RoleProvider; import org.onap.vid.services.AaiService; import org.onap.vid.services.PombaService; @@ -71,6 +46,25 @@ import org.onap.vid.services.VidService; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import javax.ws.rs.core.MediaType; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.stream.IntStream; + +import static java.util.stream.Collectors.toMap; +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.Matchers.not; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.then; +import static org.mockito.Mockito.times; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + @RunWith(MockitoJUnitRunner.class) public class VidControllerTest { diff --git a/vid-app-common/src/test/java/org/onap/vid/dao/FnAppDoaImplTest.java b/vid-app-common/src/test/java/org/onap/vid/dao/FnAppDoaImplTest.java index 2c2aa89a..6d60aa18 100644 --- a/vid-app-common/src/test/java/org/onap/vid/dao/FnAppDoaImplTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/dao/FnAppDoaImplTest.java @@ -1,20 +1,20 @@ package org.onap.vid.dao; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; import static org.assertj.core.api.Java6Assertions.assertThat; import static org.assertj.core.api.Java6Assertions.assertThatThrownBy; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.BDDMockito.given; -import static org.mockito.Matchers.anyString; @RunWith(MockitoJUnitRunner.class) public class FnAppDoaImplTest { diff --git a/vid-app-common/src/test/java/org/onap/vid/job/impl/JobWorkerTest.java b/vid-app-common/src/test/java/org/onap/vid/job/impl/JobWorkerTest.java index b7e8e35a..e58b6ba0 100644 --- a/vid-app-common/src/test/java/org/onap/vid/job/impl/JobWorkerTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/job/impl/JobWorkerTest.java @@ -19,7 +19,7 @@ import java.util.UUID; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java index 46167322..718e22fb 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java @@ -20,25 +20,8 @@ */ package org.onap.vid.mso; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.junit.Assert.assertEquals; -import static org.mockito.BDDMockito.given; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.argThat; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.onap.vid.mso.MsoBusinessLogicImpl.validateEndpointPath; - import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; -import java.net.URL; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.List; -import java.util.stream.Collectors; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -56,6 +39,22 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.togglz.core.manager.FeatureManager; +import java.io.IOException; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; +import java.util.stream.Collectors; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.mock; +import static org.onap.vid.mso.MsoBusinessLogicImpl.validateEndpointPath; + @ContextConfiguration(classes = {SystemProperties.class}) @RunWith(SpringJUnit4ClassRunner.class) public class MsoBusinessLogicImplTest { @@ -287,7 +286,7 @@ public class MsoBusinessLogicImplTest { return new String(Files.readAllBytes(path)); } - private static class MsoRequestWrapperMatcher extends + private static class MsoRequestWrapperMatcher implements ArgumentMatcher<org.onap.vid.changeManagement.RequestDetailsWrapper> { private final org.onap.vid.changeManagement.RequestDetailsWrapper expectedRequest; @@ -297,9 +296,8 @@ public class MsoBusinessLogicImplTest { } @Override - public boolean matches(Object argument) { - org.onap.vid.changeManagement.RequestDetailsWrapper requestDetailsWrapper = (org.onap.vid.changeManagement.RequestDetailsWrapper) argument; - return expectedRequest.requestDetails.equals(requestDetailsWrapper.requestDetails); + public boolean matches(org.onap.vid.changeManagement.RequestDetailsWrapper argument) { + return expectedRequest.requestDetails.equals(argument.requestDetails); } } } diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/OutgoingRequestIdTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/OutgoingRequestIdTest.java index 909975fb..197bfe75 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/rest/OutgoingRequestIdTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/OutgoingRequestIdTest.java @@ -2,12 +2,7 @@ package org.onap.vid.mso.rest; import com.google.common.collect.ImmutableList; import org.apache.commons.lang3.reflect.FieldUtils; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.InjectMocks; -import org.mockito.Matchers; -import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; +import org.mockito.*; import org.onap.vid.aai.util.AAIRestInterface; import org.onap.vid.changeManagement.RequestDetailsWrapper; import org.onap.vid.controller.filter.PromiseEcompRequestIdFilter; @@ -31,13 +26,9 @@ import java.util.function.Consumer; import java.util.stream.Collectors; import java.util.stream.Stream; +import static org.apache.commons.lang3.StringUtils.equalsIgnoreCase; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.allOf; -import static org.hamcrest.Matchers.equalToIgnoringCase; -import static org.hamcrest.Matchers.hasItem; -import static org.hamcrest.Matchers.hasToString; -import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.Matchers.matchesPattern; +import static org.hamcrest.Matchers.*; public class OutgoingRequestIdTest { @@ -130,7 +121,7 @@ public class OutgoingRequestIdTest { ArgumentCaptor<Object> argumentCaptor = ArgumentCaptor.forClass(Object.class); Mockito.verify(fakeBuilder) .header( - Matchers.argThat(equalToIgnoringCase(requestIdHeader)), + Matchers.argThat(s -> equalsIgnoreCase(s, requestIdHeader)), argumentCaptor.capture() ); requestId = argumentCaptor.getValue(); diff --git a/vid-app-common/src/test/java/org/onap/vid/scheduler/SchedulerRestInterfaceTest.java b/vid-app-common/src/test/java/org/onap/vid/scheduler/SchedulerRestInterfaceTest.java index 6390f580..0655aca9 100644 --- a/vid-app-common/src/test/java/org/onap/vid/scheduler/SchedulerRestInterfaceTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/scheduler/SchedulerRestInterfaceTest.java @@ -30,7 +30,7 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.vid.exceptions.GenericUncheckedException; import org.onap.vid.testUtils.StubServerUtil; import org.testng.annotations.AfterMethod; diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java index 7ad49a96..5ead3fce 100644 --- a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java @@ -23,7 +23,6 @@ package org.onap.vid.services; import com.google.common.collect.ImmutableMap; import io.joshworks.restclient.http.HttpResponse; -import java.io.UnsupportedEncodingException; import jersey.repackaged.com.google.common.collect.ImmutableList; import org.apache.http.HttpStatus; import org.apache.http.HttpVersion; @@ -45,9 +44,10 @@ import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; import org.togglz.core.manager.FeatureManager; import javax.inject.Inject; +import java.io.UnsupportedEncodingException; import java.util.*; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests { diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java index 3f13c9df..9711fa85 100644 --- a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java @@ -1,72 +1,9 @@ package org.onap.vid.services; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import jersey.repackaged.com.google.common.collect.ImmutableList; -import net.javacrumbs.jsonunit.JsonAssert; -import org.apache.commons.io.IOUtils; -import org.hibernate.SessionFactory; -import org.json.JSONException; -import org.mockito.ArgumentCaptor; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; -import org.onap.vid.aai.exceptions.InvalidAAIResponseException; -import org.onap.vid.aai.model.ResourceType; -import org.onap.vid.changeManagement.RequestDetailsWrapper; -import org.onap.vid.exceptions.GenericUncheckedException; -import org.onap.vid.exceptions.MaxRetriesException; -import org.onap.vid.exceptions.OperationNotAllowedException; -import org.onap.vid.job.Job; -import org.onap.vid.job.Job.JobStatus; -import org.onap.vid.job.JobAdapter; -import org.onap.vid.job.JobsBrokerService; -import org.onap.vid.job.impl.JobDaoImpl; -import org.onap.vid.model.JobAuditStatus; -import org.onap.vid.model.JobAuditStatus.SourceStatus; -import org.onap.vid.model.NameCounter; -import org.onap.vid.model.ServiceInfo; -import org.onap.vid.model.serviceInstantiation.ServiceInstantiation; -import org.onap.vid.model.serviceInstantiation.Vnf; -import org.onap.vid.mso.model.ServiceInstantiationRequestDetails; -import org.onap.vid.mso.rest.AsyncRequestStatus; -import org.onap.vid.utils.DaoUtils; +import org.onap.portalsdk.core.util.SystemProperties; import org.onap.vid.config.DataSourceConfig; import org.onap.vid.config.MockedAaiClientAndFeatureManagerConfig; -import org.onap.vid.mso.MsoOperationalEnvironmentTest; -import org.onap.vid.services.AsyncInstantiationBaseTest; -import org.onap.portalsdk.core.domain.FusionObject; -import org.onap.portalsdk.core.service.DataAccessService; -import org.onap.portalsdk.core.util.SystemProperties; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; -import org.testng.Assert; -import org.testng.annotations.*; - -import javax.inject.Inject; -import java.io.IOException; -import java.lang.reflect.Method; -import java.net.URL; -import java.time.Instant; -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.util.*; -import java.util.Optional; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.stream.Collectors; -import java.util.stream.IntStream; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.contains; -import static org.hamcrest.Matchers.*; -import static org.hamcrest.core.Every.everyItem; -import static org.hamcrest.core.IsEqual.equalTo; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.*; -import static org.onap.vid.job.Job.JobStatus.*; -import static org.testng.Assert.*; @ContextConfiguration(classes = {DataSourceConfig.class, SystemProperties.class, MockedAaiClientAndFeatureManagerConfig.class}) public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseTest { diff --git a/vid-app-common/src/test/java/org/onap/vid/services/CategoryParameterServiceImplTest.java b/vid-app-common/src/test/java/org/onap/vid/services/CategoryParameterServiceImplTest.java index 6ac7b544..7a4263c7 100644 --- a/vid-app-common/src/test/java/org/onap/vid/services/CategoryParameterServiceImplTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/services/CategoryParameterServiceImplTest.java @@ -20,18 +20,6 @@ */ package org.onap.vid.services; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.MockitoAnnotations.initMocks; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import javax.ws.rs.ForbiddenException; import org.mockito.InjectMocks; import org.mockito.Mock; import org.onap.portalsdk.core.service.DataAccessService; @@ -50,6 +38,16 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeSuite; import org.testng.annotations.Test; +import javax.ws.rs.ForbiddenException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.*; +import static org.mockito.MockitoAnnotations.initMocks; + public class CategoryParameterServiceImplTest { private static final String CATEGORY_NAME = "SAMPLE_CATEGORY_NAME"; @@ -89,7 +87,7 @@ public class CategoryParameterServiceImplTest { Assert.assertTrue(result.getErrors().isEmpty());; verify(dataAccessService, times(1)) - .saveDomainObject(anyObject(), anyObject()); + .saveDomainObject(any(), any()); } @Test @@ -162,12 +160,12 @@ public class CategoryParameterServiceImplTest { categoryParameter.getOptions().add(categoryParameterOption); List<CategoryParameter> aList = createCategoryParametersList(categoryParameter); - doReturn(aList).when(dataAccessService).getList(anyObject(), anyString(), anyString(), anyObject()); + doReturn(aList).when(dataAccessService).getList(any(), anyString(), any(), any()); testSubject.deleteCategoryOption(CATEGORY_NAME, categoryParameterOption); verify(dataAccessService, times(1)) - .deleteDomainObject(anyObject(), anyObject()); + .deleteDomainObject(any(), any()); } @Test @@ -178,7 +176,7 @@ public class CategoryParameterServiceImplTest { categoryParameter.getOptions().add(categoryParameterOption); List<CategoryParameter> aList = createCategoryParametersList(categoryParameter); - doReturn(aList).when(dataAccessService).getList(anyObject(), anyString(), anyString(), anyObject()); + doReturn(aList).when(dataAccessService).getList(any(), anyString(), any(), any()); CategoryParametersResponse response = testSubject.getCategoryParameters(Family.PARAMETER_STANDARDIZATION); @@ -186,7 +184,7 @@ public class CategoryParameterServiceImplTest { Assert.assertTrue(response.getCategoryParameters().containsKey(CATEGORY_NAME)); verify(dataAccessService, times(1)) - .getList(anyObject(), anyString(), anyString(), anyObject()); + .getList(any(), anyString(), any(), any()); } @Test @@ -202,7 +200,7 @@ public class CategoryParameterServiceImplTest { AddCategoryOptionResponse result = testSubject.updateCategoryParameterOption(CATEGORY_NAME, optionRepExisting); verify(dataAccessService, times(1)) - .saveDomainObject(anyObject(), anyObject()); + .saveDomainObject(any(), any()); } @Test(expectedExceptions = { ForbiddenException.class }) diff --git a/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceImplTest.java b/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceImplTest.java index 157f59c7..00d9e173 100644 --- a/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceImplTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceImplTest.java @@ -1,12 +1,12 @@ package org.onap.vid.services; import org.mockito.*; +import org.onap.portalsdk.core.service.DataAccessService; import org.onap.vid.changeManagement.ChangeManagementRequest; import org.onap.vid.changeManagement.RequestDetails; import org.onap.vid.mso.MsoBusinessLogic; import org.onap.vid.mso.MsoResponseWrapperInterface; import org.onap.vid.scheduler.SchedulerRestInterfaceIfc; -import org.onap.portalsdk.core.service.DataAccessService; import org.springframework.http.ResponseEntity; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -54,47 +54,47 @@ public class ChangeManagementServiceImplTest { @Test public void doChangeManagement_requestTypeIsUpdate_MsoUpdateVnfIsCalled() throws Exception { - Mockito.doReturn(Mockito.mock(MsoResponseWrapperInterface.class)).when(msoBusinessLogicMock).updateVnf(Mockito.any(),Mockito.anyString(),Mockito.anyString()); + Mockito.doReturn(Mockito.mock(MsoResponseWrapperInterface.class)).when(msoBusinessLogicMock).updateVnf(Mockito.any(),Mockito.any(),Mockito.any()); RequestDetails requestDetails = callChangeManagement(ChangeManagementRequest.UPDATE); ArgumentCaptor<RequestDetails> argumentCaptor = ArgumentCaptor.forClass(RequestDetails.class); - verify(msoBusinessLogicMock).updateVnf(argumentCaptor.capture(),Mockito.anyString(),Mockito.anyString()); + verify(msoBusinessLogicMock).updateVnf(argumentCaptor.capture(),Mockito.any(),Mockito.any()); assertEquals(argumentCaptor.getValue().getVnfInstanceId(),requestDetails.getVnfInstanceId()); } @Test public void doChangeManagement_requestTypeIsReplace_MsoUpdateVnfIsCalled() throws Exception { - Mockito.doReturn(Mockito.mock(MsoResponseWrapperInterface.class)).when(msoBusinessLogicMock).replaceVnf(Mockito.any(),Mockito.anyString(),Mockito.anyString()); + Mockito.doReturn(Mockito.mock(MsoResponseWrapperInterface.class)).when(msoBusinessLogicMock).replaceVnf(Mockito.any(),Mockito.any(),Mockito.any()); RequestDetails requestDetails = callChangeManagement(ChangeManagementRequest.REPLACE); ArgumentCaptor<RequestDetails> argumentCaptor = ArgumentCaptor.forClass(RequestDetails.class); - verify(msoBusinessLogicMock).replaceVnf(argumentCaptor.capture(),Mockito.anyString(),Mockito.anyString()); + verify(msoBusinessLogicMock).replaceVnf(argumentCaptor.capture(),Mockito.any(),Mockito.any()); assertEquals(argumentCaptor.getValue().getVnfInstanceId(),requestDetails.getVnfInstanceId()); } @Test public void doChangeManagement_requestTypeIsInPlaceSoftwareUpdate_MsoUpdateVnfIsCalled() throws Exception { - Mockito.doReturn(Mockito.mock(MsoResponseWrapperInterface.class)).when(msoBusinessLogicMock).updateVnfSoftware(Mockito.any(),Mockito.anyString(),Mockito.anyString()); + Mockito.doReturn(Mockito.mock(MsoResponseWrapperInterface.class)).when(msoBusinessLogicMock).updateVnfSoftware(Mockito.any(),Mockito.any(),Mockito.any()); RequestDetails requestDetails = callChangeManagement(ChangeManagementRequest.VNF_IN_PLACE_SOFTWARE_UPDATE); ArgumentCaptor<RequestDetails> argumentCaptor = ArgumentCaptor.forClass(RequestDetails.class); - verify(msoBusinessLogicMock).updateVnfSoftware(argumentCaptor.capture(),Mockito.anyString(),Mockito.anyString()); + verify(msoBusinessLogicMock).updateVnfSoftware(argumentCaptor.capture(),Mockito.any(),Mockito.any()); assertEquals(argumentCaptor.getValue().getVnfInstanceId(),requestDetails.getVnfInstanceId()); } @Test public void doChangeManagement_requestTypeIsConfigUpdate_MsoUpdateVnfIsCalled() throws Exception { - Mockito.doReturn(Mockito.mock(MsoResponseWrapperInterface.class)).when(msoBusinessLogicMock).updateVnfConfig(Mockito.any(),Mockito.anyString(),Mockito.anyString()); + Mockito.doReturn(Mockito.mock(MsoResponseWrapperInterface.class)).when(msoBusinessLogicMock).updateVnfConfig(Mockito.any(),Mockito.any(),Mockito.any()); RequestDetails requestDetails = callChangeManagement(ChangeManagementRequest.CONFIG_UPDATE); ArgumentCaptor<RequestDetails> argumentCaptor = ArgumentCaptor.forClass(RequestDetails.class); - verify(msoBusinessLogicMock).updateVnfConfig(argumentCaptor.capture(),Mockito.anyString(),Mockito.anyString()); + verify(msoBusinessLogicMock).updateVnfConfig(argumentCaptor.capture(),Mockito.any(),Mockito.any()); assertEquals(argumentCaptor.getValue().getVnfInstanceId(),requestDetails.getVnfInstanceId()); } @@ -106,8 +106,8 @@ public class ChangeManagementServiceImplTest { updateRequest.setRequestType(requestType); RequestDetails requestDetails = new RequestDetails(); requestDetails.setVnfInstanceId("vnfFakeId"); - Mockito.doReturn("fakeId").when(changeManagementServiceSpied).extractServiceInstanceId(Mockito.anyObject(),Mockito.anyString()); - Mockito.doReturn(requestDetails).when(changeManagementServiceSpied).findRequestByVnfName(Matchers.anyList(),Mockito.anyString()); + Mockito.doReturn("fakeId").when(changeManagementServiceSpied).extractServiceInstanceId(Mockito.any(),Mockito.any()); + Mockito.doReturn(requestDetails).when(changeManagementServiceSpied).findRequestByVnfName(Matchers.any(),Mockito.any()); changeManagementServiceSpied.doChangeManagement(updateRequest,"anyVnfName"); diff --git a/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceUnitTest.java b/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceUnitTest.java index 8aafda3f..d849869b 100644 --- a/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceUnitTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceUnitTest.java @@ -24,6 +24,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import io.joshworks.restclient.http.HttpResponse; import org.apache.commons.io.IOUtils; import org.mockito.ArgumentCaptor; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.util.SystemProperties; import org.onap.vid.changeManagement.ChangeManagementRequest; import org.onap.vid.changeManagement.RequestDetailsWrapper; import org.onap.vid.client.SyncRestClient; @@ -37,8 +39,6 @@ import org.onap.vid.mso.rest.RequestDetails; import org.onap.vid.properties.AsdcClientConfiguration; import org.onap.vid.scheduler.SchedulerRestInterfaceIfc; import org.onap.vid.testUtils.RegExMatcher; -import org.onap.portalsdk.core.service.DataAccessService; -import org.onap.portalsdk.core.util.SystemProperties; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; import org.springframework.context.annotation.Bean; @@ -54,8 +54,8 @@ import java.net.URL; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsInstanceOf.instanceOf; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Matchers.anyString; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.*; @@ -74,7 +74,7 @@ public class ChangeManagementServiceUnitTest extends AbstractTestNGSpringContext void testInPlaceSoftwareUpdateRequest() throws Exception { - doReturn(new HttpResponse<>(anyObject(), RequestReferencesContainer.class, anyObject())).when(restClientUnderTest).post(anyString(), anyObject(), anyObject()); + doReturn(new HttpResponse<>(any(), RequestReferencesContainer.class, any())).when(restClientUnderTest).post(anyString(), any(), any()); URL requestJsonUrl = this.getClass().getResource("/services/change_management_software_update_request.json"); ChangeManagementRequest changeManagementRequest = objectMapper.readValue(requestJsonUrl, ChangeManagementRequest.class); diff --git a/vid-app-common/src/test/java/org/onap/vid/testUtils/TestUtils.java b/vid-app-common/src/test/java/org/onap/vid/testUtils/TestUtils.java index 0460f532..b4c7828b 100644 --- a/vid-app-common/src/test/java/org/onap/vid/testUtils/TestUtils.java +++ b/vid-app-common/src/test/java/org/onap/vid/testUtils/TestUtils.java @@ -22,8 +22,8 @@ import java.util.Iterator; import java.util.List; import static fj.parser.Parser.fail; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.*; /** |