aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/guard/src/test/java
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2018-08-14 14:22:34 -0400
committerPamela Dragosh <pdragosh@research.att.com>2018-08-14 14:22:41 -0400
commitdbe1d23be5420a5efa4d3977fee974c452bbfd29 (patch)
treecf5ab051e698d9278e6fd28022acbd5c1a9a91a2 /controlloop/common/guard/src/test/java
parent6f9976df27dccb2dcaedeb9106166f62a435b050 (diff)
Fix checkstyle issues
Spacing, missing javadoc Issue-ID: POLICY-883 Change-Id: Ice65c6c1baf0bb7c6273411f078bacfe3496b89b Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'controlloop/common/guard/src/test/java')
-rw-r--r--controlloop/common/guard/src/test/java/org/onap/policy/guard/PIPEngineGetHistoryTest.java3
-rw-r--r--controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardTest.java18
2 files changed, 14 insertions, 7 deletions
diff --git a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PIPEngineGetHistoryTest.java b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PIPEngineGetHistoryTest.java
index e728d4168..8c7392e71 100644
--- a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PIPEngineGetHistoryTest.java
+++ b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PIPEngineGetHistoryTest.java
@@ -113,6 +113,9 @@ public class PIPEngineGetHistoryTest {
emf.close();
}
+ /**
+ * Setup method.
+ */
@Before
public void setUp() {
// clear the table
diff --git a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardTest.java b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardTest.java
index dd1ede49c..9cee0af27 100644
--- a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardTest.java
+++ b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardTest.java
@@ -29,6 +29,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+
import java.util.UUID;
import org.junit.AfterClass;
import org.junit.Before;
@@ -105,6 +106,9 @@ public class PolicyGuardTest {
PolicyGuard.setFactory(saveFactory);
}
+ /**
+ * Setup method.
+ */
@Before
public void setUp() {
mgr = spy(new PolicyResourceLockManager() {
@@ -282,14 +286,14 @@ public class PolicyGuardTest {
// acquired
result = PolicyGuard.lockTarget(type, INSTANCENAME, uuid, dlcb, LOCK_SEC);
- verify(mgr).lock(INSTANCENAME, type+":"+uuid, LOCK_SEC);
+ verify(mgr).lock(INSTANCENAME, type + ":" + uuid, LOCK_SEC);
assertEquals(GuardResult.LOCK_ACQUIRED, result.getA());
assertEquals(VMTargetLock.class, result.getB().getClass());
// diff owner - denied
UUID uuid2 = UUID.randomUUID();
- result = PolicyGuard.lockTarget(type, INSTANCENAME, uuid2, dlcb, LOCK_SEC+10);
- verify(mgr).lock(INSTANCENAME, type+":"+uuid2, LOCK_SEC+10);
+ result = PolicyGuard.lockTarget(type, INSTANCENAME, uuid2, dlcb, LOCK_SEC + 10);
+ verify(mgr).lock(INSTANCENAME, type + ":" + uuid2, LOCK_SEC + 10);
assertEquals(GuardResult.LOCK_DENIED, result.getA());
assertNull(result.getB());
}
@@ -302,21 +306,21 @@ public class PolicyGuardTest {
// acquired
result = PolicyGuard.lockTarget(type, INSTANCENAME, uuid, dlcb, LOCK_SEC);
- verify(mgr).lock(INSTANCENAME, type+":"+uuid, LOCK_SEC);
+ verify(mgr).lock(INSTANCENAME, type + ":" + uuid, LOCK_SEC);
assertEquals(GuardResult.LOCK_ACQUIRED, result.getA());
assertEquals(VMTargetLock.class, result.getB().getClass());
TargetLock lock = result.getB();
// refresh - re-acquired
- assertEquals(GuardResult.LOCK_ACQUIRED, PolicyGuard.lockTarget(lock, LOCK_SEC+1));
- verify(mgr).refresh(INSTANCENAME, type+":"+uuid, LOCK_SEC+1);
+ assertEquals(GuardResult.LOCK_ACQUIRED, PolicyGuard.lockTarget(lock, LOCK_SEC + 1));
+ verify(mgr).refresh(INSTANCENAME, type + ":" + uuid, LOCK_SEC + 1);
// unlock
PolicyGuard.unlockTarget(lock);
// refresh - denied, as we no longer own the lock
- assertEquals(GuardResult.LOCK_DENIED, PolicyGuard.lockTarget(lock, LOCK_SEC+2));
+ assertEquals(GuardResult.LOCK_DENIED, PolicyGuard.lockTarget(lock, LOCK_SEC + 2));
}
@Test(expected = IllegalArgumentException.class)