diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/onap/dcae/vestest/TestDmaapPropertyReader.java | 4 | ||||
-rw-r--r-- | src/test/java/org/onap/dcae/vestest/TestEventProcessor.java | 23 | ||||
-rw-r--r-- | src/test/java/org/onap/dcae/vestest/TestFetchConfig.java | 90 | ||||
-rw-r--r-- | src/test/java/org/onap/dcae/vestest/TestLoadDynamicConfig.java | 57 | ||||
-rw-r--r-- | src/test/java/org/onap/dcae/vestest/TestSchemaValidation.java | 18 | ||||
-rw-r--r-- | src/test/java/org/onap/dcae/vestest/TestVESLogger.java | 115 | ||||
-rw-r--r-- | src/test/resources/controller-config.json | 17 | ||||
-rw-r--r-- | src/test/resources/controller-config_dmaap_ip.json | 239 | ||||
-rw-r--r-- | src/test/resources/controller-config_singleline_ip.json | 1 | ||||
-rw-r--r-- | src/test/resources/testDmaapConfig_ip.json (renamed from src/test/resources/testDmaapConfig.json) | 0 | ||||
-rw-r--r-- | src/test/resources/test_collector_ip_op.properties | 78 | ||||
-rw-r--r-- | src/test/resources/testcollector.properties | 150 |
12 files changed, 661 insertions, 131 deletions
diff --git a/src/test/java/org/onap/dcae/vestest/TestDmaapPropertyReader.java b/src/test/java/org/onap/dcae/vestest/TestDmaapPropertyReader.java index e54b4cbb..2a7a205e 100644 --- a/src/test/java/org/onap/dcae/vestest/TestDmaapPropertyReader.java +++ b/src/test/java/org/onap/dcae/vestest/TestDmaapPropertyReader.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * PROJECT * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ import org.onap.dcae.commonFunction.DmaapPropertyReader; public class TestDmaapPropertyReader { DmaapPropertyReader dr; - String testinput = "src/test/resources/testDmaapConfig.json"; + String testinput = "src/test/resources/testDmaapConfig_ip.json"; Boolean flag = false; @Before diff --git a/src/test/java/org/onap/dcae/vestest/TestEventProcessor.java b/src/test/java/org/onap/dcae/vestest/TestEventProcessor.java index f11cc905..47672956 100644 --- a/src/test/java/org/onap/dcae/vestest/TestEventProcessor.java +++ b/src/test/java/org/onap/dcae/vestest/TestEventProcessor.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * PROJECT * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,6 @@ import static org.junit.Assert.*; import java.io.File; -import java.io.FileReader; import java.net.URL; import java.util.Map; @@ -47,13 +46,13 @@ public class TestEventProcessor { EventProcessor ec; String ev= "{\"event\": {\"commonEventHeader\": { \"reportingEntityName\": \"VM name will be provided by ECOMP\", \"startEpochMicrosec\": 1477012779802988,\"lastEpochMicrosec\": 1477012789802988,\"eventId\": \"83\",\"sourceName\": \"Dummy VM name - No Metadata available\",\"sequence\": 83,\"priority\": \"Normal\",\"functionalRole\": \"vFirewall\",\"domain\": \"measurementsForVfScaling\",\"reportingEntityId\": \"VM UUID will be provided by ECOMP\",\"sourceId\": \"Dummy VM UUID - No Metadata available\",\"version\": 1.1},\"measurementsForVfScalingFields\": {\"measurementInterval\": 10,\"measurementsForVfScalingVersion\": 1.1,\"vNicUsageArray\": [{\"multicastPacketsIn\": 0,\"bytesIn\": 3896,\"unicastPacketsIn\": 0, \"multicastPacketsOut\": 0,\"broadcastPacketsOut\": 0, \"packetsOut\": 28,\"bytesOut\": 12178,\"broadcastPacketsIn\": 0,\"packetsIn\": 58,\"unicastPacketsOut\": 0,\"vNicIdentifier\": \"eth0\"}]}}}"; - + String testinput; @Before public void setUp() throws Exception { CommonStartup.streamid="fault=sec_fault|syslog=sec_syslog|heartbeat=sec_heartbeat|measurementsForVfScaling=sec_measurement|mobileFlow=sec_mobileflow|other=sec_other|stateChange=sec_statechange|thresholdCrossingAlert=sec_thresholdCrossingAlert|voiceQuality=ves_voicequality|sipSignaling=ves_sipsignaling"; CommonStartup.eventTransformFlag = 1; - + testinput = "src/test/resources/testDmaapConfig_ip.json"; } @@ -81,7 +80,7 @@ public class TestEventProcessor { DmaapPropertyReader dr; EventPublisher ep = null; - String testinput = "src/test/resources/testDmaapConfig.json"; + Boolean flag = false; dr = new DmaapPropertyReader(testinput); @@ -106,9 +105,11 @@ public class TestEventProcessor { DmaapPropertyReader dr; EventPublisherHash eph = null; + Boolean flag = false; + dr = new DmaapPropertyReader(testinput); eph = EventPublisherHash.getInstance(); - + if (eph.equals(null)) { @@ -128,13 +129,14 @@ public class TestEventProcessor { DmaapPropertyReader dr; EventPublisherHash eph = null; - String testinput = "src/test/resources/testDmaapConfig.json"; + Boolean flag = false; dr = new DmaapPropertyReader(testinput); eph = EventPublisherHash.getInstance(); EventProcessor ec = new EventProcessor(); ec.event=new org.json.JSONObject(ev); - CommonStartup.cambriaConfigFile="src/test/resources/testDmaapConfig.json"; + CommonStartup.cambriaConfigFile="src/test/resources/testDmaapConfig_ip.json"; + CambriaBatchingPublisher pub = eph.Dmaaphash("sec_fault_ueb"); if (pub == null || pub.equals(null)) @@ -154,7 +156,7 @@ public class TestEventProcessor { DmaapPropertyReader dr; EventPublisherHash eph = null; - String testinput = "src/test/resources/testDmaapConfig.json"; + Boolean flag = true; dr = new DmaapPropertyReader(testinput); eph = EventPublisherHash.getInstance(); @@ -162,7 +164,7 @@ public class TestEventProcessor { EventProcessor ec = new EventProcessor(); ec.event=new org.json.JSONObject(ev); - CommonStartup.cambriaConfigFile="src/test/resources/testDmaapConfig.json"; + CommonStartup.cambriaConfigFile="src/test/resources/testDmaapConfig_ip.json"; eph.sendEvent(ec.event, "sec_fault_ueb"); assertEquals(true, flag); @@ -170,4 +172,3 @@ public class TestEventProcessor { } } - diff --git a/src/test/java/org/onap/dcae/vestest/TestFetchConfig.java b/src/test/java/org/onap/dcae/vestest/TestFetchConfig.java new file mode 100644 index 00000000..ed3e1086 --- /dev/null +++ b/src/test/java/org/onap/dcae/vestest/TestFetchConfig.java @@ -0,0 +1,90 @@ +/*- + * ============LICENSE_START======================================================= + * PROJECT + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.dcae.vestest; + +import static org.junit.Assert.*; + +import static org.junit.Assert.assertEquals; + +import java.io.FileReader; +import java.io.IOException; +import org.json.JSONObject; +import com.google.gson.JsonParser; +import com.google.gson.JsonObject; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.dcae.commonFunction.CommonStartup; +import org.onap.dcae.commonFunction.DmaapPropertyReader; +import org.onap.dcae.commonFunction.EventProcessor; +import org.onap.dcae.commonFunction.EventPublisherHash; +import org.onap.dcae.controller.FetchDynamicConfig; + + +public class TestFetchConfig { + + JSONObject jsonObject; + + @Before + public void setUp() throws Exception { + + + } + + @After + public void tearDown() throws Exception { + } + + + + @Test + public void testwritefile() { + Boolean flag = false; + + FetchDynamicConfig fc = new FetchDynamicConfig(); + FetchDynamicConfig.configFile = "src/test/resources/controller-config_formatted_op.json"; + + + + try{ + JsonParser parser = new JsonParser(); + FileReader fr = new FileReader ("src/test/resources/controller-config_singleline_ip.json" ); + final JsonObject jo = (JsonObject) parser.parse (fr); + final String jsonText = jo.toString (); + jsonObject = new JSONObject ( jsonText ); + fc.writefile(jsonObject.toString()); + } + catch(Exception e){ + System.out.println("Exception while opening the file"); + e.printStackTrace(); + } + if(jsonObject.has("streams_publishes")) + { + flag = true; + } + + assertEquals(true, flag); + + } + + +} + diff --git a/src/test/java/org/onap/dcae/vestest/TestLoadDynamicConfig.java b/src/test/java/org/onap/dcae/vestest/TestLoadDynamicConfig.java index 902add73..765d9c61 100644 --- a/src/test/java/org/onap/dcae/vestest/TestLoadDynamicConfig.java +++ b/src/test/java/org/onap/dcae/vestest/TestLoadDynamicConfig.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * PROJECT * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,30 +21,29 @@ package org.onap.dcae.vestest; import static org.junit.Assert.*; -import java.io.File; import java.io.FileReader; -import java.net.URL; -import java.util.Map; - -import org.json.simple.JSONObject; +import org.json.JSONObject; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.onap.dcae.controller.FetchDynamicConfig; import org.onap.dcae.controller.LoadDynamicConfig; +import com.google.gson.JsonObject; import com.google.gson.JsonParser; public class TestLoadDynamicConfig { LoadDynamicConfig lc; - String propop = "src/test/resources/testcollector.properties"; + String propop = "src/test/resources/test_collector_ip_op.properties"; + @Before public void setUp() throws Exception { - + lc = new LoadDynamicConfig(); } @@ -55,18 +54,50 @@ public class TestLoadDynamicConfig { @Test public void testLoad() { - // File file = new File("."); - // for(String fileNames : file.list()) System.out.println(fileNames); Boolean flag=false; - lc = new LoadDynamicConfig(); - lc.propFile = "src/test/resources/testcollector.properties"; - lc.configFile = "src/test/resources/controller-config.json"; + + + lc.propFile = "src/test/resources/test_collector_ip_op.properties"; + lc.configFile = "src/test/resources/controller-config_dmaap_ip.json"; String data = LoadDynamicConfig.readFile(propop); assertEquals(data.isEmpty(), flag); } + @Test + public void testwrite() { + + + Boolean flag=false; + + lc.propFile = "src/test/resources/test_collector_ip_op.properties"; + lc.configFile = "src/test/resources/controller-config_dmaap_ip.json"; + lc.dmaapoutputfile = "src/test/resources/DmaapConfig-op.json"; + + String data = LoadDynamicConfig.readFile(lc.configFile); + JSONObject jsonObject = new JSONObject(data); + lc.writeconfig(jsonObject); + + try{ + JsonParser parser = new JsonParser(); + FileReader fr = new FileReader ( lc.dmaapoutputfile ); + final JsonObject jo = (JsonObject) parser.parse (fr); + final String jsonText = jo.toString (); + jsonObject = new JSONObject ( jsonText ); + } + catch(Exception e){ + System.out.println("Exception while opening the file"); + e.printStackTrace(); + } + if(jsonObject.has("ves-fault-secondary")) + { + flag = true; + } + + assertEquals(true, flag); + + } } diff --git a/src/test/java/org/onap/dcae/vestest/TestSchemaValidation.java b/src/test/java/org/onap/dcae/vestest/TestSchemaValidation.java index a34b3336..af8a62f3 100644 --- a/src/test/java/org/onap/dcae/vestest/TestSchemaValidation.java +++ b/src/test/java/org/onap/dcae/vestest/TestSchemaValidation.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * PROJECT * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -83,30 +83,22 @@ public class TestSchemaValidation { } - +/* @Test public void testeventReceipt() { - //com.att.nsa.drumlin.service.framework.context.DrumlinRequestContext.DrumlinRequestContext(DrumlinServlet webServlet, - //HttpServletRequest req, HttpServletResponse resp, DrumlinConnection s, Map<String, Object> objects, DrumlinRequestRouter router) - //HttpServletRequest req = new HttpServletRequest(); - //HttpServletResponse res = new HttpServletResponse(); DrumlinServlet webServlet = new DrumlinServlet(); - //webServlet.addToBaseContext(key, o); - //Map<String,Object> mp = new Map<String, Object>(); DrumlinRequestContext ctx = new DrumlinRequestContext(webServlet, null, null, null, null, null); EventReceipt er= new EventReceipt(); try { EventReceipt.receiveVESEvent(null); } catch ( NullPointerException e) { - // TODO Auto-generated catch block - + + e.printStackTrace(); } - - Assert.assertEquals("true", "true"); - } + }*/ @Test public void testsafeclosefr() { diff --git a/src/test/java/org/onap/dcae/vestest/TestVESLogger.java b/src/test/java/org/onap/dcae/vestest/TestVESLogger.java new file mode 100644 index 00000000..3d41eed6 --- /dev/null +++ b/src/test/java/org/onap/dcae/vestest/TestVESLogger.java @@ -0,0 +1,115 @@ +/*- + * ============LICENSE_START======================================================= + * PROJECT + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.dcae.vestest; + +import static org.junit.Assert.*; + +import static org.junit.Assert.assertEquals; + +import java.io.FileReader; +import java.io.IOException; +import java.util.UUID; + +import org.json.JSONObject; +import com.google.gson.JsonParser; +import com.att.nsa.logging.LoggingContext; +import com.google.gson.JsonObject; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.dcae.commonFunction.CommonStartup; +import org.onap.dcae.commonFunction.DmaapPropertyReader; +import org.onap.dcae.commonFunction.EventProcessor; +import org.onap.dcae.commonFunction.EventPublisherHash; +import org.onap.dcae.commonFunction.VESLogger; +import org.onap.dcae.controller.FetchDynamicConfig; + + +public class TestVESLogger { + + LoggingContext threadLC; + + @Before + public void setUp() throws Exception { + + threadLC = null; + } + + @After + public void tearDown() throws Exception { + } + + + + @Test + public void testgetCommonLoggingContext() { + Boolean flag = false; + threadLC = VESLogger.getCommonLoggingContext(); + if(!threadLC.equals("")) + { + flag = true; + } + + assertEquals(true, flag); + + } + @Test + public void testUuidgetLoggingContextForThread() { + Boolean flag = false; + final UUID uuid = UUID.randomUUID(); + threadLC = VESLogger.getLoggingContextForThread(uuid); + //if(threadLC.get("REQUEST_ID", null) != null) + if(!threadLC.equals("")) + { + flag = true; + } + + assertEquals(true, flag); + + + } + @Test + public void testStringgetLoggingContextForThread() { + Boolean flag = false; + final UUID uuid = UUID.randomUUID(); + threadLC = VESLogger.getLoggingContextForThread(uuid.toString()); + //if(threadLC.get("REQUEST_ID", null) != null) + if(!threadLC.equals("")) + { + flag = true; + } + + assertEquals(true, flag); + + } + + @Test + public void testsetUpEcompLogging() { + Boolean flag = false; + VESLogger.setUpEcompLogging(); + + + assertEquals(true, true); + + } + +} + diff --git a/src/test/resources/controller-config.json b/src/test/resources/controller-config.json deleted file mode 100644 index c71f434d..00000000 --- a/src/test/resources/controller-config.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "services_calls": {}, - "collector.schema.checkflag": 1, - "collector.inputQueue.maxPending": 8096, - "collector.keystore.alias": "dynamically generated", - "collector.schema.file": "{\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.json\"}", - "header.authlist": "userid1,base64encodepwd1|userid2,base64encodepwd2", - "streams_subscribes": {}, - "tomcat.maxthreads": "200", - "collector.service.secure.port": 8443, - "collector.dmaap.streamid": "fault=ves_fault|syslog=ves_syslog|heartbeat=ves_heartbeat|measurementsForVfScaling=ves_measurement|mobileFlow=ves_mobileflow|other=ves_other|stateChange=ves_statechange|thresholdCrossingAlert=ves_thresholdCrossingAlert|voiceQuality=ves_voicequality|sipSignaling=ves_sipsignaling", - "event.transform.flag": 0, - "collector.keystore.file.location": "/opt/app/dcae-certificate/keystore.jks", - "collector.keystore.passwordfile": "/opt/app/dcae-certificate/.password", - "header.authflag": 0, - "collector.service.port": 8080 -} diff --git a/src/test/resources/controller-config_dmaap_ip.json b/src/test/resources/controller-config_dmaap_ip.json new file mode 100644 index 00000000..8979a614 --- /dev/null +++ b/src/test/resources/controller-config_dmaap_ip.json @@ -0,0 +1,239 @@ +{ + "header.authflag": 1, + "collector.inputQueue.maxPending": 8096, + "collector.keystore.alias": "dynamically generated", + "collector.schema.checkflag": 1, + "collector.keystore.file.location": "/opt/app/dcae-certificate/keystore.jks", + "tomcat.maxthreads": "200", + "collector.keystore.passwordfile": "/opt/app/dcae-certificate/.password", + "collector.service.secure.port": 8443, + "collector.schema.file": "{\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.json\"}", + "collector.dmaap.streamid": "fault=ves-fault,ves-fault-secondary|syslog=ves-syslog,ves-syslog-secondary|heartbeat=ves-heartbeat,ves-heartbeat-secondary|measurementsForVfScaling=ves-measurement,ves-measurement-secondary|mobileFlow=ves-mobileflow,ves-mobileflow-secondary|other=ves-other,ves-other-secondary|stateChange=ves-statechange,ves-statechange-secondary|thresholdCrossingAlert=ves-thresholdCrossingAlert,ves-thresholdCrossingAlert-secondary|voiceQuality=ves-voicequality,ves-voicequality-secondary|sipSignaling=ves-sipsignaling,ves-sipsignaling-secondary", + "streams_subscribes": {}, + "collector.service.port": -1, + "services_calls": {}, + "streams_publishes": { + "ves-other": { + "aaf_username": null, + "type": "message_router", + "aaf_password": null, + "dmaap_info": { + "client_id": null, + "location": "mtl5", + "client_role": null, + "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV" + } + }, + "ves-fault": { + "aaf_username": null, + "type": "message_router", + "aaf_password": null, + "dmaap_info": { + "client_id": null, + "location": "mtl5", + "client_role": null, + "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV" + } + }, + "ves-syslog": { + "aaf_username": null, + "type": "message_router", + "aaf_password": null, + "dmaap_info": { + "client_id": null, + "location": "mtl5", + "client_role": null, + "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV" + } + }, + "ves-other-secondary": { + "aaf_username": null, + "type": "message_router", + "aaf_password": null, + "dmaap_info": { + "client_id": null, + "location": "mtl5", + "client_role": null, + "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV" + } + }, + "ves-syslog-secondary": { + "aaf_username": null, + "type": "message_router", + "aaf_password": null, + "dmaap_info": { + "client_id": null, + "location": "mtl5", + "client_role": null, + "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV" + } + }, + "ves-thresholdCrossingAlert-secondary": { + "aaf_username": null, + "type": "message_router", + "aaf_password": null, + "dmaap_info": { + "client_id": null, + "location": "mtl5", + "client_role": null, + "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV" + } + }, + "ves-voicequality": { + "aaf_username": null, + "type": "message_router", + "aaf_password": null, + "dmaap_info": { + "client_id": null, + "location": "mtl5", + "client_role": null, + "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV" + } + }, + "ves-sipsignaling-secondary": { + "aaf_username": null, + "type": "message_router", + "aaf_password": null, + "dmaap_info": { + "client_id": null, + "location": "mtl5", + "client_role": null, + "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV" + } + }, + "ves-heartbeat": { + "aaf_username": null, + "type": "message_router", + "aaf_password": null, + "dmaap_info": { + "client_id": null, + "location": "mtl5", + "client_role": null, + "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV" + } + }, + "ves-mobileflow-secondary": { + "aaf_username": null, + "type": "message_router", + "aaf_password": null, + "dmaap_info": { + "client_id": null, + "location": "mtl5", + "client_role": null, + "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV" + } + }, + "ves-heartbeat-secondary": { + "aaf_username": null, + "type": "message_router", + "aaf_password": null, + "dmaap_info": { + "client_id": null, + "location": "mtl5", + "client_role": null, + "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV" + } + }, + "ves-measurement-secondary": { + "aaf_username": null, + "type": "message_router", + "aaf_password": null, + "dmaap_info": { + "client_id": null, + "location": "mtl5", + "client_role": null, + "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV" + } + }, + "ves-measurement": { + "aaf_username": null, + "type": "message_router", + "aaf_password": null, + "dmaap_info": { + "client_id": null, + "location": "mtl5", + "client_role": null, + "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV" + } + }, + "ves-sipsignaling": { + "aaf_username": null, + "type": "message_router", + "aaf_password": null, + "dmaap_info": { + "client_id": null, + "location": "mtl5", + "client_role": null, + "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV" + } + }, + "ves-statechange-secondary": { + "aaf_username": null, + "type": "message_router", + "aaf_password": null, + "dmaap_info": { + "client_id": null, + "location": "mtl5", + "client_role": null, + "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV" + } + }, + "ves-voicequality-secondary": { + "aaf_username": null, + "type": "message_router", + "aaf_password": null, + "dmaap_info": { + "client_id": null, + "location": "mtl5", + "client_role": null, + "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV" + } + }, + "ves-fault-secondary": { + "aaf_username": null, + "type": "message_router", + "aaf_password": null, + "dmaap_info": { + "client_id": null, + "location": "mtl5", + "client_role": null, + "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV" + } + }, + "ves-statechange": { + "aaf_username": null, + "type": "message_router", + "aaf_password": null, + "dmaap_info": { + "client_id": null, + "location": "mtl5", + "client_role": null, + "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV" + } + }, + "ves-mobileflow": { + "aaf_username": null, + "type": "message_router", + "aaf_password": null, + "dmaap_info": { + "client_id": null, + "location": "mtl5", + "client_role": null, + "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV" + } + }, + "ves-thresholdCrossingAlert": { + "aaf_username": null, + "type": "message_router", + "aaf_password": null, + "dmaap_info": { + "client_id": null, + "location": "mtl5", + "client_role": null, + "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV" + } + } + }, + "event.transform.flag": 1, + "header.authlist": "sample1,c2FtcGxlMQ==|userid1,base64encodepwd1|userid2,base64encodepwd2" +} diff --git a/src/test/resources/controller-config_singleline_ip.json b/src/test/resources/controller-config_singleline_ip.json new file mode 100644 index 00000000..220e3f1b --- /dev/null +++ b/src/test/resources/controller-config_singleline_ip.json @@ -0,0 +1 @@ +{"header.authflag": "1", "collector.schema.file": "{\"v1\": \"./etc/CommonEventFormat_27.2.json\", \"v2\": \"./etc/CommonEventFormat_27.2.json\", \"v3\": \"./etc/CommonEventFormat_27.2.json\", \"v4\": \"./etc/CommonEventFormat_27.2.json\", \"v5\": \"./etc/CommonEventFormat_28.4.json\"}", "collector.keystore.passwordfile": "/opt/app/dcae-certificate/.password", "tomcat.maxthreads": "200", "collector.dmaap.streamid": "fault=ves-fault|syslog=ves-syslog|heartbeat=ves-heartbeat|measurementsForVfScaling=ves-measurement|mobileFlow=ves-mobileflow|other=ves-other|stateChange=ves-statechange|thresholdCrossingAlert=ves-thresholdCrossingAlert|voiceQuality=ves-voicequality|sipSignaling=ves-sipsignaling", "streams_subscribes": {}, "collector.inputQueue.maxPending": "8096", "collector.keystore.alias": "dynamically generated", "streams_publishes": {"ves-mobileflow": {"type": "message_router", "dmaap_info": {"client_id": "1517590629043", "client_role": "com.att.secCollector.member", "location": "rdm5bdcc2", "topic_url": "https://DMAAPHOST:3905/events/com.att.dcae.dmaap.FTL.24256-SEC-MOBILEFLOW-OUTPUT-v1"}, "aaf_username": "userid@namespace", "aaf_password": "authpwd"}, "ves-measurement": {"type": "message_router", "dmaap_info": {"client_id": "1517590433916", "client_role": "com.att.secCollector.member", "location": "rdm5bdcc2", "topic_url": "https://DMAAPHOST:3905/events/com.att.dcae.dmaap.FTL.24256-ENC-MEASUREMENT-OUTPUT-v1"}, "aaf_username": "userid@namespace", "aaf_password": "authpwd"}, "ves-voicequality": {"type": "message_router", "dmaap_info": {"client_id": "1517590778397", "client_role": "com.att.secCollector.member", "location": "rdm5bdcc2", "topic_url": "https://DMAAPHOST:3905/events/com.att.dcae.dmaap.FTL.24256-VES-VOICEQUALITY-OUTPUT-v1"}, "aaf_username": "userid@namespace", "aaf_password": "authpwd"}, "ves-thresholdCrossingAlert": {"type": "message_router", "dmaap_info": {"client_id": "1517590728150", "client_role": "com.att.secCollector.member", "location": "rdm5bdcc2", "topic_url": "https://DMAAPHOST:3905/events/com.att.dcae.dmaap.FTL.24256-SEC-TCA-OUTPUT-v1"}, "aaf_username": "userid@namespace", "aaf_password": "authpwd"}, "ves-fault": {"type": "message_router", "dmaap_info": {"client_id": "1517590384670", "client_role": "com.att.secCollector.member", "location": "rdm5bdcc2", "topic_url": "https://DMAAPHOST:3905/events/com.att.dcae.dmaap.FTL.24256-SEC-FAULT-OUTPUT-v1"}, "aaf_username": "userid@namespace", "aaf_password": "authpwd"}, "ves-heartbeat": {"type": "message_router", "dmaap_info": {"client_id": "1517590530041", "client_role": "com.att.secCollector.member", "location": "rdm5bdcc2", "topic_url": "https://DMAAPHOST:3905/events/com.att.dcae.dmaap.FTL.24256-SEC-HEARTBEAT-OUTPUT-v1"}, "aaf_username": "userid@namespace", "aaf_password": "authpwd"}, "ves-sipsignaling": {"type": "message_router", "dmaap_info": {"client_id": "1517590828736", "client_role": "com.att.secCollector.member", "location": "rdm5bdcc2", "topic_url": "https://DMAAPHOST:3905/events/com.att.dcae.dmaap.FTL.24256-VES-SIPSIGNALING-OUTPUT-v1"}, "aaf_username": "userid@namespace", "aaf_password": "authpwd"}, "ves-syslog": {"type": "message_router", "dmaap_info": {"client_id": "1517590482019", "client_role": "com.att.secCollector.member", "location": "rdm5bdcc2", "topic_url": "https://DMAAPHOST:3905/events/com.att.dcae.dmaap.FTL.24256-SEC-SYSLOG-OUTPUT-v1"}, "aaf_username": "userid@namespace", "aaf_password": "authpwd"}, "ves-other": {"type": "message_router", "dmaap_info": {"client_id": "1517590581045", "client_role": "com.att.secCollector.member", "location": "rdm5bdcc2", "topic_url": "https://DMAAPHOST:3905/events/com.att.dcae.dmaap.FTL.24256-SEC-OTHER-OUTPUT-v1"}, "aaf_username": "userid@namespace", "aaf_password": "authpwd"}, "ves-statechange": {"type": "message_router", "dmaap_info": {"client_id": "1517590677649", "client_role": "com.att.secCollector.member", "location": "rdm5bdcc2", "topic_url": "https://DMAAPHOST:3905/events/com.att.dcae.dmaap.FTL.24256-SEC-STATECHANGE-OUTPUT-v1"}, "aaf_username": "userid@namespace", "aaf_password": "authpwd"}}, "collector.schema.checkflag": "1", "services_calls": {}, "event.transform.flag": "1", "collector.keystore.file.location": "/opt/app/dcae-certificate/keystore.jks", "header.authlist": "sample1,c2FtcGxlMQ==|userid1,base64encodepwd1|userid2,base64encodepwd2", "collector.service.secure.port": "8443", "collector.service.port": "-1"}
\ No newline at end of file diff --git a/src/test/resources/testDmaapConfig.json b/src/test/resources/testDmaapConfig_ip.json index 247db789..247db789 100644 --- a/src/test/resources/testDmaapConfig.json +++ b/src/test/resources/testDmaapConfig_ip.json diff --git a/src/test/resources/test_collector_ip_op.properties b/src/test/resources/test_collector_ip_op.properties new file mode 100644 index 00000000..ad3ee2f1 --- /dev/null +++ b/src/test/resources/test_collector_ip_op.properties @@ -0,0 +1,78 @@ +###############################################################################
+##
+## Collector Server config
+##
+## - Default values are shown as commented settings.
+##
+###############################################################################
+##
+## HTTP(S) service
+##
+## Normally:
+##
+## - 8080 is http service
+## - https is disabled by default (-1)
+##
+## - At this time, the server always binds to 0.0.0.0
+##
+## The default port when header.authflag is disabled (0)
+collector.service.port=-1
+
+## The secure port is required if header.authflag is set to 1 (true)
+## Authentication is only supported via secure port
+## When enabled - require valid keystore defined
+collector.service.secure.port=8443
+
+## The keystore must be setup per installation when secure port is configured
+collector.keystore.file.location=/opt/app/dcae-certificate/keystore.jks
+collector.keystore.passwordfile=/opt/app/dcae-certificate/.password
+collector.keystore.alias=dynamically generated
+
+
+###############################################################################
+## Processing
+##
+## If there's a problem that prevents the collector from processing alarms,
+## it's normally better to apply back pressure to the caller than to try to
+## buffer beyond a reasonable size limit. With a limit, the server won't crash
+## due to being out of memory, and the caller will get a 5xx reply saying the
+## server is in trouble.
+collector.inputQueue.maxPending=8096
+
+## Schema Validation checkflag
+## default no validation checkflag (-1)
+## If enabled (1) - schemafile location must be specified
+collector.schema.checkflag=1
+collector.schema.file={\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.json\"}
+
+## List all streamid per domain to be supported. The streamid should match to channel name on dmaapfile
+collector.dmaap.streamid=fault=ves-fault,ves-fault-secondary|syslog=ves-syslog,ves-syslog-secondary|heartbeat=ves-heartbeat,ves-heartbeat-secondary|measurementsForVfScaling=ves-measurement,ves-measurement-secondary|mobileFlow=ves-mobileflow,ves-mobileflow-secondary|other=ves-other,ves-other-secondary|stateChange=ves-statechange,ves-statechange-secondary|thresholdCrossingAlert=ves-thresholdCrossingAlert,ves-thresholdCrossingAlert-secondary|voiceQuality=ves-voicequality,ves-voicequality-secondary|sipSignaling=ves-sipsignaling,ves-sipsignaling-secondary
+collector.dmaapfile=./etc/DmaapConfig.json
+
+## Custom ExceptionConfiguration
+exceptionConfig=./etc/ExceptionConfig.json
+
+## authflag control authentication by the collector
+## If enabled (1) - then authlist has to be defined
+## When authflag is enabled, only secure port will be supported
+## To disable enter 0
+header.authflag=1
+## Combination of userid,base64 encoded pwd list to be supported
+## userid and pwd comma separated; pipe delimitation between each pair
+header.authlist=sample1,c2FtcGxlMQ==|userid1,base64encodepwd1|userid2,base64encodepwd2
+
+## Event transformation Flag - when set expects configurable transformation
+## defined under ./etc/eventTransform.json
+## Enabled by default; to disable set to 0
+event.transform.flag=1
+streams_subscribes = {}
+services_calls = {}
+tomcat.maxthreads = 200
+
+###############################################################################
+##
+## Tomcat control
+##
+#tomcat.maxthreads=(tomcat default, which is usually 200)
+
+
diff --git a/src/test/resources/testcollector.properties b/src/test/resources/testcollector.properties index 6b166b04..7c00a208 100644 --- a/src/test/resources/testcollector.properties +++ b/src/test/resources/testcollector.properties @@ -1,75 +1,75 @@ -############################################################################### -## -## Collector Server config -## -## - Default values are shown as commented settings. -## -############################################################################### -## -## HTTP(S) service -## -## Normally: -## -## - 8080 is http service -## - https is disabled by default (-1) -## -## - At this time, the server always binds to 0.0.0.0 -## -## The default port when header.authflag is disabled (0) -collector.service.port=9999 - -## The secure port is required if header.authflag is set to 1 (true) -## Authentication is only supported via secure port -## When enabled - require valid keystore defined -collector.service.secure.port=8443 - -## The keystore must be setup per installation when secure port is configured -collector.keystore.file.location=../etc/keystore -collector.keystore.passwordfile=./etc/passwordfile -collector.keystore.alias=tomcat - - -############################################################################### -## Processing -## -## If there's a problem that prevents the collector from processing alarms, -## it's normally better to apply back pressure to the caller than to try to -## buffer beyond a reasonable size limit. With a limit, the server won't crash -## due to being out of memory, and the caller will get a 5xx reply saying the -## server is in trouble. -collector.inputQueue.maxPending=8096 - -## Schema Validation checkflag -## default no validation checkflag (-1) -## If enabled (1) - schemafile location must be specified -collector.schema.checkflag=1 -collector.schema.file={\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.json\"} - -## List all streamid per domain to be supported. The streamid should match to channel name on dmaapfile -collector.dmaap.streamid=fault=sec_fault|syslog=sec_syslog|heartbeat=sec_heartbeat|measurementsForVfScaling=sec_measurement|mobileFlow=sec_mobileflow|other=sec_other|stateChange=sec_statechange|thresholdCrossingAlert=sec_thresholdCrossingAlert|voiceQuality=ves_voicequality|sipSignaling=ves_sipsignaling -collector.dmaapfile=./etc/DmaapConfig.json - -## Custom ExceptionConfiguration -exceptionConfig=./etc/ExceptionConfig.json - -## authflag control authentication by the collector -## If enabled (1) - then authlist has to be defined -## When authflag is enabled, only secure port will be supported -## To disable enter 0 -header.authflag=1 -## Combination of userid,base64 encoded pwd list to be supported -## userid and pwd comma separated; pipe delimitation between each pair -header.authlist=secureid,IWRjYWVSb2FkbTEyMyEt|sample1,c2FtcGxlMQ==|vdnsagg,dmRuc2FnZw== - -## Event transformation Flag - when set expects configurable transformation -## defined under ./etc/eventTransform.json -## Enabled by default; to disable set to 0 -event.transform.flag=1 - -############################################################################### -## -## Tomcat control -## -#tomcat.maxthreads=(tomcat default, which is usually 200) - - +###############################################################################
+##
+## Collector Server config
+##
+## - Default values are shown as commented settings.
+##
+###############################################################################
+##
+## HTTP(S) service
+##
+## Normally:
+##
+## - 8080 is http service
+## - https is disabled by default (-1)
+##
+## - At this time, the server always binds to 0.0.0.0
+##
+## The default port when header.authflag is disabled (0)
+collector.service.port=9999
+
+## The secure port is required if header.authflag is set to 1 (true)
+## Authentication is only supported via secure port
+## When enabled - require valid keystore defined
+collector.service.secure.port=8443
+
+## The keystore must be setup per installation when secure port is configured
+collector.keystore.file.location=../etc/keystore
+collector.keystore.passwordfile=./etc/passwordfile
+collector.keystore.alias=tomcat
+
+
+###############################################################################
+## Processing
+##
+## If there's a problem that prevents the collector from processing alarms,
+## it's normally better to apply back pressure to the caller than to try to
+## buffer beyond a reasonable size limit. With a limit, the server won't crash
+## due to being out of memory, and the caller will get a 5xx reply saying the
+## server is in trouble.
+collector.inputQueue.maxPending=8096
+
+## Schema Validation checkflag
+## default no validation checkflag (-1)
+## If enabled (1) - schemafile location must be specified
+collector.schema.checkflag=1
+collector.schema.file={\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.json\"}
+
+## List all streamid per domain to be supported. The streamid should match to channel name on dmaapfile
+collector.dmaap.streamid=fault=sec_fault|syslog=sec_syslog|heartbeat=sec_heartbeat|measurementsForVfScaling=sec_measurement|mobileFlow=sec_mobileflow|other=sec_other|stateChange=sec_statechange|thresholdCrossingAlert=sec_thresholdCrossingAlert|voiceQuality=ves_voicequality|sipSignaling=ves_sipsignaling
+collector.dmaapfile=./etc/DmaapConfig.json
+
+## Custom ExceptionConfiguration
+exceptionConfig=./etc/ExceptionConfig.json
+
+## authflag control authentication by the collector
+## If enabled (1) - then authlist has to be defined
+## When authflag is enabled, only secure port will be supported
+## To disable enter 0
+header.authflag=1
+## Combination of userid,base64 encoded pwd list to be supported
+## userid and pwd comma separated; pipe delimitation between each pair
+header.authlist=secureid,IWRjYWVSb2FkbTEyMyEt|sample1,c2FtcGxlMQ==
+
+## Event transformation Flag - when set expects configurable transformation
+## defined under ./etc/eventTransform.json
+## Enabled by default; to disable set to 0
+event.transform.flag=1
+
+###############################################################################
+##
+## Tomcat control
+##
+#tomcat.maxthreads=(tomcat default, which is usually 200)
+
+
|