import org.junit.*;
import org.junit.runner.RunWith;
import org.mockito.*;
-import org.openecomp.appc.adapter.dmaap.EventSender;
-import org.openecomp.appc.adapter.dmaap.DmaapDestination;
-import org.openecomp.appc.adapter.dmaap.event.EventMessage;
-import org.openecomp.appc.dg.common.impl.Constants;
+import org.openecomp.appc.adapter.message.EventSender;
+import org.openecomp.appc.adapter.message.MessageDestination;
+import org.openecomp.appc.adapter.message.event.EventMessage;
import org.openecomp.appc.dg.common.impl.DCAEReporterPluginImpl;
import org.openecomp.appc.exceptions.APPCException;
import org.openecomp.sdnc.sli.SvcLogicContext;
@RunWith(PowerMockRunner.class)
@PrepareForTest({DCAEReporterPluginImpl.class, FrameworkUtil.class})
-@Ignore
public class DCAEReporterPluginImplTest {
private SvcLogicContext ctx;
private Map<String, String> params;
-
- @Test
- public void testReportBwcTrue() throws Exception {
-
- ctx = new SvcLogicContext();
- params = new HashMap<>();
- ctx.setAttribute("isBwcMode", "true");
- params.put(Constants.DG_ERROR_FIELD_NAME, error);
- ctx.setAttribute(Constants.API_VERSION_FIELD_NAME, apiVer);
- ctx.setAttribute(Constants.REQ_ID_FIELD_NAME, requestId);
-
- positiveAssert();
- }
-
- @Test
- public void testReportErrorDescriptionNullBwcModeTrue() throws Exception {
-
- ctx = new SvcLogicContext();
- params = new HashMap<>();
- ctx.setAttribute("isBwcMode", "true");
- params.put(Constants.DG_ERROR_FIELD_NAME, null);
- ctx.setAttribute(Constants.API_VERSION_FIELD_NAME, apiVer);
- ctx.setAttribute(Constants.REQ_ID_FIELD_NAME, requestId);
-
- errorReasonNullAssert();
- }
-
@Test
public void testReportErrorDescriptionNullBwcModeFalse() throws Exception {
ctx = new SvcLogicContext();
params = new HashMap<>();
- ctx.setAttribute("isBwcMode", "false");
params.put("output.status.message", null);
ctx.setAttribute("input.common-header.api-ver", apiVer);
ctx.setAttribute("input.common-header.request-id", requestId);
private void errorReasonNullAssert() throws APPCException {
dcaeReporterPlugin.report(params, ctx);
- DmaapDestination destination = eventSender.getDestination();
+ MessageDestination destination = eventSender.getDestination();
EventMessage msg = eventSender.getMsg();
Assert.assertEquals("wrong API version", apiVer, msg.getEventHeader().getApiVer());
Assert.assertEquals("wrong requestId", requestId, msg.getEventHeader().getEventId());
private void positiveAssert() throws APPCException {
dcaeReporterPlugin.report(params, ctx);
- DmaapDestination destination = eventSender.getDestination();
+ MessageDestination destination = eventSender.getDestination();
EventMessage msg = eventSender.getMsg();
Assert.assertEquals("wrong API version", apiVer, msg.getEventHeader().getApiVer());
Assert.assertEquals("wrong requestId", requestId, msg.getEventHeader().getEventId());