diff options
author | 2021-01-28 14:33:07 +0530 | |
---|---|---|
committer | 2021-02-09 17:57:20 +0530 | |
commit | cabe143a7c7c8011139cbb3c154abc4c3616c66f (patch) | |
tree | 0568507a3f5e6b0dee4ae2f16bbd6ebcb77d3b53 /src/test | |
parent | 8333cde6f59d9a3b341c7e762cf68df8f316b962 (diff) |
[DMaap-msgrtr] Update Security Vulnerabilities
- Log4j version 1.2.17 to 2.13.3
- commons-codec version 1.11 to 1.15
- jackson-databind version 2.8.11.1 to 2.11.2
- grails-bootstrap version 2.5.4 to 4.0.1
- httpclient version 4.5.3 to 4.5.13
- Code Refactoring
Issue-ID: DMAAP-1515
Signed-off-by: ajay_dp001 <ajay.deep.singh@est.tech>
Change-Id: I6d52dd85e1ca82b5863815b26e4d521f9dac28b7
Diffstat (limited to 'src/test')
45 files changed, 1416 insertions, 1541 deletions
diff --git a/src/test/java/org/onap/dmaap/mr/apiServer/metrics/cambria/JUnitTestSuite.java b/src/test/java/org/onap/dmaap/mr/apiServer/metrics/cambria/JUnitTestSuite.java index 4bef234..9758383 100644 --- a/src/test/java/org/onap/dmaap/mr/apiServer/metrics/cambria/JUnitTestSuite.java +++ b/src/test/java/org/onap/dmaap/mr/apiServer/metrics/cambria/JUnitTestSuite.java @@ -7,9 +7,9 @@ * 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. @@ -18,24 +18,25 @@ * ============LICENSE_END========================================================= */ -package org.onap.dmaap.mr.apiServer.metrics.cambria; +package org.onap.dmaap.mr.apiServer.metrics.cambria; import junit.framework.TestSuite; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.apache.log4j.Logger; @RunWith(Suite.class) -@SuiteClasses({ DMaaPMetricsSenderTest.class}) +@SuiteClasses({DMaaPMetricsSenderTest.class}) public class JUnitTestSuite { - private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class); - public static void main(String[] args) { - LOGGER.info("Running the test suite"); - - TestSuite tstSuite = new TestSuite(); - LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); - } + private static final Logger LOGGER = LogManager.getLogger(JUnitTestSuite.class); + public static void main(String[] args) { + LOGGER.info("Running the test suite"); + + TestSuite tstSuite = new TestSuite(); + LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/apiServer/metrics/cambria/TestRunner.java b/src/test/java/org/onap/dmaap/mr/apiServer/metrics/cambria/TestRunner.java index 2eb7c1c..c1150e9 100644 --- a/src/test/java/org/onap/dmaap/mr/apiServer/metrics/cambria/TestRunner.java +++ b/src/test/java/org/onap/dmaap/mr/apiServer/metrics/cambria/TestRunner.java @@ -7,9 +7,9 @@ * 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. @@ -18,24 +18,24 @@ * ============LICENSE_END========================================================= */ -package org.onap.dmaap.mr.apiServer.metrics.cambria; +package org.onap.dmaap.mr.apiServer.metrics.cambria; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; -import org.apache.log4j.Logger; public class TestRunner { - private static final Logger LOGGER = Logger.getLogger(TestRunner.class); - public static void main(String[] args) { - // TODO Auto-generated method stub - Result result = JUnitCore.runClasses(JUnitTestSuite.class); - for (Failure failure : result.getFailures()) { - LOGGER.info(failure.toString()); - - } - LOGGER.info(result.wasSuccessful()); - } + private static final Logger LOGGER = LogManager.getLogger(TestRunner.class); + public static void main(String[] args) { + // TODO Auto-generated method stub + Result result = JUnitCore.runClasses(JUnitTestSuite.class); + for (Failure failure : result.getFailures()) { + LOGGER.info(failure.toString()); + } + LOGGER.info(result.wasSuccessful()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/JUnitTestSuite.java b/src/test/java/org/onap/dmaap/mr/cambria/JUnitTestSuite.java index d9e3483..bcac8d9 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/JUnitTestSuite.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/JUnitTestSuite.java @@ -7,9 +7,9 @@ * 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. @@ -18,25 +18,26 @@ * ============LICENSE_END========================================================= */ -package org.onap.dmaap.mr.cambria; +package org.onap.dmaap.mr.cambria; import junit.framework.TestSuite; - +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.apache.log4j.Logger; @RunWith(Suite.class) -@SuiteClasses({ CambriaApiExceptionTest.class, CambriaApiVersionInfoTest.class, CambriaApiTestCase.class, CambriaRateLimiterTest.class, }) +@SuiteClasses({CambriaApiExceptionTest.class, CambriaApiVersionInfoTest.class, + CambriaApiTestCase.class, CambriaRateLimiterTest.class,}) public class JUnitTestSuite { - private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class); - public static void main(String[] args) { - LOGGER.info("Running the test suite"); - - TestSuite tstSuite = new TestSuite(); - LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); - } + private static final Logger LOGGER = LogManager.getLogger(JUnitTestSuite.class); + + public static void main(String[] args) { + LOGGER.info("Running the test suite"); + TestSuite tstSuite = new TestSuite(); + LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/TestRunner.java b/src/test/java/org/onap/dmaap/mr/cambria/TestRunner.java index f276888..8465cbe 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/TestRunner.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/TestRunner.java @@ -7,9 +7,9 @@ * 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. @@ -18,24 +18,24 @@ * ============LICENSE_END========================================================= */ -package org.onap.dmaap.mr.cambria; +package org.onap.dmaap.mr.cambria; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; -import org.apache.log4j.Logger; public class TestRunner { - private static final Logger LOGGER = Logger.getLogger(TestRunner.class); - public static void main(String[] args) { - // TODO Auto-generated method stub - Result result = JUnitCore.runClasses(JUnitTestSuite.class); - for (Failure failure : result.getFailures()) { - LOGGER.info(failure.toString()); - - } - LOGGER.info(result.wasSuccessful()); - } + private static final Logger LOGGER = LogManager.getLogger(TestRunner.class); + public static void main(String[] args) { + // TODO Auto-generated method stub + Result result = JUnitCore.runClasses(JUnitTestSuite.class); + for (Failure failure : result.getFailures()) { + LOGGER.info(failure.toString()); + } + LOGGER.info(result.wasSuccessful()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/backends/kafka/JUnitTestSuite.java b/src/test/java/org/onap/dmaap/mr/cambria/backends/kafka/JUnitTestSuite.java index de77603..d299fdd 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/backends/kafka/JUnitTestSuite.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/backends/kafka/JUnitTestSuite.java @@ -7,9 +7,9 @@ * 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. @@ -18,25 +18,26 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.backends.kafka; +package org.onap.dmaap.mr.cambria.backends.kafka; import junit.framework.TestSuite; - +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.apache.log4j.Logger; @RunWith(Suite.class) -@SuiteClasses({ KafkaConsumerCacheTest.class, KafkaPublisherTest.class,Kafka011ConsumerTest.class,KafkaLiveLockAvoider2Test.class }) +@SuiteClasses({KafkaConsumerCacheTest.class, KafkaPublisherTest.class, Kafka011ConsumerTest.class, + KafkaLiveLockAvoider2Test.class}) public class JUnitTestSuite { - private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class); - public static void main(String[] args) { - LOGGER.info("Running the test suite"); - - TestSuite tstSuite = new TestSuite(); - LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); - } + private static final Logger LOGGER = LogManager.getLogger(JUnitTestSuite.class); + + public static void main(String[] args) { + LOGGER.info("Running the test suite"); + TestSuite tstSuite = new TestSuite(); + LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/backends/kafka/TestRunner.java b/src/test/java/org/onap/dmaap/mr/cambria/backends/kafka/TestRunner.java index 8f70091..38261e1 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/backends/kafka/TestRunner.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/backends/kafka/TestRunner.java @@ -7,9 +7,9 @@ * 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. @@ -18,24 +18,24 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.backends.kafka; +package org.onap.dmaap.mr.cambria.backends.kafka; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; -import org.apache.log4j.Logger; public class TestRunner { - private static final Logger LOGGER = Logger.getLogger(TestRunner.class); - public static void main(String[] args) { - // TODO Auto-generated method stub - Result result = JUnitCore.runClasses(JUnitTestSuite.class); - for (Failure failure : result.getFailures()) { - LOGGER.info(failure.toString()); - - } - LOGGER.info(result.wasSuccessful()); - } + private static final Logger LOGGER = LogManager.getLogger(TestRunner.class); + public static void main(String[] args) { + // TODO Auto-generated method stub + Result result = JUnitCore.runClasses(JUnitTestSuite.class); + for (Failure failure : result.getFailures()) { + LOGGER.info(failure.toString()); + } + LOGGER.info(result.wasSuccessful()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/backends/memory/JUnitTestSuite.java b/src/test/java/org/onap/dmaap/mr/cambria/backends/memory/JUnitTestSuite.java index d577ae8..c38be64 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/backends/memory/JUnitTestSuite.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/backends/memory/JUnitTestSuite.java @@ -7,9 +7,9 @@ * 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. @@ -18,26 +18,26 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.backends.memory; +package org.onap.dmaap.mr.cambria.backends.memory; import junit.framework.TestSuite; - +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.apache.log4j.Logger; @RunWith(Suite.class) -@SuiteClasses({ MemoryConsumerFactoryTest.class, MemoryMetaBrokerTest.class, MemoryQueueTest.class, - MemoryQueuePublisherTest.class, MessageLoggerTest.class, }) +@SuiteClasses({MemoryConsumerFactoryTest.class, MemoryMetaBrokerTest.class, MemoryQueueTest.class, + MemoryQueuePublisherTest.class, MessageLoggerTest.class,}) public class JUnitTestSuite { - private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class); - public static void main(String[] args) { - LOGGER.info("Running the test suite"); - - TestSuite tstSuite = new TestSuite(); - LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); - } + private static final Logger LOGGER = LogManager.getLogger(JUnitTestSuite.class); + + public static void main(String[] args) { + LOGGER.info("Running the test suite"); + TestSuite tstSuite = new TestSuite(); + LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/backends/memory/TestRunner.java b/src/test/java/org/onap/dmaap/mr/cambria/backends/memory/TestRunner.java index c6af86e..2f0a215 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/backends/memory/TestRunner.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/backends/memory/TestRunner.java @@ -7,9 +7,9 @@ * 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. @@ -18,24 +18,24 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.backends.memory; +package org.onap.dmaap.mr.cambria.backends.memory; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; -import org.apache.log4j.Logger; public class TestRunner { - private static final Logger LOGGER = Logger.getLogger(TestRunner.class); - public static void main(String[] args) { - // TODO Auto-generated method stub - Result result = JUnitCore.runClasses(JUnitTestSuite.class); - for (Failure failure : result.getFailures()) { - LOGGER.info(failure.toString()); - - } - LOGGER.info(result.wasSuccessful()); - } + private static final Logger LOGGER = LogManager.getLogger(TestRunner.class); + public static void main(String[] args) { + // TODO Auto-generated method stub + Result result = JUnitCore.runClasses(JUnitTestSuite.class); + for (Failure failure : result.getFailures()) { + LOGGER.info(failure.toString()); + } + LOGGER.info(result.wasSuccessful()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/beans/JUnitTestSuite.java b/src/test/java/org/onap/dmaap/mr/cambria/beans/JUnitTestSuite.java index 1589290..cf48007 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/beans/JUnitTestSuite.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/beans/JUnitTestSuite.java @@ -7,9 +7,9 @@ * 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. @@ -18,32 +18,36 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.beans; +package org.onap.dmaap.mr.cambria.beans; import junit.framework.TestSuite; - +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.apache.log4j.Logger; @RunWith(Suite.class) -@SuiteClasses({ ApiKeyBeanTest.class, ApiKeyBeanTest2.class, ApiKeyBeanTest3.class, ApiKeyBeanTest4.class, ApiKeyBeanTest5.class, ApiKeyBeanTest6.class, - DMaaPCambriaLimiterTest.class, DMaaPContextTest.class, DMaaPContextTest2.class, - DMaaPContextTest3.class,DMaaPContextTest4.class,DMaaPContextTest5.class,DMaaPContextTest6.class, - LogDetailsTest.class, LogDetailsTest2.class,LogDetailsTest3.class,LogDetailsTest4.class,LogDetailsTest5.class,LogDetailsTest6.class, - LogDetailsTest7.class,LogDetailsTest8.class,LogDetailsTest9.class,LogDetailsTest10.class,LogDetailsTest11.class,LogDetailsTest12.class, - LogDetailsTest13.class,LogDetailsTest14.class,LogDetailsTest15.class,LogDetailsTest16.class, TopicBeanTest.class,TopicBeanTest2.class,TopicBeanTest3.class, - TopicBeanTest4.class,TopicBeanTest5.class,TopicBeanTest6.class,TopicBeanTest7.class,TopicBeanTest8.class,TopicBeanTest9.class,TopicBeanTest10.class,}) +@SuiteClasses({ApiKeyBeanTest.class, ApiKeyBeanTest2.class, ApiKeyBeanTest3.class, + ApiKeyBeanTest4.class, ApiKeyBeanTest5.class, ApiKeyBeanTest6.class, + DMaaPCambriaLimiterTest.class, DMaaPContextTest.class, DMaaPContextTest2.class, + DMaaPContextTest3.class, DMaaPContextTest4.class, DMaaPContextTest5.class, + DMaaPContextTest6.class, LogDetailsTest.class, LogDetailsTest2.class, + LogDetailsTest3.class, LogDetailsTest4.class, LogDetailsTest5.class, LogDetailsTest6.class, + LogDetailsTest7.class, LogDetailsTest8.class, LogDetailsTest9.class, LogDetailsTest10.class, + LogDetailsTest11.class, LogDetailsTest12.class, LogDetailsTest13.class, LogDetailsTest14.class, + LogDetailsTest15.class, LogDetailsTest16.class, TopicBeanTest.class, TopicBeanTest2.class, + TopicBeanTest3.class, TopicBeanTest4.class, TopicBeanTest5.class, TopicBeanTest6.class, + TopicBeanTest7.class, TopicBeanTest8.class, TopicBeanTest9.class, TopicBeanTest10.class,}) public class JUnitTestSuite { - private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class); - public static void main(String[] args) { - LOGGER.info("Running the test suite"); - - TestSuite tstSuite = new TestSuite(); - LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); - } + private static final Logger LOGGER = LogManager.getLogger(JUnitTestSuite.class); + + public static void main(String[] args) { + LOGGER.info("Running the test suite"); + TestSuite tstSuite = new TestSuite(); + LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/beans/TestRunner.java b/src/test/java/org/onap/dmaap/mr/cambria/beans/TestRunner.java index f65bdfa..dc024b4 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/beans/TestRunner.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/beans/TestRunner.java @@ -7,9 +7,9 @@ * 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. @@ -18,24 +18,24 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.beans; +package org.onap.dmaap.mr.cambria.beans; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; -import org.apache.log4j.Logger; public class TestRunner { - private static final Logger LOGGER = Logger.getLogger(TestRunner.class); - public static void main(String[] args) { - // TODO Auto-generated method stub - Result result = JUnitCore.runClasses(JUnitTestSuite.class); - for (Failure failure : result.getFailures()) { - LOGGER.info(failure.toString()); - - } - LOGGER.info(result.wasSuccessful()); - } + private static final Logger LOGGER = LogManager.getLogger(TestRunner.class); + public static void main(String[] args) { + // TODO Auto-generated method stub + Result result = JUnitCore.runClasses(JUnitTestSuite.class); + for (Failure failure : result.getFailures()) { + LOGGER.info(failure.toString()); + } + LOGGER.info(result.wasSuccessful()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/exception/JUnitTestSuite.java b/src/test/java/org/onap/dmaap/mr/cambria/exception/JUnitTestSuite.java index e7aedac..dc0cf50 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/exception/JUnitTestSuite.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/exception/JUnitTestSuite.java @@ -7,9 +7,9 @@ * 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. @@ -18,26 +18,26 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.exception; +package org.onap.dmaap.mr.cambria.exception; import junit.framework.TestSuite; - +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.apache.log4j.Logger; @RunWith(Suite.class) -@SuiteClasses({ DMaaPCambriaExceptionMapperTest.class, - DMaaPErrorMessagesTest.class, DMaaPWebExceptionMapperTest.class, ErrorResponseTest.class}) +@SuiteClasses({DMaaPCambriaExceptionMapperTest.class, + DMaaPErrorMessagesTest.class, DMaaPWebExceptionMapperTest.class, ErrorResponseTest.class}) public class JUnitTestSuite { - private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class); - public static void main(String[] args) { - LOGGER.info("Running the test suite"); - - TestSuite tstSuite = new TestSuite(); - LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); - } + private static final Logger LOGGER = LogManager.getLogger(JUnitTestSuite.class); + + public static void main(String[] args) { + LOGGER.info("Running the test suite"); + TestSuite tstSuite = new TestSuite(); + LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/exception/TestRunner.java b/src/test/java/org/onap/dmaap/mr/cambria/exception/TestRunner.java index cd5a2ff..77920c8 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/exception/TestRunner.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/exception/TestRunner.java @@ -7,9 +7,9 @@ * 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. @@ -18,24 +18,24 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.exception; +package org.onap.dmaap.mr.cambria.exception; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; -import org.apache.log4j.Logger; public class TestRunner { - private static final Logger LOGGER = Logger.getLogger(TestRunner.class); - public static void main(String[] args) { - // TODO Auto-generated method stub - Result result = JUnitCore.runClasses(JUnitTestSuite.class); - for (Failure failure : result.getFailures()) { - LOGGER.info(failure.toString()); - - } - LOGGER.info(result.wasSuccessful()); - } + private static final Logger LOGGER = LogManager.getLogger(TestRunner.class); + public static void main(String[] args) { + // TODO Auto-generated method stub + Result result = JUnitCore.runClasses(JUnitTestSuite.class); + for (Failure failure : result.getFailures()) { + LOGGER.info(failure.toString()); + } + LOGGER.info(result.wasSuccessful()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/listener/JUnitTestSuite.java b/src/test/java/org/onap/dmaap/mr/cambria/listener/JUnitTestSuite.java index 38efa3b..0dd7db5 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/listener/JUnitTestSuite.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/listener/JUnitTestSuite.java @@ -7,9 +7,9 @@ * 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. @@ -19,25 +19,25 @@ */ - package org.onap.dmaap.mr.cambria.listener; +package org.onap.dmaap.mr.cambria.listener; import junit.framework.TestSuite; - +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.apache.log4j.Logger; @RunWith(Suite.class) -@SuiteClasses({ DME2EndPointLoaderTest.class, CambriaServletContextListenerTest.class }) +@SuiteClasses({DME2EndPointLoaderTest.class, CambriaServletContextListenerTest.class}) public class JUnitTestSuite { - private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class); - public static void main(String[] args) { - LOGGER.info("Running the test suite"); - - TestSuite tstSuite = new TestSuite(); - LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); - } + private static final Logger LOGGER = LogManager.getLogger(JUnitTestSuite.class); + + public static void main(String[] args) { + LOGGER.info("Running the test suite"); + TestSuite tstSuite = new TestSuite(); + LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/listener/TestRunner.java b/src/test/java/org/onap/dmaap/mr/cambria/listener/TestRunner.java index 636c7b4..82078c6 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/listener/TestRunner.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/listener/TestRunner.java @@ -7,9 +7,9 @@ * 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. @@ -18,24 +18,24 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.listener; +package org.onap.dmaap.mr.cambria.listener; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; -import org.apache.log4j.Logger; public class TestRunner { - private static final Logger LOGGER = Logger.getLogger(TestRunner.class); - public static void main(String[] args) { - // TODO Auto-generated method stub - Result result = JUnitCore.runClasses(JUnitTestSuite.class); - for (Failure failure : result.getFailures()) { - LOGGER.info(failure.toString()); - - } - LOGGER.info(result.wasSuccessful()); - } + private static final Logger LOGGER = LogManager.getLogger(TestRunner.class); -} + public static void main(String[] args) { + // TODO Auto-generated method stub + Result result = JUnitCore.runClasses(JUnitTestSuite.class); + for (Failure failure : result.getFailures()) { + LOGGER.info(failure.toString()); + } + LOGGER.info(result.wasSuccessful()); + } +}
\ No newline at end of file diff --git a/src/test/java/org/onap/dmaap/mr/cambria/metabroker/JUnitTestSuite.java b/src/test/java/org/onap/dmaap/mr/cambria/metabroker/JUnitTestSuite.java index 4224aae..b321af5 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/metabroker/JUnitTestSuite.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/metabroker/JUnitTestSuite.java @@ -7,9 +7,9 @@ * 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. @@ -18,25 +18,25 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.metabroker; +package org.onap.dmaap.mr.cambria.metabroker; import junit.framework.TestSuite; - +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.apache.log4j.Logger; @RunWith(Suite.class) -@SuiteClasses({ BrokerImplTest.class, TopicImplemTest.class, }) +@SuiteClasses({BrokerImplTest.class, TopicImplemTest.class,}) public class JUnitTestSuite { - private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class); - public static void main(String[] args) { - LOGGER.info("Running the test suite"); - - TestSuite tstSuite = new TestSuite(); - LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); - } + private static final Logger LOGGER = LogManager.getLogger(JUnitTestSuite.class); + + public static void main(String[] args) { + LOGGER.info("Running the test suite"); + TestSuite tstSuite = new TestSuite(); + LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/metabroker/TestRunner.java b/src/test/java/org/onap/dmaap/mr/cambria/metabroker/TestRunner.java index 072c9e3..acf2184 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/metabroker/TestRunner.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/metabroker/TestRunner.java @@ -7,9 +7,9 @@ * 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. @@ -18,24 +18,24 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.metabroker; +package org.onap.dmaap.mr.cambria.metabroker; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; -import org.apache.log4j.Logger; public class TestRunner { - private static final Logger LOGGER = Logger.getLogger(TestRunner.class); - public static void main(String[] args) { - // TODO Auto-generated method stub - Result result = JUnitCore.runClasses(JUnitTestSuite.class); - for (Failure failure : result.getFailures()) { - LOGGER.info(failure.toString()); - - } - LOGGER.info(result.wasSuccessful()); - } + private static final Logger LOGGER = LogManager.getLogger(TestRunner.class); + public static void main(String[] args) { + // TODO Auto-generated method stub + Result result = JUnitCore.runClasses(JUnitTestSuite.class); + for (Failure failure : result.getFailures()) { + LOGGER.info(failure.toString()); + } + LOGGER.info(result.wasSuccessful()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/metrics/publisher/JUnitTestSuite.java b/src/test/java/org/onap/dmaap/mr/cambria/metrics/publisher/JUnitTestSuite.java index 87b6e8b..8dbcf12 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/metrics/publisher/JUnitTestSuite.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/metrics/publisher/JUnitTestSuite.java @@ -7,9 +7,9 @@ * 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. @@ -18,25 +18,25 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.metrics.publisher; +package org.onap.dmaap.mr.cambria.metrics.publisher; import junit.framework.TestSuite; - +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.apache.log4j.Logger; @RunWith(Suite.class) -@SuiteClasses({ DMaaPCambriaClientFactoryTest.class, CambriaPublisherUtilityTest.class}) +@SuiteClasses({DMaaPCambriaClientFactoryTest.class, CambriaPublisherUtilityTest.class}) public class JUnitTestSuite { - private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class); - public static void main(String[] args) { - LOGGER.info("Running the test suite"); - - TestSuite tstSuite = new TestSuite(); - LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); - } + private static final Logger LOGGER = LogManager.getLogger(JUnitTestSuite.class); + + public static void main(String[] args) { + LOGGER.info("Running the test suite"); + TestSuite tstSuite = new TestSuite(); + LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/metrics/publisher/TestRunner.java b/src/test/java/org/onap/dmaap/mr/cambria/metrics/publisher/TestRunner.java index b7e997f..92e9f7d 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/metrics/publisher/TestRunner.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/metrics/publisher/TestRunner.java @@ -7,9 +7,9 @@ * 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. @@ -18,24 +18,24 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.metrics.publisher; +package org.onap.dmaap.mr.cambria.metrics.publisher; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; -import org.apache.log4j.Logger; public class TestRunner { - private static final Logger LOGGER = Logger.getLogger(TestRunner.class); - public static void main(String[] args) { - // TODO Auto-generated method stub - Result result = JUnitCore.runClasses(JUnitTestSuite.class); - for (Failure failure : result.getFailures()) { - LOGGER.info(failure.toString()); - - } - LOGGER.info(result.wasSuccessful()); - } + private static final Logger LOGGER = LogManager.getLogger(TestRunner.class); + public static void main(String[] args) { + // TODO Auto-generated method stub + Result result = JUnitCore.runClasses(JUnitTestSuite.class); + for (Failure failure : result.getFailures()) { + LOGGER.info(failure.toString()); + } + LOGGER.info(result.wasSuccessful()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/metrics/publisher/impl/JUnitTestSuite.java b/src/test/java/org/onap/dmaap/mr/cambria/metrics/publisher/impl/JUnitTestSuite.java index 2b72f70..4bb1d15 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/metrics/publisher/impl/JUnitTestSuite.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/metrics/publisher/impl/JUnitTestSuite.java @@ -7,9 +7,9 @@ * 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. @@ -18,26 +18,26 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.metrics.publisher.impl; +package org.onap.dmaap.mr.cambria.metrics.publisher.impl; import junit.framework.TestSuite; - +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.apache.log4j.Logger; @RunWith(Suite.class) -@SuiteClasses({ DMaaPCambriaSimplerBatchPublisherTest.class, ClockTest.class, - CambriaBaseClientTest.class, DMaaPCambriaConsumerImplTest.class}) +@SuiteClasses({DMaaPCambriaSimplerBatchPublisherTest.class, ClockTest.class, + CambriaBaseClientTest.class, DMaaPCambriaConsumerImplTest.class}) public class JUnitTestSuite { - private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class); - public static void main(String[] args) { - LOGGER.info("Running the test suite"); - - TestSuite tstSuite = new TestSuite(); - LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); - } + private static final Logger LOGGER = LogManager.getLogger(JUnitTestSuite.class); + + public static void main(String[] args) { + LOGGER.info("Running the test suite"); + TestSuite tstSuite = new TestSuite(); + LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/metrics/publisher/impl/TestRunner.java b/src/test/java/org/onap/dmaap/mr/cambria/metrics/publisher/impl/TestRunner.java index 895e93f..451be9e 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/metrics/publisher/impl/TestRunner.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/metrics/publisher/impl/TestRunner.java @@ -7,9 +7,9 @@ * 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. @@ -18,24 +18,24 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.metrics.publisher.impl; +package org.onap.dmaap.mr.cambria.metrics.publisher.impl; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; -import org.apache.log4j.Logger; public class TestRunner { - private static final Logger LOGGER = Logger.getLogger(TestRunner.class); - public static void main(String[] args) { - // TODO Auto-generated method stub - Result result = JUnitCore.runClasses(JUnitTestSuite.class); - for (Failure failure : result.getFailures()) { - LOGGER.info(failure.toString()); - - } - LOGGER.info(result.wasSuccessful()); - } + private static final Logger LOGGER = LogManager.getLogger(TestRunner.class); + public static void main(String[] args) { + // TODO Auto-generated method stub + Result result = JUnitCore.runClasses(JUnitTestSuite.class); + for (Failure failure : result.getFailures()) { + LOGGER.info(failure.toString()); + } + LOGGER.info(result.wasSuccessful()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/resources/JUnitTestSuite.java b/src/test/java/org/onap/dmaap/mr/cambria/resources/JUnitTestSuite.java index d35105a..5fd3143 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/resources/JUnitTestSuite.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/resources/JUnitTestSuite.java @@ -7,9 +7,9 @@ * 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. @@ -18,25 +18,25 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.resources; +package org.onap.dmaap.mr.cambria.resources; import junit.framework.TestSuite; - +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.apache.log4j.Logger; @RunWith(Suite.class) -@SuiteClasses({ CambriaEventSetTest.class,CambriaOutboundEventStreamTest.class, }) +@SuiteClasses({CambriaEventSetTest.class, CambriaOutboundEventStreamTest.class,}) public class JUnitTestSuite { - private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class); - public static void main(String[] args) { - LOGGER.info("Running the test suite"); - - TestSuite tstSuite = new TestSuite(); - LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); - } + private static final Logger LOGGER = LogManager.getLogger(JUnitTestSuite.class); + + public static void main(String[] args) { + LOGGER.info("Running the test suite"); + TestSuite tstSuite = new TestSuite(); + LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/resources/TestRunner.java b/src/test/java/org/onap/dmaap/mr/cambria/resources/TestRunner.java index 92b94d5..c701f10 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/resources/TestRunner.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/resources/TestRunner.java @@ -7,9 +7,9 @@ * 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. @@ -18,24 +18,24 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.resources; +package org.onap.dmaap.mr.cambria.resources; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; -import org.apache.log4j.Logger; public class TestRunner { - private static final Logger LOGGER = Logger.getLogger(TestRunner.class); - public static void main(String[] args) { - // TODO Auto-generated method stub - Result result = JUnitCore.runClasses(JUnitTestSuite.class); - for (Failure failure : result.getFailures()) { - LOGGER.info(failure.toString()); - - } - LOGGER.info(result.wasSuccessful()); - } + private static final Logger LOGGER = LogManager.getLogger(TestRunner.class); + public static void main(String[] args) { + // TODO Auto-generated method stub + Result result = JUnitCore.runClasses(JUnitTestSuite.class); + for (Failure failure : result.getFailures()) { + LOGGER.info(failure.toString()); + } + LOGGER.info(result.wasSuccessful()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/resources/streamReaders/JUnitTestSuite.java b/src/test/java/org/onap/dmaap/mr/cambria/resources/streamReaders/JUnitTestSuite.java index a01fa6c..da7626b 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/resources/streamReaders/JUnitTestSuite.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/resources/streamReaders/JUnitTestSuite.java @@ -7,9 +7,9 @@ * 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. @@ -18,26 +18,26 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.resources.streamReaders; +package org.onap.dmaap.mr.cambria.resources.streamReaders; import junit.framework.TestSuite; - +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.apache.log4j.Logger; @RunWith(Suite.class) -@SuiteClasses({ CambriaJsonStreamReaderTest.class,CambriaRawStreamReaderTest.class, - CambriaStreamReaderTest.class, CambriaTextStreamReaderTest.class, }) +@SuiteClasses({CambriaJsonStreamReaderTest.class, CambriaRawStreamReaderTest.class, + CambriaStreamReaderTest.class, CambriaTextStreamReaderTest.class,}) public class JUnitTestSuite { - private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class); - public static void main(String[] args) { - LOGGER.info("Running the test suite"); - - TestSuite tstSuite = new TestSuite(); - LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); - } + private static final Logger LOGGER = LogManager.getLogger(JUnitTestSuite.class); + + public static void main(String[] args) { + LOGGER.info("Running the test suite"); + TestSuite tstSuite = new TestSuite(); + LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/resources/streamReaders/TestRunner.java b/src/test/java/org/onap/dmaap/mr/cambria/resources/streamReaders/TestRunner.java index 5da7245..22f7656 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/resources/streamReaders/TestRunner.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/resources/streamReaders/TestRunner.java @@ -7,9 +7,9 @@ * 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. @@ -18,24 +18,24 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.resources.streamReaders; +package org.onap.dmaap.mr.cambria.resources.streamReaders; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; -import org.apache.log4j.Logger; public class TestRunner { - private static final Logger LOGGER = Logger.getLogger(TestRunner.class); - public static void main(String[] args) { - // TODO Auto-generated method stub - Result result = JUnitCore.runClasses(JUnitTestSuite.class); - for (Failure failure : result.getFailures()) { - LOGGER.info(failure.toString()); - - } - LOGGER.info(result.wasSuccessful()); - } + private static final Logger LOGGER = LogManager.getLogger(TestRunner.class); + public static void main(String[] args) { + // TODO Auto-generated method stub + Result result = JUnitCore.runClasses(JUnitTestSuite.class); + for (Failure failure : result.getFailures()) { + LOGGER.info(failure.toString()); + } + LOGGER.info(result.wasSuccessful()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/security/JUnitTestSuite.java b/src/test/java/org/onap/dmaap/mr/cambria/security/JUnitTestSuite.java index ea3f051..667ee04 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/security/JUnitTestSuite.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/security/JUnitTestSuite.java @@ -7,9 +7,9 @@ * 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. @@ -18,27 +18,27 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.security; +package org.onap.dmaap.mr.cambria.security; import junit.framework.TestSuite; - +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.apache.log4j.Logger; import org.onap.dmaap.dmf.mr.security.DMaaPAAFAuthenticatorImplTest; @RunWith(Suite.class) -@SuiteClasses({ DMaaPAAFAuthenticatorImplTest.class,DMaaPAuthenticatorImplTest.class, +@SuiteClasses({DMaaPAAFAuthenticatorImplTest.class, DMaaPAuthenticatorImplTest.class, }) public class JUnitTestSuite { - private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class); - public static void main(String[] args) { - LOGGER.info("Running the test suite"); - - TestSuite tstSuite = new TestSuite(); - LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); - } + private static final Logger LOGGER = LogManager.getLogger(JUnitTestSuite.class); + + public static void main(String[] args) { + LOGGER.info("Running the test suite"); + TestSuite tstSuite = new TestSuite(); + LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/security/TestRunner.java b/src/test/java/org/onap/dmaap/mr/cambria/security/TestRunner.java index e294538..30a6387 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/security/TestRunner.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/security/TestRunner.java @@ -7,9 +7,9 @@ * 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. @@ -18,24 +18,24 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.security; +package org.onap.dmaap.mr.cambria.security; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; -import org.apache.log4j.Logger; public class TestRunner { - private static final Logger LOGGER = Logger.getLogger(TestRunner.class); - public static void main(String[] args) { - // TODO Auto-generated method stub - Result result = JUnitCore.runClasses(JUnitTestSuite.class); - for (Failure failure : result.getFailures()) { - LOGGER.info(failure.toString()); - - } - LOGGER.info(result.wasSuccessful()); - } + private static final Logger LOGGER = LogManager.getLogger(TestRunner.class); + public static void main(String[] args) { + // TODO Auto-generated method stub + Result result = JUnitCore.runClasses(JUnitTestSuite.class); + for (Failure failure : result.getFailures()) { + LOGGER.info(failure.toString()); + } + LOGGER.info(result.wasSuccessful()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/security/impl/JUnitTestSuite.java b/src/test/java/org/onap/dmaap/mr/cambria/security/impl/JUnitTestSuite.java index 3a54ac5..48cf300 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/security/impl/JUnitTestSuite.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/security/impl/JUnitTestSuite.java @@ -7,9 +7,9 @@ * 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. @@ -18,26 +18,26 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.security.impl; +package org.onap.dmaap.mr.cambria.security.impl; import junit.framework.TestSuite; - +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.apache.log4j.Logger; @RunWith(Suite.class) -@SuiteClasses({ DMaaPMechIdAuthenticatorTest.class, DMaaPOriginalUebAuthenticatorTest.class, +@SuiteClasses({DMaaPMechIdAuthenticatorTest.class, DMaaPOriginalUebAuthenticatorTest.class, }) public class JUnitTestSuite { - private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class); - public static void main(String[] args) { - LOGGER.info("Running the test suite"); - - TestSuite tstSuite = new TestSuite(); - LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); - } + private static final Logger LOGGER = LogManager.getLogger(JUnitTestSuite.class); + + public static void main(String[] args) { + LOGGER.info("Running the test suite"); + TestSuite tstSuite = new TestSuite(); + LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/security/impl/TestRunner.java b/src/test/java/org/onap/dmaap/mr/cambria/security/impl/TestRunner.java index 2699acd..57285f6 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/security/impl/TestRunner.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/security/impl/TestRunner.java @@ -7,9 +7,9 @@ * 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. @@ -18,24 +18,24 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.security.impl; +package org.onap.dmaap.mr.cambria.security.impl; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; -import org.apache.log4j.Logger; public class TestRunner { - private static final Logger LOGGER = Logger.getLogger(TestRunner.class); - public static void main(String[] args) { - // TODO Auto-generated method stub - Result result = JUnitCore.runClasses(JUnitTestSuite.class); - for (Failure failure : result.getFailures()) { - LOGGER.info(failure.toString()); - - } - LOGGER.info(result.wasSuccessful()); - } + private static final Logger LOGGER = LogManager.getLogger(TestRunner.class); + public static void main(String[] args) { + // TODO Auto-generated method stub + Result result = JUnitCore.runClasses(JUnitTestSuite.class); + for (Failure failure : result.getFailures()) { + LOGGER.info(failure.toString()); + } + LOGGER.info(result.wasSuccessful()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/service/impl/JUnitTestSuite.java b/src/test/java/org/onap/dmaap/mr/cambria/service/impl/JUnitTestSuite.java index 7536127..5ba8ec2 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/service/impl/JUnitTestSuite.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/service/impl/JUnitTestSuite.java @@ -7,9 +7,9 @@ * 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. @@ -18,28 +18,30 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.service.impl; +package org.onap.dmaap.mr.cambria.service.impl; import junit.framework.TestSuite; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.apache.log4j.Logger; import org.onap.dmaap.dmf.mr.service.impl.EventsServiceImplTest; import org.onap.dmaap.dmf.mr.service.impl.TopicServiceImplTest; @RunWith(Suite.class) -@SuiteClasses({ UIServiceImplTest.class, AdminServiceImplemTest.class, ApiKeysServiceImplTest.class, - ShowConsumerCacheTest.class,TopicServiceImplTest.class, TransactionServiceImplTest.class, MMServiceImplTest.class, - BaseTransactionDbImplTest.class, MetricsServiceImplTest.class, EventsServiceImplTest.class}) +@SuiteClasses({UIServiceImplTest.class, AdminServiceImplemTest.class, ApiKeysServiceImplTest.class, + ShowConsumerCacheTest.class, TopicServiceImplTest.class, TransactionServiceImplTest.class, + MMServiceImplTest.class, + BaseTransactionDbImplTest.class, MetricsServiceImplTest.class, EventsServiceImplTest.class}) public class JUnitTestSuite { - private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class); - public static void main(String[] args) { - LOGGER.info("Running the test suite"); - - TestSuite tstSuite = new TestSuite(); - LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); - } + private static final Logger LOGGER = LogManager.getLogger(JUnitTestSuite.class); + public static void main(String[] args) { + LOGGER.info("Running the test suite"); + + TestSuite tstSuite = new TestSuite(); + LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/service/impl/TestRunner.java b/src/test/java/org/onap/dmaap/mr/cambria/service/impl/TestRunner.java index 277950a..5e296b7 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/service/impl/TestRunner.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/service/impl/TestRunner.java @@ -7,9 +7,9 @@ * 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. @@ -18,24 +18,24 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.service.impl; +package org.onap.dmaap.mr.cambria.service.impl; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; -import org.apache.log4j.Logger; public class TestRunner { - private static final Logger LOGGER = Logger.getLogger(TestRunner.class); - public static void main(String[] args) { - // TODO Auto-generated method stub - Result result = JUnitCore.runClasses(JUnitTestSuite.class); - for (Failure failure : result.getFailures()) { - LOGGER.info(failure.toString()); - - } - LOGGER.info(result.wasSuccessful()); - } + private static final Logger LOGGER = LogManager.getLogger(TestRunner.class); + public static void main(String[] args) { + // TODO Auto-generated method stub + Result result = JUnitCore.runClasses(JUnitTestSuite.class); + for (Failure failure : result.getFailures()) { + LOGGER.info(failure.toString()); + } + LOGGER.info(result.wasSuccessful()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/transaction/JUnitTestSuite.java b/src/test/java/org/onap/dmaap/mr/cambria/transaction/JUnitTestSuite.java index eded211..1fad8f3 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/transaction/JUnitTestSuite.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/transaction/JUnitTestSuite.java @@ -7,9 +7,9 @@ * 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. @@ -18,25 +18,25 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.transaction; +package org.onap.dmaap.mr.cambria.transaction; import junit.framework.TestSuite; - +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.apache.log4j.Logger; @RunWith(Suite.class) -@SuiteClasses({ TransactionObjTest.class, TrnRequestTest.class, }) +@SuiteClasses({TransactionObjTest.class, TrnRequestTest.class,}) public class JUnitTestSuite { - private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class); - public static void main(String[] args) { - LOGGER.info("Running the test suite"); - - TestSuite tstSuite = new TestSuite(); - LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); - } + private static final Logger LOGGER = LogManager.getLogger(JUnitTestSuite.class); + + public static void main(String[] args) { + LOGGER.info("Running the test suite"); + TestSuite tstSuite = new TestSuite(); + LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/transaction/TestRunner.java b/src/test/java/org/onap/dmaap/mr/cambria/transaction/TestRunner.java index b2ba612..7fc990e 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/transaction/TestRunner.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/transaction/TestRunner.java @@ -7,9 +7,9 @@ * 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. @@ -18,24 +18,24 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.transaction; +package org.onap.dmaap.mr.cambria.transaction; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; -import org.apache.log4j.Logger; public class TestRunner { - private static final Logger LOGGER = Logger.getLogger(TestRunner.class); - public static void main(String[] args) { - // TODO Auto-generated method stub - Result result = JUnitCore.runClasses(JUnitTestSuite.class); - for (Failure failure : result.getFailures()) { - LOGGER.info(failure.toString()); - - } - LOGGER.info(result.wasSuccessful()); - } + private static final Logger LOGGER = LogManager.getLogger(TestRunner.class); + public static void main(String[] args) { + // TODO Auto-generated method stub + Result result = JUnitCore.runClasses(JUnitTestSuite.class); + for (Failure failure : result.getFailures()) { + LOGGER.info(failure.toString()); + } + LOGGER.info(result.wasSuccessful()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/transaction/impl/JUnitTestSuite.java b/src/test/java/org/onap/dmaap/mr/cambria/transaction/impl/JUnitTestSuite.java index a70cf18..f173b57 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/transaction/impl/JUnitTestSuite.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/transaction/impl/JUnitTestSuite.java @@ -7,9 +7,9 @@ * 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. @@ -18,25 +18,25 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.transaction.impl; +package org.onap.dmaap.mr.cambria.transaction.impl; import junit.framework.TestSuite; - +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.apache.log4j.Logger; @RunWith(Suite.class) -@SuiteClasses({ DMaaPSimpleTransactionFactoryTest.class, }) +@SuiteClasses({DMaaPSimpleTransactionFactoryTest.class,}) public class JUnitTestSuite { - private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class); - public static void main(String[] args) { - LOGGER.info("Running the test suite"); - - TestSuite tstSuite = new TestSuite(); - LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); - } + private static final Logger LOGGER = LogManager.getLogger(JUnitTestSuite.class); + + public static void main(String[] args) { + LOGGER.info("Running the test suite"); + TestSuite tstSuite = new TestSuite(); + LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/cambria/transaction/impl/TestRunner.java b/src/test/java/org/onap/dmaap/mr/cambria/transaction/impl/TestRunner.java index e889ec7..212f551 100644 --- a/src/test/java/org/onap/dmaap/mr/cambria/transaction/impl/TestRunner.java +++ b/src/test/java/org/onap/dmaap/mr/cambria/transaction/impl/TestRunner.java @@ -7,9 +7,9 @@ * 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. @@ -18,24 +18,24 @@ * ============LICENSE_END========================================================= */ - package org.onap.dmaap.mr.cambria.transaction.impl; +package org.onap.dmaap.mr.cambria.transaction.impl; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; -import org.apache.log4j.Logger; public class TestRunner { - private static final Logger LOGGER = Logger.getLogger(TestRunner.class); - public static void main(String[] args) { - // TODO Auto-generated method stub - Result result = JUnitCore.runClasses(JUnitTestSuite.class); - for (Failure failure : result.getFailures()) { - LOGGER.info(failure.toString()); - - } - LOGGER.info(result.wasSuccessful()); - } + private static final Logger LOGGER = LogManager.getLogger(TestRunner.class); + public static void main(String[] args) { + // TODO Auto-generated method stub + Result result = JUnitCore.runClasses(JUnitTestSuite.class); + for (Failure failure : result.getFailures()) { + LOGGER.info(failure.toString()); + } + LOGGER.info(result.wasSuccessful()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/filter/JUnitTestSuite.java b/src/test/java/org/onap/dmaap/mr/filter/JUnitTestSuite.java index a534560..7aa0d28 100644 --- a/src/test/java/org/onap/dmaap/mr/filter/JUnitTestSuite.java +++ b/src/test/java/org/onap/dmaap/mr/filter/JUnitTestSuite.java @@ -7,9 +7,9 @@ * 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. @@ -21,22 +21,22 @@ package org.onap.dmaap.mr.filter; import junit.framework.TestSuite; - +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.apache.log4j.Logger; @RunWith(Suite.class) -@SuiteClasses({ ContentLengthFilterTest.class, DefaultLengthTest.class,}) +@SuiteClasses({ContentLengthFilterTest.class, DefaultLengthTest.class,}) public class JUnitTestSuite { - private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class); - public static void main(String[] args) { - LOGGER.info("Running the test suite"); - - TestSuite tstSuite = new TestSuite(); - LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); - } + private static final Logger LOGGER = LogManager.getLogger(JUnitTestSuite.class); + + public static void main(String[] args) { + LOGGER.info("Running the test suite"); + TestSuite tstSuite = new TestSuite(); + LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/filter/TestRunner.java b/src/test/java/org/onap/dmaap/mr/filter/TestRunner.java index ec78329..d5b3972 100644 --- a/src/test/java/org/onap/dmaap/mr/filter/TestRunner.java +++ b/src/test/java/org/onap/dmaap/mr/filter/TestRunner.java @@ -7,9 +7,9 @@ * 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. @@ -18,24 +18,24 @@ * ============LICENSE_END========================================================= */ -package org.onap.dmaap.mr.filter; +package org.onap.dmaap.mr.filter; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; -import org.apache.log4j.Logger; public class TestRunner { - private static final Logger LOGGER = Logger.getLogger(TestRunner.class); - public static void main(String[] args) { - // TODO Auto-generated method stub - Result result = JUnitCore.runClasses(JUnitTestSuite.class); - for (Failure failure : result.getFailures()) { - LOGGER.info(failure.toString()); - - } - LOGGER.info(result.wasSuccessful()); - } + private static final Logger LOGGER = LogManager.getLogger(TestRunner.class); + public static void main(String[] args) { + // TODO Auto-generated method stub + Result result = JUnitCore.runClasses(JUnitTestSuite.class); + for (Failure failure : result.getFailures()) { + LOGGER.info(failure.toString()); + } + LOGGER.info(result.wasSuccessful()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/test/dme2/DME2AdminTest.java b/src/test/java/org/onap/dmaap/mr/test/dme2/DME2AdminTest.java index da786ad..91d897c 100644 --- a/src/test/java/org/onap/dmaap/mr/test/dme2/DME2AdminTest.java +++ b/src/test/java/org/onap/dmaap/mr/test/dme2/DME2AdminTest.java @@ -8,7 +8,7 @@ * 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. @@ -17,132 +17,125 @@ * ============LICENSE_END========================================================= * * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * + * *******************************************************************************/ package org.onap.dmaap.mr.test.dme2; +import com.att.aft.dme2.api.DME2Client; +import com.att.aft.dme2.api.DME2Exception; import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; import java.util.Properties; +import junit.framework.TestCase; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; -import org.apache.log4j.Logger; +public class DME2AdminTest extends TestCase { -import junit.framework.TestCase; + private static final Logger LOGGER = LogManager.getLogger(DME2AdminTest.class); -import com.att.aft.dme2.api.DME2Client; -import com.att.aft.dme2.api.DME2Exception; -//import com.ibm.disthub2.impl.client.PropSchema; + protected String url; -public class DME2AdminTest extends TestCase { - private static final Logger LOGGER = Logger.getLogger(DME2AdminTest.class); - - protected String url; - - protected Properties props; - - protected HashMap<String, String> hm; - - protected String methodType; - - protected String contentType; - - protected String user; - - protected String password; - - @Override - protected void setUp() throws Exception { - super.setUp(); - System.setProperty("AFT_DME2_CLIENT_SSL_INCLUDE_PROTOCOLS", "SSLv3,TLSv1,TLSv1.1"); - System.setProperty("AFT_DME2_CLIENT_IGNORE_SSL_CONFIG", "false"); - System.setProperty("AFT_DME2_CLIENT_KEYSTORE_PASSWORD", "changeit"); - this.props = LoadPropertyFile.getPropertyFileDataProducer(); - String latitude = props.getProperty("Latitude"); - String longitude = props.getProperty("Longitude"); - String version = props.getProperty("Version"); - String serviceName = props.getProperty("ServiceName"); - serviceName = "mr/admin"; - String env = props.getProperty("Environment"); - String partner = props.getProperty("Partner"); - String protocol = props.getProperty("Protocol"); - - methodType = props.getProperty("MethodTypeGet"); - contentType = props.getProperty("contenttype"); - user = props.getProperty("user"); - password = props.getProperty("password"); - - - this.url = protocol + "://" + serviceName + "?" + "version=" + version + "&" + "envContext=" + env + "&" - + "routeOffer=" + partner + "&partner=BOT_R"; - LoadPropertyFile.loadAFTProperties(latitude, longitude); - hm = new HashMap<String, String>(); - hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); - hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); - hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); - } - - public void testGetConsumerCache() { - LOGGER.info("test case consumer cache started"); - - String subContextPath = props.getProperty("SubContextPathGetAdminConsumerCache"); - try { - DME2Client sender = new DME2Client(new URI(url), 5000L); - sender.setAllowAllHttpReturnCodes(true); - sender.setMethod(methodType); - sender.setSubContext(subContextPath); - sender.setPayload(""); - sender.addHeader("Content-Type", contentType); - - sender.addHeader("X-CambriaAuth", "user1:7J49YriFlyRgebyOsSJhZvY/C60="); - sender.addHeader("X-X-CambriaDate", "2016-10-18T09:56:04-05:00"); - - //sender.setCredentials(user, password); - sender.setHeaders(hm); - LOGGER.info("Getting consumer Cache"); - String reply = sender.sendAndWait(5000L); - System.out.println(reply); - assertTrue(LoadPropertyFile.isValidJsonString(reply)); - assertNotNull(reply); - LOGGER.info("response from consumer cache=" + reply); - - } catch (DME2Exception e) { - e.printStackTrace(); - } catch (URISyntaxException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void ttestDropConsumerCache() { - LOGGER.info("Drom consumer cache initiated"); - - String subContextPath = props.getProperty("SubContextPathDropAdminConsumerCache"); - - try { - DME2Client sender = new DME2Client(new URI(url), 5000L); - sender.setAllowAllHttpReturnCodes(true); - sender.setMethod(methodType); - sender.setSubContext(subContextPath); - sender.setPayload(""); - sender.addHeader("Content-Type", contentType); - sender.setCredentials(user, password); - sender.setHeaders(hm); - - LOGGER.info("Dropping consumer cache..........."); - String reply = sender.sendAndWait(5000L); - - // assertTrue(LoadPropertyFile.isValidJsonString(reply)); - assertNotNull(reply); - LOGGER.info("response =" + reply); - } catch (DME2Exception e) { - e.printStackTrace(); - } catch (URISyntaxException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - } + protected Properties props; + + protected HashMap<String, String> hm; + + protected String methodType; + + protected String contentType; + + protected String user; + + protected String password; + + @Override + protected void setUp() throws Exception { + super.setUp(); + System.setProperty("AFT_DME2_CLIENT_SSL_INCLUDE_PROTOCOLS", "SSLv3,TLSv1,TLSv1.1"); + System.setProperty("AFT_DME2_CLIENT_IGNORE_SSL_CONFIG", "false"); + System.setProperty("AFT_DME2_CLIENT_KEYSTORE_PASSWORD", "changeit"); + this.props = LoadPropertyFile.getPropertyFileDataProducer(); + String latitude = props.getProperty("Latitude"); + String longitude = props.getProperty("Longitude"); + String version = props.getProperty("Version"); + String serviceName = props.getProperty("ServiceName"); + serviceName = "mr/admin"; + String env = props.getProperty("Environment"); + String partner = props.getProperty("Partner"); + String protocol = props.getProperty("Protocol"); + + methodType = props.getProperty("MethodTypeGet"); + contentType = props.getProperty("contenttype"); + user = props.getProperty("user"); + password = props.getProperty("password"); + this.url = + protocol + "://" + serviceName + "?" + "version=" + version + "&" + "envContext=" + env + + "&" + + "routeOffer=" + partner + "&partner=BOT_R"; + LoadPropertyFile.loadAFTProperties(latitude, longitude); + hm = new HashMap<String, String>(); + hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); + hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); + hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); + } + + public void testGetConsumerCache() { + LOGGER.info("test case consumer cache started"); + String subContextPath = props.getProperty("SubContextPathGetAdminConsumerCache"); + try { + DME2Client sender = new DME2Client(new URI(url), 5000L); + sender.setAllowAllHttpReturnCodes(true); + sender.setMethod(methodType); + sender.setSubContext(subContextPath); + sender.setPayload(""); + sender.addHeader("Content-Type", contentType); + + sender.addHeader("X-CambriaAuth", "user1:7J49YriFlyRgebyOsSJhZvY/C60="); + sender.addHeader("X-X-CambriaDate", "2016-10-18T09:56:04-05:00"); + + //sender.setCredentials(user, password); + sender.setHeaders(hm); + LOGGER.info("Getting consumer Cache"); + String reply = sender.sendAndWait(5000L); + System.out.println(reply); + assertTrue(LoadPropertyFile.isValidJsonString(reply)); + assertNotNull(reply); + LOGGER.info("response from consumer cache=" + reply); + } catch (DME2Exception e) { + e.printStackTrace(); + } catch (URISyntaxException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void ttestDropConsumerCache() { + LOGGER.info("Drom consumer cache initiated"); + String subContextPath = props.getProperty("SubContextPathDropAdminConsumerCache"); + try { + DME2Client sender = new DME2Client(new URI(url), 5000L); + sender.setAllowAllHttpReturnCodes(true); + sender.setMethod(methodType); + sender.setSubContext(subContextPath); + sender.setPayload(""); + sender.addHeader("Content-Type", contentType); + sender.setCredentials(user, password); + sender.setHeaders(hm); + + LOGGER.info("Dropping consumer cache..........."); + String reply = sender.sendAndWait(5000L); + // assertTrue(LoadPropertyFile.isValidJsonString(reply)); + assertNotNull(reply); + LOGGER.info("response =" + reply); + } catch (DME2Exception e) { + e.printStackTrace(); + } catch (URISyntaxException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } } diff --git a/src/test/java/org/onap/dmaap/mr/test/dme2/DME2ApiKeyTest.java b/src/test/java/org/onap/dmaap/mr/test/dme2/DME2ApiKeyTest.java index ad45706..b49b2b4 100644 --- a/src/test/java/org/onap/dmaap/mr/test/dme2/DME2ApiKeyTest.java +++ b/src/test/java/org/onap/dmaap/mr/test/dme2/DME2ApiKeyTest.java @@ -8,7 +8,7 @@ * 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. @@ -17,114 +17,105 @@ * ============LICENSE_END========================================================= * * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * + * *******************************************************************************/ package org.onap.dmaap.mr.test.dme2; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Properties; - -import org.apache.log4j.Logger; -import org.json.JSONObject; - import com.att.aft.dme2.api.DME2Client; import com.att.aft.dme2.api.DME2Exception; import com.att.aft.dme2.internal.jackson.map.ObjectMapper; - +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Properties; import junit.framework.TestCase; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class DME2ApiKeyTest extends TestCase { - private static final Logger LOGGER = Logger.getLogger(DME2ApiKeyTest.class); - - protected String url; - - protected Properties props; - - @Override - protected void setUp() throws Exception { - super.setUp(); - System.setProperty("AFT_DME2_CLIENT_SSL_INCLUDE_PROTOCOLS", "SSLv3,TLSv1,TLSv1.1"); - System.setProperty("AFT_DME2_CLIENT_IGNORE_SSL_CONFIG", "false"); - System.setProperty("AFT_DME2_CLIENT_KEYSTORE_PASSWORD", "changeit"); - this.props = LoadPropertyFile.getPropertyFileDataProducer(); - String latitude = props.getProperty("Latitude"); - String longitude = props.getProperty("Longitude"); - String version = props.getProperty("Version"); - String serviceName = props.getProperty("ServiceName"); - String env = props.getProperty("Environment"); - String partner = props.getProperty("Partner"); - String protocol = props.getProperty("Protocol"); - this.url = protocol + "://" + serviceName + "?" + "version=" + version + "&" + "envContext=" + env + "&" - + "routeOffer=" + partner + "&partner=BOT_R"; - LoadPropertyFile.loadAFTProperties(latitude, longitude); - } - - public void testCreateKey() { - LOGGER.info("Create Key test case initiated"); - - ApiKeyBean apiKeyBean = new ApiKeyBean("user1@onap.com", "Creating Api Key.m"); - - System.out.println(url); - - returnKey(apiKeyBean, url, props); - - } - - public String returnKey(ApiKeyBean apibean, String url, Properties props) { - - String reply = null; - try { - LOGGER.info("Call to return key "); - DME2Client sender = new DME2Client(new URI(url), 5000L); - sender.setAllowAllHttpReturnCodes(true); - sender.setMethod(props.getProperty("MethodTypePost")); - sender.setSubContext(props.getProperty("SubContextPathGetCreateKeys")); - String jsonStringApiBean = new ObjectMapper().writeValueAsString(apibean); - sender.setPayload(jsonStringApiBean); - sender.addHeader("content-type", props.getProperty("contenttype")); - sender.setCredentials(props.getProperty("user"), props.getProperty("password")); - LOGGER.info("creating ApiKey"); - reply = sender.sendAndWait(5000L); - System.out.println("reply: " + reply); - assertTrue(LoadPropertyFile.isValidJsonString(reply)); - LOGGER.info("response =" + reply); - - } catch (DME2Exception e) { - e.printStackTrace(); - } catch (URISyntaxException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - return reply; - } - - public void testGetAllKey() { - LOGGER.info("Test case Get All key initiated...."); - try { - DME2Client sender = new DME2Client(new URI(this.url), 5000L); - sender.setAllowAllHttpReturnCodes(true); - sender.setMethod(this.props.getProperty("MethodTypeGet")); - String subcontextPath = this.props.getProperty("SubContextPathGetApiKeys"); - // sender.setSubContext(subcontextPath); - sender.setPayload(""); - sender.addHeader("content-type", props.getProperty("contenttype")); - sender.setCredentials(props.getProperty("user"), props.getProperty("password")); - LOGGER.info("Fetching all keys"); - String reply = sender.sendAndWait(5000L); - System.out.println(reply); - assertTrue(LoadPropertyFile.isValidJsonString(reply)); - LOGGER.info("response =" + reply); - } catch (DME2Exception e) { - e.printStackTrace(); - } catch (URISyntaxException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - + private static final Logger LOGGER = LogManager.getLogger(DME2ApiKeyTest.class); + + protected String url; + + protected Properties props; + + @Override + protected void setUp() throws Exception { + super.setUp(); + System.setProperty("AFT_DME2_CLIENT_SSL_INCLUDE_PROTOCOLS", "SSLv3,TLSv1,TLSv1.1"); + System.setProperty("AFT_DME2_CLIENT_IGNORE_SSL_CONFIG", "false"); + System.setProperty("AFT_DME2_CLIENT_KEYSTORE_PASSWORD", "changeit"); + this.props = LoadPropertyFile.getPropertyFileDataProducer(); + String latitude = props.getProperty("Latitude"); + String longitude = props.getProperty("Longitude"); + String version = props.getProperty("Version"); + String serviceName = props.getProperty("ServiceName"); + String env = props.getProperty("Environment"); + String partner = props.getProperty("Partner"); + String protocol = props.getProperty("Protocol"); + this.url = + protocol + "://" + serviceName + "?" + "version=" + version + "&" + "envContext=" + env + + "&" + + "routeOffer=" + partner + "&partner=BOT_R"; + LoadPropertyFile.loadAFTProperties(latitude, longitude); + } + + public void testCreateKey() { + LOGGER.info("Create Key test case initiated"); + ApiKeyBean apiKeyBean = new ApiKeyBean("user1@onap.com", "Creating Api Key.m"); + System.out.println(url); + returnKey(apiKeyBean, url, props); + } + + public String returnKey(ApiKeyBean apibean, String url, Properties props) { + String reply = null; + try { + LOGGER.info("Call to return key "); + DME2Client sender = new DME2Client(new URI(url), 5000L); + sender.setAllowAllHttpReturnCodes(true); + sender.setMethod(props.getProperty("MethodTypePost")); + sender.setSubContext(props.getProperty("SubContextPathGetCreateKeys")); + String jsonStringApiBean = new ObjectMapper().writeValueAsString(apibean); + sender.setPayload(jsonStringApiBean); + sender.addHeader("content-type", props.getProperty("contenttype")); + sender.setCredentials(props.getProperty("user"), props.getProperty("password")); + LOGGER.info("creating ApiKey"); + reply = sender.sendAndWait(5000L); + System.out.println("reply: " + reply); + assertTrue(LoadPropertyFile.isValidJsonString(reply)); + LOGGER.info("response =" + reply); + } catch (DME2Exception e) { + e.printStackTrace(); + } catch (URISyntaxException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + return reply; + } + + public void testGetAllKey() { + LOGGER.info("Test case Get All key initiated...."); + try { + DME2Client sender = new DME2Client(new URI(this.url), 5000L); + sender.setAllowAllHttpReturnCodes(true); + sender.setMethod(this.props.getProperty("MethodTypeGet")); + String subcontextPath = this.props.getProperty("SubContextPathGetApiKeys"); + // sender.setSubContext(subcontextPath); + sender.setPayload(""); + sender.addHeader("content-type", props.getProperty("contenttype")); + sender.setCredentials(props.getProperty("user"), props.getProperty("password")); + LOGGER.info("Fetching all keys"); + String reply = sender.sendAndWait(5000L); + System.out.println(reply); + assertTrue(LoadPropertyFile.isValidJsonString(reply)); + LOGGER.info("response =" + reply); + } catch (DME2Exception e) { + e.printStackTrace(); + } catch (URISyntaxException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } } diff --git a/src/test/java/org/onap/dmaap/mr/test/dme2/DME2ConsumerFilterTest.java b/src/test/java/org/onap/dmaap/mr/test/dme2/DME2ConsumerFilterTest.java index 59e1845..af1a43e 100644 --- a/src/test/java/org/onap/dmaap/mr/test/dme2/DME2ConsumerFilterTest.java +++ b/src/test/java/org/onap/dmaap/mr/test/dme2/DME2ConsumerFilterTest.java @@ -8,7 +8,7 @@ * 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. @@ -17,80 +17,74 @@ * ============LICENSE_END========================================================= * * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * + * *******************************************************************************/ package org.onap.dmaap.mr.test.dme2; +import com.att.aft.dme2.api.DME2Client; +import com.att.aft.dme2.api.DME2Exception; import java.net.URI; import java.net.URISyntaxException; import java.net.URLEncoder; import java.util.HashMap; import java.util.Properties; - -import org.apache.log4j.Logger; - import junit.framework.TestCase; - -import com.att.aft.dme2.api.DME2Client; -import com.att.aft.dme2.api.DME2Exception; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class DME2ConsumerFilterTest extends TestCase { - private static final Logger LOGGER = Logger.getLogger(DME2ConsumerFilterTest.class); - - public void testConsumerFilter() { - LOGGER.info("Test case consumer filter initiated"); - - Properties props = LoadPropertyFile.getPropertyFileDataProducer(); - String latitude = props.getProperty("Latitude"); - String longitude = props.getProperty("Longitude"); - String version = props.getProperty("Version"); - String serviceName = props.getProperty("ServiceName"); - String env = props.getProperty("Environment"); - String partner = props.getProperty("Partner"); - String protocol = props.getProperty("Protocol"); - String methodType = props.getProperty("MethodTypeGet"); - String user = props.getProperty("user"); - String password = props.getProperty("password"); - String contenttype = props.getProperty("contenttype"); - String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + "/" - + "envContext=" + env + "/" + "partner=" + partner; - LoadPropertyFile.loadAFTProperties(latitude, longitude); - HashMap<String, String> hm = new HashMap<String, String>(); - hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); - hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); - hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); + private static final Logger LOGGER = LogManager.getLogger(DME2ConsumerFilterTest.class); - try { - // ..checking for topic exist is commented - // if (!topicTestObj.topicExist(url, props, hm)) { - // throw new Exception("Topic does not exist"); - // } else { - DME2Client sender = new DME2Client(new URI(url), 5000L); - sender.setAllowAllHttpReturnCodes(true); - sender.setMethod(methodType); - String subContextPathConsumer = props.getProperty("SubContextPathConsumer") + props.getProperty("newTopic") - + "/" + props.getProperty("group") + "/" + props.getProperty("id") + "?" - + props.getProperty("filterType"); + public void testConsumerFilter() { + LOGGER.info("Test case consumer filter initiated"); + Properties props = LoadPropertyFile.getPropertyFileDataProducer(); + String latitude = props.getProperty("Latitude"); + String longitude = props.getProperty("Longitude"); + String version = props.getProperty("Version"); + String serviceName = props.getProperty("ServiceName"); + String env = props.getProperty("Environment"); + String partner = props.getProperty("Partner"); + String protocol = props.getProperty("Protocol"); + String methodType = props.getProperty("MethodTypeGet"); + String user = props.getProperty("user"); + String password = props.getProperty("password"); + String contenttype = props.getProperty("contenttype"); + String url = + protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + + "/" + + "envContext=" + env + "/" + "partner=" + partner; + LoadPropertyFile.loadAFTProperties(latitude, longitude); + HashMap<String, String> hm = new HashMap<String, String>(); + hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); + hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); + hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); - sender.setSubContext(URLEncoder.encode(subContextPathConsumer, "UTF-8")); - sender.setPayload(""); + try { + DME2Client sender = new DME2Client(new URI(url), 5000L); + sender.setAllowAllHttpReturnCodes(true); + sender.setMethod(methodType); + String subContextPathConsumer = + props.getProperty("SubContextPathConsumer") + props.getProperty("newTopic") + + "/" + props.getProperty("group") + "/" + props.getProperty("id") + "?" + + props.getProperty("filterType"); - sender.addHeader("Content-Type", contenttype); - sender.setCredentials(user, password); - sender.setHeaders(hm); + sender.setSubContext(URLEncoder.encode(subContextPathConsumer, "UTF-8")); + sender.setPayload(""); - LOGGER.info("Consuming Message for Filter"); - String reply = sender.sendAndWait(5000L); - assertNotNull(reply); - LOGGER.info("Message received = " + reply); - // } - } catch (DME2Exception e) { - e.printStackTrace(); - } catch (URISyntaxException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - } + sender.addHeader("Content-Type", contenttype); + sender.setCredentials(user, password); + sender.setHeaders(hm); + LOGGER.info("Consuming Message for Filter"); + String reply = sender.sendAndWait(5000L); + assertNotNull(reply); + LOGGER.info("Message received = " + reply); + } catch (DME2Exception e) { + e.printStackTrace(); + } catch (URISyntaxException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } } diff --git a/src/test/java/org/onap/dmaap/mr/test/dme2/DME2ConsumerTest.java b/src/test/java/org/onap/dmaap/mr/test/dme2/DME2ConsumerTest.java index b12f001..a1c449c 100644 --- a/src/test/java/org/onap/dmaap/mr/test/dme2/DME2ConsumerTest.java +++ b/src/test/java/org/onap/dmaap/mr/test/dme2/DME2ConsumerTest.java @@ -8,7 +8,7 @@ * 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. @@ -17,78 +17,73 @@ * ============LICENSE_END========================================================= * * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * + * *******************************************************************************/ package org.onap.dmaap.mr.test.dme2; +import com.att.aft.dme2.api.DME2Client; +import com.att.aft.dme2.api.DME2Exception; import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; import java.util.Properties; - -import org.apache.log4j.Logger; - import junit.framework.TestCase; - -import com.att.aft.dme2.api.DME2Client; -import com.att.aft.dme2.api.DME2Exception; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class DME2ConsumerTest extends TestCase { - private static final Logger LOGGER = Logger.getLogger(DME2ConsumerTest.class); - public void testConsumer() { - LOGGER.info("Test case subcribing initiated"); - - Properties props = LoadPropertyFile.getPropertyFileDataProducer(); - String latitude = props.getProperty("Latitude"); - String longitude = props.getProperty("Longitude"); - String version = props.getProperty("Version"); - String serviceName = props.getProperty("ServiceName"); - String env = props.getProperty("Environment"); - String partner = props.getProperty("Partner"); - String protocol = props.getProperty("Protocol"); - String methodType = props.getProperty("MethodTypeGet"); - String user = props.getProperty("user"); - String password = props.getProperty("password"); - String contenttype = props.getProperty("contenttype"); - String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + "/" - + "envContext=" + env + "/" + "partner=" + partner; - LoadPropertyFile.loadAFTProperties(latitude, longitude); - HashMap<String, String> hm = new HashMap<String, String>(); - hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); - hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); - hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); - try { + private static final Logger LOGGER = LogManager.getLogger(DME2ConsumerTest.class); - // topic exist logic is commented - // if (!topicTestObj.topicExist(url, props, hm)) { - // throw new Exception("Topic does not exist"); - // } else { - DME2Client sender = new DME2Client(new URI(url), 5000L); - sender.setAllowAllHttpReturnCodes(true); - sender.setMethod(methodType); - String subContextPathConsumer = props.getProperty("SubContextPathConsumer") + props.getProperty("newTopic") - + "/" + props.getProperty("group") + "/" + props.getProperty("id"); - sender.setSubContext(subContextPathConsumer); - sender.setPayload(""); + public void testConsumer() { + LOGGER.info("Test case subcribing initiated"); - sender.addHeader("Content-Type", contenttype); - sender.setCredentials(user, password); - sender.setHeaders(hm); + Properties props = LoadPropertyFile.getPropertyFileDataProducer(); + String latitude = props.getProperty("Latitude"); + String longitude = props.getProperty("Longitude"); + String version = props.getProperty("Version"); + String serviceName = props.getProperty("ServiceName"); + String env = props.getProperty("Environment"); + String partner = props.getProperty("Partner"); + String protocol = props.getProperty("Protocol"); + String methodType = props.getProperty("MethodTypeGet"); + String user = props.getProperty("user"); + String password = props.getProperty("password"); + String contenttype = props.getProperty("contenttype"); + String url = + protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + + "/" + + "envContext=" + env + "/" + "partner=" + partner; + LoadPropertyFile.loadAFTProperties(latitude, longitude); + HashMap<String, String> hm = new HashMap<String, String>(); + hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); + hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); + hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); + try { + DME2Client sender = new DME2Client(new URI(url), 5000L); + sender.setAllowAllHttpReturnCodes(true); + sender.setMethod(methodType); + String subContextPathConsumer = + props.getProperty("SubContextPathConsumer") + props.getProperty("newTopic") + + "/" + props.getProperty("group") + "/" + props.getProperty("id"); + sender.setSubContext(subContextPathConsumer); + sender.setPayload(""); - LOGGER.info("Consuming Message"); - String reply = sender.sendAndWait(5000L); + sender.addHeader("Content-Type", contenttype); + sender.setCredentials(user, password); + sender.setHeaders(hm); - assertNotNull(reply); - LOGGER.info("Message received = " + reply); - // } - } catch (DME2Exception e) { - e.printStackTrace(); - } catch (URISyntaxException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - } + LOGGER.info("Consuming Message"); + String reply = sender.sendAndWait(5000L); + assertNotNull(reply); + LOGGER.info("Message received = " + reply); + } catch (DME2Exception e) { + e.printStackTrace(); + } catch (URISyntaxException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } } diff --git a/src/test/java/org/onap/dmaap/mr/test/dme2/DME2MetricsTest.java b/src/test/java/org/onap/dmaap/mr/test/dme2/DME2MetricsTest.java index 35c3218..94e08bd 100644 --- a/src/test/java/org/onap/dmaap/mr/test/dme2/DME2MetricsTest.java +++ b/src/test/java/org/onap/dmaap/mr/test/dme2/DME2MetricsTest.java @@ -8,7 +8,7 @@ * 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. @@ -17,116 +17,113 @@ * ============LICENSE_END========================================================= * * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * + * *******************************************************************************/ package org.onap.dmaap.mr.test.dme2; +import com.att.aft.dme2.api.DME2Client; +import com.att.aft.dme2.api.DME2Exception; import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; import java.util.Properties; - -import org.apache.log4j.Logger; - import junit.framework.TestCase; - -import com.att.aft.dme2.api.DME2Client; -import com.att.aft.dme2.api.DME2Exception; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class DME2MetricsTest extends TestCase { - private static final Logger LOGGER = Logger.getLogger(DME2MetricsTest.class); - - public void testGetMetrics() { - LOGGER.info("Test case get metrics initiated..."); - - Properties props = LoadPropertyFile.getPropertyFileDataProducer(); - String latitude = props.getProperty("Latitude"); - String longitude = props.getProperty("Longitude"); - String version = props.getProperty("Version"); - String serviceName = props.getProperty("ServiceName"); - String env = props.getProperty("Environment"); - String partner = props.getProperty("Partner"); - String subContextPath = props.getProperty("SubContextPathGetMetrics"); - String protocol = props.getProperty("Protocol"); - String methodType = props.getProperty("MethodTypeGet"); - String user = props.getProperty("user"); - String password = props.getProperty("password"); - String contenttype = props.getProperty("contenttype"); - String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + "/" - + "envContext=" + env + "/" + "partner=" + partner; - LoadPropertyFile.loadAFTProperties(latitude, longitude); - HashMap<String, String> hm = new HashMap<String, String>(); - hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); - hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); - hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); - - try { - DME2Client sender = new DME2Client(new URI(url), 5000L); - sender.setAllowAllHttpReturnCodes(true); - sender.setMethod(methodType); - sender.setSubContext(subContextPath); - sender.setPayload(""); - sender.addHeader("Content-Type", contenttype); - sender.setCredentials(user, password); - sender.setHeaders(hm); - - LOGGER.info("Getting Metrics Details"); - String reply = sender.sendAndWait(5000L); - assertTrue(LoadPropertyFile.isValidJsonString(reply)); - LOGGER.info("response =" + reply); - - } catch (DME2Exception e) { - e.printStackTrace(); - } catch (URISyntaxException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - } - public void testGetMetricsByName() { - LOGGER.info("Test case get metrics by name initiated"); - Properties props = LoadPropertyFile.getPropertyFileDataProducer(); - String latitude = props.getProperty("Latitude"); - String longitude = props.getProperty("Longitude"); - String version = props.getProperty("Version"); - String serviceName = props.getProperty("ServiceName"); - String env = props.getProperty("Environment"); - String partner = props.getProperty("Partner"); - String subContextPath = props.getProperty("SubContextPathGetMetricsByName"); - String protocol = props.getProperty("Protocol"); - String methodType = props.getProperty("MethodTypeGet"); - String user = props.getProperty("user"); - String password = props.getProperty("password"); - String contenttype = props.getProperty("contenttype"); - String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + "/" - + "envContext=" + env + "/" + "partner=" + partner; - LoadPropertyFile.loadAFTProperties(latitude, longitude); - HashMap<String, String> hm = new HashMap<String, String>(); - hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); - hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); - hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); - try { - DME2Client sender = new DME2Client(new URI(url), 5000L); - sender.setAllowAllHttpReturnCodes(true); - sender.setMethod(methodType); - sender.setSubContext(subContextPath); - sender.setPayload(""); - sender.addHeader("Content-Type", contenttype); - sender.setCredentials(user, password); - sender.setHeaders(hm); + private static final Logger LOGGER = LogManager.getLogger(DME2MetricsTest.class); - LOGGER.info("Getting Metrics By name"); - String reply = sender.sendAndWait(5000L); - assertTrue(LoadPropertyFile.isValidJsonString(reply)); - LOGGER.info("response =" + reply); + public void testGetMetrics() { + LOGGER.info("Test case get metrics initiated..."); + Properties props = LoadPropertyFile.getPropertyFileDataProducer(); + String latitude = props.getProperty("Latitude"); + String longitude = props.getProperty("Longitude"); + String version = props.getProperty("Version"); + String serviceName = props.getProperty("ServiceName"); + String env = props.getProperty("Environment"); + String partner = props.getProperty("Partner"); + String subContextPath = props.getProperty("SubContextPathGetMetrics"); + String protocol = props.getProperty("Protocol"); + String methodType = props.getProperty("MethodTypeGet"); + String user = props.getProperty("user"); + String password = props.getProperty("password"); + String contenttype = props.getProperty("contenttype"); + String url = + protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + + "/" + + "envContext=" + env + "/" + "partner=" + partner; + LoadPropertyFile.loadAFTProperties(latitude, longitude); + HashMap<String, String> hm = new HashMap<String, String>(); + hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); + hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); + hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); + try { + DME2Client sender = new DME2Client(new URI(url), 5000L); + sender.setAllowAllHttpReturnCodes(true); + sender.setMethod(methodType); + sender.setSubContext(subContextPath); + sender.setPayload(""); + sender.addHeader("Content-Type", contenttype); + sender.setCredentials(user, password); + sender.setHeaders(hm); + LOGGER.info("Getting Metrics Details"); + String reply = sender.sendAndWait(5000L); + assertTrue(LoadPropertyFile.isValidJsonString(reply)); + LOGGER.info("response =" + reply); + } catch (DME2Exception e) { + e.printStackTrace(); + } catch (URISyntaxException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } - } catch (DME2Exception e) { - e.printStackTrace(); - } catch (URISyntaxException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - } + public void testGetMetricsByName() { + LOGGER.info("Test case get metrics by name initiated"); + Properties props = LoadPropertyFile.getPropertyFileDataProducer(); + String latitude = props.getProperty("Latitude"); + String longitude = props.getProperty("Longitude"); + String version = props.getProperty("Version"); + String serviceName = props.getProperty("ServiceName"); + String env = props.getProperty("Environment"); + String partner = props.getProperty("Partner"); + String subContextPath = props.getProperty("SubContextPathGetMetricsByName"); + String protocol = props.getProperty("Protocol"); + String methodType = props.getProperty("MethodTypeGet"); + String user = props.getProperty("user"); + String password = props.getProperty("password"); + String contenttype = props.getProperty("contenttype"); + String url = + protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + + "/" + + "envContext=" + env + "/" + "partner=" + partner; + LoadPropertyFile.loadAFTProperties(latitude, longitude); + HashMap<String, String> hm = new HashMap<String, String>(); + hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); + hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); + hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); + try { + DME2Client sender = new DME2Client(new URI(url), 5000L); + sender.setAllowAllHttpReturnCodes(true); + sender.setMethod(methodType); + sender.setSubContext(subContextPath); + sender.setPayload(""); + sender.addHeader("Content-Type", contenttype); + sender.setCredentials(user, password); + sender.setHeaders(hm); + LOGGER.info("Getting Metrics By name"); + String reply = sender.sendAndWait(5000L); + assertTrue(LoadPropertyFile.isValidJsonString(reply)); + LOGGER.info("response =" + reply); + } catch (DME2Exception e) { + e.printStackTrace(); + } catch (URISyntaxException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } } diff --git a/src/test/java/org/onap/dmaap/mr/test/dme2/DME2ProducerTest.java b/src/test/java/org/onap/dmaap/mr/test/dme2/DME2ProducerTest.java index c053502..6991e35 100644 --- a/src/test/java/org/onap/dmaap/mr/test/dme2/DME2ProducerTest.java +++ b/src/test/java/org/onap/dmaap/mr/test/dme2/DME2ProducerTest.java @@ -8,7 +8,7 @@ * 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. @@ -17,84 +17,84 @@ * ============LICENSE_END========================================================= * * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * + * *******************************************************************************/ package org.onap.dmaap.mr.test.dme2; +import com.att.aft.dme2.api.DME2Client; +import com.att.aft.dme2.api.DME2Exception; +import com.att.aft.dme2.internal.jackson.map.ObjectMapper; import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; import java.util.Properties; - -import org.apache.log4j.Logger; - import junit.framework.TestCase; - -import com.att.aft.dme2.api.DME2Client; -import com.att.aft.dme2.api.DME2Exception; -import com.att.aft.dme2.internal.jackson.map.ObjectMapper; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class DME2ProducerTest extends TestCase { - private static final Logger LOGGER = Logger.getLogger(DME2ProducerTest.class); - - public void testProducer() { - DME2TopicTest topicTestObj = new DME2TopicTest(); - - Properties props = LoadPropertyFile.getPropertyFileDataProducer(); - String latitude = props.getProperty("Latitude"); - String longitude = props.getProperty("Longitude"); - String version = props.getProperty("Version"); - String serviceName = props.getProperty("ServiceName"); - String env = props.getProperty("Environment"); - String partner = props.getProperty("Partner"); - String protocol = props.getProperty("Protocol"); - String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + "/" - + "envContext=" + env + "/" + "partner=" + partner; - LoadPropertyFile.loadAFTProperties(latitude, longitude); - HashMap<String, String> hm = new HashMap<String, String>(); - hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); - hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); - hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); - // checking whether topic exist or not - if (!topicTestObj.topicExist(url, props, hm)) { - // if topic doesn't exist then create the topic - topicTestObj.createTopic(url, props, hm); - // after creating the topic publish on that topic - publishMessage(url, props, hm); - } else { - // if topic already exist start publishing on the topic - publishMessage(url, props, hm); - } - } + private static final Logger LOGGER = LogManager.getLogger(DME2ProducerTest.class); - public void publishMessage(String url, Properties props, HashMap<String, String> mapData) { - try { - LOGGER.info("Call to publish message "); - DME2Client sender = new DME2Client(new URI(url), 5000L); - sender.setAllowAllHttpReturnCodes(true); - sender.setMethod(props.getProperty("MethodTypePost")); - String subcontextpathPublish = props.getProperty("SubContextPathproducer") + props.getProperty("newTopic"); - sender.setSubContext(subcontextpathPublish); - String jsonStringApiBean = new ObjectMapper().writeValueAsString(new ApiKeyBean("example@att.com", - "description")); - sender.setPayload(jsonStringApiBean); + public void testProducer() { + DME2TopicTest topicTestObj = new DME2TopicTest(); + Properties props = LoadPropertyFile.getPropertyFileDataProducer(); + String latitude = props.getProperty("Latitude"); + String longitude = props.getProperty("Longitude"); + String version = props.getProperty("Version"); + String serviceName = props.getProperty("ServiceName"); + String env = props.getProperty("Environment"); + String partner = props.getProperty("Partner"); + String protocol = props.getProperty("Protocol"); + String url = + protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + + "/" + + "envContext=" + env + "/" + "partner=" + partner; + LoadPropertyFile.loadAFTProperties(latitude, longitude); + HashMap<String, String> hm = new HashMap<String, String>(); + hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); + hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); + hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); + // checking whether topic exist or not + if (!topicTestObj.topicExist(url, props, hm)) { + // if topic doesn't exist then create the topic + topicTestObj.createTopic(url, props, hm); + // after creating the topic publish on that topic + publishMessage(url, props, hm); + } else { + // if topic already exist start publishing on the topic + publishMessage(url, props, hm); + } - sender.setCredentials(props.getProperty("user"), props.getProperty("password")); - sender.addHeader("content-type", props.getProperty("contenttype")); - LOGGER.info("Publishing message"); - String reply = sender.sendAndWait(5000L); - // assertTrue(LoadPropertyFile.isValidJsonString(reply)); - assertNotNull(reply); - LOGGER.info("response =" + reply); + } - } catch (DME2Exception e) { - e.printStackTrace(); - } catch (URISyntaxException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } + public void publishMessage(String url, Properties props, HashMap<String, String> mapData) { + try { + LOGGER.info("Call to publish message "); + DME2Client sender = new DME2Client(new URI(url), 5000L); + sender.setAllowAllHttpReturnCodes(true); + sender.setMethod(props.getProperty("MethodTypePost")); + String subcontextpathPublish = + props.getProperty("SubContextPathproducer") + props.getProperty("newTopic"); + sender.setSubContext(subcontextpathPublish); + String jsonStringApiBean = new ObjectMapper() + .writeValueAsString(new ApiKeyBean("example@att.com", + "description")); + sender.setPayload(jsonStringApiBean); - } + sender.setCredentials(props.getProperty("user"), props.getProperty("password")); + sender.addHeader("content-type", props.getProperty("contenttype")); + LOGGER.info("Publishing message"); + String reply = sender.sendAndWait(5000L); + // assertTrue(LoadPropertyFile.isValidJsonString(reply)); + assertNotNull(reply); + LOGGER.info("response =" + reply); + } catch (DME2Exception e) { + e.printStackTrace(); + } catch (URISyntaxException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } } diff --git a/src/test/java/org/onap/dmaap/mr/test/dme2/DME2TopicTest.java b/src/test/java/org/onap/dmaap/mr/test/dme2/DME2TopicTest.java index 94c507c..ec03d26 100644 --- a/src/test/java/org/onap/dmaap/mr/test/dme2/DME2TopicTest.java +++ b/src/test/java/org/onap/dmaap/mr/test/dme2/DME2TopicTest.java @@ -8,7 +8,7 @@ * 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. @@ -17,529 +17,425 @@ * ============LICENSE_END========================================================= * * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * + * *******************************************************************************/ package org.onap.dmaap.mr.test.dme2; +import com.att.aft.dme2.api.DME2Client; +import com.att.aft.dme2.api.DME2Exception; +import com.att.aft.dme2.internal.jackson.map.ObjectMapper; import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; import java.util.Properties; - -import javax.ws.rs.client.Entity; - -import org.apache.log4j.Logger; - import junit.framework.TestCase; - -import com.att.aft.dme2.api.DME2Client; -import com.att.aft.dme2.api.DME2Exception; -import com.att.aft.dme2.internal.jackson.map.ObjectMapper; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class DME2TopicTest extends TestCase { - private String latitude; - private String longitude; - private String version; - private String serviceName; - private String env; - private String partner; - private String protocol; - private String methodTypeGet; - private String methodTypePost; - private String methodTypeDelete; - private String methodTypePut; - - private String user; - private String password; - private String contenttype; - private String subContextPathGetAllTopic; - private String subContextPathGetOneTopic; - private String SubContextPathCreateTopic; - private String SubContextPathGetPublisherl; - private String SubContextPathGetPublisher; - private String SubContextPathGetPermitPublisher; - private String SubContextPathGetConsumer; - private String SubContextPathGetPermitConsumer; - private static final Logger LOGGER = Logger.getLogger(DME2TopicTest.class); - - public void createTopic(String url, Properties props, HashMap<String, String> mapData) { - LOGGER.info("create topic method starts"); - if (!topicExist(url, props, mapData)) { - LOGGER.info("creating a new topic"); - try { - DME2Client sender = new DME2Client(new URI(url), 5000L); - sender.setAllowAllHttpReturnCodes(true); - sender.setMethod(props.getProperty("MethodTypePost")); - sender.setSubContext(props.getProperty("SubContextPathCreateTopic")); - TopicBeanDME2 topicBean = new TopicBeanDME2(props.getProperty("newTopic"), - props.getProperty("topicDescription"), Integer.parseInt(props.getProperty("partition")), - Integer.parseInt(props.getProperty("replication")), Boolean.valueOf(props - .getProperty("txenabled"))); - String jsonStringApiBean = new ObjectMapper().writeValueAsString(topicBean); - sender.setPayload(jsonStringApiBean); - sender.addHeader("content-type", props.getProperty("contenttype")); - sender.setCredentials(props.getProperty("user"), props.getProperty("password")); - - LOGGER.info("creating Topic"); - String reply = sender.sendAndWait(5000L); - assertTrue(LoadPropertyFile.isValidJsonString(reply)); - LOGGER.info("response =" + reply); - - } catch (DME2Exception e) { - e.printStackTrace(); - } catch (URISyntaxException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - public boolean topicExist(String url, Properties props, HashMap<String, String> mapData) { - boolean topicExist = false; - try { - LOGGER.info("Checking topic exists or not"); - DME2Client sender = new DME2Client(new URI(url), 5000L); - sender.setAllowAllHttpReturnCodes(true); - sender.setMethod(props.getProperty("MethodTypeGet")); - String subcontextPath = props.getProperty("subContextPathGetOneTopic") + props.getProperty("newTopic"); - sender.setSubContext(subcontextPath); - sender.setPayload(""); - sender.addHeader("content-type", props.getProperty("contenttype")); - sender.setCredentials(props.getProperty("user"), props.getProperty("password")); - String reply = sender.sendAndWait(5000L); - topicExist = LoadPropertyFile.isValidJsonString(reply); - LOGGER.info("Topic exist =" + topicExist); - } catch (DME2Exception e) { - e.printStackTrace(); - } catch (URISyntaxException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - return topicExist; - } - - public void testAllTopics() { - LOGGER.info("Test case get all topics initiated"); - Properties props = LoadPropertyFile.getPropertyFileDataProducer(); - latitude = props.getProperty("Latitude"); - longitude = props.getProperty("Longitude"); - version = props.getProperty("Version"); - serviceName = props.getProperty("ServiceName"); - env = props.getProperty("Environment"); - partner = props.getProperty("Partner"); - subContextPathGetAllTopic = props.getProperty("subContextPathGetAllTopic"); - protocol = props.getProperty("Protocol"); - methodTypeGet = props.getProperty("MethodTypeGet"); - user = props.getProperty("user"); - password = props.getProperty("password"); - contenttype = props.getProperty("contenttype"); - - String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + "/" - + "envContext=" + env + "/" + "partner=" + partner; - LoadPropertyFile.loadAFTProperties(latitude, longitude); // } else { - HashMap<String, String> hm = new HashMap<String, String>(); - hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); - hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); - hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); - - try { - DME2Client sender = new DME2Client(new URI(url), 5000L); - sender.setAllowAllHttpReturnCodes(true); - sender.setMethod(methodTypeGet); - sender.setSubContext(subContextPathGetAllTopic); - sender.setPayload(""); - - sender.addHeader("Content-Type", contenttype); - sender.setCredentials(user, password); - sender.setHeaders(hm); - - LOGGER.info("Retrieving all topics"); - String reply = sender.sendAndWait(5000L); - assertTrue(LoadPropertyFile.isValidJsonString(reply)); - LOGGER.info("All Topics details = " + reply); - - } catch (DME2Exception e) { - e.printStackTrace(); - } catch (URISyntaxException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void testOneTopic() { - LOGGER.info("Test case get one topic initiated"); - Properties props = LoadPropertyFile.getPropertyFileDataProducer(); - latitude = props.getProperty("Latitude"); - longitude = props.getProperty("Longitude"); - version = props.getProperty("Version"); - serviceName = props.getProperty("ServiceName"); - env = props.getProperty("Environment"); - partner = props.getProperty("Partner"); - subContextPathGetOneTopic = props.getProperty("subContextPathGetOneTopic"); - protocol = props.getProperty("Protocol"); - methodTypeGet = props.getProperty("MethodTypeGet"); - user = props.getProperty("user"); - password = props.getProperty("password"); - contenttype = props.getProperty("contenttype"); - - String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + "/" - + "envContext=" + env + "/" + "partner=" + partner; - LoadPropertyFile.loadAFTProperties(latitude, longitude); - - HashMap<String, String> hm = new HashMap<String, String>(); - hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); - hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); - hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); - System.out.println("Retrieving topic detail"); - if (!topicExist(url, props, hm)) { - createTopic(url, props, hm); - } else { - assertTrue(true); - } - } - - public void createTopicForDeletion(String url, Properties props, HashMap<String, String> mapData) { - LOGGER.info("create topic method starts"); - - LOGGER.info("creating a new topic for deletion"); - try { - DME2Client sender = new DME2Client(new URI(url), 5000L); - sender.setAllowAllHttpReturnCodes(true); - sender.setMethod(props.getProperty("MethodTypePost")); - sender.setSubContext(props.getProperty("SubContextPathCreateTopic")); - TopicBeanDME2 topicBean = new TopicBeanDME2(props.getProperty("deleteTopic"), - props.getProperty("topicDescription"), Integer.parseInt(props.getProperty("partition")), - Integer.parseInt(props.getProperty("replication")), Boolean.valueOf(props.getProperty("txenabled"))); - String jsonStringApiBean = new ObjectMapper().writeValueAsString(topicBean); - sender.setPayload(jsonStringApiBean); - sender.addHeader("content-type", props.getProperty("contenttype")); - sender.setCredentials(props.getProperty("user"), props.getProperty("password")); - - LOGGER.info("creating Topic"); - String reply = sender.sendAndWait(5000L); - assertTrue(LoadPropertyFile.isValidJsonString(reply)); - LOGGER.info("response =" + reply); - - } catch (DME2Exception e) { - e.printStackTrace(); - } catch (URISyntaxException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - - } - - public boolean topicExistForDeletion(String url, Properties props, HashMap<String, String> mapData) { - boolean topicExist = false; - try { - LOGGER.info("Checking topic exists for deletion"); - DME2Client sender = new DME2Client(new URI(url), 5000L); - sender.setAllowAllHttpReturnCodes(true); - sender.setMethod(props.getProperty("MethodTypeGet")); - String subcontextPath = props.getProperty("subContextPathGetOneTopic") + props.getProperty("deleteTopic"); - sender.setSubContext(subcontextPath); - sender.setPayload(""); - sender.addHeader("content-type", props.getProperty("contenttype")); - sender.setCredentials(props.getProperty("user"), props.getProperty("password")); - String reply = sender.sendAndWait(5000L); - topicExist = LoadPropertyFile.isValidJsonString(reply); - LOGGER.info("Topic exist for deletion=" + topicExist); - } catch (DME2Exception e) { - e.printStackTrace(); - } catch (URISyntaxException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - return topicExist; - } - - public void testDeleteTopic() { - Properties props = LoadPropertyFile.getPropertyFileDataProducer(); - latitude = props.getProperty("Latitude"); - longitude = props.getProperty("Longitude"); - version = props.getProperty("Version"); - serviceName = props.getProperty("ServiceName"); - env = props.getProperty("Environment"); - partner = props.getProperty("Partner"); - SubContextPathCreateTopic = props.getProperty("SubContextPathCreateTopic"); - protocol = props.getProperty("Protocol"); - methodTypePost = props.getProperty("MethodTypeDelete"); - user = props.getProperty("user"); - password = props.getProperty("password"); - contenttype = props.getProperty("contenttypejson"); - String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + "/" - + "envContext=" + env + "/" + "partner=" + partner; - LoadPropertyFile.loadAFTProperties(latitude, longitude); - HashMap<String, String> hm = new HashMap<String, String>(); - hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); - hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); - hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); - System.out.println("deleteing topic"); - if (!topicExistForDeletion(url, props, hm)) { - createTopicForDeletion(url, props, hm); - deleteTopic(url, props, hm); - } else { - deleteTopic(url, props, hm); - } - } - - public void deleteTopic(String url, Properties props, HashMap<String, String> mapData) { - try { - DME2Client sender = new DME2Client(new URI(url), 5000L); - sender.setAllowAllHttpReturnCodes(true); - sender.setMethod(props.getProperty("MethodTypeDelete")); - String subsontextPathDelete = props.getProperty("subContextPathGetOneTopic") - + props.getProperty("deleteTopic"); - sender.setSubContext(subsontextPathDelete); - sender.setPayload(""); - sender.addHeader("content-type", props.getProperty("contenttype")); - sender.setCredentials(props.getProperty("user"), props.getProperty("password")); - System.out.println("Deleting Topic " + props.getProperty("deleteTopic")); - String reply = sender.sendAndWait(5000L); - assertNotNull(reply); - System.out.println("response =" + reply); - } catch (DME2Exception e) { - e.printStackTrace(); - } catch (URISyntaxException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void testGetProducersTopics() { - LOGGER.info("Test case get list of producers on topic"); - Properties props = LoadPropertyFile.getPropertyFileDataProducer(); - latitude = props.getProperty("Latitude"); - longitude = props.getProperty("Longitude"); - version = props.getProperty("Version"); - serviceName = props.getProperty("ServiceName"); - env = props.getProperty("Environment"); - partner = props.getProperty("Partner"); - SubContextPathGetPublisher = props.getProperty("SubContextPathGetPublisher"); - protocol = props.getProperty("Protocol"); - methodTypeGet = props.getProperty("MethodTypeGet"); - user = props.getProperty("user"); - password = props.getProperty("password"); - contenttype = props.getProperty("contenttype"); - - String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + "/" - + "envContext=" + env + "/" + "partner=" + partner; - LoadPropertyFile.loadAFTProperties(latitude, longitude); - - HashMap<String, String> hm = new HashMap<String, String>(); - hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); - hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); - hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); - - try { - DME2Client sender = new DME2Client(new URI(url), 5000L); - sender.setAllowAllHttpReturnCodes(true); - sender.setMethod(methodTypeGet); - sender.setSubContext(SubContextPathGetPublisher); - sender.setPayload(""); - - sender.addHeader("Content-Type", contenttype); - sender.setCredentials(user, password); - sender.setHeaders(hm); - - LOGGER.info("Retrieving List of publishers"); - String reply = sender.sendAndWait(5000L); - assertTrue(LoadPropertyFile.isValidJsonString(reply)); - LOGGER.info("All Publishers details = " + reply); - - } catch (DME2Exception e) { - e.printStackTrace(); - } catch (URISyntaxException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - // permitting a producer on topic is not applicable - // public void testPermitProducersTopics() { - // LOGGER.info("Test case "); - // Properties props = LoadPropertyFile.getPropertyFileDataProducer(); - // latitude = props.getProperty("Latitude"); - // longitude = props.getProperty("Longitude"); - // version = props.getProperty("Version"); - // serviceName = props.getProperty("ServiceName"); - // env = props.getProperty("Environment"); - // partner = props.getProperty("Partner"); - // SubContextPathGetPermitPublisher = - // props.getProperty("SubContextPathGetPermitPublisher"); - // protocol = props.getProperty("Protocol"); - // methodTypePut = props.getProperty("MethodTypePut"); - // user = props.getProperty("user"); - // password = props.getProperty("password"); - // contenttype = props.getProperty("contenttype"); - // - // String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" - // + "version=" + version + "/" - // + "envContext=" + env + "/" + "partner=" + partner; - // LoadPropertyFile.loadAFTProperties(latitude, longitude); - // - // HashMap<String, String> hm = new HashMap<String, String>(); - // hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); - // hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); - // hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); - // - // try { - // DME2Client sender = new DME2Client(new URI(url), 5000L); - // sender.setAllowAllHttpReturnCodes(true); - // sender.setMethod(methodTypePut); - // sender.setSubContext(SubContextPathGetPermitPublisher); - // sender.setPayload(""); - // - // sender.addHeader("Content-Type", contenttype); - // sender.setCredentials(user, password); - // sender.setHeaders(hm); - // - // System.out.println("Permitting a producer on topic"); - // String reply = sender.sendAndWait(5000L); - // System.out.println("Reply from server = " + reply); - // - // } catch (DME2Exception e) { - // e.printStackTrace(); - // } catch (URISyntaxException e) { - // e.printStackTrace(); - // } catch (Exception e) { - // e.printStackTrace(); - // } - // } - - public void testGetConsumersTopics() { - LOGGER.info("Test case get list of consumers on topic "); - Properties props = LoadPropertyFile.getPropertyFileDataProducer(); - latitude = props.getProperty("Latitude"); - longitude = props.getProperty("Longitude"); - version = props.getProperty("Version"); - serviceName = props.getProperty("ServiceName"); - env = props.getProperty("Environment"); - partner = props.getProperty("Partner"); - SubContextPathGetConsumer = props.getProperty("SubContextPathGetConsumer"); - protocol = props.getProperty("Protocol"); - methodTypeGet = props.getProperty("MethodTypeGet"); - user = props.getProperty("user"); - password = props.getProperty("password"); - contenttype = props.getProperty("contenttype"); - - String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + "/" - + "envContext=" + env + "/" + "partner=" + partner; - LoadPropertyFile.loadAFTProperties(latitude, longitude); - - HashMap<String, String> hm = new HashMap<String, String>(); - hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); - hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); - hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); - - try { - DME2Client sender = new DME2Client(new URI(url), 5000L); - sender.setAllowAllHttpReturnCodes(true); - sender.setMethod(methodTypeGet); - sender.setSubContext(SubContextPathGetConsumer); - sender.setPayload(""); - - sender.addHeader("Content-Type", contenttype); - sender.setCredentials(user, password); - sender.setHeaders(hm); - - LOGGER.info("Retrieving consumer details on topics"); - String reply = sender.sendAndWait(5000L); - assertTrue(LoadPropertyFile.isValidJsonString(reply)); - System.out.println("Reply from server = " + reply); - - } catch (DME2Exception e) { - e.printStackTrace(); - } catch (URISyntaxException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void testCreateTopic() { - LOGGER.info("Test case create topic starts"); - Properties props = LoadPropertyFile.getPropertyFileDataProducer(); - latitude = props.getProperty("Latitude"); - longitude = props.getProperty("Longitude"); - version = props.getProperty("Version"); - serviceName = props.getProperty("ServiceName"); - env = props.getProperty("Environment"); - partner = props.getProperty("Partner"); - SubContextPathCreateTopic = props.getProperty("SubContextPathCreateTopic"); - protocol = props.getProperty("Protocol"); - methodTypePost = props.getProperty("MethodTypePost"); - user = props.getProperty("user"); - password = props.getProperty("password"); - contenttype = props.getProperty("contenttypejson"); - - String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + "/" - + "envContext=" + env + "/" + "partner=" + partner; - LoadPropertyFile.loadAFTProperties(latitude, longitude); - HashMap<String, String> hm = new HashMap<String, String>(); - hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); - hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); - hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); - - createTopic(url, props, hm); - } - // permitting a consumer on topic is not applicable - // public void testPermitConsumerTopics() { - // Properties props = LoadPropertyFile.getPropertyFileDataProducer(); - // latitude = props.getProperty("Latitude"); - // longitude = props.getProperty("Longitude"); - // version = props.getProperty("Version"); - // serviceName = props.getProperty("ServiceName"); - // env = props.getProperty("Environment"); - // partner = props.getProperty("Partner"); - // SubContextPathGetPermitConsumer = - // props.getProperty("SubContextPathGetPermitConsumer"); - // protocol = props.getProperty("Protocol"); - // methodTypePut = props.getProperty("MethodTypePut"); - // user = props.getProperty("user"); - // password = props.getProperty("password"); - // contenttype = props.getProperty("contenttype"); - // - // String url = protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" - // + "version=" + version + "/" - // + "envContext=" + env + "/" + "partner=" + partner; - // LoadPropertyFile.loadAFTProperties(latitude, longitude); - // - // HashMap<String, String> hm = new HashMap<String, String>(); - // hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); - // hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); - // hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); - // - // try { - // DME2Client sender = new DME2Client(new URI(url), 5000L); - // sender.setAllowAllHttpReturnCodes(true); - // sender.setMethod(methodTypePut); - // sender.setSubContext(SubContextPathGetPermitConsumer); - // sender.setPayload(""); - // - // sender.addHeader("Content-Type", contenttype); - // sender.setCredentials(user, password); - // sender.setHeaders(hm); - // - // System.out.println("Permitting a consumer on topic"); - // String reply = sender.sendAndWait(5000L); - // assertNotNull(reply); - // System.out.println("Reply from server = " + reply); - // - // } catch (DME2Exception e) { - // e.printStackTrace(); - // } catch (URISyntaxException e) { - // e.printStackTrace(); - // } catch (Exception e) { - // e.printStackTrace(); - // } - // } + private String latitude; + private String longitude; + private String version; + private String serviceName; + private String env; + private String partner; + private String protocol; + private String methodTypeGet; + private String methodTypePost; + private String methodTypeDelete; + private String methodTypePut; + + private String user; + private String password; + private String contenttype; + private String subContextPathGetAllTopic; + private String subContextPathGetOneTopic; + private String SubContextPathCreateTopic; + private String SubContextPathGetPublisherl; + private String SubContextPathGetPublisher; + private String SubContextPathGetPermitPublisher; + private String SubContextPathGetConsumer; + private String SubContextPathGetPermitConsumer; + private static final Logger LOGGER = LogManager.getLogger(DME2TopicTest.class); + + public void createTopic(String url, Properties props, HashMap<String, String> mapData) { + LOGGER.info("create topic method starts"); + if (!topicExist(url, props, mapData)) { + LOGGER.info("creating a new topic"); + try { + DME2Client sender = new DME2Client(new URI(url), 5000L); + sender.setAllowAllHttpReturnCodes(true); + sender.setMethod(props.getProperty("MethodTypePost")); + sender.setSubContext(props.getProperty("SubContextPathCreateTopic")); + TopicBeanDME2 topicBean = new TopicBeanDME2(props.getProperty("newTopic"), + props.getProperty("topicDescription"), + Integer.parseInt(props.getProperty("partition")), + Integer.parseInt(props.getProperty("replication")), Boolean.valueOf(props + .getProperty("txenabled"))); + String jsonStringApiBean = new ObjectMapper().writeValueAsString(topicBean); + sender.setPayload(jsonStringApiBean); + sender.addHeader("content-type", props.getProperty("contenttype")); + sender.setCredentials(props.getProperty("user"), props.getProperty("password")); + LOGGER.info("creating Topic"); + String reply = sender.sendAndWait(5000L); + assertTrue(LoadPropertyFile.isValidJsonString(reply)); + LOGGER.info("response =" + reply); + } catch (DME2Exception e) { + e.printStackTrace(); + } catch (URISyntaxException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + public boolean topicExist(String url, Properties props, HashMap<String, String> mapData) { + boolean topicExist = false; + try { + LOGGER.info("Checking topic exists or not"); + DME2Client sender = new DME2Client(new URI(url), 5000L); + sender.setAllowAllHttpReturnCodes(true); + sender.setMethod(props.getProperty("MethodTypeGet")); + String subcontextPath = + props.getProperty("subContextPathGetOneTopic") + props.getProperty("newTopic"); + sender.setSubContext(subcontextPath); + sender.setPayload(""); + sender.addHeader("content-type", props.getProperty("contenttype")); + sender.setCredentials(props.getProperty("user"), props.getProperty("password")); + String reply = sender.sendAndWait(5000L); + topicExist = LoadPropertyFile.isValidJsonString(reply); + LOGGER.info("Topic exist =" + topicExist); + } catch (DME2Exception e) { + e.printStackTrace(); + } catch (URISyntaxException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + return topicExist; + } + + public void testAllTopics() { + LOGGER.info("Test case get all topics initiated"); + Properties props = LoadPropertyFile.getPropertyFileDataProducer(); + latitude = props.getProperty("Latitude"); + longitude = props.getProperty("Longitude"); + version = props.getProperty("Version"); + serviceName = props.getProperty("ServiceName"); + env = props.getProperty("Environment"); + partner = props.getProperty("Partner"); + subContextPathGetAllTopic = props.getProperty("subContextPathGetAllTopic"); + protocol = props.getProperty("Protocol"); + methodTypeGet = props.getProperty("MethodTypeGet"); + user = props.getProperty("user"); + password = props.getProperty("password"); + contenttype = props.getProperty("contenttype"); + String url = + protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + + "/" + + "envContext=" + env + "/" + "partner=" + partner; + LoadPropertyFile.loadAFTProperties(latitude, longitude); // } else { + HashMap<String, String> hm = new HashMap<String, String>(); + hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); + hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); + hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); + try { + DME2Client sender = new DME2Client(new URI(url), 5000L); + sender.setAllowAllHttpReturnCodes(true); + sender.setMethod(methodTypeGet); + sender.setSubContext(subContextPathGetAllTopic); + sender.setPayload(""); + + sender.addHeader("Content-Type", contenttype); + sender.setCredentials(user, password); + sender.setHeaders(hm); + + LOGGER.info("Retrieving all topics"); + String reply = sender.sendAndWait(5000L); + assertTrue(LoadPropertyFile.isValidJsonString(reply)); + LOGGER.info("All Topics details = " + reply); + + } catch (DME2Exception e) { + e.printStackTrace(); + } catch (URISyntaxException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void testOneTopic() { + LOGGER.info("Test case get one topic initiated"); + Properties props = LoadPropertyFile.getPropertyFileDataProducer(); + latitude = props.getProperty("Latitude"); + longitude = props.getProperty("Longitude"); + version = props.getProperty("Version"); + serviceName = props.getProperty("ServiceName"); + env = props.getProperty("Environment"); + partner = props.getProperty("Partner"); + subContextPathGetOneTopic = props.getProperty("subContextPathGetOneTopic"); + protocol = props.getProperty("Protocol"); + methodTypeGet = props.getProperty("MethodTypeGet"); + user = props.getProperty("user"); + password = props.getProperty("password"); + contenttype = props.getProperty("contenttype"); + String url = + protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + + "/" + + "envContext=" + env + "/" + "partner=" + partner; + LoadPropertyFile.loadAFTProperties(latitude, longitude); + + HashMap<String, String> hm = new HashMap<String, String>(); + hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); + hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); + hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); + System.out.println("Retrieving topic detail"); + if (!topicExist(url, props, hm)) { + createTopic(url, props, hm); + } else { + assertTrue(true); + } + } + + public void createTopicForDeletion(String url, Properties props, + HashMap<String, String> mapData) { + LOGGER.info("create topic method starts"); + LOGGER.info("creating a new topic for deletion"); + try { + DME2Client sender = new DME2Client(new URI(url), 5000L); + sender.setAllowAllHttpReturnCodes(true); + sender.setMethod(props.getProperty("MethodTypePost")); + sender.setSubContext(props.getProperty("SubContextPathCreateTopic")); + TopicBeanDME2 topicBean = new TopicBeanDME2(props.getProperty("deleteTopic"), + props.getProperty("topicDescription"), + Integer.parseInt(props.getProperty("partition")), + Integer.parseInt(props.getProperty("replication")), + Boolean.valueOf(props.getProperty("txenabled"))); + String jsonStringApiBean = new ObjectMapper().writeValueAsString(topicBean); + sender.setPayload(jsonStringApiBean); + sender.addHeader("content-type", props.getProperty("contenttype")); + sender.setCredentials(props.getProperty("user"), props.getProperty("password")); + + LOGGER.info("creating Topic"); + String reply = sender.sendAndWait(5000L); + assertTrue(LoadPropertyFile.isValidJsonString(reply)); + LOGGER.info("response =" + reply); + } catch (DME2Exception e) { + e.printStackTrace(); + } catch (URISyntaxException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public boolean topicExistForDeletion(String url, Properties props, + HashMap<String, String> mapData) { + boolean topicExist = false; + try { + LOGGER.info("Checking topic exists for deletion"); + DME2Client sender = new DME2Client(new URI(url), 5000L); + sender.setAllowAllHttpReturnCodes(true); + sender.setMethod(props.getProperty("MethodTypeGet")); + String subcontextPath = + props.getProperty("subContextPathGetOneTopic") + props.getProperty("deleteTopic"); + sender.setSubContext(subcontextPath); + sender.setPayload(""); + sender.addHeader("content-type", props.getProperty("contenttype")); + sender.setCredentials(props.getProperty("user"), props.getProperty("password")); + String reply = sender.sendAndWait(5000L); + topicExist = LoadPropertyFile.isValidJsonString(reply); + LOGGER.info("Topic exist for deletion=" + topicExist); + } catch (DME2Exception e) { + e.printStackTrace(); + } catch (URISyntaxException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + return topicExist; + } + + public void testDeleteTopic() { + Properties props = LoadPropertyFile.getPropertyFileDataProducer(); + latitude = props.getProperty("Latitude"); + longitude = props.getProperty("Longitude"); + version = props.getProperty("Version"); + serviceName = props.getProperty("ServiceName"); + env = props.getProperty("Environment"); + partner = props.getProperty("Partner"); + SubContextPathCreateTopic = props.getProperty("SubContextPathCreateTopic"); + protocol = props.getProperty("Protocol"); + methodTypePost = props.getProperty("MethodTypeDelete"); + user = props.getProperty("user"); + password = props.getProperty("password"); + contenttype = props.getProperty("contenttypejson"); + String url = + protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + + "/" + + "envContext=" + env + "/" + "partner=" + partner; + LoadPropertyFile.loadAFTProperties(latitude, longitude); + HashMap<String, String> hm = new HashMap<String, String>(); + hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); + hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); + hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); + System.out.println("deleteing topic"); + if (!topicExistForDeletion(url, props, hm)) { + createTopicForDeletion(url, props, hm); + deleteTopic(url, props, hm); + } else { + deleteTopic(url, props, hm); + } + } + + public void deleteTopic(String url, Properties props, HashMap<String, String> mapData) { + try { + DME2Client sender = new DME2Client(new URI(url), 5000L); + sender.setAllowAllHttpReturnCodes(true); + sender.setMethod(props.getProperty("MethodTypeDelete")); + String subsontextPathDelete = props.getProperty("subContextPathGetOneTopic") + + props.getProperty("deleteTopic"); + sender.setSubContext(subsontextPathDelete); + sender.setPayload(""); + sender.addHeader("content-type", props.getProperty("contenttype")); + sender.setCredentials(props.getProperty("user"), props.getProperty("password")); + System.out.println("Deleting Topic " + props.getProperty("deleteTopic")); + String reply = sender.sendAndWait(5000L); + assertNotNull(reply); + System.out.println("response =" + reply); + } catch (DME2Exception e) { + e.printStackTrace(); + } catch (URISyntaxException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void testGetProducersTopics() { + LOGGER.info("Test case get list of producers on topic"); + Properties props = LoadPropertyFile.getPropertyFileDataProducer(); + latitude = props.getProperty("Latitude"); + longitude = props.getProperty("Longitude"); + version = props.getProperty("Version"); + serviceName = props.getProperty("ServiceName"); + env = props.getProperty("Environment"); + partner = props.getProperty("Partner"); + SubContextPathGetPublisher = props.getProperty("SubContextPathGetPublisher"); + protocol = props.getProperty("Protocol"); + methodTypeGet = props.getProperty("MethodTypeGet"); + user = props.getProperty("user"); + password = props.getProperty("password"); + contenttype = props.getProperty("contenttype"); + String url = + protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + + "/" + + "envContext=" + env + "/" + "partner=" + partner; + LoadPropertyFile.loadAFTProperties(latitude, longitude); + + HashMap<String, String> hm = new HashMap<String, String>(); + hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); + hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); + hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); + try { + DME2Client sender = new DME2Client(new URI(url), 5000L); + sender.setAllowAllHttpReturnCodes(true); + sender.setMethod(methodTypeGet); + sender.setSubContext(SubContextPathGetPublisher); + sender.setPayload(""); + + sender.addHeader("Content-Type", contenttype); + sender.setCredentials(user, password); + sender.setHeaders(hm); + + LOGGER.info("Retrieving List of publishers"); + String reply = sender.sendAndWait(5000L); + assertTrue(LoadPropertyFile.isValidJsonString(reply)); + LOGGER.info("All Publishers details = " + reply); + } catch (DME2Exception e) { + e.printStackTrace(); + } catch (URISyntaxException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void testGetConsumersTopics() { + LOGGER.info("Test case get list of consumers on topic "); + Properties props = LoadPropertyFile.getPropertyFileDataProducer(); + latitude = props.getProperty("Latitude"); + longitude = props.getProperty("Longitude"); + version = props.getProperty("Version"); + serviceName = props.getProperty("ServiceName"); + env = props.getProperty("Environment"); + partner = props.getProperty("Partner"); + SubContextPathGetConsumer = props.getProperty("SubContextPathGetConsumer"); + protocol = props.getProperty("Protocol"); + methodTypeGet = props.getProperty("MethodTypeGet"); + user = props.getProperty("user"); + password = props.getProperty("password"); + contenttype = props.getProperty("contenttype"); + String url = + protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + + "/" + + "envContext=" + env + "/" + "partner=" + partner; + LoadPropertyFile.loadAFTProperties(latitude, longitude); + + HashMap<String, String> hm = new HashMap<String, String>(); + hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); + hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); + hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); + try { + DME2Client sender = new DME2Client(new URI(url), 5000L); + sender.setAllowAllHttpReturnCodes(true); + sender.setMethod(methodTypeGet); + sender.setSubContext(SubContextPathGetConsumer); + sender.setPayload(""); + + sender.addHeader("Content-Type", contenttype); + sender.setCredentials(user, password); + sender.setHeaders(hm); + + LOGGER.info("Retrieving consumer details on topics"); + String reply = sender.sendAndWait(5000L); + assertTrue(LoadPropertyFile.isValidJsonString(reply)); + System.out.println("Reply from server = " + reply); + } catch (DME2Exception e) { + e.printStackTrace(); + } catch (URISyntaxException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void testCreateTopic() { + LOGGER.info("Test case create topic starts"); + Properties props = LoadPropertyFile.getPropertyFileDataProducer(); + latitude = props.getProperty("Latitude"); + longitude = props.getProperty("Longitude"); + version = props.getProperty("Version"); + serviceName = props.getProperty("ServiceName"); + env = props.getProperty("Environment"); + partner = props.getProperty("Partner"); + SubContextPathCreateTopic = props.getProperty("SubContextPathCreateTopic"); + protocol = props.getProperty("Protocol"); + methodTypePost = props.getProperty("MethodTypePost"); + user = props.getProperty("user"); + password = props.getProperty("password"); + contenttype = props.getProperty("contenttypejson"); + String url = + protocol + "://DME2SEARCH/" + "service=" + serviceName + "/" + "version=" + version + + "/" + + "envContext=" + env + "/" + "partner=" + partner; + LoadPropertyFile.loadAFTProperties(latitude, longitude); + HashMap<String, String> hm = new HashMap<String, String>(); + hm.put("AFT_DME2_EP_READ_TIMEOUT_MS", "50000"); + hm.put("AFT_DME2_ROUNDTRIP_TIMEOUT_MS", "240000"); + hm.put("AFT_DME2_EP_CONN_TIMEOUT", "5000"); + createTopic(url, props, hm); + } } diff --git a/src/test/java/org/onap/dmaap/mr/test/dme2/JUnitTestSuite.java b/src/test/java/org/onap/dmaap/mr/test/dme2/JUnitTestSuite.java index 163d3c1..bab1be3 100644 --- a/src/test/java/org/onap/dmaap/mr/test/dme2/JUnitTestSuite.java +++ b/src/test/java/org/onap/dmaap/mr/test/dme2/JUnitTestSuite.java @@ -8,7 +8,7 @@ * 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. @@ -17,28 +17,28 @@ * ============LICENSE_END========================================================= * * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * + * *******************************************************************************/ package org.onap.dmaap.mr.test.dme2; import junit.framework.TestSuite; - +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.apache.log4j.Logger; @RunWith(Suite.class) -@SuiteClasses({ DME2AdminTest.class, DME2ApiKeyTest.class, DME2ConsumerTest.class, DME2ConsumerTest.class, - DME2MetricsTest.class, DME2ProducerTest.class, DME2TopicTest.class, }) +@SuiteClasses({DME2AdminTest.class, DME2ApiKeyTest.class, DME2ConsumerTest.class, + DME2ConsumerTest.class, DME2MetricsTest.class, DME2ProducerTest.class, DME2TopicTest.class,}) public class JUnitTestSuite { - private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class); - public static void main(String[] args) { - LOGGER.info("Running the test suite"); - - TestSuite tstSuite = new TestSuite(); - LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); - } + private static final Logger LOGGER = LogManager.getLogger(JUnitTestSuite.class); + + public static void main(String[] args) { + LOGGER.info("Running the test suite"); + TestSuite tstSuite = new TestSuite(); + LOGGER.info("Total Test Counts " + tstSuite.countTestCases()); + } } diff --git a/src/test/java/org/onap/dmaap/mr/test/dme2/TestRunner.java b/src/test/java/org/onap/dmaap/mr/test/dme2/TestRunner.java index f8696f4..5e6e1c3 100644 --- a/src/test/java/org/onap/dmaap/mr/test/dme2/TestRunner.java +++ b/src/test/java/org/onap/dmaap/mr/test/dme2/TestRunner.java @@ -8,7 +8,7 @@ * 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. @@ -17,26 +17,26 @@ * ============LICENSE_END========================================================= * * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * + * *******************************************************************************/ package org.onap.dmaap.mr.test.dme2; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; -import org.apache.log4j.Logger; public class TestRunner { - private static final Logger LOGGER = Logger.getLogger(TestRunner.class); - public static void main(String[] args) { - // TODO Auto-generated method stub - Result result = JUnitCore.runClasses(JUnitTestSuite.class); - for (Failure failure : result.getFailures()) { - LOGGER.info(failure.toString()); - - } - LOGGER.info(result.wasSuccessful()); - } + private static final Logger LOGGER = LogManager.getLogger(TestRunner.class); + public static void main(String[] args) { + // TODO Auto-generated method stub + Result result = JUnitCore.runClasses(JUnitTestSuite.class); + for (Failure failure : result.getFailures()) { + LOGGER.info(failure.toString()); + } + LOGGER.info(result.wasSuccessful()); + } } |