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);
}
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);
}
}
Aggregations