Search in sources :

Example 21 with OperationProvidedRole

use of org.palladiosimulator.pcm.repository.OperationProvidedRole in project iobserve-analysis by research-iobserve.

the class SystemModelProviderTest method createThenUpdateThenReadUpdated.

@Override
@Test
public void createThenUpdateThenReadUpdated() throws NodeLookupException, DBException {
    final Neo4JModelResource<System> resource = ModelProviderTestUtils.prepareResource("createThenUpdateThenReadUpdated", this.prefix, this.ePackage);
    resource.storeModelPartition(this.testModel);
    // Update the model by renaming and removing the business context
    this.testModel.setEntityName("MyVideoOnDemandService");
    final AssemblyContext businessQueryAssemblyContext = SystemDataFactory.findAssemblyContext(this.system, SystemDataFactory.BUSINESS_ORDER_ASSEMBLY_CONTEXT);
    final Connector businessQueryConnector = SystemDataFactory.findConnector(this.system, SystemDataFactory.BUSINESS_QUERY_CONNECTOR);
    final Connector businessPayConnector = SystemDataFactory.findConnector(this.system, SystemDataFactory.BUSINESS_PAY_CONNECTOR);
    this.testModel.getAssemblyContexts__ComposedStructure().remove(businessQueryAssemblyContext);
    this.testModel.getConnectors__ComposedStructure().remove(businessQueryConnector);
    this.testModel.getConnectors__ComposedStructure().remove(businessPayConnector);
    // Replace the business context by a context for groups of people placing an order
    final AssemblyContext sharedOrderContext = CompositionFactory.eINSTANCE.createAssemblyContext();
    sharedOrderContext.setEntityName("sharedOrderContext_org.myvideoondemandservice.orderComponent");
    sharedOrderContext.setEncapsulatedComponent__AssemblyContext(RepositoryModelDataFactory.findComponentByName(this.repository, RepositoryModelDataFactory.ORDER_COMPONENT));
    final AssemblyContext queryInputAssemblyContext = SystemDataFactory.findAssemblyContext(this.system, SystemDataFactory.QUERY_ASSEMBLY_CONTEXT);
    final OperationProvidedRole providedInputRole = RepositoryModelDataFactory.findProvidedRole(sharedOrderContext.getEncapsulatedComponent__AssemblyContext(), RepositoryModelDataFactory.QUERY_PROVIDED_ROLE);
    final OperationRequiredRole requiredInputRole = RepositoryModelDataFactory.findRequiredRole(queryInputAssemblyContext.getEncapsulatedComponent__AssemblyContext(), RepositoryModelDataFactory.QUERY_REQUIRED_ROLE);
    final AssemblyConnector sharedQueryInputConnector = CompositionFactory.eINSTANCE.createAssemblyConnector();
    sharedQueryInputConnector.setEntityName("sharedQueryInput");
    sharedQueryInputConnector.setProvidedRole_AssemblyConnector(providedInputRole);
    sharedQueryInputConnector.setRequiredRole_AssemblyConnector(requiredInputRole);
    sharedQueryInputConnector.setProvidingAssemblyContext_AssemblyConnector(sharedOrderContext);
    sharedQueryInputConnector.setRequiringAssemblyContext_AssemblyConnector(queryInputAssemblyContext);
    final AssemblyContext paymentAssemblyContext = SystemDataFactory.findAssemblyContext(this.system, SystemDataFactory.PAYMENT_ASSEMBLY_CONTEXT);
    final OperationProvidedRole providedPayRole = RepositoryModelDataFactory.findProvidedRole(paymentAssemblyContext.getEncapsulatedComponent__AssemblyContext(), RepositoryModelDataFactory.PAYMENT_PROVIDED_ROLE);
    final OperationRequiredRole requiredPayRole = RepositoryModelDataFactory.findRequiredRole(sharedOrderContext.getEncapsulatedComponent__AssemblyContext(), RepositoryModelDataFactory.PAYMENT_REQUIRED_ROLE);
    final AssemblyConnector sharedPayConnector = CompositionFactory.eINSTANCE.createAssemblyConnector();
    sharedPayConnector.setEntityName("sharedPayment");
    sharedPayConnector.setProvidedRole_AssemblyConnector(providedPayRole);
    sharedPayConnector.setRequiredRole_AssemblyConnector(requiredPayRole);
    sharedPayConnector.setProvidingAssemblyContext_AssemblyConnector(paymentAssemblyContext);
    sharedPayConnector.setRequiringAssemblyContext_AssemblyConnector(sharedOrderContext);
    this.testModel.getAssemblyContexts__ComposedStructure().add(sharedOrderContext);
    this.testModel.getConnectors__ComposedStructure().add(sharedQueryInputConnector);
    this.testModel.getConnectors__ComposedStructure().add(sharedPayConnector);
    resource.updatePartition(this.testModel);
    final System readModel = resource.getModelRootNode(System.class, this.eClass);
    Assert.assertTrue(this.equalityHelper.comparePartition(this.testModel, readModel, readModel.eClass()));
}
Also used : AssemblyConnector(org.palladiosimulator.pcm.core.composition.AssemblyConnector) Connector(org.palladiosimulator.pcm.core.composition.Connector) AssemblyConnector(org.palladiosimulator.pcm.core.composition.AssemblyConnector) OperationProvidedRole(org.palladiosimulator.pcm.repository.OperationProvidedRole) AssemblyContext(org.palladiosimulator.pcm.core.composition.AssemblyContext) System(org.palladiosimulator.pcm.system.System) OperationRequiredRole(org.palladiosimulator.pcm.repository.OperationRequiredRole) Test(org.junit.Test)

Example 22 with OperationProvidedRole

use of org.palladiosimulator.pcm.repository.OperationProvidedRole in project iobserve-analysis by research-iobserve.

the class DataProtectionWarner method addConnectors.

/**
 * Adding connections between components to the privacy graph.
 *
 * @param graph
 *            graph
 * @throws DBException
 *             on db errors during resolving objects
 * @throws InvocationException
 *             on other errors during resolving objects
 */
private void addConnectors(final PrivacyGraph graph) throws InvocationException, DBException {
    for (final Connector connector : this.systemRootElement.getConnectors__ComposedStructure()) {
        if (connector instanceof AssemblyConnector) {
            final AssemblyConnector assemblyConnector = (AssemblyConnector) connector;
            // Providing Component
            final AssemblyContext provididingAssemblyContext = assemblyConnector.getProvidingAssemblyContext_AssemblyConnector();
            final RepositoryComponent providingComponent = this.repositoryResource.resolve(provididingAssemblyContext.getEncapsulatedComponent__AssemblyContext());
            // Requiring Component
            final AssemblyContext requiringAssemblyContext = assemblyConnector.getRequiringAssemblyContext_AssemblyConnector();
            final RepositoryComponent requiringComponent = this.repositoryResource.resolve(requiringAssemblyContext.getEncapsulatedComponent__AssemblyContext());
            if (providingComponent != null && requiringComponent != null) {
                final OperationProvidedRole providedRole = this.repositoryResource.resolve(assemblyConnector.getProvidedRole_AssemblyConnector());
                final String interfaceName = this.shortName(providedRole.getEntityName());
                // Check Interface Name in Repository and add Edge
                final OperationInterface operationInterface = this.interfaces.get(interfaceName);
                this.computePrivacyLevelsAndAddEdge(graph, operationInterface, providingComponent, requiringComponent);
            } else {
                this.logger.info("Either Providing: " + providingComponent + " was Null or Requiring: " + requiringComponent + " was Null.");
            }
        }
    }
}
Also used : AssemblyConnector(org.palladiosimulator.pcm.core.composition.AssemblyConnector) Connector(org.palladiosimulator.pcm.core.composition.Connector) AssemblyConnector(org.palladiosimulator.pcm.core.composition.AssemblyConnector) OperationProvidedRole(org.palladiosimulator.pcm.repository.OperationProvidedRole) AssemblyContext(org.palladiosimulator.pcm.core.composition.AssemblyContext) RepositoryComponent(org.palladiosimulator.pcm.repository.RepositoryComponent) OperationInterface(org.palladiosimulator.pcm.repository.OperationInterface)

Aggregations

OperationProvidedRole (org.palladiosimulator.pcm.repository.OperationProvidedRole)22 OperationInterface (org.palladiosimulator.pcm.repository.OperationInterface)10 ProvidedRole (org.palladiosimulator.pcm.repository.ProvidedRole)9 RepositoryComponent (org.palladiosimulator.pcm.repository.RepositoryComponent)9 OperationRequiredRole (org.palladiosimulator.pcm.repository.OperationRequiredRole)7 AssemblyContext (org.palladiosimulator.pcm.core.composition.AssemblyContext)5 Interface (org.palladiosimulator.pcm.repository.Interface)5 OperationSignature (org.palladiosimulator.pcm.repository.OperationSignature)5 Repository (org.palladiosimulator.pcm.repository.Repository)5 RequiredRole (org.palladiosimulator.pcm.repository.RequiredRole)5 Test (org.junit.Test)4 AssemblyConnector (org.palladiosimulator.pcm.core.composition.AssemblyConnector)4 ArrayList (java.util.ArrayList)3 Connector (org.palladiosimulator.pcm.core.composition.Connector)3 BasicComponent (org.palladiosimulator.pcm.repository.BasicComponent)3 EntryLevelSystemCall (org.palladiosimulator.pcm.usagemodel.EntryLevelSystemCall)3 EObject (org.eclipse.emf.ecore.EObject)2 System (org.palladiosimulator.pcm.system.System)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1