Search in sources :

Example 1 with RepositoryFactory

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

the class RepositoryModelProviderTest method createThenUpdateThenReadUpdated.

@Override
@Test
public void createThenUpdateThenReadUpdated() throws NodeLookupException, DBException {
    final Neo4JModelResource<Repository> resource = ModelProviderTestUtils.prepareResource("createThenUpdateThenReadUpdated", this.prefix, this.ePackage);
    final Interface payInterface = RepositoryModelDataFactory.findInterfaceByName(this.repository, RepositoryModelDataFactory.PAYMENT_INTERFACE);
    final RepositoryComponent paymentComponent = RepositoryModelDataFactory.findComponentByName(this.repository, RepositoryModelDataFactory.PAYMENT_COMPONENT);
    resource.storeModelPartition(this.testModel);
    // Update the model by renaming and replacing the payment method
    this.testModel.setEntityName("MyVideoOnDemandService");
    final OperationProvidedRole providedPayOperation = ((RepositoryFactory) this.ePackage.getEFactoryInstance()).createOperationProvidedRole();
    providedPayOperation.setEntityName("payPalPayment");
    providedPayOperation.setProvidedInterface__OperationProvidedRole((OperationInterface) payInterface);
    paymentComponent.getProvidedRoles_InterfaceProvidingEntity().clear();
    paymentComponent.getProvidedRoles_InterfaceProvidingEntity().add(providedPayOperation);
    resource.updatePartition(this.testModel);
    final Repository readModel = resource.getModelRootNode(Repository.class, RepositoryPackage.Literals.REPOSITORY);
    Assert.assertTrue(this.equalityHelper.comparePartition(this.testModel, readModel, readModel.eClass()));
    resource.getGraphDatabaseService().shutdown();
}
Also used : Repository(org.palladiosimulator.pcm.repository.Repository) OperationProvidedRole(org.palladiosimulator.pcm.repository.OperationProvidedRole) RepositoryFactory(org.palladiosimulator.pcm.repository.RepositoryFactory) RepositoryComponent(org.palladiosimulator.pcm.repository.RepositoryComponent) OperationInterface(org.palladiosimulator.pcm.repository.OperationInterface) Interface(org.palladiosimulator.pcm.repository.Interface) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 Interface (org.palladiosimulator.pcm.repository.Interface)1 OperationInterface (org.palladiosimulator.pcm.repository.OperationInterface)1 OperationProvidedRole (org.palladiosimulator.pcm.repository.OperationProvidedRole)1 Repository (org.palladiosimulator.pcm.repository.Repository)1 RepositoryComponent (org.palladiosimulator.pcm.repository.RepositoryComponent)1 RepositoryFactory (org.palladiosimulator.pcm.repository.RepositoryFactory)1