Search in sources :

Example 1 with Link

use of org.iobserve.model.test.storage.two.Link in project iobserve-analysis by research-iobserve.

the class EvalProxyDBTest method checkProxies.

private void checkProxies(final String label, final Two retrievedModelTwo) {
    System.out.println("Step " + label);
    for (final Link l : retrievedModelTwo.getLinks()) {
        final Other ref = l.getReference();
        System.out.println("Link " + ref.getName() + " " + ref.eIsProxy() + " -- " + ((BasicEObjectImpl) ref).eProxyURI());
    }
}
Also used : Link(org.iobserve.model.test.storage.two.Link) BasicEObjectImpl(org.eclipse.emf.ecore.impl.BasicEObjectImpl) Other(org.iobserve.model.test.storage.one.Other)

Example 2 with Link

use of org.iobserve.model.test.storage.two.Link in project iobserve-analysis by research-iobserve.

the class TestModelData method createLink.

/**
 * Create a link to an other object.
 *
 * @param other
 *            the other object
 * @return returns the link
 */
public static Link createLink(final Other other) {
    final Link link = TwoFactory.eINSTANCE.createLink();
    link.setReference(other);
    return link;
}
Also used : Link(org.iobserve.model.test.storage.two.Link)

Example 3 with Link

use of org.iobserve.model.test.storage.two.Link in project iobserve-analysis by research-iobserve.

the class ECoreNeo4JTest method createWithReferenceThenUpdate.

@Test
public void createWithReferenceThenUpdate() throws Exception {
    final Neo4JModelResource<Root> oneResource = ModelProviderTestUtils.prepareResource("createWithReferenceThenUpdate-one", this.prefix, OnePackage.eINSTANCE);
    final Neo4JModelResource<Two> twoResource = ModelProviderTestUtils.prepareResource("createWithReferenceThenUpdate-two", this.prefix, TwoPackage.eINSTANCE);
    oneResource.storeModelPartition(this.modelOne);
    twoResource.storeModelPartition(this.modelTwo);
    this.modelTwo.getLinks().add(TestModelData.createLink(TestModelData.SECOND_OTHER));
    twoResource.updatePartition(this.modelTwo);
    final Two two = twoResource.getModelRootNode(Two.class, TwoPackage.Literals.TWO);
    Assert.assertThat("Different number of links", two.getLinks().size(), Is.is(this.modelTwo.getLinks().size()));
    for (int i = 0; i < two.getLinks().size(); i++) {
        final Link newLink = two.getLinks().get(i);
        final Link oldLink = this.modelTwo.getLinks().get(i);
        oneResource.resolve(newLink.getReference());
        Assert.assertThat("Links differ", newLink.getReference().getName(), Is.is(oldLink.getReference().getName()));
    }
}
Also used : Root(org.iobserve.model.test.storage.one.Root) Two(org.iobserve.model.test.storage.two.Two) Link(org.iobserve.model.test.storage.two.Link) Test(org.junit.Test)

Example 4 with Link

use of org.iobserve.model.test.storage.two.Link in project iobserve-analysis by research-iobserve.

the class EvalProxyTest method checkProxies.

private void checkProxies(final String label, final Resource resource) {
    System.out.println("Step " + label);
    for (final EObject o : resource.getContents()) {
        if (o instanceof Two) {
            for (final EObject l : ((Two) o).getLinks()) {
                if (l instanceof Link) {
                    final Other ref = ((Link) l).getReference();
                    System.out.println("Link " + ref.getName() + " " + ref.eIsProxy() + " -- " + ((BasicEObjectImpl) ref).eProxyURI());
                }
            }
        }
    }
}
Also used : EObject(org.eclipse.emf.ecore.EObject) Two(org.iobserve.model.test.storage.two.Two) Link(org.iobserve.model.test.storage.two.Link) BasicEObjectImpl(org.eclipse.emf.ecore.impl.BasicEObjectImpl) Other(org.iobserve.model.test.storage.one.Other)

Aggregations

Link (org.iobserve.model.test.storage.two.Link)4 BasicEObjectImpl (org.eclipse.emf.ecore.impl.BasicEObjectImpl)2 Other (org.iobserve.model.test.storage.one.Other)2 Two (org.iobserve.model.test.storage.two.Two)2 EObject (org.eclipse.emf.ecore.EObject)1 Root (org.iobserve.model.test.storage.one.Root)1 Test (org.junit.Test)1