Search in sources :

Example 6 with PCMUndeployedEvent

use of org.iobserve.analysis.deployment.data.PCMUndeployedEvent in project iobserve-analysis by research-iobserve.

the class UndeploymentVisualizationStageTest method setUp.

/**
 * Initialize test data and stub necessary method calls.
 *
 * @throws MalformedURLException
 *             if the creation of the URL fails.
 * @throws DBException
 */
@Before
public void setUp() throws MalformedURLException, DBException {
    final URL changelogURL = new URL("http://" + UndeploymentVisualizationStageTest.OUTPUT_HOSTNAME + ":" + UndeploymentVisualizationStageTest.OUTPUT_PORT + "/v1/systems/" + UndeploymentVisualizationStageTest.SYSTEM_ID + "/changelogs");
    this.undeploymentVisualizationStage = new UndeploymentVisualizationStage(changelogURL, UndeploymentVisualizationStageTest.SYSTEM_ID, this.mockedResourceContainerModelProvider, this.mockedSystemModelGraphProvider);
    // TODO reimplement for current filters
    /**
     * test correspondent
     */
    // UndeploymentVisualizationStageTest.testCorrespondent =
    // CorrespondentFactory.newInstance("test.org.pcm.entity",
    // "testPcmEntityId", "testPcmOperationName", "testPcmOperationId");
    // UndeploymentVisualizationStageTest.optTestCorrespondent = Optional
    /**
     * test events
     */
    final String urlContext = UndeploymentVisualizationStageTest.CONTEXT.replaceAll("\\.", "/");
    final String url = "http://" + UndeploymentVisualizationStageTest.SERVICE + '/' + urlContext;
    final PCMUndeployedEvent undeployedEvent = new PCMUndeployedEvent(UndeploymentVisualizationStageTest.SERVICE, null, /* AssemblyContextDataFactory.ASSEMBLY_CONTEXT */
    this.testResourceContainer, 0);
    /**
     * input events
     */
    this.inputEvents.add(undeployedEvent);
    /**
     * test resource container
     */
    this.testResourceContainer = ResourceenvironmentFactory.eINSTANCE.createResourceContainer();
    this.testResourceContainer.setId(UndeploymentVisualizationStageTest.TEST_NODE_ID);
    this.testResourceContainers.add(this.testResourceContainer);
    /**
     * test assembly context
     */
    final AssemblyContext testAssemblyContext = CompositionFactory.eINSTANCE.createAssemblyContext();
    testAssemblyContext.setId("test_serviceId");
    testAssemblyContext.setEntityName("test_serviceName");
    this.testAssemblyContexts.add(testAssemblyContext);
    // stubbing
    Mockito.when(this.mockedResourceContainerModelProvider.findObjectsByTypeAndProperty(ResourceContainer.class, ResourceenvironmentPackage.Literals.RESOURCE_CONTAINER, "entityName", UndeploymentVisualizationStageTest.SERVICE)).thenReturn(this.testResourceContainers);
// TODO fix this
// Mockito.when(this.mockedCorrespondenceModel.getCorrespondent(UndeploymentVisualizationStageTest.CONTEXT))
// .thenReturn(UndeploymentVisualizationStageTest.optTestCorrespondent);
// final String asmContextName =
// UndeploymentVisualizationStageTest.testCorrespondent.getPcmEntityName() + "_"
// + UndeploymentVisualizationStageTest.SERVICE;
// Mockito.when(this.mockedSystemModelGraphProvider.findObjectsByTypeAndName(AssemblyContext.class,
// CompositionPackage.Literals.ASSEMBLY_CONTEXT, "entityName", asmContextName))
// .thenReturn(this.testAssemblyContexts);
}
Also used : UndeploymentVisualizationStage(org.iobserve.analysis.service.updater.UndeploymentVisualizationStage) PCMUndeployedEvent(org.iobserve.analysis.deployment.data.PCMUndeployedEvent) AssemblyContext(org.palladiosimulator.pcm.core.composition.AssemblyContext) URL(java.net.URL) Before(org.junit.Before)

Example 7 with PCMUndeployedEvent

use of org.iobserve.analysis.deployment.data.PCMUndeployedEvent in project iobserve-analysis by research-iobserve.

the class DataProtectionWarner method execute.

@Override
protected void execute() throws Exception {
    final PCMDeployedEvent deployedEvent = this.deployedInputPort.receive();
    final PCMUndeployedEvent undeployedEvent = this.undeployedInputPort.receive();
    if (deployedEvent != null) {
        // ExperimentLoggingUtils.measureDeploymentEvent(deployedEvent, ObservationPoint.PRIVACY_WARNER_ENTRY);
        this.logger.debug("Received Deployment");
        this.logger.debug("CountryCode: " + deployedEvent.getCountryCode());
        this.logger.debug("Service: " + deployedEvent.getService());
        this.performPrivacyEvaluation(deployedEvent);
        this.logger.debug("Deployment processed");
    // ExperimentLoggingUtils.measureDeploymentEvent(deployedEvent, ObservationPoint.PRIVACY_WARNER_EXIT);
    }
    if (undeployedEvent != null) {
        // ExperimentLoggingUtils.measureDeploymentEvent(undeployedEvent, ObservationPoint.PRIVACY_WARNER_ENTRY);
        this.logger.debug("Received undeployment");
        this.performPrivacyEvaluation(undeployedEvent);
        this.logger.debug("Deployment processed");
    // ExperimentLoggingUtils.measureDeploymentEvent(undeployedEvent, ObservationPoint.PRIVACY_WARNER_EXIT);
    }
}
Also used : PCMDeployedEvent(org.iobserve.analysis.deployment.data.PCMDeployedEvent) PCMUndeployedEvent(org.iobserve.analysis.deployment.data.PCMUndeployedEvent)

Aggregations

PCMUndeployedEvent (org.iobserve.analysis.deployment.data.PCMUndeployedEvent)7 AssemblyContext (org.palladiosimulator.pcm.core.composition.AssemblyContext)3 URL (java.net.URL)2 PCMDeployedEvent (org.iobserve.analysis.deployment.data.PCMDeployedEvent)2 Correspondent (org.iobserve.model.correspondence.Correspondent)2 Before (org.junit.Before)2 UndeploymentVisualizationStage (org.iobserve.analysis.service.updater.UndeploymentVisualizationStage)1 AssemblyEntry (org.iobserve.model.correspondence.AssemblyEntry)1 Warnings (org.iobserve.stages.data.Warnings)1 ResourceContainer (org.palladiosimulator.pcm.resourceenvironment.ResourceContainer)1