Merge "Handle numRecords default setting when built as 0."
[policy/models.git] / models-sim / models-sim-dmaap / src / test / java / org / onap / policy / sim / dmaap / startstop / MainTest.java
index b3f83dd..1d6c68a 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * ============LICENSE_START=======================================================
- *  Modifications Copyright (C) 2019-2020 AT&T Intellectual Property.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property.
+ * Modifications Copyright (C) 2021 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,6 +21,7 @@
 
 package org.onap.policy.sim.dmaap.startstop;
 
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatCode;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
@@ -30,6 +32,7 @@ import org.junit.Before;
 import org.junit.Test;
 import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
 import org.onap.policy.models.sim.dmaap.rest.CommonRestServer;
+import org.onap.policy.models.sim.dmaap.startstop.DmaapSimCommandLineArguments;
 import org.onap.policy.models.sim.dmaap.startstop.Main;
 import org.onap.policy.sim.dmaap.parameters.CommonTestData;
 
@@ -42,7 +45,7 @@ public class MainTest extends CommonRestServer {
     private Main main;
 
     /**
-     * Set up.
+     * Sets up.
      */
     @Before
     public void setUp() {
@@ -64,7 +67,7 @@ public class MainTest extends CommonRestServer {
 
     @Test
     public void testMain() throws Exception {
-        CommonRestServer.reconfigure(false);
+        CommonRestServer.reconfigure();
         final String[] NormalParameters = {"-c", CONFIG_FILE};
         main = new Main(NormalParameters);
         assertTrue(main.getParameters().isValid());
@@ -82,7 +85,7 @@ public class MainTest extends CommonRestServer {
 
     @Test
     public void testMain_InvalidArguments() throws Exception {
-        CommonRestServer.reconfigure(false);
+        CommonRestServer.reconfigure();
 
         // note: this is missing the "-c" argument, thus the ARGUMENTS are invalid
         final String[] NormalParameters = {CONFIG_FILE};
@@ -102,4 +105,11 @@ public class MainTest extends CommonRestServer {
         main = new Main(NormalParameters);
         assertNull(main.getParameters());
     }
+
+    @Test
+    public void testDmaapSimVersion() {
+        String[] testArgs = {"-v"};
+        DmaapSimCommandLineArguments sutArgs = new DmaapSimCommandLineArguments(testArgs);
+        assertThat(sutArgs.version()).startsWith("ONAP DMaaP simulator Service");
+    }
 }