Search in sources :

Example 1 with IDistributionStatusMessage

use of org.onap.sdc.api.consumer.IDistributionStatusMessage in project so by onap.

the class DistributionClientEmulatorTest method sendDeploymentStatusPrimary.

@Test
public void sendDeploymentStatusPrimary() {
    IDistributionStatusMessage message = new DistributionStatusMessage("testArtifactUrl", "testConsumerId", "testDistributionId", DistributionStatusEnum.DOWNLOAD_OK, 123456);
    IDistributionClientResult result = distClientEmulator.sendDeploymentStatus(message);
    IDistributionClientResult expectedResult = new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name());
    assertEquals(message, distClientEmulator.getDistributionMessageReceived().get(0));
    assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult());
    assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult());
}
Also used : IDistributionStatusMessage(org.onap.sdc.api.consumer.IDistributionStatusMessage) DistributionStatusMessage(org.onap.so.asdc.client.DistributionStatusMessage) IDistributionStatusMessage(org.onap.sdc.api.consumer.IDistributionStatusMessage) IDistributionClientResult(org.onap.sdc.api.results.IDistributionClientResult) DistributionClientResultImpl(org.onap.sdc.impl.DistributionClientResultImpl) Test(org.junit.Test)

Example 2 with IDistributionStatusMessage

use of org.onap.sdc.api.consumer.IDistributionStatusMessage in project so by onap.

the class DistributionClientEmulatorTest method sendDeploymentStatusSecondary.

@Test
public void sendDeploymentStatusSecondary() {
    IDistributionStatusMessage message = new DistributionStatusMessage("testArtifactUrl", "testConsumerId", "testDistributionId", DistributionStatusEnum.DOWNLOAD_OK, 123456);
    IDistributionClientResult result = distClientEmulator.sendDeploymentStatus(message, "test");
    IDistributionClientResult expectedResult = new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name());
    assertEquals(message, distClientEmulator.getDistributionMessageReceived().get(0));
    assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult());
    assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult());
}
Also used : IDistributionStatusMessage(org.onap.sdc.api.consumer.IDistributionStatusMessage) DistributionStatusMessage(org.onap.so.asdc.client.DistributionStatusMessage) IDistributionStatusMessage(org.onap.sdc.api.consumer.IDistributionStatusMessage) IDistributionClientResult(org.onap.sdc.api.results.IDistributionClientResult) DistributionClientResultImpl(org.onap.sdc.impl.DistributionClientResultImpl) Test(org.junit.Test)

Example 3 with IDistributionStatusMessage

use of org.onap.sdc.api.consumer.IDistributionStatusMessage in project so by onap.

the class DistributionClientEmulatorTest method sendDownloadStatusPrimary.

@Test
public void sendDownloadStatusPrimary() {
    IDistributionStatusMessage message = new DistributionStatusMessage("testArtifactUrl", "testConsumerId", "testDistributionId", DistributionStatusEnum.DOWNLOAD_OK, 123456);
    IDistributionClientResult result = distClientEmulator.sendDownloadStatus(message);
    IDistributionClientResult expectedResult = new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name());
    assertEquals(message, distClientEmulator.getDistributionMessageReceived().get(0));
    assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult());
    assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult());
}
Also used : IDistributionStatusMessage(org.onap.sdc.api.consumer.IDistributionStatusMessage) DistributionStatusMessage(org.onap.so.asdc.client.DistributionStatusMessage) IDistributionStatusMessage(org.onap.sdc.api.consumer.IDistributionStatusMessage) IDistributionClientResult(org.onap.sdc.api.results.IDistributionClientResult) DistributionClientResultImpl(org.onap.sdc.impl.DistributionClientResultImpl) Test(org.junit.Test)

Example 4 with IDistributionStatusMessage

use of org.onap.sdc.api.consumer.IDistributionStatusMessage in project so by onap.

the class ASDCController method sendASDCNotification.

protected void sendASDCNotification(NotificationType notificationType, String artifactURL, String consumerID, String distributionID, DistributionStatusEnum status, String errorReason, long timestamp) {
    String event = "Sending " + notificationType.name() + "(" + status.name() + ")" + " notification to ASDC for artifact:" + artifactURL;
    if (errorReason != null) {
        event = event + "(" + errorReason + ")";
    }
    logger.info(LoggingAnchor.SIX, MessageEnum.ASDC_SEND_NOTIF_ASDC.toString(), notificationType.name(), status.name(), artifactURL, "ASDC", "sendASDCNotification");
    logger.debug(event);
    try {
        IDistributionStatusMessage message = new DistributionStatusMessage(artifactURL, consumerID, distributionID, status, timestamp);
        if (errorReason != null) {
            sendNotificationWithMessageAndErrorReason(notificationType, errorReason, message);
        } else {
            sendNotificationWithMessage(notificationType, message);
        }
    } catch (RuntimeException e) {
        logger.warn(LoggingAnchor.FIVE, MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC.toString(), "ASDC", "sendASDCNotification", ErrorCode.SchemaError.getValue(), "RuntimeException - sendASDCNotification", e);
    }
}
Also used : IDistributionStatusMessage(org.onap.sdc.api.consumer.IDistributionStatusMessage) IDistributionStatusMessage(org.onap.sdc.api.consumer.IDistributionStatusMessage)

Example 5 with IDistributionStatusMessage

use of org.onap.sdc.api.consumer.IDistributionStatusMessage in project so by onap.

the class DistributionClientEmulatorTest method sendDownloadStatusSecondary.

@Test
public void sendDownloadStatusSecondary() {
    IDistributionStatusMessage message = new DistributionStatusMessage("testArtifactUrl", "testConsumerId", "testDistributionId", DistributionStatusEnum.DOWNLOAD_OK, 123456);
    IDistributionClientResult result = distClientEmulator.sendDownloadStatus(message, "test");
    IDistributionClientResult expectedResult = new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name());
    assertEquals(message, distClientEmulator.getDistributionMessageReceived().get(0));
    assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult());
    assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult());
}
Also used : IDistributionStatusMessage(org.onap.sdc.api.consumer.IDistributionStatusMessage) DistributionStatusMessage(org.onap.so.asdc.client.DistributionStatusMessage) IDistributionStatusMessage(org.onap.sdc.api.consumer.IDistributionStatusMessage) IDistributionClientResult(org.onap.sdc.api.results.IDistributionClientResult) DistributionClientResultImpl(org.onap.sdc.impl.DistributionClientResultImpl) Test(org.junit.Test)

Aggregations

IDistributionStatusMessage (org.onap.sdc.api.consumer.IDistributionStatusMessage)6 Test (org.junit.Test)5 DistributionStatusMessage (org.onap.so.asdc.client.DistributionStatusMessage)5 IDistributionClientResult (org.onap.sdc.api.results.IDistributionClientResult)4 DistributionClientResultImpl (org.onap.sdc.impl.DistributionClientResultImpl)4