aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSandeep J <sandeejh@in.ibm.com>2018-12-11 19:59:13 +0530
committerTschaen, Brendan <ctschaen@att.com>2018-12-12 17:16:11 -0500
commite71ad4704a4a16874be65f40713009e13ce4eabf (patch)
treea78ef47ed3a14a2021b128d04b3b866ab8a05878 /src
parent24c82cbc9ccdcfab25b304bc4c1660dca304bdb9 (diff)
added files to convert project to spring boot
also made changes to pom to add required dependencies. fix junit cases, upgrading to mockito 2.x Issue-ID: MUSIC-212 Change-Id: Ieeeaa6d62e03e962534182183aae8ae838d93eba Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
Diffstat (limited to 'src')
-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
8 files changed, 341 insertions, 79 deletions
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