Search in sources :

Example 1 with UndeploymentVisualizationStage

use of org.iobserve.analysis.service.updater.UndeploymentVisualizationStage 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)

Aggregations

URL (java.net.URL)1 PCMUndeployedEvent (org.iobserve.analysis.deployment.data.PCMUndeployedEvent)1 UndeploymentVisualizationStage (org.iobserve.analysis.service.updater.UndeploymentVisualizationStage)1 Before (org.junit.Before)1 AssemblyContext (org.palladiosimulator.pcm.core.composition.AssemblyContext)1