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