aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBharath Balasubramanian <bharathb@research.att.com>2018-12-20 06:37:14 +0000
committerGerrit Code Review <gerrit@onap.org>2018-12-20 06:37:14 +0000
commitd7c26306f0daaa7645f88f1bbb1f1d5cca88ac6c (patch)
tree72b3d41d5a1d5f24348ba7a0313c716afdd9f213
parent85662cac4cfd2276ced5777c2547ad6df1d67eac (diff)
parente71ad4704a4a16874be65f40713009e13ce4eabf (diff)
Merge "added files to convert project to spring boot" into dev-cassandra-only
-rw-r--r--.gitignore48
-rwxr-xr-xpom.xml947
-rw-r--r--src/main/java/org/onap/music/spring/data/cassandra/CassandraConfig.java67
-rw-r--r--src/main/java/org/onap/music/spring/data/cassandra/MusicApplication.java55
-rw-r--r--src/main/java/org/onap/music/util/TestVotingApp.java145
-rw-r--r--src/main/resources/application.properties2
-rw-r--r--src/test/java/org/onap/music/unittests/TestRestMusicData.java102
-rw-r--r--src/test/java/org/onap/music/unittests/TestRestMusicQAPI.java47
-rw-r--r--src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker1
-rw-r--r--src/test/resources/mockito-extensions/org.mockito.plugins.StackTraceCleanerProvider1
10 files changed, 859 insertions, 556 deletions
diff --git a/.gitignore b/.gitignore
index c795c9e7..570ed90e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,31 +1,27 @@
-# Byte-compiled / optimized / DLL files
-__pycache__/
-*.py[cod]
+/target/
+!.mvn/wrapper/maven-wrapper.jar
-# ignore all bin directories
-# matches "bin" in any subfolder
-bin/
-
-# ignore all target directories
-target/
-src/main/webapp
-# ignore all files ending with ~
-*~
-
-.DS_Store
-
-._*
-
-.metadata
-# Eclipse stuff
-.settings/
+### STS ###
+.apt_generated
.classpath
+.factorypath
.project
-# Idea
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
.idea
-debug-logs/
-.README.md.html
+*.iws
+*.iml
+*.ipr
-docs/Makefile
-docs/_build
-docs/conf.py
+### NetBeans ###
+/nbproject/private/
+/build/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+src/main/webapp/WEB-INF/classes/
+debug-logs/
diff --git a/pom.xml b/pom.xml
index 7be084f9..2c90b00d 100755
--- a/pom.xml
+++ b/pom.xml
@@ -1,464 +1,509 @@
-<!--
- ============LICENSE_START==========================================
- org.onap.music
- ===================================================================
- Copyright (c) 2017 AT&T Intellectual Property
- ===================================================================
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- ============LICENSE_END=============================================
- ====================================================================
--->
+<?xml version="1.0"?>
+<!-- ============LICENSE_START==========================================
+ org.onap.music ===================================================================
+ Copyright (c) 2017 AT&T Intellectual Property
+ Modifications Copyright (c) 2018 IBM===================================================================
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ use this file except in compliance with the License. You may obtain a copy
+ of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
+ by applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ OF ANY KIND, either express or implied. See the License for the specific
+ language governing permissions and limitations under the License. ============LICENSE_END=============================================
+ ==================================================================== -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.onap.music</groupId>
- <artifactId>dev-MUSIC-cassandra</artifactId>
- <packaging>jar</packaging>
- <version>3.2.1-SNAPSHOT</version>
- <description>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.onap.music</groupId>
+ <artifactId>dev-MUSIC-cassandra</artifactId>
+ <packaging>war</packaging>
+ <version>3.2.1-SNAPSHOT</version>
+ <description>
This is the MUSIC REST interface, packaged as a war file.
</description>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <jersey1.version>1.19</jersey1.version>
- <jersey2.version>2.25.1</jersey2.version>
- <jaxrs.version>2.0.1</jaxrs.version>
- <cassandra.version>3.4.0</cassandra.version>
- <zookeeper.version>3.4.11</zookeeper.version>
+ <parent>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-parent</artifactId>
+ <version>2.1.0.RELEASE</version>
+ <relativePath /> <!-- lookup parent from repository -->
+ </parent>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <!--nexus -->
- <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/music/${project.version}</sitePath>
- <!--maven -->
- <timestamp>${maven.build.timestamp}</timestamp>
- <maven.build.timestamp.format>yyyy.MM.dd.HH.mm</maven.build.timestamp.format>
- <!--docker -->
- <docker.tag>${project.version}-${timestamp}</docker.tag>
- <docker.latest.tag>${project.version}-latest</docker.latest.tag>
- </properties>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <jersey1.version>1.19</jersey1.version>
+ <jersey2.version>2.25.1</jersey2.version>
+ <jaxrs.version>2.0.1</jaxrs.version>
+ <cassandra.version>3.4.0</cassandra.version>
+ <zookeeper.version>3.4.11</zookeeper.version>
- <repositories>
- <repository>
- <id>ecomp-releases</id>
- <name>ECOMP Release Repository</name>
- <url>${onap.nexus.url}/${releaseNexusPath}</url>
- </repository>
- <repository>
- <id>ecomp-snapshots</id>
- <name>Snapshot Repository</name>
- <url>${nexusproxy}/${snapshotNexusPath}</url>
- </repository>
- <repository>
- <id>ecomp-staging</id>
- <name>Staging Repository</name>
- <url>${nexusproxy}/${stagingNexusPath}</url>
- </repository>
- </repositories>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <!--nexus -->
+ <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/music/${project.version}</sitePath>
+ <!--maven -->
+ <timestamp>${maven.build.timestamp}</timestamp>
+ <maven.build.timestamp.format>yyyy.MM.dd.HH.mm</maven.build.timestamp.format>
+ <!--docker -->
+ <docker.tag>${project.version}-${timestamp}</docker.tag>
+ <docker.latest.tag>${project.version}-latest</docker.latest.tag>
+ </properties>
- <build>
- <finalName>dev-MUSIC-cassandra</finalName>
- <sourceDirectory>src/main/java</sourceDirectory>
- <outputDirectory>src/main/webapp/WEB-INF/classes</outputDirectory>
- <testSourceDirectory>src/test/java</testSourceDirectory>
- <testOutputDirectory>target/test-classes</testOutputDirectory>
- <defaultGoal>validate</defaultGoal>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <artifactId>maven-eclipse-plugin</artifactId>
- <version>2.9</version>
- <configuration>
- <additionalProjectnatures>
- <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
- </additionalProjectnatures>
- <additionalBuildcommands>
- <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
- </additionalBuildcommands>
- <downloadSources>true</downloadSources>
- <downloadJavadocs>true</downloadJavadocs>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.5.1</version>
- <configuration>
- <source>1.7</source>
- <target>1.7</target>
- <excludes>
- <exclude>jar/**</exclude>
- </excludes>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-war-plugin</artifactId>
- <version>2.4</version>
- <configuration>
- <warSourceDirectory>WebContent</warSourceDirectory>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.4</version>
- <executions>
- <execution>
- <id>make-a-jar</id>
- <phase>compile</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- <configuration>
- <excludes>
- <exclude>**/*.xml</exclude>
- <exclude>**/*.properties</exclude>
- <exclude>**/Sample*</exclude>
- </excludes>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-install-plugin</artifactId>
- <version>2.4</version>
- <executions>
- <execution>
- <phase>install</phase>
- <goals>
- <goal>install-file</goal>
- </goals>
- <configuration>
- <packaging>jar</packaging>
- <artifactId>${project.artifactId}</artifactId>
- <groupId>${project.groupId}</groupId>
- <version>${project.version}</version>
- <file>${project.build.directory}/${project.artifactId}.jar</file>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <repositories>
+ <repository>
+ <id>ecomp-releases</id>
+ <name>ECOMP Release Repository</name>
+ <url>${onap.nexus.url}/${releaseNexusPath}</url>
+ </repository>
+ <repository>
+ <id>ecomp-snapshots</id>
+ <name>Snapshot Repository</name>
+ <url>${nexusproxy}/${snapshotNexusPath}</url>
+ </repository>
+ <repository>
+ <id>ecomp-staging</id>
+ <name>Staging Repository</name>
+ <url>${nexusproxy}/${stagingNexusPath}</url>
+ </repository>
+ </repositories>
- <dependencies>
- <!-- Development -->
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <version>3.0.1</version>
- <scope>provided</scope>
- </dependency>
- <!-- /Development -->
-
- <!-- Logging -->
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-core</artifactId>
- <version>1.2.3</version>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <version>1.2.3</version>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>com.att.eelf</groupId>
- <artifactId>eelf-core</artifactId>
- <version>1.0.1-oss</version>
- </dependency>
- <!-- End Logging -->
-
- <!-- Cassandra -->
- <dependency>
- <groupId>com.datastax.cassandra</groupId>
- <artifactId>cassandra-driver-core</artifactId>
- <version>${cassandra.version}</version>
- </dependency>
- <!-- /Cassandra -->
-
- <!-- Zookeeper -->
- <dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- <version>${zookeeper.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <!-- /Zookeeper -->
-
- <!-- Jersey -->
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-client</artifactId>
- <version>${jersey1.version}</version>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-server</artifactId>
- <version>${jersey1.version}</version>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-json</artifactId>
- <version>${jersey1.version}</version>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-servlet</artifactId>
- <version>${jersey1.version}</version>
- </dependency>
- <!-- /Jersey -->
+ <build>
+ <finalName>dev-MUSIC-cassandra</finalName>
+ <sourceDirectory>src/main/java</sourceDirectory>
+ <outputDirectory>src/main/webapp/WEB-INF/classes</outputDirectory>
+ <testSourceDirectory>src/test/java</testSourceDirectory>
+ <testOutputDirectory>target/test-classes</testOutputDirectory>
+ <defaultGoal>validate</defaultGoal>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <version>2.9</version>
+ <configuration>
+ <additionalProjectnatures>
+ <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
+ </additionalProjectnatures>
+ <additionalBuildcommands>
+ <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
+ </additionalBuildcommands>
+ <downloadSources>true</downloadSources>
+ <downloadJavadocs>true</downloadJavadocs>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.5.1</version>
+ <configuration>
+ <source>1.7</source>
+ <target>1.7</target>
+ <excludes>
+ <exclude>jar/**</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.4</version>
+ <configuration>
+ <warSourceDirectory>WebContent</warSourceDirectory>
+ <failOnMissingWebXml>false</failOnMissingWebXml>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.4</version>
+ <executions>
+ <execution>
+ <id>make-a-jar</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <excludes>
+ <exclude>**/*.xml</exclude>
+ <exclude>**/*.properties</exclude>
+ <exclude>**/Sample*</exclude>
+ </excludes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <version>2.4</version>
+ <executions>
+ <execution>
+ <phase>install</phase>
+ <goals>
+ <goal>install-file</goal>
+ </goals>
+ <configuration>
+ <packaging>jar</packaging>
+ <artifactId>${project.artifactId}</artifactId>
+ <groupId>${project.groupId}</groupId>
+ <version>${project.version}</version>
+ <file>${project.build.directory}/${project.artifactId}.jar</file>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-jcs-core</artifactId>
- <version>2.2</version>
- </dependency>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>1.11</version>
- </dependency>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <!-- Development -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>3.0.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <!-- /Development -->
+ <!-- <dependency> <groupId>com.hazelcast</groupId> <artifactId>hazelcast-client</artifactId>
+ <version>3.7.1</version> </dependency> -->
+
+ <!-- Swagger -->
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger2</artifactId>
+ <version>2.4.0</version>
+ </dependency>
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger-ui</artifactId>
+ <version>2.4.0</version>
+ </dependency>
+
+ <!-- Logging -->
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-core</artifactId>
+ <version>1.2.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>1.2.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>com.att.eelf</groupId>
+ <artifactId>eelf-core</artifactId>
+ <version>1.0.1-oss</version>
+ </dependency>
+ <!-- End Logging -->
+ <!-- Cassandra -->
+ <dependency>
+ <groupId>com.datastax.cassandra</groupId>
+ <artifactId>cassandra-driver-core</artifactId>
+ <version>${cassandra.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.dropwizard.metrics</groupId>
+ <artifactId>metrics-core</artifactId>
+ <version>3.1.0</version>
+ </dependency>
+ <!-- /Cassandra -->
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-data-cassandra</artifactId>
+ </dependency>
+ <!-- Zookeeper -->
+ <dependency>
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>zookeeper</artifactId>
+ <version>${zookeeper.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <!-- /Zookeeper -->
+ <!-- Jersey -->
+ <dependency>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-client</artifactId>
+ <version>${jersey1.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-server</artifactId>
+ <version>${jersey1.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-json</artifactId>
+ <version>${jersey1.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-servlet</artifactId>
+ <version>${jersey1.version}</version>
+ </dependency>
+ <!-- /Jersey -->
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-jcs-core</artifactId>
+ <version>2.2</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.11</version>
+ </dependency>
+
+ <!-- Testing -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.cassandraunit</groupId>
+ <artifactId>cassandra-unit</artifactId>
+ <version>3.3.0.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.curator</groupId>
+ <artifactId>curator-test</artifactId>
+ <version>2.3.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.zookeeper</groupId>
+ <artifactId>zookeeper</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>test</scope>
+ </dependency>
+ <!-- /Testing -->
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-handler</artifactId>
+ <version>4.1.30.Final</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>2.9.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>4.5.3</version>
+ </dependency>
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-jersey-jaxrs</artifactId>
+ <version>1.5.18</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>18.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mindrot</groupId>
+ <artifactId>jbcrypt</artifactId>
+ <version>0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-buffer</artifactId>
+ <version>4.1.30.Final</version>
+ </dependency>
+
+ <!-- <dependency> <groupId>com.owlike</groupId> <artifactId>genson</artifactId>
+ <version>1.3</version> </dependency> -->
+ </dependencies>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.10.3</version>
+ <configuration>
+ <author>true</author>
+ <breakiterator>true</breakiterator>
+ <version>true</version>
+ <links>
+ <link>https://docs.oracle.com/javase/7/docs/api/</link>
+ <link>https://tomcat.apache.org/tomcat-7.0-doc/jspapi/</link>
+ <link>http://docs.oracle.com/javaee/7/api/</link>
+ </links>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+ <profiles>
+ <profile>
+ <id>docker</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>0.19.1</version>
+ <configuration>
+ <verbose>true</verbose>
+ <apiVersion>1.23</apiVersion>
+ <registry>nexus3.onap.org:10003</registry>
+ <images>
+ <!-- MUSIC War -->
+ <image>
+ <name>onap/music/music</name>
+ <alias>docker_music</alias>
+ <build>
+ <cleanup>true</cleanup>
+ <tags>
+ <tag>${docker.tag}</tag>
+ <tag>${docker.latest.tag}</tag>
+ </tags>
+ <dockerFileDir>${project.basedir}</dockerFileDir>
+ <assembly>
+ <descriptorRef>artifact</descriptorRef>
+ </assembly>
+ </build>
+ </image>
+ <!-- Cassandra -->
+ <image>
+ <name>onap/music/cassandra_3_11</name>
+ <alias>docker_cassandra_sec</alias>
+ <build>
+ <cleanup>true</cleanup>
+ <tags>
+ <tag>${docker.tag}</tag>
+ <tag>${docker.latest.tag}</tag>
+ </tags>
+ <dockerFileDir>${project.basedir}/distribution/cassandra</dockerFileDir>
+ </build>
+ </image>
+ <!-- Cassandra Job -->
+ <image>
+ <name>onap/music/cassandra_job</name>
+ <alias>docker_cassandra_job</alias>
+ <build>
+ <cleanup>true</cleanup>
+ <tags>
+ <tag>${docker.tag}</tag>
+ <tag>${docker.latest.tag}</tag>
+ </tags>
+ <dockerFileDir>${project.basedir}/distribution/cassandra_job</dockerFileDir>
+ </build>
+ </image>
+ <!-- Zookeeper -->
+ <!-- <image> <name>onap/music/zookeeper_music</name> <alias>docker_zookeeper</alias>
+ <build> <cleanup>true</cleanup> <tags> <tag>3.4-${timestamp}</tag> <tag>3.4-latest</tag>
+ </tags> <dockerFileDir>${project.basedir}/distribution/zookeeper</dockerFileDir>
+ </build> </image> -->
+ <!-- tomcat 8.5 -->
+ <!-- <image> <name>onap/music/tomcat_music</name> <alias>docker_tomcat</alias>
+ <build> <cleanup>true</cleanup> <tags> <tag>8.5-${timestamp}</tag> <tag>8.5-latest</tag>
+ </tags> <dockerFileDir>${project.basedir}/distribution/tomcat</dockerFileDir>
+ </build> </image>\ -->
+ </images>
+ </configuration>
+ <executions>
+ <execution>
+ <id>clean-images</id>
+ <phase>pre-clean</phase>
+ <goals>
+ <goal>remove</goal>
+ </goals>
+ <configuration>
+ <removeAll>true</removeAll>
+ <image>music</image>
+ </configuration>
+ </execution>
+ <execution>
+ <id>generate-images</id>
+ <phase>package</phase>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>push-images</id>
+ <phase>deploy</phase>
+ <goals>
+ <goal>push</goal>
+ </goals>
+ <configuration>
+ <image>onap/music/music</image>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+ <distributionManagement>
+ <repository>
+ <id>ecomp-releases</id>
+ <name>Release Repository</name>
+ <url>${nexusproxy}/${releaseNexusPath}</url>
+ </repository>
+ <snapshotRepository>
+ <id>ecomp-snapshots</id>
+ <name>Snapshot Repository</name>
+ <url>${nexusproxy}/${snapshotNexusPath}</url>
+ </snapshotRepository>
+ <!-- added for javadoc -->
+ <site>
+ <id>ecomp-site</id>
+ <url>dav:${nexusproxy}${sitePath}</url>
+ </site>
+ </distributionManagement>
- <!-- Testing -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.cassandraunit</groupId>
- <artifactId>cassandra-unit</artifactId>
- <version>3.3.0.2</version>
- <scope>test</scope>
- </dependency>
- <!-- https://mvnrepository.com/artifact/it.unimi.dsi/fastutil -->
- <dependency>
- <groupId>org.apache.curator</groupId>
- <artifactId>curator-test</artifactId>
- <version>2.3.0</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- </exclusions>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.9.0</version>
- <scope>test</scope>
- </dependency>
- <!-- /Testing -->
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-handler</artifactId>
- <version>4.0.56.Final</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>2.9.4</version>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- <version>4.5.3</version>
- </dependency>
- <dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-jersey-jaxrs</artifactId>
- <version>1.5.18</version>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>19.0</version>
- </dependency>
- <dependency>
- <groupId>org.mindrot</groupId>
- <artifactId>jbcrypt</artifactId>
- <version>0.4</version>
- </dependency>
- </dependencies>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.10.3</version>
- <configuration>
- <author>true</author>
- <breakiterator>true</breakiterator>
- <version>true</version>
- <links>
- <link>https://docs.oracle.com/javase/7/docs/api/</link>
- <link>https://tomcat.apache.org/tomcat-7.0-doc/jspapi/</link>
- <link>http://docs.oracle.com/javaee/7/api/</link>
- </links>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
- <profiles>
- <profile>
- <id>docker</id>
- <build>
- <plugins>
- <plugin>
- <groupId>io.fabric8</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <version>0.19.1</version>
- <configuration>
- <verbose>true</verbose>
- <apiVersion>1.23</apiVersion>
- <registry>nexus3.onap.org:10003</registry>
- <images>
- <!-- MUSIC War -->
- <image>
- <name>onap/music/music</name>
- <alias>docker_music</alias>
- <build>
- <cleanup>true</cleanup>
- <tags>
- <tag>${docker.tag}</tag>
- <tag>${docker.latest.tag}</tag>
- </tags>
- <dockerFileDir>${project.basedir}</dockerFileDir>
- <assembly>
- <descriptorRef>artifact</descriptorRef>
- </assembly>
- </build>
- </image>
- <!-- Cassandra -->
- <image>
- <name>onap/music/cassandra_music</name>
- <alias>docker_cassandra</alias>
- <build>
- <cleanup>true</cleanup>
- <tags>
- <tag>3.0-${timestamp}</tag>
- <tag>3.0-latest</tag>
- </tags>
- <dockerFileDir>${project.basedir}/distribution/cassandra</dockerFileDir>
- </build>
- </image>
- <!-- Zookeeper -->
- <!-- <image> <name>onap/music/zookeeper_music</name>
- <alias>docker_zookeeper</alias> <build> <cleanup>true</cleanup> <tags> <tag>3.4-${timestamp}</tag>
- <tag>3.4-latest</tag> </tags> <dockerFileDir>${project.basedir}/distribution/zookeeper</dockerFileDir>
- </build> </image> -->
- <!-- tomcat 8.5 -->
- <!-- <image> <name>onap/music/tomcat_music</name>
- <alias>docker_tomcat</alias> <build> <cleanup>true</cleanup> <tags> <tag>8.5-${timestamp}</tag>
- <tag>8.5-latest</tag> </tags> <dockerFileDir>${project.basedir}/distribution/tomcat</dockerFileDir>
- </build> </image>\ -->
- </images>
- </configuration>
- <executions>
- <execution>
- <id>clean-images</id>
- <phase>pre-clean</phase>
- <goals>
- <goal>remove</goal>
- </goals>
- <configuration>
- <removeAll>true</removeAll>
- <image>music</image>
- </configuration>
- </execution>
- <execution>
- <id>generate-images</id>
- <phase>package</phase>
- <goals>
- <goal>build</goal>
- </goals>
- </execution>
- <execution>
- <id>push-images</id>
- <phase>deploy</phase>
- <goals>
- <goal>push</goal>
- </goals>
- <configuration>
- <image>onap/music/music</image>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
- <distributionManagement>
- <repository>
- <id>ecomp-releases</id>
- <name>Release Repository</name>
- <url>${nexusproxy}/${releaseNexusPath}</url>
- </repository>
- <snapshotRepository>
- <id>ecomp-snapshots</id>
- <name>Snapshot Repository</name>
- <url>${nexusproxy}/${snapshotNexusPath}</url>
- </snapshotRepository>
- <!-- added for javadoc -->
- <site>
- <id>ecomp-site</id>
- <url>dav:${nexusproxy}${sitePath}</url>
- </site>
- </distributionManagement>
</project>
diff --git a/src/main/java/org/onap/music/spring/data/cassandra/CassandraConfig.java b/src/main/java/org/onap/music/spring/data/cassandra/CassandraConfig.java
new file mode 100644
index 00000000..f35206db
--- /dev/null
+++ b/src/main/java/org/onap/music/spring/data/cassandra/CassandraConfig.java
@@ -0,0 +1,67 @@
+/*
+ * ============LICENSE_START==========================================
+ * org.onap.music
+ * ===================================================================
+ * Copyright (c) 2018 IBM.
+ * ===================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END=============================================
+ * ====================================================================
+ */
+
+package org.onap.music.spring.data.cassandra;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.env.Environment;
+import org.springframework.data.cassandra.config.AbstractCassandraConfiguration;
+import org.springframework.data.cassandra.config.SchemaAction;
+import org.springframework.data.cassandra.core.cql.keyspace.CreateKeyspaceSpecification;
+
+@Configuration
+public class CassandraConfig extends AbstractCassandraConfiguration {
+ @Autowired
+ private Environment env;
+
+ private static String KEYSPACE;
+
+ @Override
+ public SchemaAction getSchemaAction() {
+ return SchemaAction.CREATE_IF_NOT_EXISTS;
+ }
+
+ @Override
+ protected List<CreateKeyspaceSpecification> getKeyspaceCreations() {
+ String keyspace = env.getProperty("keyspace.name") + System.currentTimeMillis();
+ KEYSPACE=keyspace;
+ CreateKeyspaceSpecification specification = null;
+ specification = CreateKeyspaceSpecification.createKeyspace(KEYSPACE);
+ specification.ifNotExists(true);
+
+ return Arrays.asList(specification);
+ }
+
+ @Override
+ public String[] getEntityBasePackages() {
+ return new String[] { "org.onap.music" };
+ }
+
+ @Override
+ protected String getKeyspaceName() {
+ return KEYSPACE;
+ }
+}
diff --git a/src/main/java/org/onap/music/spring/data/cassandra/MusicApplication.java b/src/main/java/org/onap/music/spring/data/cassandra/MusicApplication.java
new file mode 100644
index 00000000..dabae9a5
--- /dev/null
+++ b/src/main/java/org/onap/music/spring/data/cassandra/MusicApplication.java
@@ -0,0 +1,55 @@
+/*
+ * ============LICENSE_START==========================================
+ * org.onap.music
+ * ===================================================================
+ * Copyright (c) 2018 IBM.
+ * ===================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END=============================================
+ * ====================================================================
+ */
+
+package org.onap.music.spring.data.cassandra;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
+import org.springframework.context.annotation.ComponentScan;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+@EnableSwagger2
+@SpringBootApplication
+@ComponentScan(basePackages = {"org.onap.music" })
+
+/**
+ *
+ */
+public class MusicApplication extends SpringBootServletInitializer {
+
+ /**
+ *
+ */
+ public static void main(String[] args) {
+ SpringApplication.run(MusicApplication.class, args);
+ }
+
+ /**
+ *
+ */
+ @Override
+ protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
+ return application.sources(MusicApplication.class);
+ }
+}
diff --git a/src/main/java/org/onap/music/util/TestVotingApp.java b/src/main/java/org/onap/music/util/TestVotingApp.java
new file mode 100644
index 00000000..e4a8272b
--- /dev/null
+++ b/src/main/java/org/onap/music/util/TestVotingApp.java
@@ -0,0 +1,145 @@
+/*
+ * ============LICENSE_START==========================================
+ * org.onap.music
+ * ===================================================================
+ * Copyright (c) 2018 IBM.
+ * ===================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END=============================================
+ * ====================================================================
+ */
+
+package org.onap.music.util;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.onap.music.datastore.PreparedQueryObject;
+import org.onap.music.exceptions.MusicLockingException;
+import org.onap.music.exceptions.MusicQueryException;
+import org.onap.music.exceptions.MusicServiceException;
+import org.onap.music.main.MusicCore;
+
+import com.datastax.driver.core.ResultSet;
+import com.datastax.driver.core.Row;
+
+/**
+ *
+ */
+public class TestVotingApp {
+ String keyspaceName;
+ String tableName;
+
+ public TestVotingApp() throws MusicServiceException {
+ keyspaceName = "VotingAppForMusic" + System.currentTimeMillis();
+ tableName = "votecount";
+ }
+
+ public void initialize() throws MusicServiceException {
+ createVotingKeyspace();
+ System.out.println("Created keyspaces");
+ createVotingTable();
+ System.out.println("Created tables");
+
+ createEntryForCandidate("Popeye");
+ createEntryForCandidate("Judy");
+ createEntryForCandidate("Flash");
+ createEntryForCandidate("Mickey");
+ System.out.println("Created candidates");
+ }
+
+ private void createVotingTable() throws MusicServiceException {
+ PreparedQueryObject queryObject = new PreparedQueryObject();
+ queryObject.appendQueryString(
+ "CREATE TABLE " + keyspaceName + "." + tableName + " (name text PRIMARY KEY, count int);");
+
+ try {
+ MusicCore.createTable(keyspaceName, tableName, queryObject, "eventual");
+ } catch (MusicServiceException e) {
+ throw (e);
+ }
+ }
+
+ private void createVotingKeyspace() throws MusicServiceException {
+ Map<String, Object> replicationInfo = new HashMap<String, Object>();
+ replicationInfo.put("'class'", "'SimpleStrategy'");
+ replicationInfo.put("'replication_factor'", 1);
+
+ PreparedQueryObject queryObject = new PreparedQueryObject();
+ queryObject.appendQueryString("CREATE KEYSPACE " + keyspaceName + " WITH REPLICATION = "
+ + replicationInfo.toString().replaceAll("=", ":"));
+
+ try {
+ MusicCore.nonKeyRelatedPut(queryObject, "eventual");
+ } catch (MusicServiceException e) {
+ throw (e);
+ }
+ }
+
+ /*
+ * private void createVotingTable() throws MusicServiceException {
+ * PreparedQueryObject queryObject = new PreparedQueryObject();
+ * queryObject.appendQueryString( "CREATE TABLE " + keyspaceName + "." +
+ * tableName + " (name text PRIMARY KEY, count int);");
+ *
+ * try { MusicCore.createTable(keyspaceName, tableName, queryObject,
+ * "eventual"); } catch (MusicServiceException e) { throw (e); } }
+ */
+
+ private void createEntryForCandidate(String candidateName) throws MusicServiceException {
+ PreparedQueryObject queryObject = new PreparedQueryObject();
+ queryObject.appendQueryString("INSERT INTO " + keyspaceName + "." + tableName + " (name, count) " + "VALUES ('"
+ + candidateName + "', 0);");
+
+ MusicCore.nonKeyRelatedPut(queryObject, "eventual");
+ }
+
+ public void updateVoteCount(String candidateName, int numVotes)
+ throws MusicLockingException, MusicQueryException, MusicServiceException {
+ PreparedQueryObject queryObject = new PreparedQueryObject();
+ queryObject.appendQueryString("UPDATE " + keyspaceName + "." + tableName + " SET count=" + numVotes
+ + " where name='" + candidateName + "';");
+ MusicCore.atomicPut(keyspaceName, tableName, candidateName, queryObject, null);
+ }
+
+ public HashMap<String, Integer> readAllVotes() throws MusicServiceException {
+ PreparedQueryObject queryObject = new PreparedQueryObject();
+ queryObject.appendQueryString("SELECT * FROM " + keyspaceName + "." + tableName);
+ ResultSet rs = MusicCore.get(queryObject);
+ HashMap<String, Integer> voteCount = new HashMap<String, Integer>();
+ for (Row candidate : rs.all()) {
+ voteCount.put(candidate.getString("name"), candidate.getInt("count"));
+ }
+ return voteCount;
+ }
+
+ public static void main(String[] args) throws Exception {
+ TestVotingApp tva = new TestVotingApp();
+ tva.initialize();
+
+ tva.updateVoteCount("Popeye", 5);
+ tva.updateVoteCount("Judy", 9);
+ tva.updateVoteCount("Mickey", 8);
+ tva.updateVoteCount("Flash", 1);
+ tva.updateVoteCount("Flash", 2);
+
+ HashMap<String, Integer> voteCount = tva.readAllVotes();
+ System.out.println(voteCount);
+ assert (voteCount.get("Popeye") == 5);
+ assert (voteCount.get("Judy") == 9);
+ assert (voteCount.get("Mickey") == 8);
+ assert (voteCount.get("Flash") == 2);
+ }
+
+} \ No newline at end of file
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
new file mode 100644
index 00000000..cdeaa6e0
--- /dev/null
+++ b/src/main/resources/application.properties
@@ -0,0 +1,2 @@
+keyspace.name=VotingAppForMusic
+server.port=1010 \ No newline at end of file
diff --git a/src/test/java/org/onap/music/unittests/TestRestMusicData.java b/src/test/java/org/onap/music/unittests/TestRestMusicData.java
index 493a6a4a..c8dd0830 100644
--- a/src/test/java/org/onap/music/unittests/TestRestMusicData.java
+++ b/src/test/java/org/onap/music/unittests/TestRestMusicData.java
@@ -39,11 +39,9 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.mindrot.jbcrypt.BCrypt;
-import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.music.datastore.MusicDataStoreHandle;
import org.onap.music.datastore.PreparedQueryObject;
import org.onap.music.datastore.jsonobjects.JsonDelete;
@@ -82,14 +80,6 @@ public class TestRestMusicData {
@Mock
UriInfo info;
-
- //* cjc out
- @Mock
- CachingUtil cachUtilMock;
-
- @InjectMocks
- private MusicCore mCore;
- //*/
static String appName = "TestApp";
static String userId = "TestUser";
@@ -198,7 +188,7 @@ public class TestRestMusicData {
jsonKeyspace.setDurabilityOfWrites("true");
jsonKeyspace.setKeyspaceName(keyspaceName);
jsonKeyspace.setReplicationInfo(replicationInfo);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.createKeySpace("1", "1", "1", null,authorization, appName, jsonKeyspace, keyspaceName);
System.out.println("#######status is " + response.getStatus());
System.out.println("Entity" + response.getEntity());
@@ -210,7 +200,7 @@ public class TestRestMusicData {
JsonKeySpace jsonKeyspace = new JsonKeySpace();
Map<String, String> consistencyInfo = new HashMap<>();
Map<String, Object> replicationInfo = new HashMap<>();
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.createKeySpace("1", "1", "1", null, authorization,appName, jsonKeyspace, keyspaceName);
System.out.println("#######status is " + response.getStatus());
System.out.println("Entity" + response.getEntity());
@@ -223,7 +213,7 @@ public class TestRestMusicData {
Map<String, String> consistencyInfo = new HashMap<>();
Map<String, Object> replicationInfo = new HashMap<>();
String appName1 = "test";
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.createKeySpace("1", "1", "1", null,authorization, appName1, jsonKeyspace, keyspaceName);
System.out.println("#######status is " + response.getStatus());
System.out.println("Entity" + response.getEntity());
@@ -242,7 +232,7 @@ public class TestRestMusicData {
jsonKeyspace.setDurabilityOfWrites("true");
jsonKeyspace.setKeyspaceName("TestApp1");
jsonKeyspace.setReplicationInfo(replicationInfo);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.createKeySpace("1", "1", "1", null,authorization, "TestApp1",
jsonKeyspace, keyspaceName);
System.out.println("#######status is " + response.getStatus());
@@ -252,8 +242,6 @@ public class TestRestMusicData {
@Test
public void Test2_createKeyspaceEmptyAuth() throws Exception {
-
- //MockitoAnnotations.initMocks(this);
JsonKeySpace jsonKeyspace = new JsonKeySpace();
Map<String, String> consistencyInfo = new HashMap<>();
Map<String, Object> replicationInfo = new HashMap<>();
@@ -267,7 +255,7 @@ public class TestRestMusicData {
//Map<String, Object> m1= new HashMap<>() ;
//Mockito.when(CachingUtil.verifyOnboarding("x","y","x")).thenReturn(m1);
//Mockito.when(CachingUtil.verifyOnboarding(appNamex,userId,password).thenReturn(m1));
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
String authDatax = ":"+password;
String authorizationx = new String(Base64.encode(authDatax.getBytes()));
try {
@@ -295,7 +283,7 @@ public class TestRestMusicData {
jsonTable.setPrimaryKey("emp_name");
jsonTable.setTableName(tableName);
jsonTable.setFields(fields);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.createTable("1", "1", "1",
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6",appName, authorization,
jsonTable, keyspaceName, tableName);
@@ -321,7 +309,7 @@ public class TestRestMusicData {
jsonTable.setClusteringOrder("ASC");
jsonTable.setTableName(tableName);
jsonTable.setFields(fields);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.createTable("1", "1", "1",
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6",appName, authorization,
jsonTable, keyspaceName, tableName);
@@ -350,7 +338,7 @@ public class TestRestMusicData {
jsonTable.setFields(fields);
jsonTable.setProperties(properties);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.createTable("1", "1", "1",
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6",appName, authorization,
jsonTable, keyspaceName, tableName_prop);
@@ -375,7 +363,7 @@ public class TestRestMusicData {
String tableNameDup=tableName+"X";
jsonTable.setTableName(tableNameDup);
jsonTable.setFields(fields);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.createTable("1", "1", "1",
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName, authorization,
jsonTable, keyspaceName, tableNameDup);
@@ -411,7 +399,7 @@ public class TestRestMusicData {
jsonTable.setPrimaryKey("emp_name");
jsonTable.setTableName(tableName);
jsonTable.setFields(fields);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.createTable("1", "1", "1",
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName, wrongAuthorization,
jsonTable, keyspaceName, tableName);
@@ -436,7 +424,7 @@ public class TestRestMusicData {
jsonTable.setPrimaryKey("emp_name");
jsonTable.setTableName(tableName);
jsonTable.setFields(fields);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.createTable("1", "1", "1",
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName, authorization,
jsonTable, "wrong", tableName);
@@ -464,7 +452,7 @@ public class TestRestMusicData {
jsonTable.setTableName(tableNameC);
jsonTable.setClusteringOrder("emp_id Desc");
jsonTable.setFields(fields);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.createTable("1", "1", "1",
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName, authorization,
jsonTable, keyspaceName, tableNameC);
@@ -493,7 +481,7 @@ public class TestRestMusicData {
jsonTable.setTableName(tableNameC);
jsonTable.setClusteringOrder("emp_salary ASC");
jsonTable.setFields(fields);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.createTable("1", "1", "1",
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName, authorization,
jsonTable, keyspaceName, tableNameC);
@@ -520,7 +508,7 @@ public class TestRestMusicData {
jsonTable.setTableName(tableNameC);
jsonTable.setClusteringOrder("emp_salary ASC");
jsonTable.setFields(fields);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.createTable("1", "1", "1",
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName, authorization,
jsonTable, keyspaceName, tableNameC);
@@ -548,7 +536,7 @@ public class TestRestMusicData {
jsonTable.setTableName(tableNameC);
jsonTable.setClusteringOrder("emp_salary ASC");
jsonTable.setFields(fields);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.createTable("1", "1", "1",
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName, authorization,
jsonTable, keyspaceName, tableNameC);
@@ -576,7 +564,7 @@ public class TestRestMusicData {
jsonTable.setTableName(tableNameC);
jsonTable.setClusteringOrder("emp_salary ASC");
jsonTable.setFields(fields);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.createTable("1", "1", "1",
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName, authorization,
jsonTable, keyspaceName, tableNameC);
@@ -604,7 +592,7 @@ public class TestRestMusicData {
jsonTable.setTableName(tableNameC);
jsonTable.setClusteringOrder("emp_idx desc, emp_salary ASC");
jsonTable.setFields(fields);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.createTable("1", "1", "1",
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName, authorization,
jsonTable, keyspaceName, tableNameC);
@@ -632,7 +620,7 @@ public class TestRestMusicData {
jsonTable.setTableName(tableNameC);
jsonTable.setClusteringOrder("emp_id desc, emp_salary ASC,uuid desc");
jsonTable.setFields(fields);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.createTable("1", "1", "1",
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName, authorization,
jsonTable, keyspaceName, tableNameC);
@@ -660,7 +648,7 @@ public class TestRestMusicData {
jsonTable.setTableName(tableNameC);
jsonTable.setClusteringOrder("emp_salary ASC");
jsonTable.setFields(fields);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.createTable("1", "1", "1",
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName, authorization,
jsonTable, keyspaceName, tableNameC);
@@ -695,7 +683,7 @@ public class TestRestMusicData {
jsonInsert.setKeyspaceName(keyspaceName);
jsonInsert.setTableName(tableName);
jsonInsert.setValues(values);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.insertIntoTable("1", "1", "1", "abc66ccc-d857-4e90-b1e5-df98a3d40ce6",
appName, authorization, jsonInsert, keyspaceName, tableName);
assertEquals(200, response.getStatus());
@@ -714,7 +702,7 @@ public class TestRestMusicData {
jsonInsert.setKeyspaceName(keyspaceName);
jsonInsert.setTableName(tableName);
jsonInsert.setValues(values);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.insertIntoTable("1", "1", "1",
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName, authorization,
jsonInsert, keyspaceName, tableName);
@@ -735,7 +723,7 @@ public class TestRestMusicData {
jsonInsert.setKeyspaceName(keyspaceName);
jsonInsert.setTableName(tableName);
jsonInsert.setValues(values);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.insertIntoTable("1", "1", "1",
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName, wrongAuthorization,
jsonInsert, keyspaceName, tableName);
@@ -756,7 +744,7 @@ public class TestRestMusicData {
jsonInsert.setKeyspaceName(keyspaceName);
jsonInsert.setTableName(tableName);
jsonInsert.setValues(values);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.insertIntoTable("1", "1", "1",
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName, authorization,
jsonInsert, keyspaceName, "wrong");
@@ -777,7 +765,7 @@ public class TestRestMusicData {
jsonUpdate.setKeyspaceName(keyspaceName);
jsonUpdate.setTableName(tableName);
jsonUpdate.setValues(values);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Mockito.when(info.getQueryParameters()).thenReturn(row);
Response response = data.updateTable("1", "1", "1", "abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName,
authorization, jsonUpdate, keyspaceName, tableName, info);
@@ -787,7 +775,7 @@ public class TestRestMusicData {
// need mock code to create error for MusicCore methods
@Test
public void Test5_updateTableAuthE() throws Exception {
- MockitoAnnotations.initMocks(this);
+ //MockitoAnnotations.initMocks(this);
JsonUpdate jsonUpdate = new JsonUpdate();
Map<String, String> consistencyInfo = new HashMap<>();
MultivaluedMap<String, String> row = new MultivaluedMapImpl();
@@ -800,7 +788,7 @@ public class TestRestMusicData {
jsonUpdate.setTableName(tableName);
jsonUpdate.setValues(values);
//add ttl & timestamp
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Mockito.when(info.getQueryParameters()).thenReturn(row);
//Map<String, Object> m1= new HashMap<>() ;
//Mockito.when(MusicCore.autheticateUser(appName,userId,password,keyspaceName,"abc66ccc-d857-4e90-b1e5-df98a3d40ce6","updateTable")).thenReturn(m1);
@@ -827,8 +815,8 @@ public class TestRestMusicData {
jsonUpdate.setTableName(tableName);
jsonUpdate.setValues(values);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
- Mockito.when(info.getQueryParameters()).thenReturn(row);
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.when(info.getQueryParameters()).thenReturn(row);
String authDatax = ":";//+password;
String authorizationx = new String(Base64.encode(authDatax.getBytes()));
try {
@@ -855,8 +843,8 @@ public class TestRestMusicData {
jsonUpdate.setTableName(tableName);
jsonUpdate.setValues(values);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
- Mockito.when(info.getQueryParameters()).thenReturn(row);
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.when(info.getQueryParameters()).thenReturn(row);
String authDatax =":"+password;
String authorizationx = new String(Base64.encode(authDatax.getBytes()));
String appNamex="xx";
@@ -880,7 +868,7 @@ public class TestRestMusicData {
row.add("emp_name", "testName");
consistencyInfo.put("type", "atomic");
jsonSelect.setConsistencyInfo(consistencyInfo);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Mockito.when(info.getQueryParameters()).thenReturn(row);
Response response = data.select("1", "1", "1","abc66ccc-d857-4e90-b1e5-df98a3d40ce6",
appName, authorization, keyspaceName, tableName, info);
@@ -897,7 +885,7 @@ public class TestRestMusicData {
row.add("emp_name", "testName");
consistencyInfo.put("type", "atomic");
jsonInsert.setConsistencyInfo(consistencyInfo);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Mockito.when(info.getQueryParameters()).thenReturn(row);
Response response = data.selectCritical("1", "1", "1","abc66ccc-d857-4e90-b1e5-df98a3d40ce6",
appName, authorization, jsonInsert, keyspaceName, tableName,info);
@@ -914,7 +902,7 @@ public class TestRestMusicData {
row.add("emp_name", "test1");
consistencyInfo.put("type", "atomic");
jsonDelete.setConsistencyInfo(consistencyInfo);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Mockito.when(info.getQueryParameters()).thenReturn(row);
Response response = data.deleteFromTable("1", "1", "1",
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName, authorization,
@@ -931,7 +919,7 @@ public class TestRestMusicData {
MultivaluedMap<String, String> row = new MultivaluedMapImpl();
consistencyInfo.put("type", "atomic");
jsonDelete.setConsistencyInfo(consistencyInfo);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Mockito.when(info.getQueryParameters()).thenReturn(row);
Response response = data.deleteFromTable("1", "1", "1",
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName, authorization,
@@ -948,8 +936,8 @@ public class TestRestMusicData {
row.add("emp_name", "test1");
consistencyInfo.put("type", "atomic");
jsonDelete.setConsistencyInfo(consistencyInfo);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
- Mockito.when(info.getQueryParameters()).thenReturn(row);
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.when(info.getQueryParameters()).thenReturn(row);
Response response = data.deleteFromTable("1", "1", "1",
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName, authorization,
null, keyspaceName, tableName, info);
@@ -962,7 +950,7 @@ public class TestRestMusicData {
Map<String, String> consistencyInfo = new HashMap<>();
consistencyInfo.put("type", "atomic");
jsonTable.setConsistencyInfo(consistencyInfo);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.dropTable("1", "1", "1",
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName, authorization,
keyspaceName, tableName);
@@ -982,7 +970,7 @@ public class TestRestMusicData {
jsonKeyspace.setDurabilityOfWrites("true");
jsonKeyspace.setKeyspaceName("TestApp1");
jsonKeyspace.setReplicationInfo(replicationInfo);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.dropKeySpace("1", "1", "1", "abc66ccc-d857-4e90-b1e5-df98a3d40ce6",
authorization,appName, keyspaceName);
assertEquals(200, response.getStatus());
@@ -1000,7 +988,7 @@ public class TestRestMusicData {
jsonKeyspace.setDurabilityOfWrites("true");
jsonKeyspace.setKeyspaceName("TestApp1");
jsonKeyspace.setReplicationInfo(replicationInfo);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.dropKeySpace("1", "1", "1", "abc66ccc-d857-4e90-b1e5-df98a3d40ce6",
wrongAuthorization, appName, keyspaceName);
assertEquals(401, response.getStatus());
@@ -1011,7 +999,7 @@ public class TestRestMusicData {
JsonKeySpace jsonKeyspace = new JsonKeySpace();
Map<String, String> consistencyInfo = new HashMap<>();
Map<String, Object> replicationInfo = new HashMap<>();
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = data.dropKeySpace("1", "1", "1", "abc66ccc-d857-4e90-b1e5-df98a3d40ce6",
authorization, appName, keyspaceName);
assertEquals(400, response.getStatus());
@@ -1140,7 +1128,7 @@ public class TestRestMusicData {
@Ignore
@Test
public void Test3_createLockReference() throws Exception {
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Map<String, Object> resultMap = (Map<String, Object>) lock.createLockReference(lockName,"1","1",authorization, null, appName).getEntity();
@SuppressWarnings("unchecked")
Map<String, Object> resultMap1 = (Map<String, Object>) resultMap.get("lock");
@@ -1151,7 +1139,7 @@ public class TestRestMusicData {
@Ignore
@Test
public void Test4_accquireLock() throws Exception {
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Map<String, Object> resultMap = (Map<String, Object>) lock.accquireLock(lockId,"1","1",authorization, null, appName).getEntity();
assertEquals(ResultType.SUCCESS, resultMap.get("status"));
}
@@ -1159,7 +1147,7 @@ public class TestRestMusicData {
@Ignore
@Test
public void Test5_currentLockHolder() throws Exception {
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Map<String, Object> resultMap = (Map<String, Object>) lock.currentLockHolder(lockName,"1","1",authorization, null, appName).getEntity();
assertEquals(ResultType.SUCCESS, resultMap.get("status"));
}
@@ -1167,7 +1155,7 @@ public class TestRestMusicData {
@Ignore
@Test
public void Test7_unLock() throws Exception {
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Map<String, Object> resultMap = (Map<String, Object>) lock.unLock(lockId,"1","1",authorization, null, appName).getEntity();
assertEquals(ResultType.SUCCESS, resultMap.get("status"));
}
diff --git a/src/test/java/org/onap/music/unittests/TestRestMusicQAPI.java b/src/test/java/org/onap/music/unittests/TestRestMusicQAPI.java
index f611959c..c48f7b80 100644
--- a/src/test/java/org/onap/music/unittests/TestRestMusicQAPI.java
+++ b/src/test/java/org/onap/music/unittests/TestRestMusicQAPI.java
@@ -35,6 +35,7 @@ import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import org.apache.curator.test.TestingServer;
+import org.junit.After;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.FixMethodOrder;
@@ -46,7 +47,7 @@ import org.mindrot.jbcrypt.BCrypt;
//cjcimport org.mindrot.jbcrypt.BCrypt;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.music.datastore.MusicDataStoreHandle;
import org.onap.music.datastore.PreparedQueryObject;
import org.onap.music.datastore.jsonobjects.JsonDelete;
@@ -264,7 +265,7 @@ public class TestRestMusicQAPI {
jsonTable.setTableName(tableName);
jsonTable.setFields(fields);
//System.out.println("cjc before print version, xLatestVersion="+xLatestVersion);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = qData.createQ(majorV, minorV,patchV,
aid, appName, authorization,
jsonTable, keyspaceName, tableName);
@@ -374,7 +375,7 @@ public class TestRestMusicQAPI {
jsonTable.setClusteringOrder("emp_id DESC");
jsonTable.setFields(fields);
//System.out.println("cjc before print version, xLatestVersion="+xLatestVersion);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = qData.createQ(majorV, minorV,patchV,
aid, appName, authorization,
jsonTable, keyspaceName, tableNameC);
@@ -463,7 +464,7 @@ public class TestRestMusicQAPI {
jsonTable.setClusteringOrder("emp_id DESCx");
jsonTable.setFields(fields);
//System.out.println("cjc before print version, xLatestVersion="+xLatestVersion);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = qData.createQ(majorV, minorV,patchV,
aid, appName, authorization,
jsonTable, keyspaceName, tableNameC);
@@ -491,7 +492,7 @@ public class TestRestMusicQAPI {
String tableNameDup=tableName+"X";
jsonTable.setTableName(tableNameDup);
jsonTable.setFields(fields);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = qData.createQ(majorV, minorV,patchV,
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName, authorization,
jsonTable, keyspaceName, tableNameDup);
@@ -530,7 +531,7 @@ public class TestRestMusicQAPI {
jsonTable.setTableName(tableName);
jsonTable.setClusteringOrder("uuid DESC");
jsonTable.setFields(fields);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = qData.createQ(majorV, minorV,patchV,
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName, wrongAuthorization,
jsonTable, keyspaceName, tableName);
@@ -557,7 +558,7 @@ public class TestRestMusicQAPI {
jsonTable.setClusteringKey("emp_salary");
jsonTable.setClusteringOrder("emp_salary DESC");
jsonTable.setFields(fields);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = qData.createQ(majorV, minorV,patchV,
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName, authorization,
jsonTable, "wrong", tableName);
@@ -603,7 +604,7 @@ public class TestRestMusicQAPI {
jsonInsert.setKeyspaceName(keyspaceName);
jsonInsert.setTableName(tableName);
jsonInsert.setValues(values);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = qData.insertIntoQ(majorV, minorV,patchV, "abc66ccc-d857-4e90-b1e5-df98a3d40ce6",
appName, authorization, jsonInsert, keyspaceName, tableName);
assertNotEquals(200, response.getStatus());
@@ -643,7 +644,7 @@ public class TestRestMusicQAPI {
jsonInsert.setKeyspaceName(keyspaceName);
jsonInsert.setTableName(tableName);
jsonInsert.setValues(values);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = qData.insertIntoQ(majorV, minorV,patchV,
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName, wrongAuthorization,
jsonInsert, keyspaceName, tableName);
@@ -664,7 +665,7 @@ public class TestRestMusicQAPI {
jsonInsert.setKeyspaceName(keyspaceName);
jsonInsert.setTableName(tableName);
jsonInsert.setValues(values);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = qData.insertIntoQ(majorV, minorV,patchV,
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName, authorization,
jsonInsert, keyspaceName, "wrong");
@@ -705,8 +706,8 @@ public class TestRestMusicQAPI {
jsonUpdate.setKeyspaceName(keyspaceName);
jsonUpdate.setTableName(tableName);
jsonUpdate.setValues(values);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
- Mockito.when(info.getQueryParameters()).thenReturn(row);
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.when(info.getQueryParameters()).thenReturn(row);
Response response = qData.updateQ(majorV, minorV,patchV, "abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName,
authorization, jsonUpdate, keyspaceName, tableName, info);
assertNotEquals(200, response.getStatus());
@@ -797,7 +798,7 @@ public class TestRestMusicQAPI {
MultivaluedMap<String, String> row = new MultivaluedMapImpl();
consistencyInfo.put("type", "atomic");
jsonDelete.setConsistencyInfo(consistencyInfo);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Mockito.when(info.getQueryParameters()).thenReturn(row);
Response response = qData.deleteFromQ(majorV, minorV,patchV,
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName, authorization,
@@ -814,8 +815,8 @@ public class TestRestMusicQAPI {
row.add("emp_name", "test1");
consistencyInfo.put("type", "atomic");
jsonDelete.setConsistencyInfo(consistencyInfo);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
- Mockito.when(info.getQueryParameters()).thenReturn(row);
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.when(info.getQueryParameters()).thenReturn(row);
Response response = qData.deleteFromQ(majorV, minorV,patchV,
"abc66ccc-d857-4e90-b1e5-df98a3d40ce6", appName, authorization,
null, keyspaceName, tableName, info);
@@ -857,7 +858,7 @@ public class TestRestMusicQAPI {
jsonTable.setClusteringKey("emp_id");
jsonTable.setClusteringOrder("emp_id DESC");
jsonTable.setTableName(tableNameC);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = qData.createQ(majorV, minorV,patchV,
aid, appName, authorization,
jsonTable, keyspaceName, tableNameC);
@@ -884,7 +885,7 @@ public class TestRestMusicQAPI {
jsonTable.setClusteringOrder("emp_id DESC");
jsonTable.setTableName(tableNameC);
jsonTable.setFields(fields);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = qData.createQ(majorV, minorV,patchV,
aid, appName, authorization,
jsonTable, keyspaceName, tableNameC);
@@ -911,7 +912,7 @@ public class TestRestMusicQAPI {
jsonTable.setClusteringOrder("emp_id DESC");
jsonTable.setTableName(tableNameC);
jsonTable.setFields(fields);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = qData.createQ(majorV, minorV,patchV,
aid, appName, authorization,
jsonTable, keyspaceName, tableNameC);
@@ -938,7 +939,7 @@ public class TestRestMusicQAPI {
jsonTable.setClusteringKey("emp_id");
jsonTable.setTableName(tableNameC);
jsonTable.setFields(fields);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = qData.createQ(majorV, minorV,patchV,
aid, appName, authorization,
jsonTable, keyspaceName, tableNameC);
@@ -966,7 +967,7 @@ public class TestRestMusicQAPI {
jsonTable.setClusteringOrder("emp_id ASC");
jsonTable.setTableName(tableNameC);
jsonTable.setFields(fields);
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = qData.createQ(majorV, minorV,patchV,
aid, appName, authorization,
jsonTable, keyspaceName, tableNameC);
@@ -993,13 +994,14 @@ public class TestRestMusicQAPI {
jsonTable.setTableName(tableNameC);
jsonTable.setFields(fields);
jsonTable.setClusteringOrder("emp_id ASC");
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = qData.createQ(majorV, minorV,patchV,
aid, appName, authorization,
jsonTable, keyspaceName, tableNameC);
System.out.println("#######status is " + response.getStatus()+"table namec="+tableNameC);
System.out.println("Entity" + response.getEntity());
assertEquals(400, response.getStatus());
+
}
//Primary key with no partition key
@@ -1020,7 +1022,8 @@ public class TestRestMusicQAPI {
jsonTable.setTableName(tableNameC);
jsonTable.setFields(fields);
jsonTable.setClusteringOrder("emp_id ASC");
- Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
+
+ //Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
Response response = qData.createQ(majorV, minorV,patchV,
aid, appName, authorization,
jsonTable, keyspaceName, tableNameC);
diff --git a/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker
new file mode 100644
index 00000000..1f0955d4
--- /dev/null
+++ b/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker
@@ -0,0 +1 @@
+mock-maker-inline
diff --git a/src/test/resources/mockito-extensions/org.mockito.plugins.StackTraceCleanerProvider b/src/test/resources/mockito-extensions/org.mockito.plugins.StackTraceCleanerProvider
new file mode 100644
index 00000000..049073ff
--- /dev/null
+++ b/src/test/resources/mockito-extensions/org.mockito.plugins.StackTraceCleanerProvider
@@ -0,0 +1 @@
+org.mockito.internal.exceptions.stacktrace.DefaultStackTraceCleanerProvider \ No newline at end of file