summaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
authorTait,Trevor(rt0435) <rtait@amdocs.com>2019-01-10 16:40:32 -0500
committerTait,Trevor(rt0435) <rtait@amdocs.com>2019-01-10 16:56:45 -0500
commitc44a035ed8222c2b39bd0fd522b952fac61f9a36 (patch)
tree2f35316a9d892b8f73f1b2b655deb3b48fe8ae06 /src/test/java
parent011ac9cfcfd1d5aba077feffb0edbb25818e4ea0 (diff)
Context Aggregator L2 Fabric
Upgraded the Context Aggregator to use the latest pomba-audit-common model. Also cleaned up a lot of whitespace and import order errors that were being output by the ONAP audit. Issue-ID: LOG-920 Change-Id: I0a7e15f19f28775bbd3e9cf4e95c4de176545ae1 Signed-off-by: Tait,Trevor(rt0435) <rtait@amdocs.com>
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/onap/pomba/contextaggregaotr/config/TestTransportConfig.java22
-rw-r--r--src/test/java/org/onap/pomba/contextaggregator/ApplicationTest.java7
-rw-r--r--src/test/java/org/onap/pomba/contextaggregator/builder/ContextBuilderTest.java16
-rw-r--r--src/test/java/org/onap/pomba/contextaggregator/config/BuilderConfigLoaderTest.java17
-rw-r--r--src/test/java/org/onap/pomba/contextaggregator/config/EventConfigTest.java8
-rw-r--r--src/test/java/org/onap/pomba/contextaggregator/config/EventHeaderConfigTest.java5
-rw-r--r--src/test/java/org/onap/pomba/contextaggregator/config/TransportConfigTest.java24
-rw-r--r--src/test/java/org/onap/pomba/contextaggregator/datatypes/AggregatedModelsTest.java17
-rw-r--r--src/test/java/org/onap/pomba/contextaggregator/datatypes/POAEventTest.java28
-rw-r--r--src/test/java/org/onap/pomba/contextaggregator/exception/ContextAggregatorErrorTest.java8
-rw-r--r--src/test/java/org/onap/pomba/contextaggregator/publisher/EventPublisherFactoryTest.java21
-rw-r--r--src/test/java/org/onap/pomba/contextaggregator/rest/RestRequestTest.java15
-rw-r--r--src/test/java/org/onap/pomba/contextaggregator/service/ContextAggregatorProcessorTest.java43
-rw-r--r--src/test/java/org/onap/pomba/contextaggregator/service/ContextAggregatorServiceTest.java17
14 files changed, 106 insertions, 142 deletions
diff --git a/src/test/java/org/onap/pomba/contextaggregaotr/config/TestTransportConfig.java b/src/test/java/org/onap/pomba/contextaggregaotr/config/TestTransportConfig.java
deleted file mode 100644
index bd37eb5..0000000
--- a/src/test/java/org/onap/pomba/contextaggregaotr/config/TestTransportConfig.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2018 Amdocs
- * ============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=====================================================
- */
-package org.onap.pomba.contextaggregaotr.config;
-
-public class TestTransportConfig {
-
-}
diff --git a/src/test/java/org/onap/pomba/contextaggregator/ApplicationTest.java b/src/test/java/org/onap/pomba/contextaggregator/ApplicationTest.java
index 97cbe86..30d094a 100644
--- a/src/test/java/org/onap/pomba/contextaggregator/ApplicationTest.java
+++ b/src/test/java/org/onap/pomba/contextaggregator/ApplicationTest.java
@@ -15,6 +15,7 @@
* limitations under the License.
* ============LICENSE_END=====================================================
*/
+
package org.onap.pomba.contextaggregator;
import org.junit.Test;
@@ -24,12 +25,10 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
-public class ApplicationTest
-{
+public class ApplicationTest {
@Test
- public void testMain() throws Exception
- {
+ public void testMain() throws Exception {
Application.main(new String[]{"args"});
}
}
diff --git a/src/test/java/org/onap/pomba/contextaggregator/builder/ContextBuilderTest.java b/src/test/java/org/onap/pomba/contextaggregator/builder/ContextBuilderTest.java
index d96fbce..c34c6ba 100644
--- a/src/test/java/org/onap/pomba/contextaggregator/builder/ContextBuilderTest.java
+++ b/src/test/java/org/onap/pomba/contextaggregator/builder/ContextBuilderTest.java
@@ -15,8 +15,12 @@
* limitations under the License.
* ============LICENSE_END=====================================================
*/
+
package org.onap.pomba.contextaggregator.builder;
+import java.io.File;
+import java.io.IOException;
+
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -25,24 +29,18 @@ import org.mockito.MockitoAnnotations;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import java.io.File;
-import java.io.IOException;
-
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
-public class ContextBuilderTest
-{
+public class ContextBuilderTest {
private ContextBuilder contextBuilder;
@Before
- public void setUp() throws IOException
- {
+ public void setUp() throws IOException {
MockitoAnnotations.initMocks(this);
}
@Test
- public void testGetEntity() throws Exception
- {
+ public void testGetEntity() throws Exception {
File configFile =
new File("./src/test/resources/GoodProperties/sdnc.properties");
contextBuilder = new ContextBuilder(configFile);
diff --git a/src/test/java/org/onap/pomba/contextaggregator/config/BuilderConfigLoaderTest.java b/src/test/java/org/onap/pomba/contextaggregator/config/BuilderConfigLoaderTest.java
index 5d3b823..89b9e45 100644
--- a/src/test/java/org/onap/pomba/contextaggregator/config/BuilderConfigLoaderTest.java
+++ b/src/test/java/org/onap/pomba/contextaggregator/config/BuilderConfigLoaderTest.java
@@ -15,8 +15,11 @@
* limitations under the License.
* ============LICENSE_END=====================================================
*/
+
package org.onap.pomba.contextaggregator.config;
+import java.io.File;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -28,13 +31,11 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.core.io.support.ResourcePatternResolver;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import java.io.File;
-
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
@ConfigurationProperties("classpath:/src/test/resources/GoodProperties/sdnc.properties")
-public class BuilderConfigLoaderTest
-{
+public class BuilderConfigLoaderTest {
+
@InjectMocks
private BuilderConfigLoader builderConfigLoader;
@@ -43,16 +44,14 @@ public class BuilderConfigLoaderTest
private String buildersPropertiesPath ;
@Before
- public void setUp()
- {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
}
@Test
- public void testContextBuilders()
- {
+ public void testContextBuilders() {
buildersPropertiesPath = new File(
"./src/test/resources/GoodProperties/").getAbsolutePath();
- builderConfigLoader.contextBuilders();
+ builderConfigLoader.contextBuilders();
}
}
diff --git a/src/test/java/org/onap/pomba/contextaggregator/config/EventConfigTest.java b/src/test/java/org/onap/pomba/contextaggregator/config/EventConfigTest.java
index 41f91f6..4e53c13 100644
--- a/src/test/java/org/onap/pomba/contextaggregator/config/EventConfigTest.java
+++ b/src/test/java/org/onap/pomba/contextaggregator/config/EventConfigTest.java
@@ -15,6 +15,7 @@
* limitations under the License.
* ============LICENSE_END=====================================================
*/
+
package org.onap.pomba.contextaggregator.config;
import org.junit.Assert;
@@ -25,13 +26,12 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
-public class EventConfigTest
-{
+public class EventConfigTest {
+
EventConfig eventConfig = new EventConfig();
@Test
- public void testEventHeaderConfig() throws Exception
- {
+ public void testEventHeaderConfig() throws Exception {
EventHeaderConfig result = eventConfig
.eventHeaderConfig("domain", "sourceName", "eventType",
"entityType", "topicEntityType", "topicName");
diff --git a/src/test/java/org/onap/pomba/contextaggregator/config/EventHeaderConfigTest.java b/src/test/java/org/onap/pomba/contextaggregator/config/EventHeaderConfigTest.java
index 04db525..c7084ab 100644
--- a/src/test/java/org/onap/pomba/contextaggregator/config/EventHeaderConfigTest.java
+++ b/src/test/java/org/onap/pomba/contextaggregator/config/EventHeaderConfigTest.java
@@ -15,6 +15,7 @@
* limitations under the License.
* ============LICENSE_END=====================================================
*/
+
package org.onap.pomba.contextaggregator.config;
import org.junit.Assert;
@@ -25,8 +26,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
-public class EventHeaderConfigTest
-{
+public class EventHeaderConfigTest {
private String domain;
private String sourceName;
@@ -37,6 +37,7 @@ public class EventHeaderConfigTest
EventHeaderConfig eventHeaderConfig = new EventHeaderConfig(
domain, sourceName, eventType, entityType, topicEntityType, topicName);
+
@Test
public void getDomainTest() {
Assert.assertEquals(eventHeaderConfig.getDomain(), domain);
diff --git a/src/test/java/org/onap/pomba/contextaggregator/config/TransportConfigTest.java b/src/test/java/org/onap/pomba/contextaggregator/config/TransportConfigTest.java
index fdb2709..8604a13 100644
--- a/src/test/java/org/onap/pomba/contextaggregator/config/TransportConfigTest.java
+++ b/src/test/java/org/onap/pomba/contextaggregator/config/TransportConfigTest.java
@@ -15,34 +15,33 @@
* limitations under the License.
* ============LICENSE_END=====================================================
*/
+
package org.onap.pomba.contextaggregator.config;
import com.att.nsa.mr.client.MRConsumer;
import com.att.nsa.mr.client.impl.MRConsumerImpl;
+import java.util.Properties;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.pomba.contextaggregator.publisher.EventPublisherFactory;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.test.context.TestPropertySource;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
-
-import java.util.Properties;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class })
@SpringBootTest
@TestPropertySource(properties = { "transport.consume.host=http://localhost", "transport.consume.port=8080" })
-public class TransportConfigTest
-{
+public class TransportConfigTest {
+
TransportConfig transportConfig = new TransportConfig();
@Test
- public void testConsumer() throws Exception
- {
+ public void testConsumer() throws Exception {
MRConsumer result = transportConfig
.consumer("host", "port", "topic", "motsid", "pass",
"consumerGroup", "consumerId", 0, 0, 0, "type");
@@ -54,13 +53,12 @@ public class TransportConfigTest
}
@Test
- public void testPublisherFactory() throws Exception
- {
+ public void testPublisherFactory() throws Exception {
EventPublisherFactory result = transportConfig
.publisherFactory("host", "port", "topic", "motsid", "pass", 0,
0, 0, "type", "partition", 0);
- EventPublisherFactory lEventPublisherFactory = new EventPublisherFactory("host:port", "topic", "motsid", "pass", 0,
- 0, 0, "type", "partition", 0);
+ EventPublisherFactory lEventPublisherFactory = new EventPublisherFactory("host:port", "topic", "motsid",
+ "pass", 0, 0, 0, "type", "partition", 0);
Assert.assertEquals(lEventPublisherFactory.getPartition(), result.getPartition());
Assert.assertEquals(lEventPublisherFactory.getRetries(), result.getRetries());
}
diff --git a/src/test/java/org/onap/pomba/contextaggregator/datatypes/AggregatedModelsTest.java b/src/test/java/org/onap/pomba/contextaggregator/datatypes/AggregatedModelsTest.java
index ffb2a2f..e0c9705 100644
--- a/src/test/java/org/onap/pomba/contextaggregator/datatypes/AggregatedModelsTest.java
+++ b/src/test/java/org/onap/pomba/contextaggregator/datatypes/AggregatedModelsTest.java
@@ -15,8 +15,12 @@
* limitations under the License.
* ============LICENSE_END=====================================================
*/
+
package org.onap.pomba.contextaggregator.datatypes;
+import java.util.HashMap;
+import java.util.Map;
+
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -26,13 +30,10 @@ import org.onap.pomba.contextaggregator.config.EventHeaderConfig;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import java.util.HashMap;
-import java.util.Map;
-
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
-public class AggregatedModelsTest
-{
+public class AggregatedModelsTest {
+
AggregatedModels aggregatedModels;
private String domain;
@@ -50,8 +51,7 @@ public class AggregatedModelsTest
POAEvent pOAEvent = new POAEvent();
@Before
- public void setUp()
- {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
pOAEvent.setServiceInstanceId("a");
pOAEvent.setModelVersionId("b");
@@ -61,8 +61,7 @@ public class AggregatedModelsTest
}
@Test
- public void testGenerateJsonPayload() throws Exception
- {
+ public void testGenerateJsonPayload() throws Exception {
aggregatedModels = new AggregatedModels(eventHeaderConfig,jsonContextMap,pOAEvent);
Assert.assertNotNull(aggregatedModels.generateJsonPayload());
Assert.assertNotNull(aggregatedModels.getEntityHeader());
diff --git a/src/test/java/org/onap/pomba/contextaggregator/datatypes/POAEventTest.java b/src/test/java/org/onap/pomba/contextaggregator/datatypes/POAEventTest.java
index 2afa260..13f15dd 100644
--- a/src/test/java/org/onap/pomba/contextaggregator/datatypes/POAEventTest.java
+++ b/src/test/java/org/onap/pomba/contextaggregator/datatypes/POAEventTest.java
@@ -15,8 +15,11 @@
* limitations under the License.
* ============LICENSE_END=====================================================
*/
+
package org.onap.pomba.contextaggregator.datatypes;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -25,17 +28,14 @@ import org.onap.pomba.contextaggregator.exception.ContextAggregatorException;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import static org.junit.Assert.assertTrue;
-
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
-public class POAEventTest
-{
+public class POAEventTest {
+
POAEvent pOAEvent = new POAEvent();
@Before
- public void setup()
- {
+ public void setup() {
pOAEvent.setServiceInstanceId("a");
pOAEvent.setModelVersionId("b");
pOAEvent.setModelInvariantId("c");
@@ -44,8 +44,7 @@ public class POAEventTest
}
@Test
- public void testValidate() throws ContextAggregatorException
- {
+ public void testValidate() throws ContextAggregatorException {
pOAEvent.validate();
}
@@ -55,7 +54,7 @@ public class POAEventTest
try {
pOAEvent.validate();
}
- catch (ContextAggregatorException e){
+ catch (ContextAggregatorException e) {
assertTrue(e.getMessage().contains("is missing"));
}
}
@@ -67,7 +66,7 @@ public class POAEventTest
try {
pOAEvent.validate();
}
- catch (ContextAggregatorException e){
+ catch (ContextAggregatorException e) {
assertTrue(e.getMessage().contains("is missing"));
}
}
@@ -79,7 +78,7 @@ public class POAEventTest
try {
pOAEvent.validate();
}
- catch (ContextAggregatorException e){
+ catch (ContextAggregatorException e) {
assertTrue(e.getMessage().contains("is missing"));
}
}
@@ -91,7 +90,7 @@ public class POAEventTest
try {
pOAEvent.validate();
}
- catch (ContextAggregatorException e){
+ catch (ContextAggregatorException e) {
assertTrue(e.getMessage().contains("is missing"));
}
}
@@ -103,14 +102,13 @@ public class POAEventTest
try {
pOAEvent.validate();
}
- catch (ContextAggregatorException e){
+ catch (ContextAggregatorException e) {
assertTrue(e.getMessage().contains("is missing"));
}
}
@Test
- public void testToString()
- {
+ public void testToString() {
String result = pOAEvent.toString();
Assert.assertNotEquals("", result);
}
diff --git a/src/test/java/org/onap/pomba/contextaggregator/exception/ContextAggregatorErrorTest.java b/src/test/java/org/onap/pomba/contextaggregator/exception/ContextAggregatorErrorTest.java
index bd4bad8..3468e78 100644
--- a/src/test/java/org/onap/pomba/contextaggregator/exception/ContextAggregatorErrorTest.java
+++ b/src/test/java/org/onap/pomba/contextaggregator/exception/ContextAggregatorErrorTest.java
@@ -15,6 +15,7 @@
* limitations under the License.
* ============LICENSE_END=====================================================
*/
+
package org.onap.pomba.contextaggregator.exception;
import org.junit.Assert;
@@ -25,14 +26,13 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
-public class ContextAggregatorErrorTest
-{
+public class ContextAggregatorErrorTest {
+
ContextAggregatorError contextAggregatorError =
ContextAggregatorError.GENERAL_ERROR;
@Test
- public void testGetMessage() throws Exception
- {
+ public void testGetMessage() throws Exception {
String result = contextAggregatorError.getMessage(null);
Assert.assertEquals(contextAggregatorError.GENERAL_ERROR.getMessage(), result);
}
diff --git a/src/test/java/org/onap/pomba/contextaggregator/publisher/EventPublisherFactoryTest.java b/src/test/java/org/onap/pomba/contextaggregator/publisher/EventPublisherFactoryTest.java
index 7f87e29..8879154 100644
--- a/src/test/java/org/onap/pomba/contextaggregator/publisher/EventPublisherFactoryTest.java
+++ b/src/test/java/org/onap/pomba/contextaggregator/publisher/EventPublisherFactoryTest.java
@@ -15,8 +15,11 @@
* limitations under the License.
* ============LICENSE_END=====================================================
*/
+
package org.onap.pomba.contextaggregator.publisher;
+import static org.junit.Assert.assertEquals;
+
import com.att.nsa.mr.client.MRBatchingPublisher;
import org.junit.Assert;
import org.junit.Test;
@@ -24,12 +27,10 @@ import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import static org.junit.Assert.assertEquals;
-
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
- public class EventPublisherFactoryTest
-{
+public class EventPublisherFactoryTest {
+
@Test
public void testgetPartition() {
EventPublisherFactory pojo = new EventPublisherFactory(
@@ -45,22 +46,20 @@ import static org.junit.Assert.assertEquals;
}
@Test
- public void testCreatePublisherNullPublisher() throws IllegalArgumentException
- {
+ public void testCreatePublisherNullPublisher() throws IllegalArgumentException {
EventPublisherFactory eventPublisherFactory =
new EventPublisherFactory("host", "topic", "motsid", "pass", 0, 0,
0, "type", "partition", 0);
- try{
+ try {
eventPublisherFactory.createPublisher();
- }
- catch (IllegalArgumentException e){
+ }
+ catch (IllegalArgumentException e) {
// Expected
}
}
@Test
- public void testCreatePublisher()
- {
+ public void testCreatePublisher() {
EventPublisherFactory eventPublisherFactory =
new EventPublisherFactory("host", "topic", "motsid", "pass", 0, 0,
1, "type", "partition", 0);
diff --git a/src/test/java/org/onap/pomba/contextaggregator/rest/RestRequestTest.java b/src/test/java/org/onap/pomba/contextaggregator/rest/RestRequestTest.java
index 58624b5..c72b83c 100644
--- a/src/test/java/org/onap/pomba/contextaggregator/rest/RestRequestTest.java
+++ b/src/test/java/org/onap/pomba/contextaggregator/rest/RestRequestTest.java
@@ -15,8 +15,11 @@
* limitations under the License.
* ============LICENSE_END=====================================================
*/
+
package org.onap.pomba.contextaggregator.rest;
+import java.io.File;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -29,27 +32,23 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import java.io.File;
-
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
@ConfigurationProperties("classpath:/src/test/resources/GoodProperties/sdnc.properties")
- public class RestRequestTest
-{
+public class RestRequestTest {
+
@Mock
Logger log;
@InjectMocks
RestRequest restRequest;
@Before
- public void setUp()
- {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
}
@Test
- public void testGetModelData() throws Exception
- {
+ public void testGetModelData() throws Exception {
File configFile =
new File("./src/test/resources/GoodProperties/sdnc.properties");
ContextBuilder contextBuilder = new ContextBuilder(configFile);
diff --git a/src/test/java/org/onap/pomba/contextaggregator/service/ContextAggregatorProcessorTest.java b/src/test/java/org/onap/pomba/contextaggregator/service/ContextAggregatorProcessorTest.java
index 4624e40..084bce0 100644
--- a/src/test/java/org/onap/pomba/contextaggregator/service/ContextAggregatorProcessorTest.java
+++ b/src/test/java/org/onap/pomba/contextaggregator/service/ContextAggregatorProcessorTest.java
@@ -15,9 +15,14 @@
* limitations under the License.
* ============LICENSE_END=====================================================
*/
+
package org.onap.pomba.contextaggregator.service;
+import static org.mockito.Mockito.when;
+
import com.att.nsa.mr.client.MRConsumer;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -32,16 +37,11 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-
-import static org.mockito.Mockito.*;
-
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
@ConfigurationProperties("classpath:/src/test/resources/GoodProperties/sdnc.properties")
-public class ContextAggregatorProcessorTest
-{
+public class ContextAggregatorProcessorTest {
+
@Mock
Logger log;
@Mock
@@ -60,25 +60,23 @@ public class ContextAggregatorProcessorTest
@InjectMocks
ContextAggregatorProcessor contextAggregatorProcessor;
- private String payload = "{" +
- " \"serviceInstanceId\"" + ": " + "\"8ea56b0d-459d-4668-b363-c9567432d8b7\"" + "," +
- " \"modelVersionId\"" + ": " + "\"4e3d28cf-d654-41af-a47b-04b4bd0ac58e\"" + "," +
- " \"modelInvariantId\"" + ": " + "\"74bc1518-282d-4148-860f-8892b6369456\"" + "," +
- " \"customerId\"" + ": " + "\"junit\"" + "," +
- " \"serviceType\"" + ": " + "\"vFWCL\"" + "," +
- " \"xFromAppId\"" + ": " + "\"POMBA\"" + "," +
- " \"xTransactionId\"" + ": " + "\"8a9ddb25-2e79-449c-a40d-5011bac0da39\"" +
- "}";
+ private String payload = "{"
+ + " \"serviceInstanceId\"" + ": " + "\"8ea56b0d-459d-4668-b363-c9567432d8b7\","
+ + " \"modelVersionId\"" + ": " + "\"4e3d28cf-d654-41af-a47b-04b4bd0ac58e\","
+ + " \"modelInvariantId\"" + ": " + "\"74bc1518-282d-4148-860f-8892b6369456\","
+ + " \"customerId\"" + ": " + "\"junit\","
+ + " \"serviceType\"" + ": " + "\"vFWCL\","
+ + " \"xFromAppId\"" + ": " + "\"POMBA\","
+ + " \"xTransactionId\"" + ": " + "\"8a9ddb25-2e79-449c-a40d-5011bac0da39\","
+ + "}";
@Before
- public void setUp()
- {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
}
@Test
- public void testProcessNullPublisherInvalidPayload() throws Exception
- {
+ public void testProcessNullPublisherInvalidPayload() throws Exception {
when(publisherFactory.getPartition())
.thenReturn("getPartitionResponse");
when(publisherFactory.getRetries()).thenReturn(0);
@@ -96,14 +94,13 @@ public class ContextAggregatorProcessorTest
try {
contextAggregatorProcessor.process("");
}
- catch (Exception e){
+ catch (Exception e) {
// expected
}
}
@Test
- public void testProcessNullPublisherValidPayload() throws Exception
- {
+ public void testProcessNullPublisherValidPayload() throws Exception {
when(publisherFactory.getPartition())
.thenReturn("getPartitionResponse");
when(publisherFactory.getRetries()).thenReturn(0);
diff --git a/src/test/java/org/onap/pomba/contextaggregator/service/ContextAggregatorServiceTest.java b/src/test/java/org/onap/pomba/contextaggregator/service/ContextAggregatorServiceTest.java
index bf4fbb5..4ae1878 100644
--- a/src/test/java/org/onap/pomba/contextaggregator/service/ContextAggregatorServiceTest.java
+++ b/src/test/java/org/onap/pomba/contextaggregator/service/ContextAggregatorServiceTest.java
@@ -15,8 +15,12 @@
* limitations under the License.
* ============LICENSE_END=====================================================
*/
+
package org.onap.pomba.contextaggregator.service;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -26,13 +30,10 @@ import org.mockito.MockitoAnnotations;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
-public class ContextAggregatorServiceTest
-{
+public class ContextAggregatorServiceTest {
+
@Mock
ContextAggregatorProcessor processor;
@Mock
@@ -43,14 +44,12 @@ public class ContextAggregatorServiceTest
ContextAggregatorService contextAggregatorService;
@Before
- public void setUp()
- {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
}
@Test
- public void testInit() throws Exception
- {
+ public void testInit() throws Exception {
contextAggregatorService.init();
}
}