server.port=
server.protocol=http
security.protocol=TLS
-connection.timeout.ms=5000
-read.timeout.ms=1000
+connection.timeout.ms=30000
+read.timeout.ms=30000
base.uri=/aaicontextbuilder/service/context
basicauth.username=
basicauth.password=
<dependency>
<groupId>org.onap.logging-analytics.pomba</groupId>
<artifactId>pomba-audit-common</artifactId>
- <version>1.3.1</version>
+ <version>1.4.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
ModelContext context = null;
if (entry.getValue().isEmpty()) {
context = new ModelContext();
- context.setVfs(null);
} else {
context = gson.fromJson(entry.getValue(), ModelContext.class);
}
private String serviceInstanceId;
private String modelVersionId;
private String modelInvariantId;
- private String customerId;
- private String serviceType;
private String xFromAppId;
private String xTransactionId;
*/
package org.onap.pomba.contextaggregator.service;
-import com.att.aft.dme2.internal.gson.Gson;
-import com.att.aft.dme2.internal.gson.GsonBuilder;
-import com.att.aft.dme2.internal.gson.JsonSyntaxException;
-import com.att.nsa.apiClient.http.HttpException;
-import com.att.nsa.mr.client.MRBatchingPublisher;
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.MRConsumer;
-import com.att.nsa.mr.client.MRPublisher;
-import com.att.nsa.mr.client.MRTopicManager;
-import com.att.nsa.mr.client.impl.MRSimplerBatchPublisher;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
+
import org.onap.pomba.contextaggregator.builder.ContextBuilder;
import org.onap.pomba.contextaggregator.config.EventHeaderConfig;
import org.onap.pomba.contextaggregator.datatypes.AggregatedModels;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
+import com.att.aft.dme2.internal.gson.Gson;
+import com.att.aft.dme2.internal.gson.GsonBuilder;
+import com.att.aft.dme2.internal.gson.JsonSyntaxException;
+import com.att.nsa.apiClient.http.HttpException;
+import com.att.nsa.mr.client.MRBatchingPublisher;
+import com.att.nsa.mr.client.MRConsumer;
+import com.att.nsa.mr.client.MRPublisher;
+import com.att.nsa.mr.client.MRTopicManager;
+import com.att.nsa.mr.client.impl.MRSimplerBatchPublisher;
+
@Component
public class ContextAggregatorProcessor implements Callable<Void> {
+++ /dev/null
-/*
- * ============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 {
-
-}
* limitations under the License.
* ============LICENSE_END=====================================================
*/
+
package org.onap.pomba.contextaggregator;
import org.junit.Test;
@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"});
}
}
* 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;
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);
* 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;
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;
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();
}
}
* limitations under the License.
* ============LICENSE_END=====================================================
*/
+
package org.onap.pomba.contextaggregator.config;
import org.junit.Assert;
@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");
* limitations under the License.
* ============LICENSE_END=====================================================
*/
+
package org.onap.pomba.contextaggregator.config;
import org.junit.Assert;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
-public class EventHeaderConfigTest
-{
+public class EventHeaderConfigTest {
private String domain;
private String sourceName;
EventHeaderConfig eventHeaderConfig = new EventHeaderConfig(
domain, sourceName, eventType, entityType, topicEntityType, topicName);
+
@Test
public void getDomainTest() {
Assert.assertEquals(eventHeaderConfig.getDomain(), domain);
* 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");
}
@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());
}
* 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;
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;
POAEvent pOAEvent = new POAEvent();
@Before
- public void setUp()
- {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
pOAEvent.setServiceInstanceId("a");
pOAEvent.setModelVersionId("b");
}
@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());
* 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;
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");
}
@Test
- public void testValidate() throws ContextAggregatorException
- {
+ public void testValidate() throws ContextAggregatorException {
pOAEvent.validate();
}
try {
pOAEvent.validate();
}
- catch (ContextAggregatorException e){
+ catch (ContextAggregatorException e) {
assertTrue(e.getMessage().contains("is missing"));
}
}
try {
pOAEvent.validate();
}
- catch (ContextAggregatorException e){
+ catch (ContextAggregatorException e) {
assertTrue(e.getMessage().contains("is missing"));
}
}
try {
pOAEvent.validate();
}
- catch (ContextAggregatorException e){
+ catch (ContextAggregatorException e) {
assertTrue(e.getMessage().contains("is missing"));
}
}
try {
pOAEvent.validate();
}
- catch (ContextAggregatorException e){
+ catch (ContextAggregatorException e) {
assertTrue(e.getMessage().contains("is missing"));
}
}
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);
}
* limitations under the License.
* ============LICENSE_END=====================================================
*/
+
package org.onap.pomba.contextaggregator.exception;
import org.junit.Assert;
@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);
}
* 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;
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(
}
@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);
* 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;
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);
* 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;
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
@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);
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);
* 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;
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
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();
}
}