use of org.iobserve.analysis.deployment.data.PCMDeployedEvent in project iobserve-analysis by research-iobserve.
the class DeploymentResourceContainerTest method checkNoDeploymentNeeded.
/**
* Tests whether a new deployment is generated for an already existing entity.
*/
@Test
public void checkNoDeploymentNeeded() {
/**
* input deployment event
*/
final PCMDeployedEvent deploymentEvent = ModelLevelData.PCM_DEPLOYED_EVENT;
final List<PCMDeployedEvent> inputEvents = new ArrayList<>();
inputEvents.add(deploymentEvent);
final List<PCMDeployedEvent> outputEvents = new ArrayList<>();
StageTester.test(this.deploymentModelUpdater).and().send(inputEvents).to(this.deploymentModelUpdater.getInputPort()).start();
Assert.assertThat(this.deploymentModelUpdater.getDeployedNotifyOutputPort(), StageTester.producesNothing());
Assert.assertEquals("There should be no notification for errorous data.", outputEvents.size(), 0);
}
use of org.iobserve.analysis.deployment.data.PCMDeployedEvent in project iobserve-analysis by research-iobserve.
the class PrivacyWarner method execute.
@Override
protected void execute() throws Exception {
final Warnings warnings = new Warnings();
final PCMDeployedEvent deployedEvent = this.deployedInputPort.receive();
final PCMUndeployedEvent undeployedEvent = this.undeployedInputPort.receive();
if (deployedEvent != null) {
// TODO generate warnings after the last deployment
} else if (undeployedEvent != null) {
// TODO generate warnings after the last undeployment
}
this.probesOutputPort.send(warnings);
this.warningsOutputPort.send(warnings);
}
use of org.iobserve.analysis.deployment.data.PCMDeployedEvent in project iobserve-analysis by research-iobserve.
the class AllocationFinishedStage method execute.
/**
* Forwards the deployment event after the allocation is finished.
*
* @throws Exception
* exception
*/
@Override
protected void execute() throws Exception {
final ResourceContainer resourceContainer = this.allocationFinishedInputPort.receive();
final PCMDeployedEvent deployedEvent = this.deployedInputPort.receive();
if (resourceContainer != null) {
this.allocations.add(resourceContainer);
}
if (deployedEvent != null) {
this.deployments.add(deployedEvent);
}
if (this.allocations.size() > 0 && this.deployments.size() > 0) {
final PCMDeployedEvent deployed = this.deployments.poll();
deployed.setResourceContainer(resourceContainer);
this.deployedOutputPort.send(deployed);
}
}
use of org.iobserve.analysis.deployment.data.PCMDeployedEvent in project iobserve-analysis by research-iobserve.
the class DeployPCMMapper method servletMapper.
private void servletMapper(final ServletDeployedEvent event) {
final String service = event.getService();
final String context = event.getContext();
// build the containerAllocationEvent
final String urlContext = context.replaceAll("\\.", "/");
final String url = "http://" + service + '/' + urlContext;
final Correspondent correspondent = this.correspondence.getCorrespondent(context).get();
if (correspondent != null) {
if (event instanceof Privacy_ServletDeployedEvent) {
this.outputPort.send(new PCMDeployedEvent(service, correspondent, url, ((Privacy_ServletDeployedEvent) event).getCountryCode()));
} else {
this.outputPort.send(new PCMDeployedEvent(service, correspondent, url, (short) 0));
}
} else {
DeployPCMMapper.LOGGER.info("No correspondent found for {}.", service);
}
}
use of org.iobserve.analysis.deployment.data.PCMDeployedEvent in project iobserve-analysis by research-iobserve.
the class DeployPCMMapper method ejbMapper.
private void ejbMapper(final EJBDeployedEvent event) {
final String service = event.getService();
final String context = event.getContext();
// build the url for the containerAllocationEvent
final String urlContext = context.replaceAll("\\.", "/");
final String url = "http://" + service + '/' + urlContext;
final Correspondent correspondent = this.correspondence.getCorrespondent(context).get();
if (correspondent != null) {
if (event instanceof Privacy_EJBDeployedEvent) {
this.outputPort.send(new PCMDeployedEvent(service, correspondent, url, ((Privacy_EJBDeployedEvent) event).getCountryCode()));
} else {
this.outputPort.send(new PCMDeployedEvent(service, correspondent, url, (short) 0));
}
} else {
DeployPCMMapper.LOGGER.warn("No correspondent found for {}.", service);
}
}
Aggregations