More actor clean-up
[policy/models.git] / models-interactions / model-actors / actor.so / src / test / java / org / onap / policy / controlloop / actor / so / SoOperatorTest.java
index 16bbdea..2040323 100644 (file)
@@ -22,9 +22,7 @@ package org.onap.policy.controlloop.actor.so;
 
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.when;
 
 import java.util.Map;
@@ -34,11 +32,7 @@ import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 import org.onap.policy.common.endpoints.http.client.HttpClient;
 import org.onap.policy.common.endpoints.http.client.HttpClientFactory;
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.actorserviceprovider.Operation;
 import org.onap.policy.controlloop.actorserviceprovider.Util;
-import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext;
-import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
 import org.onap.policy.controlloop.actorserviceprovider.parameters.ParameterValidationRuntimeException;
 
 public class SoOperatorTest {
@@ -85,36 +79,9 @@ public class SoOperatorTest {
         assertEquals(ACTOR + "." + OPERATION, oper.getFullName());
     }
 
-    @Test
-    public void testMakeSoOperator() {
-        oper = SoOperator.makeSoOperator(ACTOR, OPERATION, MyOperation::new);
-
-        VirtualControlLoopEvent event = new VirtualControlLoopEvent();
-        ControlLoopEventContext context = new ControlLoopEventContext(event);
-        ControlLoopOperationParams params =
-                        ControlLoopOperationParams.builder().actor(ACTOR).operation(OPERATION).context(context).build();
-
-        Operation operation1 = oper.buildOperation(params);
-        assertNotNull(operation1);
-
-        Operation operation2 = oper.buildOperation(params);
-        assertNotNull(operation2);
-        assertNotSame(operation1, operation2);
-    }
-
     @Test
     public void testDoConfigure_testGetters() {
-        // should use given values
-        assertSame(client, oper.getClient());
-        assertEquals(PATH_GET, oper.getPathGet());
-        assertEquals(MAX_GETS, oper.getMaxGets());
-        assertEquals(WAIT_SEC_GETS, oper.getWaitSecGet());
-
-        SoParams params = SoParams.builder().pathGet("unslashed").maxGets(MAX_GETS).waitSecGet(WAIT_SEC_GETS)
-                        .clientName(CLIENT).path(PATH).timeoutSec(TIMEOUT).build();
-        Map<String, Object> paramMap = Util.translateToMap(OPERATION, params);
-        oper.configure(paramMap);
-        assertEquals("unslashed/", oper.getPathGet());
+        assertTrue(oper.getCurrentConfig() instanceof SoConfig);
 
         // test invalid parameters
         Map<String, Object> paramMap2 = Util.translateToMap(OPERATION, SoParams.builder().build());
@@ -124,12 +91,7 @@ public class SoOperatorTest {
 
     private class MyOperator extends SoOperator {
         public MyOperator() {
-            super(ACTOR, OPERATION);
-        }
-
-        @Override
-        public Operation buildOperation(ControlLoopOperationParams params) {
-            return null;
+            super(ACTOR, OPERATION, null);
         }
 
         @Override
@@ -137,10 +99,4 @@ public class SoOperatorTest {
             return factory;
         }
     }
-
-    private class MyOperation extends SoOperation {
-        public MyOperation(ControlLoopOperationParams params, SoOperator operator) {
-            super(params, operator);
-        }
-    }
 }