aboutsummaryrefslogtreecommitdiffstats
path: root/feature-no-locking/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'feature-no-locking/src/test')
-rw-r--r--feature-no-locking/src/test/java/org/onap/policy/no/locking/NoLockManagerTest.java21
-rw-r--r--feature-no-locking/src/test/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi1
2 files changed, 16 insertions, 6 deletions
diff --git a/feature-no-locking/src/test/java/org/onap/policy/no/locking/NoLockManagerTest.java b/feature-no-locking/src/test/java/org/onap/policy/no/locking/NoLockManagerTest.java
index bae9d109..376fc04e 100644
--- a/feature-no-locking/src/test/java/org/onap/policy/no/locking/NoLockManagerTest.java
+++ b/feature-no-locking/src/test/java/org/onap/policy/no/locking/NoLockManagerTest.java
@@ -20,6 +20,7 @@
package org.onap.policy.no.locking;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -28,21 +29,29 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
-import org.junit.Before;
+import java.util.List;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.policy.drools.core.lock.AlwaysSuccessLock;
import org.onap.policy.drools.core.lock.Lock;
import org.onap.policy.drools.core.lock.LockCallback;
+import org.onap.policy.drools.features.PolicyEngineFeatureApi;
+import org.onap.policy.drools.features.PolicyEngineFeatureApiConstants;
public class NoLockManagerTest {
- private NoLockManager nlm;
- private LockCallback callback;
+ private static NoLockManager nlm;
+ private static LockCallback callback;
- @Before
- public void setUp() {
+ /**
+ * Set up Junits.
+ */
+ @BeforeClass
+ public static void setUp() {
+ List<PolicyEngineFeatureApi> engineServices = PolicyEngineFeatureApiConstants.getProviders().getList();
+ assertThat(engineServices).hasSize(1);
+ nlm = (NoLockManager) engineServices.get(0);
callback = mock(LockCallback.class);
- nlm = new NoLockManager();
}
@Test
diff --git a/feature-no-locking/src/test/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi b/feature-no-locking/src/test/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi
new file mode 100644
index 00000000..93e6abe3
--- /dev/null
+++ b/feature-no-locking/src/test/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi
@@ -0,0 +1 @@
+org.onap.policy.no.locking.NoLockManager