summaryrefslogtreecommitdiffstats
path: root/feature-no-locking/src/test
diff options
context:
space:
mode:
authorjhh <jorge.hernandez-herrero@att.com>2021-04-20 08:45:13 -0500
committerjhh <jorge.hernandez-herrero@att.com>2021-04-20 08:45:13 -0500
commit8ba0ef18395205abd8fe0a1b41a5d9d030e93cc1 (patch)
tree5ae12296e56b5f58e25e78ab7af7c11e6605a2b7 /feature-no-locking/src/test
parente05a96429ac2d4823011c9dc70accdd0f581b862 (diff)
Fix no-lock service loader incorrect metadata
Issue-ID: POLICY-3202 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: Iac6d9c7459718df1aae97e0b56f51178cd6b172e
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