Fix no-lock service loader incorrect metadata 24/120724/1
authorjhh <jorge.hernandez-herrero@att.com>
Tue, 20 Apr 2021 13:45:13 +0000 (08:45 -0500)
committerjhh <jorge.hernandez-herrero@att.com>
Tue, 20 Apr 2021 13:45:13 +0000 (08:45 -0500)
Issue-ID: POLICY-3202
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Change-Id: Iac6d9c7459718df1aae97e0b56f51178cd6b172e

feature-no-locking/src/main/resources/META-INF.services/org.onap.policy.drools.features.PolicyEngineFeatureApi [deleted file]
feature-no-locking/src/main/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi [new file with mode: 0644]
feature-no-locking/src/test/java/org/onap/policy/no/locking/NoLockManagerTest.java
feature-no-locking/src/test/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi [new file with mode: 0644]

diff --git a/feature-no-locking/src/main/resources/META-INF.services/org.onap.policy.drools.features.PolicyEngineFeatureApi b/feature-no-locking/src/main/resources/META-INF.services/org.onap.policy.drools.features.PolicyEngineFeatureApi
deleted file mode 100644 (file)
index e8a5d79..0000000
+++ /dev/null
@@ -1 +0,0 @@
-org.onap.policy.no.locking.NoLockManager
\ No newline at end of file
diff --git a/feature-no-locking/src/main/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi b/feature-no-locking/src/main/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi
new file mode 100644 (file)
index 0000000..93e6abe
--- /dev/null
@@ -0,0 +1 @@
+org.onap.policy.no.locking.NoLockManager
index bae9d10..376fc04 100644 (file)
@@ -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 (file)
index 0000000..93e6abe
--- /dev/null
@@ -0,0 +1 @@
+org.onap.policy.no.locking.NoLockManager