Search in sources :

Example 1 with ResourceContainer

use of org.palladiosimulator.pcm.resourceenvironment.ResourceContainer in project Palladio-Editors-Sirius by PalladioSimulator.

the class ReconnectLinkingResourceOfConnector method execute.

@Override
public void execute(Collection<? extends EObject> selection, Map<String, Object> parameters) {
    DNodeContainer otherEnd = (DNodeContainer) parameters.get("otherEnd");
    ResourceContainer element = (ResourceContainer) otherEnd.getTarget();
    LinkingResource source = (LinkingResource) parameters.get("source");
    LinkingResource target = (LinkingResource) parameters.get("target");
    source.getConnectedResourceContainers_LinkingResource().remove(element);
    target.getConnectedResourceContainers_LinkingResource().add(element);
}
Also used : DNodeContainer(org.eclipse.sirius.diagram.DNodeContainer) LinkingResource(org.palladiosimulator.pcm.resourceenvironment.LinkingResource) ResourceContainer(org.palladiosimulator.pcm.resourceenvironment.ResourceContainer)

Example 2 with ResourceContainer

use of org.palladiosimulator.pcm.resourceenvironment.ResourceContainer in project Palladio-Editors-Sirius by PalladioSimulator.

the class RemoveConnectorAction method execute.

@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
    DEdge edge = (DEdge) parameters.get("elementView");
    LinkingResource linkingResource = (LinkingResource) edge.getTarget();
    EdgeTarget targetNode = edge.getTargetNode();
    ResourceContainer resourceContainer = (ResourceContainer) (((DDiagramElement) targetNode).getTarget());
    linkingResource.getConnectedResourceContainers_LinkingResource().remove(resourceContainer);
}
Also used : LinkingResource(org.palladiosimulator.pcm.resourceenvironment.LinkingResource) EdgeTarget(org.eclipse.sirius.diagram.EdgeTarget) DDiagramElement(org.eclipse.sirius.diagram.DDiagramElement) DEdge(org.eclipse.sirius.diagram.DEdge) ResourceContainer(org.palladiosimulator.pcm.resourceenvironment.ResourceContainer)

Example 3 with ResourceContainer

use of org.palladiosimulator.pcm.resourceenvironment.ResourceContainer in project iobserve-analysis by research-iobserve.

the class ResourceEnvironmentModelProviderTest method createThenReadByType.

@Override
@Test
public void createThenReadByType() {
    final ModelProvider<ResourceEnvironment> modelProvider = new ModelProvider<>(ResourceEnvironmentModelProviderTest.graph);
    final ModelProvider<ResourceContainer> modelProvider2 = new ModelProvider<>(ResourceEnvironmentModelProviderTest.graph);
    final ResourceEnvironment writtenModel = new TestModelBuilder().getResourceEnvironment();
    final List<ResourceContainer> writtenContainers = writtenModel.getResourceContainer_ResourceEnvironment();
    final List<String> readIds;
    // Create complete model but only read ResourceContainers because ResourceEnvironment itself
    // has no id
    modelProvider.createComponent(writtenModel);
    readIds = modelProvider2.readComponentByType(ResourceContainer.class);
    Assert.assertTrue(readIds.size() == writtenContainers.size());
    for (int i = 0; i < readIds.size(); i++) {
        boolean foundEqualElem = false;
        for (int j = 0; j < readIds.size(); j++) {
            if (writtenContainers.get(i).getId().equals(readIds.get(j))) {
                foundEqualElem = true;
            }
        }
        Assert.assertTrue(foundEqualElem);
    }
}
Also used : ResourceEnvironment(org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment) ResourceContainer(org.palladiosimulator.pcm.resourceenvironment.ResourceContainer) Test(org.junit.Test)

Example 4 with ResourceContainer

use of org.palladiosimulator.pcm.resourceenvironment.ResourceContainer in project iobserve-analysis by research-iobserve.

the class ResourceEnvironmentModelProviderTest method createThenDeleteComponentAndDatatypes.

@Override
@Test
public void createThenDeleteComponentAndDatatypes() {
    final ModelProvider<ResourceEnvironment> modelProvider = new ModelProvider<>(ResourceEnvironmentModelProviderTest.graph);
    final ResourceEnvironment writtenModel = new TestModelBuilder().getResourceEnvironment();
    modelProvider.createComponent(writtenModel);
    Assert.assertFalse(IModelProviderTest.isGraphEmpty(modelProvider));
    for (final LinkingResource lr : writtenModel.getLinkingResources__ResourceEnvironment()) {
        new ModelProvider<LinkingResource>(ResourceEnvironmentModelProviderTest.graph).deleteComponentAndDatatypes(LinkingResource.class, lr.getId(), true);
    }
    for (final ResourceContainer rc : writtenModel.getResourceContainer_ResourceEnvironment()) {
        new ModelProvider<ResourceContainer>(ResourceEnvironmentModelProviderTest.graph).deleteComponentAndDatatypes(ResourceContainer.class, rc.getId(), true);
    }
    Assert.assertTrue(IModelProviderTest.isGraphEmpty(modelProvider));
}
Also used : ResourceEnvironment(org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment) LinkingResource(org.palladiosimulator.pcm.resourceenvironment.LinkingResource) ResourceContainer(org.palladiosimulator.pcm.resourceenvironment.ResourceContainer) Test(org.junit.Test)

Example 5 with ResourceContainer

use of org.palladiosimulator.pcm.resourceenvironment.ResourceContainer in project iobserve-analysis by research-iobserve.

the class ResourceEnvironmentModelProviderTest method createThenReadById.

@Override
@Test
public void createThenReadById() {
    final ModelProvider<ResourceEnvironment> modelProvider = new ModelProvider<>(ResourceEnvironmentModelProviderTest.graph);
    final ModelProvider<ResourceContainer> modelProvider2 = new ModelProvider<>(ResourceEnvironmentModelProviderTest.graph);
    final ResourceEnvironment writtenModel = new TestModelBuilder().getResourceEnvironment();
    final ResourceContainer writtenContainer = writtenModel.getResourceContainer_ResourceEnvironment().get(0);
    final ResourceContainer readContainer;
    // Create complete model but only read a ResourceContainer, because ResourceEnvironment
    // itself has no id
    modelProvider.createComponent(writtenModel);
    readContainer = modelProvider2.readOnlyComponentById(ResourceContainer.class, writtenContainer.getId());
    Assert.assertTrue(this.equalityHelper.equals(writtenContainer, readContainer));
}
Also used : ResourceEnvironment(org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment) ResourceContainer(org.palladiosimulator.pcm.resourceenvironment.ResourceContainer) Test(org.junit.Test)

Aggregations

ResourceContainer (org.palladiosimulator.pcm.resourceenvironment.ResourceContainer)35 ResourceEnvironment (org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment)16 LinkingResource (org.palladiosimulator.pcm.resourceenvironment.LinkingResource)8 Test (org.junit.Test)7 AllocationContext (org.palladiosimulator.pcm.allocation.AllocationContext)7 ResourceContainerCloud (org.palladiosimulator.pcm.cloud.pcmcloud.resourceenvironmentcloud.ResourceContainerCloud)6 ComputeService (org.jclouds.compute.ComputeService)5 Allocation (org.palladiosimulator.pcm.allocation.Allocation)5 AssemblyContext (org.palladiosimulator.pcm.core.composition.AssemblyContext)5 URL (java.net.URL)3 ContainerAllocationEvent (org.iobserve.common.record.ContainerAllocationEvent)3 UnknownObjectException (java.rmi.activation.UnknownObjectException)2 ArrayList (java.util.ArrayList)2 SystemadaptationFactory (org.iobserve.planning.systemadaptation.SystemadaptationFactory)2 ProcessingResourceSpecification (org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification)2 System (org.palladiosimulator.pcm.system.System)2 File (java.io.File)1 URI (org.eclipse.emf.common.util.URI)1 DDiagramElement (org.eclipse.sirius.diagram.DDiagramElement)1 DEdge (org.eclipse.sirius.diagram.DEdge)1