use of org.onap.so.asdc.client.test.emulators.DistributionClientEmulator in project so by onap.
the class ASDCRestInterface method invokeASDCStatusData.
@POST
@Path("/statusData/v1")
@Produces(MediaType.APPLICATION_JSON)
@Transactional
public Response invokeASDCStatusData(final String request) {
try {
final DistributionClientEmulator distributionClientEmulator = getDistributionClientEmulator("resource-examples/");
final JsonStatusData statusData = JsonStatusData.instantiateNotifFromJsonFile("resource-examples/");
asdcController.setDistributionClient(distributionClientEmulator);
asdcController.initASDC();
toscaInstaller.installTheComponentStatus(statusData);
asdcController.closeASDC();
logger.info(LoggingAnchor.FOUR, MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC.toString(), statusData.getDistributionID(), "ASDC", "ASDC Updates Are Complete");
} catch (final Exception e) {
logger.info("Error caught " + e.getMessage());
logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION.toString(), "Exception caught during ASDCRestInterface", "ASDC", "invokeASDCService", ErrorCode.BusinessProcessError.getValue(), "Exception in invokeASDCService", e);
}
return null;
}
use of org.onap.so.asdc.client.test.emulators.DistributionClientEmulator in project so by onap.
the class ASDCControllerITTest method setUp.
@Before
public void setUp() {
distributionId = UUID.randomUUID().toString();
artifactUuid = UUID.randomUUID().toString();
logger.info("Using distributionId: {}, artifactUUID: {} for testcase: {}", distributionId, artifactUuid, testName.getMethodName());
distributionClient = new DistributionClientEmulator();
distributionClient.setResourcePath("src/test/resources");
asdcController.setDistributionClient(distributionClient);
try {
asdcController.initASDC();
} catch (ASDCControllerException e) {
logger.error(e.getMessage(), e);
fail(e.getMessage());
}
}
use of org.onap.so.asdc.client.test.emulators.DistributionClientEmulator in project so by onap.
the class ASDCRestInterface method invokeASDCService.
@POST
@Path("/treatNotification/v1")
@Produces(MediaType.APPLICATION_JSON)
@Transactional
public Response invokeASDCService(final NotificationDataImpl request, @HeaderParam("resource-location") final String resourceLocation) {
try {
logger.info("Received message : {}", request);
logger.info("resource-location : {}", resourceLocation);
final DistributionClientEmulator distributionClientEmulator = getDistributionClientEmulator(resourceLocation);
asdcController.setControllerName("asdc-controller1");
asdcController.setDistributionClient(distributionClientEmulator);
if (asdcController.isStopped()) {
logger.info("{} not running will try to initialize it, currrent status: {}", asdcController.getClass().getName(), asdcController.getControllerStatus());
asdcController.initASDC();
}
asdcController.treatNotification(request);
if (!asdcController.isBusy()) {
asdcController.closeASDC();
}
return Response.status(Status.OK).build();
} catch (final Exception exception) {
logger.error("Unable to process notification request", exception);
return Response.status(Status.INTERNAL_SERVER_ERROR).build();
}
}
Aggregations