<artifactId>appc-common-bundle</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.onap.appc</groupId>
+ <artifactId>appc-service-communicator-bundle</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
============LICENSE_START=======================================================
ONAP : APPC
================================================================================
- Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
Copyright (C) 2017 Amdocs
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
<module>appc-chef-adapter</module>
<module>appc-rest-adapter</module>
<module>appc-iaas-adapter</module>
- <module>appc-dmaap-adapter</module>
<module>appc-netconf-adapter</module>
<module>appc-ssh-adapter</module>
<module>appc-rest-healthcheck-adapter</module>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
</dependency>
- <dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-dmaap-adapter-bundle</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>org.onap.appc</groupId>
<artifactId>appc-netconf-adapter-bundle</artifactId>
============LICENSE_START=======================================================
ONAP : APPC
================================================================================
- Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
Copyright (C) 2017 Amdocs
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
</dependency>
<dependency>
<groupId>org.onap.appc</groupId>
- <artifactId>appc-message-adapter-api</artifactId>
+ <artifactId>appc-service-communicator-bundle</artifactId>
<version>${project.version}</version>
- <scope>provided</scope>
- <!-- TODO: WA for fixing build, clueanup dependency tree -->
- <exclusions>
- <exclusion>
- <groupId>equinoxSDK381</groupId>
- <artifactId>org.eclipse.osgi</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-dmaap-adapter-bundle</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- <!-- TODO: WA for fixing build, clueanup dependency tree -->
- <exclusions>
- <exclusion>
- <groupId>equinoxSDK381</groupId>
- <artifactId>org.eclipse.osgi</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-message-adapter-factory</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- <!-- TODO: WA for fixing build, clueanup dependency tree -->
- <exclusions>
- <exclusion>
- <groupId>equinoxSDK381</groupId>
- <artifactId>org.eclipse.osgi</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.onap.ccsdk.sli.core</groupId>
<Bundle-SymbolicName>appc-dg-common</Bundle-SymbolicName>
<Export-Package>org.onap.appc.dg.common,org.onap.appc.dg.common.objects,org.onap.appc.dg.common.utils</Export-Package>
<Private-Package>org.onap.appc.dg.common.impl.*</Private-Package>
- <Import-Package>org.onap.appc.adapter.message.*,org.onap.appc.adapter.factory.*,org.onap.appc.adapter.messaging.*,
- *;resolution:=optional</Import-Package>
+ <Import-Package>org.onap.appc.srvcomm.messaging.event,org.onap.appc.srvcomm.messaging,*;resolution:=optional</Import-Package>
<Embed-Dependency>appc-dg-mdsal-bundle,appc-dg-domain-model-lib,appc-dg-dependency-model,jackson-dataformat-yaml,jackson-databind,jackson-core,jackson-annotations;scope=compile|runtime;inline=false;artifactId=!org.eclipse.osgi</Embed-Dependency>
<!--Embed-Dependency>eelf-core,logback-core,logback-classic;scope=compile|runtime;inline=false</Embed-Dependency-->
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
* =============================================================================
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
-import org.onap.appc.adapter.message.EventSender;
-import org.onap.appc.adapter.message.MessageDestination;
-import org.onap.appc.adapter.message.event.EventHeader;
-import org.onap.appc.adapter.message.event.EventMessage;
-import org.onap.appc.adapter.message.event.EventStatus;
+import org.onap.appc.srvcomm.messaging.event.EventSender;
+import org.onap.appc.srvcomm.messaging.MessageDestination;
+import org.onap.appc.srvcomm.messaging.event.EventHeader;
+import org.onap.appc.srvcomm.messaging.event.EventMessage;
+import org.onap.appc.srvcomm.messaging.event.EventStatus;
import org.onap.appc.dg.common.DCAEReporterPlugin;
import org.onap.appc.exceptions.APPCException;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
* ================================================================================
import java.util.Properties;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
-import org.onap.appc.adapter.message.MessageAdapterFactory;
-import org.onap.appc.adapter.message.Producer;
import org.onap.appc.configuration.ConfigurationFactory;
import org.onap.appc.dg.common.IntermediateMessageSender;
import org.onap.appc.exceptions.APPCException;
+import org.onap.appc.srvcomm.messaging.MessagingConnector;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
private static final String PARAM_MESSAGE = "message";
private static final String ATTR_REQUEST_ID = "input.common-header.request-id";
+ private static final String PROPERTIES_PREFIX = "appc.LCM";
- private Producer producer;
+ private MessagingConnector messageService;
private static final String STATUS = "STATUS";
private static final String FAILURE = "FAILURE";
private static final String MSO = "MSO";
public void init() {
- Properties properties = ConfigurationFactory.getConfiguration().getProperties();
-
- String writeTopic = properties.getProperty("appc.LCM.topic.write");
- String apiKey = properties.getProperty("appc.LCM.client.key");
- String apiSecret = properties.getProperty("appc.LCM.client.secret");
- String hostNames = properties.getProperty("appc.LCM.poolMembers");
-
- logger.debug("Configuration Read : writeTopic = " + writeTopic + ", " +
- "hostNames = " + hostNames);
-
- Set<String> pool = new HashSet<>();
- if (!StringUtils.isEmpty(hostNames)) {
- pool.addAll(Arrays.asList(hostNames.split(",")));
- }
-
- BundleContext ctx = FrameworkUtil.getBundle(IntermediateMessageSenderImpl.class).getBundleContext();
- if (ctx != null) {
- ServiceReference svcRef = ctx.getServiceReference(MessageAdapterFactory.class.getName());
- if (svcRef != null) {
- MessageAdapterFactory messageAdapterFactory = ((MessageAdapterFactory) ctx.getService(svcRef));
- producer = messageAdapterFactory.createProducer(pool, writeTopic, apiKey, apiSecret);
- }
- }
+ messageService = new MessagingConnector();
+ }
+ public void init(MessagingConnector messagingConnector) {
+ messageService = messagingConnector;
}
@Override
validateInputs(params, context);
String jsonMessage = getJsonMessage(params, context);
logger.debug("Constructed JSON Message : " + jsonMessage);
- producer.post("", jsonMessage);
+ messageService.publishMessage(PROPERTIES_PREFIX, "", jsonMessage);
context.setAttribute(prefix + STATUS, SUCCESS);
} catch (Exception e) {
String errorMessage = "Error sending intermediate message to initiator " + e.getMessage();
============LICENSE_START=======================================================
ONAP : APPC
================================================================================
- Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
================================================================================
Copyright (C) 2017 Amdocs
=============================================================================
<service id="JsonDgUtil" interface="org.onap.appc.dg.common.JsonDgUtil" ref="JsonDgUtilBean"/>
<reference id="eventSenderReference" availability="mandatory" activation="eager"
- interface="org.onap.appc.adapter.message.EventSender"/>
+ interface="org.onap.appc.srvcomm.messaging.event.EventSender"/>
<bean id="DCAEReporterPluginBean" class="org.onap.appc.dg.common.impl.DCAEReporterPluginImpl"
scope="singleton">
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
* ================================================================================
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Matchers;
import org.mockito.Mockito;
-import org.mockito.Spy;
-import org.onap.appc.adapter.message.EventSender;
-import org.onap.appc.adapter.message.MessageDestination;
-import org.onap.appc.adapter.message.event.EventMessage;
import org.onap.appc.exceptions.APPCException;
+import org.onap.appc.srvcomm.messaging.MessageDestination;
+import org.onap.appc.srvcomm.messaging.event.EventMessage;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.ServiceReference;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(FrameworkUtil.class)
public class DCAEReporterPluginImplTest {
private SvcLogicContext ctx;
private Map<String, String> params;
private final Bundle bundleService = Mockito.mock(Bundle.class);
private final ServiceReference sref = Mockito.mock(ServiceReference.class);
- @InjectMocks
private DCAEReporterPluginImpl dcaeReporterPlugin;
- @Spy
- private EventSenderMock eventSender = new EventSenderMock();
+ private MockEventSender eventSender;
private String apiVer = "2.0.0";
private String requestId = "123";
@SuppressWarnings("unchecked")
@Before
public void setUp() throws NoSuchFieldException, IllegalAccessException {
- PowerMockito.mockStatic(FrameworkUtil.class);
- PowerMockito.when(FrameworkUtil.getBundle(Matchers.any(Class.class))).thenReturn(bundleService);
- PowerMockito.when(bundleService.getBundleContext()).thenReturn(bundleContext);
- PowerMockito.when(bundleContext.getServiceReference(Matchers.any(Class.class))).thenReturn(sref);
- PowerMockito.when(bundleContext.<EventSender>getService(sref)).thenReturn(eventSender);
+ eventSender = new MockEventSender();
+ dcaeReporterPlugin = new DCAEReporterPluginImpl();
+ dcaeReporterPlugin.setEventSender(eventSender);
+
}
@Test
ctx.setAttribute("input.common-header.api-ver", apiVer);
ctx.setAttribute("input.common-header.request-id", requestId);
dcaeReporterPlugin.report(params, ctx);
- EventMessage msg = eventSender.getMsg();
+ EventMessage msg = eventSender.getMessage();
Assert.assertEquals("ERROR DESCRIPTION", msg.getEventStatus().getReason());
}
params = new HashMap<>();
params.put(Constants.DG_ERROR_CODE, "200");
dcaeReporterPlugin.reportSuccess(params, ctx);
- EventMessage msg = eventSender.getMsg();
+ EventMessage msg = eventSender.getMessage();
Assert.assertEquals(new Integer(500), msg.getEventStatus().getCode());
}
private void errorReasonNullAssert() throws APPCException {
+ eventSender.reset();
dcaeReporterPlugin.report(params, ctx);
MessageDestination destination = eventSender.getDestination();
- EventMessage msg = eventSender.getMsg();
+ EventMessage msg = eventSender.getMessage();
Assert.assertEquals("wrong API version", apiVer, msg.getEventHeader().getApiVer());
Assert.assertEquals("wrong requestId", requestId, msg.getEventHeader().getEventId());
Assert.assertEquals("wrong error message", "Unknown", msg.getEventStatus().getReason());
}
private void positiveAssert() throws APPCException {
+ eventSender.reset();
dcaeReporterPlugin.report(params, ctx);
MessageDestination destination = eventSender.getDestination();
- EventMessage msg = eventSender.getMsg();
+ EventMessage msg = eventSender.getMessage();
Assert.assertEquals("wrong API version", apiVer, msg.getEventHeader().getApiVer());
Assert.assertEquals("wrong requestId", requestId, msg.getEventHeader().getEventId());
Assert.assertEquals("wrong error message", error, msg.getEventStatus().getReason());
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 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.appc.dg.common.impl;
-
-import java.util.Map;
-import org.onap.appc.adapter.message.EventSender;
-import org.onap.appc.adapter.message.MessageDestination;
-import org.onap.appc.adapter.message.event.EventMessage;
-import org.onap.appc.exceptions.APPCException;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-
-
-public class EventSenderMock implements EventSender {
- EventMessage msg;
- MessageDestination destination;
-
- @Override
- public boolean sendEvent(MessageDestination destination, EventMessage msg) {
- if (destination != null && msg != null){
- this.msg = msg;
- this.destination = destination;
- return true;
- }
- else{
- return false;
- }
- }
-
- @Override
- public boolean sendEvent(MessageDestination destination, EventMessage msg, String eventTopicName) {
- return false;
- }
-
- @Override
- public boolean sendEvent(MessageDestination destination, Map<String, String> params, SvcLogicContext ctx) throws APPCException {
- return false;
- }
-
- public EventMessage getMsg() {
- return msg;
- }
-
- public MessageDestination getDestination() {
- return destination;
- }
-}
* ONAP : APPC
* ================================================================================
* Copyright (C) 2018 Ericsson
- * =============================================================================
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
import java.util.HashMap;
import java.util.Map;
import org.junit.Assert;
-import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Matchers;
import org.mockito.Mockito;
-import org.mockito.Spy;
-import org.onap.appc.adapter.message.MessageAdapterFactory;
-import org.onap.appc.adapter.message.Producer;
+import org.onap.appc.srvcomm.messaging.MessagingConnector;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.ServiceReference;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(FrameworkUtil.class)
public class IntermediateMessageSenderImplTest {
private SvcLogicContext ctx;
private Map<String, String> params;
- private final BundleContext bundleContext = Mockito.mock(BundleContext.class);
- private final Bundle bundleService = Mockito.mock(Bundle.class);
- private final ServiceReference sref = Mockito.mock(ServiceReference.class);
- private final MessageAdapterFactory mockFactory = Mockito.mock(MessageAdapterFactory.class);
- private final Producer mockProducer = Mockito.mock(Producer.class);
- @InjectMocks
private IntermediateMessageSenderImpl intermediateMessageSenderImpl;
- @Spy
- private EventSenderMock eventSender = new EventSenderMock();
- @SuppressWarnings("unchecked")
- @Before
- public void setUp() throws NoSuchFieldException, IllegalAccessException {
- PowerMockito.mockStatic(FrameworkUtil.class);
- PowerMockito.when(FrameworkUtil.getBundle(Matchers.any(Class.class))).thenReturn(bundleService);
- PowerMockito.when(bundleService.getBundleContext()).thenReturn(bundleContext);
- PowerMockito.when(bundleContext.getServiceReference(Matchers.any(Class.class))).thenReturn(sref);
- PowerMockito.when(bundleContext.<MessageAdapterFactory>getService(sref)).thenReturn(mockFactory);
- PowerMockito.when(mockFactory.createProducer(Matchers.anyCollection(), Mockito.anyString(), Mockito.anyString(),
- Mockito.anyString())).thenReturn(mockProducer);
- }
@Test
public void testSendEmptyMessage() {
- intermediateMessageSenderImpl.init();
+ intermediateMessageSenderImpl = new IntermediateMessageSenderImpl();
+ MessagingConnector msgConn = Mockito.mock(MessagingConnector.class);
+ Mockito.when(msgConn.publishMessage(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(false);
+ intermediateMessageSenderImpl.init(msgConn);
ctx = new SvcLogicContext();
params = new HashMap<>();
intermediateMessageSenderImpl.sendMessage(params, ctx);
@Test
public void testSendMessage() {
- intermediateMessageSenderImpl.init();
+ intermediateMessageSenderImpl = new IntermediateMessageSenderImpl();
+ MessagingConnector msgConn = Mockito.mock(MessagingConnector.class);
+ Mockito.when(msgConn.publishMessage(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(true);
+ intermediateMessageSenderImpl.init(msgConn);
ctx = new SvcLogicContext();
ctx.setAttribute("input.common-header.request-id", "REQUEST-ID");
params = new HashMap<>();
--- /dev/null
+package org.onap.appc.dg.common.impl;
+
+import org.onap.appc.srvcomm.messaging.MessageDestination;
+import org.onap.appc.srvcomm.messaging.event.EventMessage;
+import org.onap.appc.srvcomm.messaging.event.EventSender;
+
+public class MockEventSender extends EventSender {
+
+ private EventMessage eventMessage;
+ private String topic;
+ private MessageDestination dest;
+ private boolean success = true;
+
+ @Override
+ public boolean sendEvent(MessageDestination destination, EventMessage msg, String eventTopicName) {
+ eventMessage = msg;
+ topic = eventTopicName;
+ dest = destination;
+ return success;
+ }
+
+ @Override
+ public boolean sendEvent(MessageDestination destination, EventMessage msg) {
+ eventMessage = msg;
+ topic = null;
+ dest = destination;
+ return success;
+ }
+ public void reset() {
+ eventMessage = null;
+ topic = null;
+ dest = null;
+ success = true;
+ }
+
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ public EventMessage getMessage() {
+ return eventMessage;
+ }
+
+ public String getTopic() {
+ return topic;
+ }
+
+ public MessageDestination getDestination() {
+ return dest;
+ }
+
+}
<artifactId>appc-data-access-lib</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-dmaap-adapter-bundle</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>org.onap.appc</groupId>
<artifactId>appc-lifecycle-management-api</artifactId>
</dependency>
<dependency>
<groupId>org.onap.appc</groupId>
- <artifactId>appc-dmaap-adapter-bundle</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-message-adapter-api</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-message-adapter-factory</artifactId>
+ <artifactId>appc-service-communicator-bundle</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
* ================================================================================
package org.onap.appc.messageadapter.impl;
-
-import org.onap.appc.adapter.factory.MessageService;
-import org.onap.appc.adapter.message.MessageAdapterFactory;
-import org.onap.appc.adapter.message.Producer;
-import org.onap.appc.configuration.Configuration;
-import org.onap.appc.configuration.ConfigurationFactory;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.onap.appc.domainmodel.lcm.VNFOperation;
import org.onap.appc.messageadapter.MessageAdapter;
import org.onap.appc.requesthandler.conv.Converter;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.ServiceReference;
-
-import java.util.HashSet;
-import java.util.Properties;
+import org.onap.appc.srvcomm.messaging.MessagingConnector;
public class MessageAdapterImpl implements MessageAdapter{
- private MessageService messageService;
- private Producer producer;
+ private MessagingConnector messageService;
private String partition ;
- private Configuration configuration;
- private HashSet<String> pool;
- private String writeTopic;
- private String apiKey;
- private String apiSecret;
private static final EELFLogger logger = EELFManager.getInstance().getLogger(MessageAdapterImpl.class);
@Override
public void init(){
logger.debug("MessageAdapterImpl - init");
- this.producer = getProducer();
- }
-
- private Producer getProducer() {
- configuration = ConfigurationFactory.getConfiguration();
- Properties properties = configuration.getProperties();
- updateProperties(properties);
-
- BundleContext ctx = FrameworkUtil.getBundle(MessageAdapterImpl.class).getBundleContext();
- if (ctx != null) {
- ServiceReference svcRef = ctx.getServiceReference(MessageAdapterFactory.class.getName());
- if (svcRef != null) {
- producer = ((MessageAdapterFactory) ctx.getService(svcRef)).createProducer(pool, writeTopic, apiKey, apiSecret);
- }
- }
- return producer;
+ this.messageService = new MessagingConnector();
}
-
-
- private void updateProperties(Properties props) {
- if (logger.isTraceEnabled()) {
- logger.trace("Entering to updateProperties with Properties = " + ObjectUtils.toString(props));
- }
- pool = new HashSet<>();
- if (props != null) {
- // readTopic = props.getProperty("dmaap.topic.read");
- writeTopic = props.getProperty("appc.LCM.topic.write");
- apiKey = props.getProperty("appc.LCM.client.key");
- apiSecret = props.getProperty("appc.LCM.client.secret");
- messageService = MessageService.parse(props.getProperty("message.service.type"));
- // READ_TIMEOUT = Integer.valueOf(props.getProperty("dmaap.topic.read.timeout", String.valueOf(READ_TIMEOUT)));
- String hostnames = props.getProperty("appc.LCM.poolMembers");
- if (hostnames != null && !hostnames.isEmpty()) {
- for (String name : hostnames.split(",")) {
- pool.add(name);
- }
- }
- }
+
+ public void init(MessagingConnector connector) {
+ logger.debug("MessageAdapterImpl - init");
+ this.messageService = connector;
}
/**
logger.debug("DMaaP Response = " + jsonMessage);
}
logger.debug("Before Invoking producer.post(): jsonMessage is::" + jsonMessage);
- success = producer.post(this.partition, jsonMessage);
+ success = messageService.publishMessage("appc.LCM", this.partition, jsonMessage);
logger.debug("After Invoking producer.post()");
} catch (JsonProcessingException e1) {
logger.error("Error generating Json from DMaaP message " + e1.getMessage());
* ================================================================================
* Copyright (C) 2019 Ericsson
* ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
package org.onap.appc.messageadapter.impl;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+
+import javax.ws.rs.core.Response.Status;
+
import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
import org.mockito.Mockito;
-import org.mockito.internal.util.reflection.Whitebox;
-import org.onap.appc.adapter.message.MessageAdapterFactory;
-import org.onap.appc.adapter.message.Producer;
-import org.onap.appc.configuration.Configuration;
-import org.onap.appc.configuration.ConfigurationFactory;
-import org.onap.appc.requesthandler.conv.Converter;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.ServiceReference;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
+import org.onap.appc.domainmodel.lcm.CommonHeader;
+import org.onap.appc.domainmodel.lcm.ResponseContext;
+import org.onap.appc.domainmodel.lcm.VNFOperation;
+import org.onap.appc.srvcomm.messaging.MessagingConnector;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.fasterxml.jackson.core.JsonProcessingException;
-import com.att.eelf.configuration.EELFLogger.Level;
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({FrameworkUtil.class, Converter.class})
public class MessageAdapterImplTest {
- private Configuration mockConfig = ConfigurationFactory.getConfiguration();
- private final BundleContext bundleContext = Mockito.mock(BundleContext.class);
- private final Bundle bundleService = Mockito.mock(Bundle.class);
- private final ServiceReference sref = Mockito.mock(ServiceReference.class);
- private final Producer producer = Mockito.mock(Producer.class);
+ private final MessagingConnector connector = Mockito.mock(MessagingConnector.class);
private static final EELFLogger logger = EELFManager.getInstance().getLogger(MessageAdapterImpl.class);
- private MessageAdapterImpl impl;
-
+ private final MessageAdapterImpl impl = new MessageAdapterImpl();
+
@Before
- public void setUp() throws Exception {
- logger.setLevel(Level.TRACE);
- impl = PowerMockito.spy(new MessageAdapterImpl());
- //originalLogger = (EELFLogger) Whitebox.getInternalState(MessageAdapterImpl.class, "logger");
- Whitebox.setInternalState(impl, "configuration", mockConfig);
- PowerMockito.mockStatic(FrameworkUtil.class);
- PowerMockito.when(FrameworkUtil.getBundle(MessageAdapterImpl.class)).thenReturn(bundleService);
- PowerMockito.when(bundleService.getBundleContext()).thenReturn(bundleContext);
- PowerMockito.when(bundleContext.getServiceReference(MessageAdapterFactory.class.getName())).thenReturn(sref);
- PowerMockito.when(bundleContext.getService(sref)).thenReturn(producer);
- PowerMockito.mockStatic(Converter.class);
- PowerMockito.when(Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(
- Mockito.any(), Mockito.any(), Mockito.any())).thenReturn("{}");
+ public void setUp() {
+ impl.init(connector);
}
@Test
public void testSuccess() throws JsonProcessingException {
- PowerMockito.when(Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(
- Mockito.any(), Mockito.any(), Mockito.any())).thenReturn("{}");
- Mockito.when(producer.post(Mockito.anyString(), Mockito.anyString())).thenReturn(true);
- Whitebox.setInternalState(impl, "producer", producer);
- Whitebox.setInternalState(impl, "partition", "PARTITION");
- assertTrue(impl.post(null, null, null));
- }
- @Test
- public void testJsonException() throws JsonProcessingException {
- PowerMockito.when(Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(
- Mockito.any(), Mockito.any(), Mockito.any())).thenThrow(new JsonProcessingException("TEST") {});
- Whitebox.setInternalState(impl, "partition", "PARTITION");
- assertFalse(impl.post(null, null, null));
+ ResponseContext context = new ResponseContext();
+ context.setPayload("payload");
+ org.onap.appc.domainmodel.lcm.Status status = new org.onap.appc.domainmodel.lcm.Status();
+ status.setCode(200);
+ status.setMessage("success");
+ context.setStatus(status);
+ CommonHeader commonHeader = new CommonHeader();
+ commonHeader.setRequestId("test123");
+ commonHeader.setSubRequestId("test456");
+ context.setCommonHeader(commonHeader);
+ Mockito.when(connector.publishMessage(Mockito.any(), Mockito.any(),Mockito.any())).thenReturn(true);
+ assertTrue(impl.post(VNFOperation.Start, "test", context));
}
- @Test
- public void testException() throws JsonProcessingException {
- PowerMockito.when(Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(
- Mockito.any(), Mockito.any(), Mockito.any())).thenThrow(new RuntimeException());
- Whitebox.setInternalState(impl, "partition", "PARTITION");
- assertFalse(impl.post(null, null, null));
- }
}
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
* =============================================================================
import org.junit.runner.RunWith;
import org.mockito.Matchers;
import org.mockito.Mockito;
-import org.onap.appc.adapter.factory.DmaapMessageAdapterFactoryImpl;
-import org.onap.appc.adapter.message.MessageAdapterFactory;
import org.onap.appc.configuration.Configuration;
import org.onap.appc.configuration.ConfigurationFactory;
import org.onap.appc.domainmodel.lcm.ActionIdentifiers;
private LockManager lockManager;
private Configuration configuration;
- private final BundleContext bundleContext=Mockito.mock(BundleContext.class);
- private final Bundle bundleService=Mockito.mock(Bundle.class);
- private final ServiceReference sref=Mockito.mock(ServiceReference.class);
- private MessageAdapterFactory factory = new DmaapMessageAdapterFactoryImpl();
-
-
@Before
public void init() throws Exception {
configuration = ConfigurationFactory.getConfiguration();
configuration.setProperty("appc.LCM.client.secret" , "TEST");
PowerMockito.mockStatic(FrameworkUtil.class);
- PowerMockito.when(FrameworkUtil.getBundle(MessageAdapterImpl.class)).thenReturn(bundleService);
- PowerMockito.when(bundleService.getBundleContext()).thenReturn(bundleContext);
- PowerMockito.when(bundleContext.getServiceReference(MessageAdapterFactory.class.getName())).thenReturn(sref);
- PowerMockito.when(bundleContext.getService(sref)).thenReturn(factory);
requestHandler = new RequestHandlerImpl();
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
* =============================================================================
package org.onap.appc.requesthandler.impl;
import org.mockito.Mockito;
-import org.onap.appc.adapter.message.MessageAdapterFactory;
-import org.onap.appc.adapter.message.Producer;
import org.onap.appc.domainmodel.lcm.ActionIdentifiers;
import org.onap.appc.domainmodel.lcm.ActionLevel;
import org.onap.appc.domainmodel.lcm.CommonHeader;
BundleContext myBundleContext = mock(BundleContext.class);
Mockito.when(myBundle.getBundleContext()).thenReturn(myBundleContext);
-
- ServiceReference svcRef = mock(ServiceReference.class);
- Mockito.when(myBundleContext.getServiceReference(MessageAdapterFactory.class.getName())).thenReturn(svcRef);
-
- Producer producer = mock(Producer.class);
- MessageAdapterFactory factory = mock(MessageAdapterFactory.class);
- Mockito.when(myBundleContext.getService(svcRef)).thenReturn(factory);
- Mockito.when(factory.createProducer(anyCollectionOf(String.class), anyString(), anyString(), anyString()))
- .thenReturn(producer);
}
}
============LICENSE_START=======================================================
ONAP : APPC
================================================================================
-Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
=============================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
</dependency>
<dependency>
<groupId>org.onap.appc</groupId>
- <artifactId>appc-message-adapter-api</artifactId>
+ <artifactId>appc-service-communicator-bundle</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<artifactId>json</artifactId>
</dependency>
-
- <dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-message-adapter-api</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-message-adapter-factory</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
<dependency>
<groupId>org.onap.appc</groupId>
- <artifactId>appc-dmaap-adapter-bundle</artifactId>
+ <artifactId>appc-service-communicator-bundle</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
* =============================================================================
import com.att.eelf.configuration.EELFManager;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.apache.commons.lang.ObjectUtils;
-import org.onap.appc.adapter.message.MessageAdapterFactory;
-import org.onap.appc.adapter.message.Producer;
-import org.onap.appc.configuration.Configuration;
-import org.onap.appc.configuration.ConfigurationFactory;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.ServiceReference;
-
-import java.util.HashSet;
-import java.util.Properties;
+import org.onap.appc.srvcomm.messaging.MessagingConnector;
public class MessageAdapter {
private final EELFLogger logger = EELFManager.getInstance().getLogger(MessageAdapter.class);
- private final String PROP_APPC_OAM_DISABLED = "appc.OAM.disabled";
- private final String PROP_APPC_OAM_TOPIC_WRITE = "appc.OAM.topic.write";
- private String PROP_APPC_OAM_CLIENT_KEY = "appc.OAM.client.key";
- private String PROP_APPC_OAM_CLIENT_SECRET = "appc.OAM.client.secret";
- private String PROP_APPC_OAM_POOLMEMBERS = "appc.OAM.poolMembers";
+ private static final String PROPERTIES_PREFIX = "appc.OAM";
- private Producer producer;
+ private MessagingConnector messagingConnector;
private String partition;
- private Configuration configuration;
- private HashSet<String> pool;
- private String writeTopic;
- private String apiKey;
- private String apiSecret;
private boolean isDisabled;
/**
* Initialize producer client to post messages using configuration properties.
*/
public void init() {
- configuration = ConfigurationFactory.getConfiguration();
- Properties properties = configuration.getProperties();
- updateProperties(properties);
if (isAppcOamPropsListenerEnabled()) {
- createProducer();
+ messagingConnector = new MessagingConnector();
} else {
logger.warn(String.format("The listener %s is disabled and will not be run", "appc.OAM"));
}
}
+
+ public void init(MessagingConnector connector) {
- /**
- * Create producer using MessageAdapterFactory which is found through bundle context.
- */
- void createProducer() {
- BundleContext ctx = FrameworkUtil.getBundle(MessageAdapter.class).getBundleContext();
- if (ctx == null) {
- logger.warn("MessageAdapter cannot create producer due to no bundle context.");
- return;
- }
-
- ServiceReference svcRef = ctx.getServiceReference(MessageAdapterFactory.class.getName());
- if (svcRef == null) {
- logger.warn("MessageAdapter cannot create producer due to no MessageAdapterFactory service reference.");
- return;
- }
-
- Producer localProducer = ((MessageAdapterFactory) ctx.getService(svcRef)).createProducer(pool, writeTopic,
- apiKey, apiSecret);
-
- for (String url : pool) {
- if (url.contains("3905") || url.contains("https")) {
- localProducer.useHttps(true);
- break;
- }
+ if (isAppcOamPropsListenerEnabled()) {
+ messagingConnector = connector;
+ } else {
+ logger.warn(String.format("The listener %s is disabled and will not be run", "appc.OAM"));
}
-
- producer = localProducer;
-
- logger.debug("MessageAdapter created producer.");
}
- /**
- * Read property value to set writeTopic, apiKey, apiSecret and pool.
- *
- * @param props of configuration
- */
- private void updateProperties(Properties props) {
- logger.trace("Entering to updateProperties with Properties = " + ObjectUtils.toString(props));
-
- pool = new HashSet<>();
- if (props != null) {
- isDisabled = Boolean.parseBoolean(props.getProperty(PROP_APPC_OAM_DISABLED));
- writeTopic = props.getProperty(PROP_APPC_OAM_TOPIC_WRITE);
- apiKey = props.getProperty(PROP_APPC_OAM_CLIENT_KEY);
- apiSecret = props.getProperty(PROP_APPC_OAM_CLIENT_SECRET);
- String hostnames = props.getProperty(PROP_APPC_OAM_POOLMEMBERS);
- if (hostnames != null && !hostnames.isEmpty()) {
- for (String name : hostnames.split(",")) {
- pool.add(name);
- }
- }
- }
- }
/**
* Get producer. If it is null, call createProducer to create it again.
*
* @return Producer
*/
- Producer getProducer() {
- if (producer == null) {
- // In case, producer was not properly set yet, set it again.
- logger.info("Calling createProducer as producer is null.");
- createProducer();
+ MessagingConnector getMessagingConnector() {
+ if (messagingConnector == null) {
+ messagingConnector = new MessagingConnector();
}
- return producer;
+ return messagingConnector;
}
/**
logger.debug("UEB Response = " + jsonMessage);
}
- Producer myProducer = getProducer();
- success = myProducer != null && myProducer.post(this.partition, jsonMessage);
+ MessagingConnector connector = getMessagingConnector();
+ success = connector != null && connector.publishMessage(PROPERTIES_PREFIX, this.partition, jsonMessage);
} catch (JsonProcessingException e1) {
logger.error("Error generating Json from UEB message " + e1.getMessage());
success = false;
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
* ================================================================================
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.onap.appc.adapter.message.MessageAdapterFactory;
-import org.onap.appc.adapter.message.Producer;
import org.onap.appc.configuration.Configuration;
import org.mockito.Mockito;
import org.opendaylight.yang.gen.v1.org.onap.appc.oam.rev170303.common.header.CommonHeader;
@PrepareForTest({FrameworkUtil.class, ConfigurationFactory.class, Converter.class})
public class MessageAdapterTest {
- private Producer fakeProducer;
private MessageAdapter messageAdapter;
@Before
public final void setup() throws Exception {
- fakeProducer = mock(Producer.class);
messageAdapter = new MessageAdapter();
}
- @Test
- public void testGetProducerReturnsNull() throws Exception {
- MessageAdapter maSpy = Mockito.spy(messageAdapter);
- Mockito.doNothing().when(maSpy).createProducer();
-
- Producer producer = maSpy.getProducer();
- Assert.assertTrue("getProducer() did not return null", producer == null);
- Producer mySpyProducer = Whitebox.getInternalState(maSpy, "producer");
- Assert.assertTrue("MessageAdapter producer is not null", mySpyProducer == null);
- Mockito.verify(maSpy, Mockito.times(1)).createProducer();
- }
-
- @Test
- public void testGetProducerWithExistingProducer() throws Exception {
- MessageAdapter maSpy = Mockito.spy(messageAdapter);
- Whitebox.setInternalState(maSpy, "producer", fakeProducer);
-
- Producer producer = maSpy.getProducer();
- Assert.assertTrue("getProducer() returned null", producer == fakeProducer);
- Mockito.verify(maSpy, Mockito.times(0)).createProducer();
- }
-
- @Test
- public void testGetProducerWithCreateProducer() throws Exception {
- MessageAdapter maSpy = Mockito.spy(messageAdapter);
- Whitebox.setInternalState(maSpy, "producer", (Object) null);
- HashSet<String> pool = new HashSet<>();
- pool.add("NOT_HTTPS");
- pool.add("https");
- Whitebox.setInternalState(maSpy, "pool", pool);
-
- // Prepare all mocks
- mockStatic(FrameworkUtil.class);
- Bundle maBundle = mock(Bundle.class);
- PowerMockito.when(FrameworkUtil.getBundle(MessageAdapter.class)).thenReturn(maBundle);
-
- BundleContext maBundleContext = mock(BundleContext.class);
- Mockito.when(maBundle.getBundleContext()).thenReturn(maBundleContext);
-
- ServiceReference svcRef = mock(ServiceReference.class);
- Mockito.when(maBundleContext.getServiceReference(MessageAdapterFactory.class.getName())).thenReturn(svcRef);
-
- MessageAdapterFactory maFactory = mock(MessageAdapterFactory.class);
- Mockito.when(maBundleContext.getService(svcRef)).thenReturn(maFactory);
- Mockito.when(maFactory.createProducer(pool, (String) null, null, null)).thenReturn(fakeProducer);
-
- Producer producer = maSpy.getProducer();
- Assert.assertTrue("getProducer() result does not match", producer == fakeProducer);
- Producer mySpyProducer = Whitebox.getInternalState(maSpy, "producer");
- Assert.assertTrue("MessageAdapter producer does not match",mySpyProducer == fakeProducer);
- Mockito.verify(maSpy, Mockito.times(1)).createProducer();
- }
-
- @Test
- public void testUpdateProperties() {
- MessageAdapter maSpy = Mockito.spy(messageAdapter);
- Mockito.doNothing().when(maSpy).createProducer();
- Whitebox.setInternalState(maSpy, "isDisabled", false);
- PowerMockito.mockStatic(ConfigurationFactory.class);
- Configuration mockConfig = Mockito.mock(Configuration.class);
- Properties properties = new Properties();
- properties.setProperty("appc.OAM.poolMembers", "hostname1,hostname2");
- Mockito.when(ConfigurationFactory.getConfiguration()).thenReturn(mockConfig);
- Mockito.doReturn(properties).when(mockConfig).getProperties();
- maSpy.init();
- assertEquals(2, ((Set<String>)Whitebox.getInternalState(maSpy, "pool")).size());
- }
-
@Test
public void testPost() throws JsonProcessingException {
MessageAdapter maSpy = Mockito.spy(messageAdapter);
Mockito.when(Converter.convAsyncResponseToUebOutgoingMessageJsonString(oamContext)).thenReturn("{cambriaPartition='MSO', rpcName='maintenance_mode',"
+ " body=Body{output=MaintenanceModeOutput [_commonHeader=CommonHeader, hashCode: 14584991,"
+ " _status=Status, hashCode: 24801521, augmentation=[]]}}");
- Mockito.doNothing().when(maSpy).createProducer();
maSpy.post(oamContext);
Mockito.verify(mockLogger).trace(Mockito.contains("Entering to post"));
Mockito.verify(mockLogger).trace("Exiting from post with (success = false)");
Whitebox.setInternalState(maSpy, "logger", mockLogger);
PowerMockito.mockStatic(Converter.class);
Mockito.when(Converter.convAsyncResponseToUebOutgoingMessageJsonString(oamContext)).thenThrow(new JsonProcessingException("ERROR") {});
- Mockito.doNothing().when(maSpy).createProducer();
maSpy.post(oamContext);
Mockito.verify(mockLogger).error(Mockito.contains("Error generating Json from UEB message"));
}
Whitebox.setInternalState(maSpy, "logger", mockLogger);
PowerMockito.mockStatic(Converter.class);
Mockito.when(Converter.convAsyncResponseToUebOutgoingMessageJsonString(oamContext)).thenThrow(new RuntimeException("ERROR"));
- Mockito.doNothing().when(maSpy).createProducer();
maSpy.post(oamContext);
Mockito.verify(mockLogger).error(Mockito.contains("Error sending message to UEB ERROR"), Mockito.any(RuntimeException.class));
}
-}
\ No newline at end of file
+}
<dependency>
<groupId>org.onap.appc</groupId>
- <artifactId>appc-message-adapter-api</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.onap.appc</groupId>
- <artifactId>appc-message-adapter-factory</artifactId>
+ <artifactId>appc-service-communicator-bundle</artifactId>
<version>${project.version}</version>
</dependency>
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
* =============================================================================
package org.onap.appc.sdc.artifacts.impl;
-import org.onap.appc.adapter.message.EventSender;
-import org.onap.appc.adapter.message.MessageDestination;
-import org.onap.appc.adapter.message.event.EventHeader;
-import org.onap.appc.adapter.message.event.EventMessage;
-import org.onap.appc.adapter.message.event.EventStatus;
+import org.onap.appc.srvcomm.messaging.event.EventSender;
+import org.onap.appc.srvcomm.messaging.MessageDestination;
+import org.onap.appc.srvcomm.messaging.event.EventHeader;
+import org.onap.appc.srvcomm.messaging.event.EventMessage;
+import org.onap.appc.srvcomm.messaging.event.EventStatus;
import org.onap.appc.sdc.listener.Util;
import org.onap.appc.exceptions.APPCException;
import com.att.eelf.configuration.EELFLogger;
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
* =============================================================================
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-import org.onap.appc.adapter.message.EventSender;
+import org.onap.appc.srvcomm.messaging.event.EventSender;
import org.onap.appc.sdc.artifacts.ArtifactProcessor;
import org.onap.appc.sdc.artifacts.object.ArtifactType;
import org.onap.sdc.api.IDistributionClient;
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
* =============================================================================
import java.net.MalformedURLException;
import java.net.URI;
-import org.onap.appc.adapter.message.EventSender;
+import org.onap.appc.srvcomm.messaging.event.EventSender;
import org.onap.appc.exceptions.APPCException;
import org.onap.appc.sdc.artifacts.object.SDCArtifact;
import org.onap.appc.sdc.listener.ProviderOperations;
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
* =============================================================================
package org.onap.appc.sdc.artifacts.impl;
-import org.onap.appc.adapter.message.EventSender;
+import org.onap.appc.srvcomm.messaging.event.EventSender;
import org.onap.appc.exceptions.APPCException;
import org.onap.appc.licmgr.Constants;
import com.att.eelf.configuration.EELFLogger;
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
* =============================================================================
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import org.apache.commons.lang.StringUtils;
-import org.onap.appc.adapter.message.EventSender;
+import org.onap.appc.srvcomm.messaging.event.EventSender;
import org.onap.appc.exceptions.APPCException;
import org.onap.appc.sdc.artifacts.helper.DependencyModelGenerator;
import org.onap.appc.sdc.artifacts.object.Resource;
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
* =============================================================================
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-import org.onap.appc.adapter.message.EventSender;
+import org.onap.appc.srvcomm.messaging.event.EventSender;
import org.onap.appc.sdc.artifacts.ArtifactProcessor;
import org.onap.appc.sdc.artifacts.impl.ArtifactProcessorFactory;
import org.onap.sdc.api.IDistributionClient;
import org.mockito.Mockito;
import org.mockito.internal.util.reflection.Whitebox;
import org.mockito.runners.MockitoJUnitRunner;
-import org.onap.appc.adapter.message.EventSender;
+import org.onap.appc.srvcomm.messaging.event.EventSender;
import org.onap.sdc.api.IDistributionClient;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.api.notification.INotificationData;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
-import org.onap.appc.adapter.message.EventSender;
import org.onap.appc.sdc.artifacts.object.SDCArtifact;
+import org.onap.appc.srvcomm.messaging.event.EventSender;
import org.onap.sdc.api.IDistributionClient;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.api.notification.INotificationData;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
-import org.onap.appc.adapter.message.EventSender;
import org.onap.appc.exceptions.APPCException;
import org.onap.appc.sdc.artifacts.object.SDCArtifact;
import org.onap.appc.sdc.listener.ProviderOperations;
import org.onap.appc.sdc.listener.ProviderResponse;
import org.onap.appc.sdc.listener.Util;
+import org.onap.appc.srvcomm.messaging.event.EventSender;
import org.onap.sdc.api.IDistributionClient;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.api.notification.INotificationData;
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
* =============================================================================
import org.junit.runner.RunWith;
import org.mockito.Matchers;
import org.mockito.Mockito;
-import org.onap.appc.adapter.message.EventSender;
import org.onap.appc.exceptions.APPCException;
import org.onap.appc.sdc.artifacts.helper.ArtifactStorageService;
import org.onap.appc.sdc.artifacts.object.SDCArtifact;
+import org.onap.appc.srvcomm.messaging.event.EventSender;
import org.onap.sdc.api.IDistributionClient;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.api.notification.INotificationData;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
-import org.onap.appc.adapter.message.EventSender;
import org.onap.appc.exceptions.APPCException;
import org.onap.appc.sdc.artifacts.helper.ArtifactStorageService;
import org.onap.appc.sdc.artifacts.helper.DependencyModelGenerator;
import org.onap.appc.sdc.artifacts.object.SDCArtifact;
+import org.onap.appc.srvcomm.messaging.event.EventSender;
import org.onap.sdc.api.IDistributionClient;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.api.notification.INotificationData;
import org.junit.runner.RunWith;
import org.mockito.Matchers;
import org.mockito.Mockito;
-import org.onap.appc.adapter.message.EventSender;
import org.onap.appc.sdc.artifacts.helper.ArtifactStorageService;
import org.onap.appc.sdc.artifacts.helper.DependencyModelGenerator;
import org.onap.appc.sdc.artifacts.impl.ArtifactProcessorFactory;
import org.onap.appc.sdc.artifacts.impl.ToscaCsarArtifactProcessor;
import org.onap.appc.sdc.artifacts.object.SDCArtifact;
import org.onap.appc.sdc.artifacts.object.SDCReference;
+import org.onap.appc.srvcomm.messaging.event.EventSender;
import org.onap.sdc.api.IDistributionClient;
import org.onap.sdc.api.consumer.INotificationCallback;
import org.onap.sdc.api.notification.IArtifactInfo;
</activation>
<modules>
<module>appc-adapters</module>
+ <module>appc-service-communicator</module>
<module>appc-provider</module>
- <module>appc-event-listener</module>
<module>appc-sdc-listener</module>
<module>appc-lifecycle-management</module>
<module>appc-oam</module>
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.appc.services.dmaapService;
import java.util.Properties;
private final String PROPERTIES_PREFIX = "appc.srvcomm.messaging";
private final String DEFAULT_USER = "appc";
private final String DEFAULT_PASSWORD = "onapappc";
-
+
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable().authorizeRequests().anyRequest().authenticated().and().httpBasic();