diff options
author | Tschaen, Brendan <ctschaen@att.com> | 2018-11-15 10:31:53 -0500 |
---|---|---|
committer | Tschaen, Brendan <ctschaen@att.com> | 2018-11-15 10:32:38 -0500 |
commit | a1f03a639a2ba38ec5c19e96c3c9d703fa048a8f (patch) | |
tree | cfa2b706104c5a05cd67ce88568296876b7d3a49 /src/test | |
parent | 7addd52dc73e6571028ca7f6a018e75ec1c9b0ca (diff) |
Revert "music core implemented as a service"
This reverts commit 7addd52dc73e6571028ca7f6a018e75ec1c9b0ca.
Change-Id: I0875ce10521363b8e17eb6cd2cf9d8848e572bea
Issue-ID: MUSIC-189
Signed-off-by: Tschaen, Brendan <ctschaen@att.com>
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/onap/music/unittests/CassandraCQL.java (renamed from src/test/java/org/onap/music/unittests/CassandraCQLQueries.java) | 8 | ||||
-rw-r--r-- | src/test/java/org/onap/music/unittests/MusicDataStoreTest.java | 22 | ||||
-rw-r--r-- | src/test/java/org/onap/music/unittests/MusicLockStoreTest.java | 23 | ||||
-rw-r--r-- | src/test/java/org/onap/music/unittests/TestCassaLockStore.java | 12 | ||||
-rw-r--r-- | src/test/java/org/onap/music/unittests/TestMusicCore.java | 29 | ||||
-rw-r--r-- | src/test/java/org/onap/music/unittests/TestMusicCoreIntegration.java | 62 | ||||
-rw-r--r-- | src/test/java/org/onap/music/unittests/TestRestMusicData.java | 21 | ||||
-rw-r--r-- | src/test/java/org/onap/music/unittests/TestRestMusicQAPI.java | 14 | ||||
-rw-r--r-- | src/test/java/org/onap/music/unittests/TestVotingApp.java | 5 |
9 files changed, 92 insertions, 104 deletions
diff --git a/src/test/java/org/onap/music/unittests/CassandraCQLQueries.java b/src/test/java/org/onap/music/unittests/CassandraCQL.java index 41c518e9..a9cbe109 100644 --- a/src/test/java/org/onap/music/unittests/CassandraCQLQueries.java +++ b/src/test/java/org/onap/music/unittests/CassandraCQL.java @@ -45,10 +45,10 @@ import com.datastax.driver.core.exceptions.NoHostAvailableException; import org.apache.cassandra.exceptions.ConfigurationException; import org.apache.thrift.transport.TTransportException; import org.cassandraunit.utils.EmbeddedCassandraServerHelper; -import org.onap.music.datastore.MusicDataStore; +import org.onap.music.datastore.CassaDataStore; import org.onap.music.datastore.PreparedQueryObject; -public class CassandraCQLQueries { +public class CassandraCQL { public static final String createKeySpace = "CREATE KEYSPACE IF NOT EXISTS testCassa WITH replication = " @@ -222,7 +222,7 @@ public class CassandraCQLQueries { return allPossibleIps; } - public static MusicDataStore connectToEmbeddedCassandra() { + public static CassaDataStore connectToEmbeddedCassandra() { Iterator<String> it = getAllPossibleLocalIps().iterator(); String address = "localhost"; @@ -249,7 +249,7 @@ public class CassandraCQLQueries { } } - return new MusicDataStore(cluster, session); + return new CassaDataStore(cluster, session); } diff --git a/src/test/java/org/onap/music/unittests/MusicDataStoreTest.java b/src/test/java/org/onap/music/unittests/MusicDataStoreTest.java index 62275bb3..3f7fd3b7 100644 --- a/src/test/java/org/onap/music/unittests/MusicDataStoreTest.java +++ b/src/test/java/org/onap/music/unittests/MusicDataStoreTest.java @@ -33,7 +33,7 @@ import org.mockito.Mock; import org.onap.music.exceptions.MusicQueryException; import org.onap.music.exceptions.MusicServiceException; -import org.onap.music.datastore.MusicDataStore; +import org.onap.music.datastore.CassaDataStore; import org.onap.music.datastore.PreparedQueryObject; import com.datastax.driver.core.DataType; @@ -44,12 +44,12 @@ import com.datastax.driver.core.TableMetadata; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class MusicDataStoreTest { - static MusicDataStore dataStore; + static CassaDataStore dataStore; static PreparedQueryObject testObject; @BeforeClass public static void init() { - dataStore = CassandraCQLQueries.connectToEmbeddedCassandra(); + dataStore = CassandraCQL.connectToEmbeddedCassandra(); } @@ -57,7 +57,7 @@ public class MusicDataStoreTest { public static void close() throws MusicServiceException, MusicQueryException { testObject = new PreparedQueryObject(); - testObject.appendQueryString(CassandraCQLQueries.dropKeyspace); + testObject.appendQueryString(CassandraCQL.dropKeyspace); dataStore.executePut(testObject, "eventual"); dataStore.close(); @@ -67,10 +67,10 @@ public class MusicDataStoreTest { public void Test1_SetUp() throws MusicServiceException, MusicQueryException { boolean result = false; testObject = new PreparedQueryObject(); - testObject.appendQueryString(CassandraCQLQueries.createKeySpace); + testObject.appendQueryString(CassandraCQL.createKeySpace); result = dataStore.executePut(testObject, "eventual");; testObject = new PreparedQueryObject(); - testObject.appendQueryString(CassandraCQLQueries.createTableEmployees); + testObject.appendQueryString(CassandraCQL.createTableEmployees); result = dataStore.executePut(testObject, "eventual"); assertEquals(true, result); @@ -78,21 +78,21 @@ public class MusicDataStoreTest { @Test public void Test2_ExecutePut_eventual_insert() throws MusicServiceException, MusicQueryException { - testObject = CassandraCQLQueries.setPreparedInsertQueryObject1(); + testObject = CassandraCQL.setPreparedInsertQueryObject1(); boolean result = dataStore.executePut(testObject, "eventual"); assertEquals(true, result); } @Test public void Test3_ExecutePut_critical_insert() throws MusicServiceException, MusicQueryException { - testObject = CassandraCQLQueries.setPreparedInsertQueryObject2(); + testObject = CassandraCQL.setPreparedInsertQueryObject2(); boolean result = dataStore.executePut(testObject, "Critical"); assertEquals(true, result); } @Test public void Test4_ExecutePut_eventual_update() throws MusicServiceException, MusicQueryException { - testObject = CassandraCQLQueries.setPreparedUpdateQueryObject(); + testObject = CassandraCQL.setPreparedUpdateQueryObject(); boolean result = false; result = dataStore.executePut(testObject, "eventual"); assertEquals(true, result); @@ -101,7 +101,7 @@ public class MusicDataStoreTest { @Test public void Test5_ExecuteEventualGet() throws MusicServiceException, MusicQueryException { testObject = new PreparedQueryObject(); - testObject.appendQueryString(CassandraCQLQueries.selectALL); + testObject.appendQueryString(CassandraCQL.selectALL); boolean result = false; int count = 0; ResultSet output = null; @@ -120,7 +120,7 @@ public class MusicDataStoreTest { @Test public void Test6_ExecuteCriticalGet() throws MusicServiceException, MusicQueryException { - testObject = CassandraCQLQueries.setPreparedGetQuery(); + testObject = CassandraCQL.setPreparedGetQuery(); boolean result = false; int count = 0; ResultSet output = null; diff --git a/src/test/java/org/onap/music/unittests/MusicLockStoreTest.java b/src/test/java/org/onap/music/unittests/MusicLockStoreTest.java index 45ce9296..86774538 100644 --- a/src/test/java/org/onap/music/unittests/MusicLockStoreTest.java +++ b/src/test/java/org/onap/music/unittests/MusicLockStoreTest.java @@ -32,8 +32,9 @@ import org.junit.runners.MethodSorters; import org.mockito.Mock; import org.onap.music.exceptions.MusicQueryException; import org.onap.music.exceptions.MusicServiceException; -import org.onap.music.lockingservice.cassandra.CassaLockStore; -import org.onap.music.datastore.MusicDataStore; + +import org.onap.music.datastore.CassaDataStore; +import org.onap.music.datastore.CassaLockStore; import org.onap.music.datastore.PreparedQueryObject; import com.datastax.driver.core.DataType; @@ -44,13 +45,13 @@ import com.datastax.driver.core.TableMetadata; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class MusicLockStoreTest { - static MusicDataStore dataStore; + static CassaDataStore dataStore; static CassaLockStore lockStore; static PreparedQueryObject testObject; @BeforeClass public static void init() { - dataStore = CassandraCQLQueries.connectToEmbeddedCassandra(); + dataStore = CassandraCQL.connectToEmbeddedCassandra(); lockStore = new CassaLockStore(dataStore); } @@ -58,7 +59,7 @@ public class MusicLockStoreTest { @AfterClass public static void close() throws MusicServiceException, MusicQueryException { testObject = new PreparedQueryObject(); - testObject.appendQueryString(CassandraCQLQueries.dropKeyspace); + testObject.appendQueryString(CassandraCQL.dropKeyspace); dataStore.executePut(testObject, "eventual"); dataStore.close(); @@ -68,10 +69,10 @@ public class MusicLockStoreTest { public void Test1_SetUp() throws MusicServiceException, MusicQueryException { boolean result = false; testObject = new PreparedQueryObject(); - testObject.appendQueryString(CassandraCQLQueries.createKeySpace); + testObject.appendQueryString(CassandraCQL.createKeySpace); result = dataStore.executePut(testObject, "eventual");; testObject = new PreparedQueryObject(); - testObject.appendQueryString(CassandraCQLQueries.createTableEmployees); + testObject.appendQueryString(CassandraCQL.createTableEmployees); result = dataStore.executePut(testObject, "eventual"); assertEquals(true, result); @@ -92,14 +93,14 @@ public class MusicLockStoreTest { @Test public void Test3_ExecutePut_critical_insert() throws MusicServiceException, MusicQueryException { - testObject = CassandraCQLQueries.setPreparedInsertQueryObject2(); + testObject = CassandraCQL.setPreparedInsertQueryObject2(); boolean result = dataStore.executePut(testObject, "Critical"); assertEquals(true, result); } @Test public void Test4_ExecutePut_eventual_update() throws MusicServiceException, MusicQueryException { - testObject = CassandraCQLQueries.setPreparedUpdateQueryObject(); + testObject = CassandraCQL.setPreparedUpdateQueryObject(); boolean result = false; result = dataStore.executePut(testObject, "eventual"); assertEquals(true, result); @@ -108,7 +109,7 @@ public class MusicLockStoreTest { @Test public void Test5_ExecuteEventualGet() throws MusicServiceException, MusicQueryException { testObject = new PreparedQueryObject(); - testObject.appendQueryString(CassandraCQLQueries.selectALL); + testObject.appendQueryString(CassandraCQL.selectALL); boolean result = false; int count = 0; ResultSet output = null; @@ -127,7 +128,7 @@ public class MusicLockStoreTest { @Test public void Test6_ExecuteCriticalGet() throws MusicServiceException, MusicQueryException { - testObject = CassandraCQLQueries.setPreparedGetQuery(); + testObject = CassandraCQL.setPreparedGetQuery(); boolean result = false; int count = 0; ResultSet output = null; diff --git a/src/test/java/org/onap/music/unittests/TestCassaLockStore.java b/src/test/java/org/onap/music/unittests/TestCassaLockStore.java index 2f3750a2..bf058121 100644 --- a/src/test/java/org/onap/music/unittests/TestCassaLockStore.java +++ b/src/test/java/org/onap/music/unittests/TestCassaLockStore.java @@ -2,18 +2,16 @@ package org.onap.music.unittests; import java.util.HashMap; import java.util.Map; +import java.util.UUID; +import org.onap.music.datastore.CassaLockStore; import org.onap.music.datastore.PreparedQueryObject; import org.onap.music.exceptions.MusicQueryException; import org.onap.music.exceptions.MusicServiceException; -import org.onap.music.lockingservice.cassandra.CassaLockStore; -import org.onap.music.service.MusicCoreService; -import org.onap.music.service.impl.MusicCassaCore; +import org.onap.music.main.MusicCore; public class TestCassaLockStore { - static MusicCoreService musicCore = MusicCassaCore.getInstance(); - public static void main(String[] args) { @@ -29,12 +27,12 @@ public class TestCassaLockStore { PreparedQueryObject queryObject = new PreparedQueryObject(); queryObject.appendQueryString("CREATE KEYSPACE " + keyspace + " WITH REPLICATION = " + replicationInfo.toString().replaceAll("=", ":")); - musicCore.nonKeyRelatedPut(queryObject, "eventual"); + MusicCore.nonKeyRelatedPut(queryObject, "eventual"); queryObject = new PreparedQueryObject(); queryObject.appendQueryString("CREATE TABLE " + keyspace + "." + table + " (name text PRIMARY KEY, count varint);"); - musicCore.createTable(keyspace, table, queryObject, "eventual"); + MusicCore.createTable(keyspace, table, queryObject, "eventual"); lockStore.createLockQueue(keyspace, table); diff --git a/src/test/java/org/onap/music/unittests/TestMusicCore.java b/src/test/java/org/onap/music/unittests/TestMusicCore.java index 6f0a93a0..01d2ffb6 100644 --- a/src/test/java/org/onap/music/unittests/TestMusicCore.java +++ b/src/test/java/org/onap/music/unittests/TestMusicCore.java @@ -1,6 +1,10 @@ package org.onap.music.unittests; +import static org.junit.Assert.assertEquals; + import java.util.HashMap; +import java.util.Iterator; +import java.util.List; import java.util.Map; import org.junit.AfterClass; @@ -9,14 +13,12 @@ import org.junit.FixMethodOrder; import org.junit.Ignore; import org.junit.Test; import org.junit.runners.MethodSorters; -import org.onap.music.datastore.MusicDataStore; -import org.onap.music.datastore.MusicDataStoreHandle; +import org.onap.music.datastore.CassaDataStore; +import org.onap.music.datastore.CassaLockStore; import org.onap.music.datastore.PreparedQueryObject; import org.onap.music.exceptions.MusicQueryException; import org.onap.music.exceptions.MusicServiceException; -import org.onap.music.lockingservice.cassandra.CassaLockStore; -import org.onap.music.service.MusicCoreService; -import org.onap.music.service.impl.MusicCassaCore; +import org.onap.music.main.MusicCore; import com.datastax.driver.core.ResultSet; @@ -25,17 +27,16 @@ import com.datastax.driver.core.ResultSet; public class TestMusicCore { static PreparedQueryObject testObject; - static MusicDataStore dataStore; + static CassaDataStore dataStore; String keyspace = "MusicCoreUnitTestKp"; String table = "SampleTable"; - static MusicCoreService musicCore = MusicCassaCore.getInstance(); @BeforeClass public static void init() { System.out.println("TestMusicCore Init"); try { - MusicDataStoreHandle.mDstoreHandle = CassandraCQLQueries.connectToEmbeddedCassandra(); - CassaLockStore mLockHandle = new CassaLockStore(MusicDataStoreHandle.mDstoreHandle); + MusicCore.mDstoreHandle = CassandraCQL.connectToEmbeddedCassandra(); + MusicCore.mLockHandle = new CassaLockStore(MusicCore.mDstoreHandle); } catch (Exception e) { e.printStackTrace(); } @@ -45,9 +46,9 @@ public class TestMusicCore { public static void close() throws MusicServiceException, MusicQueryException { System.out.println("After class TestMusicCore"); testObject = new PreparedQueryObject(); - testObject.appendQueryString(CassandraCQLQueries.dropKeyspace); - musicCore.eventualPut(testObject); - MusicDataStoreHandle.mDstoreHandle.close(); + testObject.appendQueryString(CassandraCQL.dropKeyspace); + MusicCore.eventualPut(testObject); + MusicCore.mDstoreHandle.close(); } @Test @@ -60,7 +61,7 @@ public class TestMusicCore { PreparedQueryObject queryObject = new PreparedQueryObject(); queryObject.appendQueryString( "CREATE KEYSPACE " + keyspace + " WITH REPLICATION = " + replicationInfo.toString().replaceAll("=", ":")); - musicCore.nonKeyRelatedPut(queryObject, "eventual"); + MusicCore.nonKeyRelatedPut(queryObject, "eventual"); //check with the system table in cassandra @@ -76,7 +77,7 @@ public class TestMusicCore { PreparedQueryObject queryObject = new PreparedQueryObject(); queryObject.appendQueryString( "CREATE TABLE " + keyspace + "." + table + " (name text PRIMARY KEY, count varint);"); - musicCore.createTable(keyspace, table, queryObject, "eventual"); + MusicCore.createTable(keyspace, table, queryObject, "eventual"); //check with the system table in cassandra diff --git a/src/test/java/org/onap/music/unittests/TestMusicCoreIntegration.java b/src/test/java/org/onap/music/unittests/TestMusicCoreIntegration.java index 53b6d8bc..9b4fc229 100644 --- a/src/test/java/org/onap/music/unittests/TestMusicCoreIntegration.java +++ b/src/test/java/org/onap/music/unittests/TestMusicCoreIntegration.java @@ -19,29 +19,26 @@ package org.onap.music.unittests; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; - +import static org.junit.Assert.assertTrue; +import java.io.File; import java.util.List; - +import org.apache.curator.test.TestingServer; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.FixMethodOrder; import org.junit.Ignore; import org.junit.Test; import org.junit.runners.MethodSorters; -import org.onap.music.datastore.MusicDataStoreHandle; import org.onap.music.datastore.PreparedQueryObject; import org.onap.music.exceptions.MusicQueryException; import org.onap.music.exceptions.MusicServiceException; -import org.onap.music.lockingservice.cassandra.CassaLockStore; -import org.onap.music.lockingservice.cassandra.MusicLockState; -import org.onap.music.lockingservice.cassandra.MusicLockState.LockStatus; -import org.onap.music.service.MusicCoreService; -import org.onap.music.service.impl.*; +import org.onap.music.datastore.CassaLockStore; +import org.onap.music.datastore.MusicLockState; +import org.onap.music.datastore.MusicLockState.LockStatus; +import org.onap.music.main.MusicCore; import org.onap.music.main.MusicUtil; import org.onap.music.main.ResultType; import org.onap.music.main.ReturnType; -import org.onap.music.service.impl.MusicCassaCore; - import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Row; @@ -52,13 +49,12 @@ public class TestMusicCoreIntegration { static PreparedQueryObject testObject; static String lockId = null; static String lockName = "ks1.tb1.pk1"; - static MusicCassaCore musicCore = MusicCassaCore.getInstance(); @BeforeClass public static void init() throws Exception { try { - MusicDataStoreHandle.mDstoreHandle = CassandraCQLQueries.connectToEmbeddedCassandra(); - MusicCassaCore.mLockHandle = new CassaLockStore(MusicDataStoreHandle.mDstoreHandle); + MusicCore.mDstoreHandle = CassandraCQL.connectToEmbeddedCassandra(); + MusicCore.mLockHandle = new CassaLockStore(MusicCore.mDstoreHandle); } catch (Exception e) { e.printStackTrace(); } @@ -68,31 +64,31 @@ public class TestMusicCoreIntegration { public static void tearDownAfterClass() throws Exception { System.out.println("After class"); testObject = new PreparedQueryObject(); - testObject.appendQueryString(CassandraCQLQueries.dropKeyspace); - musicCore.eventualPut(testObject); - musicCore.deleteLock(lockName); - MusicDataStoreHandle.mDstoreHandle.close(); + testObject.appendQueryString(CassandraCQL.dropKeyspace); + MusicCore.eventualPut(testObject); + MusicCore.deleteLock(lockName); + MusicCore.mDstoreHandle.close(); } @Test public void Test1_SetUp() throws MusicServiceException, MusicQueryException { - MusicDataStoreHandle.mDstoreHandle = CassandraCQLQueries.connectToEmbeddedCassandra(); - MusicCassaCore.mLockHandle = new CassaLockStore(MusicDataStoreHandle.mDstoreHandle); + MusicCore.mDstoreHandle = CassandraCQL.connectToEmbeddedCassandra(); + MusicCore.mLockHandle = new CassaLockStore(MusicCore.mDstoreHandle); ResultType result = ResultType.FAILURE; testObject = new PreparedQueryObject(); - testObject.appendQueryString(CassandraCQLQueries.createKeySpace); - musicCore.eventualPut(testObject); + testObject.appendQueryString(CassandraCQL.createKeySpace); + MusicCore.eventualPut(testObject); testObject = new PreparedQueryObject(); - testObject.appendQueryString(CassandraCQLQueries.createTableEmployees); - result = musicCore.nonKeyRelatedPut(testObject, MusicUtil.EVENTUAL); + testObject.appendQueryString(CassandraCQL.createTableEmployees); + result = MusicCore.nonKeyRelatedPut(testObject, MusicUtil.EVENTUAL); assertEquals(ResultType.SUCCESS, result); } @Test public void Test2_atomicPut() throws Exception { testObject = new PreparedQueryObject(); - testObject = CassandraCQLQueries.setPreparedInsertQueryObject1(); - ReturnType returnType = musicCore.atomicPut("testCassa", "employees", "Mr Test one", + testObject = CassandraCQL.setPreparedInsertQueryObject1(); + ReturnType returnType = MusicCore.atomicPut("testCassa", "employees", "Mr Test one", testObject, null); assertEquals(ResultType.SUCCESS, returnType.getResult()); } @@ -101,28 +97,28 @@ public class TestMusicCoreIntegration { @Test public void Test5_atomicGet() throws Exception { testObject = new PreparedQueryObject(); - testObject = CassandraCQLQueries.setPreparedGetQuery(); + testObject = CassandraCQL.setPreparedGetQuery(); ResultSet resultSet = - musicCore.atomicGet("testCassa", "employees", "Mr Test two", testObject); + MusicCore.atomicGet("testCassa", "employees", "Mr Test two", testObject); List<Row> rows = resultSet.all(); assertEquals(1, rows.size()); } @Test public void Test6_createLockReference() throws Exception { - lockId = musicCore.createLockReference(lockName); + lockId = MusicCore.createLockReference(lockName); assertNotNull(lockId); } @Test public void Test7_acquireLockwithLease() throws Exception { - ReturnType lockLeaseStatus = musicCore.acquireLockWithLease(lockName, lockId, 1000); + ReturnType lockLeaseStatus = MusicCore.acquireLockWithLease(lockName, lockId, 1000); assertEquals(ResultType.SUCCESS, lockLeaseStatus.getResult()); } @Test public void Test8_acquireLock() throws Exception { - ReturnType lockStatus = musicCore.acquireLock(lockName, lockId); + ReturnType lockStatus = MusicCore.acquireLock(lockName, lockId); assertEquals(ResultType.SUCCESS, lockStatus.getResult()); } @@ -130,9 +126,9 @@ public class TestMusicCoreIntegration { public void Test9_release() throws Exception { MusicLockState musicLockState = new MusicLockState(LockStatus.LOCKED, "id1"); MusicLockState musicLockState1 = new MusicLockState(LockStatus.UNLOCKED, "id1"); - musicCore.whoseTurnIsIt(lockName); - MusicLockState mls = musicCore.getMusicLockState(lockName); - MusicLockState mls1 = musicCore.voluntaryReleaseLock(lockName,lockId); + MusicCore.whoseTurnIsIt(lockName); + MusicLockState mls = MusicCore.getMusicLockState(lockName); + MusicLockState mls1 = MusicCore.voluntaryReleaseLock(lockName,lockId); assertEquals(musicLockState.getLockStatus(), mls.getLockStatus()); assertEquals(musicLockState1.getLockStatus(), mls1.getLockStatus()); } diff --git a/src/test/java/org/onap/music/unittests/TestRestMusicData.java b/src/test/java/org/onap/music/unittests/TestRestMusicData.java index 01ae861b..f0c52a3b 100644 --- a/src/test/java/org/onap/music/unittests/TestRestMusicData.java +++ b/src/test/java/org/onap/music/unittests/TestRestMusicData.java @@ -21,17 +21,15 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; - +import java.io.File; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; - import javax.servlet.http.HttpServletResponse; 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.AfterClass; import org.junit.BeforeClass; @@ -46,7 +44,7 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.mockito.runners.MockitoJUnitRunner; -import org.onap.music.datastore.MusicDataStoreHandle; +import org.onap.music.datastore.CassaLockStore; import org.onap.music.datastore.PreparedQueryObject; import org.onap.music.datastore.jsonobjects.JsonDelete; import org.onap.music.datastore.jsonobjects.JsonInsert; @@ -55,16 +53,13 @@ import org.onap.music.datastore.jsonobjects.JsonOnboard; import org.onap.music.datastore.jsonobjects.JsonSelect; import org.onap.music.datastore.jsonobjects.JsonTable; import org.onap.music.datastore.jsonobjects.JsonUpdate; -import org.onap.music.lockingservice.cassandra.CassaLockStore; import org.onap.music.main.CachingUtil; -import org.onap.music.service.impl.*; +import org.onap.music.main.MusicCore; import org.onap.music.main.MusicUtil; import org.onap.music.main.ResultType; import org.onap.music.rest.RestMusicAdminAPI; import org.onap.music.rest.RestMusicDataAPI; import org.onap.music.rest.RestMusicLocksAPI; -import org.onap.music.service.impl.MusicCassaCore; - import com.datastax.driver.core.DataType; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Row; @@ -92,7 +87,7 @@ public class TestRestMusicData { CachingUtil cachUtilMock; @InjectMocks - private static MusicCassaCore MusicCore =MusicCassaCore.getInstance(); + private MusicCore mCore; //*/ static String appName = "TestApp"; @@ -114,8 +109,8 @@ public class TestRestMusicData { @BeforeClass public static void init() throws Exception { try { - MusicDataStoreHandle.mDstoreHandle = CassandraCQLQueries.connectToEmbeddedCassandra(); - MusicCore.mLockHandle = new CassaLockStore(MusicDataStoreHandle.mDstoreHandle); + MusicCore.mDstoreHandle = CassandraCQL.connectToEmbeddedCassandra(); + MusicCore.mLockHandle = new CassaLockStore(MusicCore.mDstoreHandle); } catch (Exception e) { e.printStackTrace(); } @@ -129,8 +124,8 @@ public class TestRestMusicData { testObject = new PreparedQueryObject(); testObject.appendQueryString("DROP KEYSPACE IF EXISTS admin"); MusicCore.eventualPut(testObject); - if(MusicDataStoreHandle.mDstoreHandle!=null) - MusicDataStoreHandle.mDstoreHandle.close(); + if(MusicCore.mDstoreHandle!=null) + MusicCore.mDstoreHandle.close(); if(zkServer!=null) zkServer.stop(); } diff --git a/src/test/java/org/onap/music/unittests/TestRestMusicQAPI.java b/src/test/java/org/onap/music/unittests/TestRestMusicQAPI.java index 93591bfd..a3d3d709 100644 --- a/src/test/java/org/onap/music/unittests/TestRestMusicQAPI.java +++ b/src/test/java/org/onap/music/unittests/TestRestMusicQAPI.java @@ -47,8 +47,7 @@ import org.mindrot.jbcrypt.BCrypt; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; -import org.onap.music.lockingservice.cassandra.CassaLockStore; -import org.onap.music.datastore.MusicDataStoreHandle; +import org.onap.music.datastore.CassaLockStore; import org.onap.music.datastore.PreparedQueryObject; import org.onap.music.datastore.jsonobjects.JsonDelete; import org.onap.music.datastore.jsonobjects.JsonInsert; @@ -58,12 +57,12 @@ import org.onap.music.datastore.jsonobjects.JsonKeySpace; import org.onap.music.datastore.jsonobjects.JsonSelect; import org.onap.music.datastore.jsonobjects.JsonTable; import org.onap.music.datastore.jsonobjects.JsonUpdate; +import org.onap.music.main.MusicCore; import org.onap.music.main.MusicUtil; //import org.onap.music.main.ResultType; import org.onap.music.rest.RestMusicAdminAPI; import org.onap.music.rest.RestMusicDataAPI; import org.onap.music.rest.RestMusicQAPI; -import org.onap.music.service.impl.MusicCassaCore; import org.onap.music.rest.RestMusicLocksAPI; import com.datastax.driver.core.DataType; import com.datastax.driver.core.ResultSet; @@ -120,13 +119,12 @@ public class TestRestMusicQAPI { static JsonKeySpace kspObject=null; static RestMusicDataAPI data = new RestMusicDataAPI(); static Response resp; - static MusicCassaCore MusicCore = MusicCassaCore.getInstance(); @BeforeClass public static void init() throws Exception { try { - MusicDataStoreHandle.mDstoreHandle = CassandraCQLQueries.connectToEmbeddedCassandra(); - MusicCassaCore.mLockHandle = new CassaLockStore(MusicDataStoreHandle.mDstoreHandle); + MusicCore.mDstoreHandle = CassandraCQL.connectToEmbeddedCassandra(); + MusicCore.mLockHandle = new CassaLockStore(MusicCore.mDstoreHandle); // System.out.println("before class keysp"); //resp=data.createKeySpace(majorV,minorV,patchV,aid,appName,userId,password,kspObject,keyspaceName); @@ -213,8 +211,8 @@ public class TestRestMusicQAPI { testObject = new PreparedQueryObject(); testObject.appendQueryString("DROP KEYSPACE IF EXISTS admin"); MusicCore.eventualPut(testObject); - if (MusicDataStoreHandle.mDstoreHandle!=null) - MusicDataStoreHandle.mDstoreHandle.close(); + if (MusicCore.mDstoreHandle!=null) + MusicCore.mDstoreHandle.close(); if (zkServer!=null) zkServer.stop(); } diff --git a/src/test/java/org/onap/music/unittests/TestVotingApp.java b/src/test/java/org/onap/music/unittests/TestVotingApp.java index 8ac71802..e7a1e252 100644 --- a/src/test/java/org/onap/music/unittests/TestVotingApp.java +++ b/src/test/java/org/onap/music/unittests/TestVotingApp.java @@ -2,12 +2,12 @@ package org.onap.music.unittests; 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.service.impl.MusicCassaCore; +import org.onap.music.main.MusicCore; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Row; @@ -19,7 +19,6 @@ public class TestVotingApp { String keyspaceName; String tableName; - static MusicCassaCore MusicCore = MusicCassaCore.getInstance(); public TestVotingApp() throws MusicServiceException { keyspaceName = "VotingAppForMusic"+System.currentTimeMillis(); |