Search in sources :

Example 1 with PCMDeployedEvent

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);
}
Also used : PCMDeployedEvent(org.iobserve.analysis.deployment.data.PCMDeployedEvent) ArrayList(java.util.ArrayList) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 2 with PCMDeployedEvent

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);
}
Also used : PCMDeployedEvent(org.iobserve.analysis.deployment.data.PCMDeployedEvent) PCMUndeployedEvent(org.iobserve.analysis.deployment.data.PCMUndeployedEvent) Warnings(org.iobserve.stages.data.Warnings)

Example 3 with PCMDeployedEvent

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);
    }
}
Also used : PCMDeployedEvent(org.iobserve.analysis.deployment.data.PCMDeployedEvent) ResourceContainer(org.palladiosimulator.pcm.resourceenvironment.ResourceContainer)

Example 4 with PCMDeployedEvent

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);
    }
}
Also used : Privacy_ServletDeployedEvent(org.iobserve.common.record.Privacy_ServletDeployedEvent) PCMDeployedEvent(org.iobserve.analysis.deployment.data.PCMDeployedEvent) Correspondent(org.iobserve.model.correspondence.Correspondent)

Example 5 with PCMDeployedEvent

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);
    }
}
Also used : PCMDeployedEvent(org.iobserve.analysis.deployment.data.PCMDeployedEvent) Correspondent(org.iobserve.model.correspondence.Correspondent) Privacy_EJBDeployedEvent(org.iobserve.common.record.Privacy_EJBDeployedEvent)

Aggregations

PCMDeployedEvent (org.iobserve.analysis.deployment.data.PCMDeployedEvent)7 ArrayList (java.util.ArrayList)2 Correspondent (org.iobserve.model.correspondence.Correspondent)2 Test (org.junit.Test)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 URL (java.net.URL)1 DeployPCMMapper (org.iobserve.analysis.deployment.DeployPCMMapper)1 PCMUndeployedEvent (org.iobserve.analysis.deployment.data.PCMUndeployedEvent)1 Privacy_EJBDeployedEvent (org.iobserve.common.record.Privacy_EJBDeployedEvent)1 Privacy_ServletDeployedEvent (org.iobserve.common.record.Privacy_ServletDeployedEvent)1 Warnings (org.iobserve.stages.data.Warnings)1 Before (org.junit.Before)1 ResourceContainer (org.palladiosimulator.pcm.resourceenvironment.ResourceContainer)1