aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap/music/unittests/TestMusicCore.java
diff options
context:
space:
mode:
authorThomas Nelson Jr (arthurdent3) tn1381@att.com <tn1381@att.com>2018-03-13 20:10:04 -0400
committerThomas Nelson Jr (arthurdent3) tn1381@att.com <tn1381@att.com>2018-03-13 20:10:04 -0400
commit3c86680e532b959bd637b6c093b3916ae5bcee11 (patch)
tree4e4f5eaed5f15c063a84b55f76ad629de95ea8ef /src/test/java/org/onap/music/unittests/TestMusicCore.java
parented47d0c5d004b1ce099090100dda6dc1d963782c (diff)
Docker update and POM fix
Update the docker for cassandra to change ownership of imported files. Update the POM to fix bug Numerous bug fixes fro Logging and Error reporting. Change-Id: I518807f9796734134341ebefd109219050a84b51 Issue-ID: MUSIC-56, MUSIC-57, MUSIC-58 Signed-off-by: Thomas Nelson Jr (arthurdent3) tn1381@att.com <tn1381@att.com>
Diffstat (limited to 'src/test/java/org/onap/music/unittests/TestMusicCore.java')
-rw-r--r--src/test/java/org/onap/music/unittests/TestMusicCore.java20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/test/java/org/onap/music/unittests/TestMusicCore.java b/src/test/java/org/onap/music/unittests/TestMusicCore.java
index c571085a..876c78b1 100644
--- a/src/test/java/org/onap/music/unittests/TestMusicCore.java
+++ b/src/test/java/org/onap/music/unittests/TestMusicCore.java
@@ -24,6 +24,8 @@ package org.onap.music.unittests;
import static org.junit.Assert.*;
import static org.onap.music.main.MusicCore.mDstoreHandle;
import static org.onap.music.main.MusicCore.mLockHandle;
+
+import org.apache.zookeeper.KeeperException.NoNodeException;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -97,7 +99,7 @@ public class TestMusicCore {
}
@Test
- public void testAcquireLockifisMyTurnTrue() {
+ public void testAcquireLockifisMyTurnTrue() throws MusicLockingException {
Mockito.when(mLockHandle.isMyTurn("id1")).thenReturn(true);
ReturnType lock = MusicCore.acquireLock("ks1.tn1", "id1");
assertEquals(lock.getResult(), ResultType.SUCCESS);
@@ -105,7 +107,7 @@ public class TestMusicCore {
}
@Test
- public void testAcquireLockifisMyTurnFalse() {
+ public void testAcquireLockifisMyTurnFalse() throws MusicLockingException {
Mockito.when(mLockHandle.isMyTurn("id1")).thenReturn(false);
ReturnType lock = MusicCore.acquireLock("ks1.ts1", "id1");
assertEquals(lock.getResult(), ResultType.FAILURE);
@@ -113,7 +115,7 @@ public class TestMusicCore {
}
@Test
- public void testAcquireLockifisMyTurnTrueandIsTableOrKeySpaceLockTrue() {
+ public void testAcquireLockifisMyTurnTrueandIsTableOrKeySpaceLockTrue() throws MusicLockingException {
Mockito.when(mLockHandle.isMyTurn("id1")).thenReturn(true);
ReturnType lock = MusicCore.acquireLock("ks1.tn1", "id1");
assertEquals(lock.getResult(), ResultType.SUCCESS);
@@ -143,7 +145,7 @@ public class TestMusicCore {
}
@Test
- public void testAcquireLockifLockRefDoesntExist() {
+ public void testAcquireLockifLockRefDoesntExist() throws MusicLockingException {
Mockito.when(mLockHandle.lockIdExists("bs1")).thenReturn(false);
ReturnType lock = MusicCore.acquireLock("ks1.ts1", "bs1");
assertEquals(lock.getResult(), ResultType.FAILURE);
@@ -230,14 +232,14 @@ public class TestMusicCore {
}
@Test
- public void testDestroyLockRef() {
+ public void testDestroyLockRef() throws NoNodeException {
Mockito.doNothing().when(mLockHandle).unlockAndDeleteId("id1");
MusicCore.destroyLockRef("id1");
Mockito.verify(mLockHandle, Mockito.atLeastOnce()).unlockAndDeleteId("id1");
}
@Test
- public void testreleaseLockwithvoluntaryReleaseTrue() {
+ public void testreleaseLockwithvoluntaryReleaseTrue() throws NoNodeException {
MusicLockState musicLockState = new MusicLockState(LockStatus.UNLOCKED, "id2");
Mockito.doNothing().when(mLockHandle).unlockAndDeleteId("id1");
MusicLockState musicLockState1 = MusicCore.releaseLock("id1", true);
@@ -246,7 +248,7 @@ public class TestMusicCore {
}
@Test
- public void testreleaseLockwithvoluntaryReleaseFalse() {
+ public void testreleaseLockwithvoluntaryReleaseFalse() throws NoNodeException {
MusicLockState musicLockState = new MusicLockState(LockStatus.UNLOCKED, "id2");
Mockito.doNothing().when(mLockHandle).unlockAndDeleteId("id1");
MusicLockState musicLockState1 = MusicCore.releaseLock("id1", false);
@@ -355,8 +357,8 @@ public class TestMusicCore {
session = Mockito.mock(Session.class);
Mockito.when(mDstoreHandle.getSession()).thenReturn(session);
Mockito.when(mDstoreHandle.executePut(preparedQueryObject, "consistency")).thenReturn(true);
- Boolean result = MusicCore.nonKeyRelatedPut(preparedQueryObject, "consistency");
- assertTrue(result);
+ ResultType result = MusicCore.nonKeyRelatedPut(preparedQueryObject, "consistency");
+ assertEquals(ResultType.SUCCESS, result);
Mockito.verify(mDstoreHandle).executePut(preparedQueryObject, "consistency");
}