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