From 2d948a9099e2b000cc061fb77dc0502c5d721ac9 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Tue, 15 Jan 2019 15:54:45 +0000 Subject: Fix crashing unit tests in Apex Issue-ID: POLICY-1403 Change-Id: Ie9d2cc46f3daf4d6b2eb2774a8be8c35e0c45754 Signed-off-by: liamfallon --- .../apex/service/engine/main/ApexMainTest.java | 29 +++++++++++----------- .../test/resources/parameters/correctParams.json | 2 +- .../parameters/correctParamsJavaProperties.json | 2 +- 3 files changed, 17 insertions(+), 16 deletions(-) (limited to 'services/services-engine') diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexMainTest.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexMainTest.java index c6118108f..6ed3c755d 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexMainTest.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexMainTest.java @@ -48,7 +48,7 @@ public class ApexMainTest { final String outString = outContent.toString(); System.setOut(stdout); - + assertTrue(outString.contains("Apex configuration file was not specified as an argument")); } @@ -57,8 +57,8 @@ public class ApexMainTest { OutputStream outContent = new ByteArrayOutputStream(); System.setOut(new PrintStream(outContent)); - String[] args = {"-whee"}; - + String[] args = { "-whee" }; + final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(200); apexMain.shutdown(); @@ -66,7 +66,7 @@ public class ApexMainTest { final String outString = outContent.toString(); System.setOut(stdout); - + assertTrue(outString.contains("invalid command line arguments specified : Unrecognized option: -whee")); } @@ -75,8 +75,8 @@ public class ApexMainTest { OutputStream outContent = new ByteArrayOutputStream(); System.setOut(new PrintStream(outContent)); - String[] args = {"-h"}; - + String[] args = { "-h" }; + final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(200); apexMain.shutdown(); @@ -93,8 +93,8 @@ public class ApexMainTest { OutputStream outContent = new ByteArrayOutputStream(); System.setOut(new PrintStream(outContent)); - String[] args = {"-c", "src/test/resources/parameters/badParams.json"}; - + String[] args = { "-c", "src/test/resources/parameters/badParams.json" }; + final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(200); apexMain.shutdown(); @@ -111,8 +111,8 @@ public class ApexMainTest { OutputStream outContent = new ByteArrayOutputStream(); System.setOut(new PrintStream(outContent)); - String[] args = {"-c", "src/test/resources/parameters/correctParams.json"}; - + String[] args = { "-c", "src/test/resources/parameters/correctParams.json" }; + final ApexMain apexMain = new ApexMain(args); assertEquals("MyApexEngine", apexMain.getParameters().getEngineServiceParameters().getName()); ThreadUtilities.sleep(200); @@ -126,20 +126,21 @@ public class ApexMainTest { } @Test - public void testjavaProperties() throws ApexException { + public void testJavaProperties() throws ApexException { OutputStream outContent = new ByteArrayOutputStream(); System.setOut(new PrintStream(outContent)); - String[] args = {"-c", "src/test/resources/parameters/correctParamsJavaProperties.json"}; - + String[] args = { "-c", "src/test/resources/parameters/correctParamsJavaProperties.json" }; + final ApexMain apexMain = new ApexMain(args); assertEquals("MyApexEngine", apexMain.getParameters().getEngineServiceParameters().getName()); - + assertEquals("trust-store-file", System.getProperty("javax.net.ssl.trustStore")); assertEquals("Pol1cy_0nap", System.getProperty("javax.net.ssl.trustStorePassword")); ThreadUtilities.sleep(200); apexMain.shutdown(); + ThreadUtilities.sleep(10000); final String outString = outContent.toString(); System.setOut(stdout); diff --git a/services/services-engine/src/test/resources/parameters/correctParams.json b/services/services-engine/src/test/resources/parameters/correctParams.json index 2265134d4..90f5fa15b 100644 --- a/services/services-engine/src/test/resources/parameters/correctParams.json +++ b/services/services-engine/src/test/resources/parameters/correctParams.json @@ -32,7 +32,7 @@ "carrierTechnologyParameters": { "carrierTechnology": "FILE", "parameters": { - "standardIo": true + "fileName": "src/test/resources/events/TestPojoEvent.json" } }, "eventProtocolParameters": { diff --git a/services/services-engine/src/test/resources/parameters/correctParamsJavaProperties.json b/services/services-engine/src/test/resources/parameters/correctParamsJavaProperties.json index 0a599d701..e92254655 100644 --- a/services/services-engine/src/test/resources/parameters/correctParamsJavaProperties.json +++ b/services/services-engine/src/test/resources/parameters/correctParamsJavaProperties.json @@ -36,7 +36,7 @@ "carrierTechnologyParameters": { "carrierTechnology": "FILE", "parameters": { - "standardIo": true + "fileName": "src/test/resources/events/TestPojoEvent.json" } }, "eventProtocolParameters": { -- cgit 1.2.3-korg