Remove dmaap from models
[policy/models.git] / models-sim / policy-models-simulators / src / test / java / org / onap / policy / models / simulators / MainTest.java
index dc3cc26..09064f4 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP
  * ================================================================================
  * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023-2024 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -30,6 +31,7 @@ import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
+import jakarta.ws.rs.core.Response;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.HashMap;
@@ -39,11 +41,9 @@ import java.util.Map.Entry;
 import java.util.Properties;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.TimeUnit;
-import javax.ws.rs.core.Response;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
 import org.onap.policy.common.endpoints.http.client.HttpClient;
@@ -66,7 +66,6 @@ public class MainTest {
     /**
      * Saves system properties.
      */
-    @Ignore
     @BeforeClass
     public static void setUpBeforeClass() throws IOException, InterruptedException {
         savedValues = new HashMap<>();
@@ -92,7 +91,6 @@ public class MainTest {
     /**
      * Restores system properties.
      */
-    @Ignore
     @AfterClass
     public static void tearDownAfterClass() {
         for (Entry<String, String> ent : savedValues.entrySet()) {
@@ -107,7 +105,6 @@ public class MainTest {
     /**
      * Shuts down the simulator instance.
      */
-    @Ignore
     @After
     public void tearDown() {
         Main main = Main.getInstance();
@@ -116,18 +113,10 @@ public class MainTest {
         }
     }
 
-    @Ignore
-    @Test
-    public void testConstructor() throws Exception {
-        assertThatIllegalArgumentException().isThrownBy(() -> new Main("invalidDmaapProvider.json"))
-                        .withMessage("invalid simulator parameters");
-    }
-
     /**
-     * Verifies that all of the simulators are brought up and that HTTPS works with at
+     * Verifies that all the simulators are brought up and that HTTPS works with at
      * least one of them.
      */
-    @Ignore
     @Test
     public void testMain() throws Exception {
         Main.main(new String[0]);
@@ -144,7 +133,6 @@ public class MainTest {
         checkAai();
     }
 
-    @Ignore
     @Test
     public void testMainMinimalParameters() {
         Main.main(new String[] {"minParameters.json"});
@@ -167,7 +155,6 @@ public class MainTest {
     /**
      * Tests readParameters() when the file cannot be found.
      */
-    @Ignore
     @Test
     public void testReadParametersNoFile() {
         assertThatIllegalArgumentException().isThrownBy(() -> new Main("missing-file.json"))
@@ -177,7 +164,6 @@ public class MainTest {
     /**
      * Tests readParameters() when the json cannot be decoded.
      */
-    @Ignore
     @Test
     public void testReadParametersInvalidJson() throws CoderException {
         Coder coder = mock(Coder.class);
@@ -194,7 +180,6 @@ public class MainTest {
     /**
      * Tests buildRestServer() when the server port is not open.
      */
-    @Ignore
     @Test
     public void testBuildRestServerNotOpen() {
         HttpServletServer server = mock(HttpServletServer.class);
@@ -217,7 +202,6 @@ public class MainTest {
     /**
      * Tests buildRestServer() when the port checker is interrupted.
      */
-    @Ignore
     @Test
     public void testBuildRestServerInterrupted() throws InterruptedException {
         HttpServletServer server = mock(HttpServletServer.class);
@@ -234,7 +218,7 @@ public class MainTest {
             }
         };
 
-        // run in another thread so we don't interrupt this thread
+        // run in another thread, so we don't interrupt this thread
         LinkedBlockingQueue<RuntimeException> queue = new LinkedBlockingQueue<>();
         Thread thread = new Thread(() -> {
             try {
@@ -253,33 +237,5 @@ public class MainTest {
         assertThat(ex.getCause()).hasMessageStartingWith("interrupted while building");
     }
 
-    /**
-     * Tests buildTopicServer() when the provider class is invalid.
-     */
-    @Ignore
-    @Test
-    public void testBuildTopicServerInvalidProvider() {
-        assertThatThrownBy(() -> new Main("invalidTopicServer.json").start())
-                        .hasCauseInstanceOf(IllegalArgumentException.class);
-    }
-
-    /**
-     * Tests buildTopicServer() when the sink is missing.
-     */
-    @Ignore
-    @Test
-    public void testBuildTopicServerNoSink() {
-        assertThatThrownBy(() -> new Main("missingSink.json").start())
-                        .hasCauseInstanceOf(IllegalArgumentException.class);
-    }
 
-    /**
-     * Tests buildTopicServer() when the sink is missing.
-     */
-    @Ignore
-    @Test
-    public void testBuildTopicServerNoSource() {
-        assertThatThrownBy(() -> new Main("missingSource.json").start())
-                        .hasCauseInstanceOf(IllegalArgumentException.class);
-    }
 }