Examples of ECollection


Examples of org.eclipselabs.emodeling.ECollection

  public static <T extends EObject> T getObject(ResourceSet resourceSet, String db, String collection)
  {
    Resource resource = resourceSet.getResource(URI.createURI("mongodb://localhost/" + db + "/" + collection + "/?"), true);
    assertThat(resource, is(notNullValue()));

    ECollection eCollection = (ECollection) resource.getContents().get(0);

    if (eCollection.getValues().isEmpty())
      return null;

    assertThat(eCollection.getValues().size(), is(1));
    return (T) eCollection.getValues().get(0);
  }
View Full Code Here

Examples of org.eclipselabs.emodeling.ECollection

  public static <T extends EObject> Collection<T> getObjects(ResourceSet resourceSet, String db, String collection)
  {
    Resource resource = resourceSet.getResource(URI.createURI("mongodb://localhost/" + db + "/" + collection + "/?"), true);
    assertThat(resource, is(notNullValue()));

    ECollection eCollection = (ECollection) resource.getContents().get(0);
    ArrayList<T> objects = new ArrayList<T>();

    for (EObject object : eCollection.getValues())
      objects.add((T) object);

    return objects;
  }
View Full Code Here

Examples of org.eclipselabs.emodeling.ECollection

    Resource resource = resourceSet.getResource(createQueryURI(ModelPackage.Literals.LIBRARY, "_id=='" + libraryObject.get(ID_KEY) + "'"), true);
    assertThat(resource, is(notNullValue()));
    assertThat(resource.getContents().size(), is(1));

    ECollection eCollection = (ECollection) resource.getContents().get(0);
    assertThat(eCollection.getValues().size(), is(1));
    Library library = (Library) eCollection.getValues().get(0);

    assertThat(library.getLocation(), is(notNullValue()));
    assertThat(library.getLocation().getAddress(), is("Wastelands"));
  }
View Full Code Here

Examples of org.eclipselabs.emodeling.ECollection

    ResourceSet resourceSet = createResourceSet();
    Resource resource = resourceSet.getResource(createQueryURI(org.eclipselabs.mongoemf.junit.model.ModelPackage.Literals.PRIMARY_OBJECT, "idAttribute=='" + id + "'"), true);
    assertThat(resource, is(notNullValue()));
    assertThat(resource.getContents().size(), is(1));

    ECollection eCollection = (ECollection) resource.getContents().get(0);
    assertThat(eCollection.getValues().size(), is(1));
  }
View Full Code Here

Examples of org.eclipselabs.emodeling.ECollection

    Resource resource = resourceSet.getResource(createQueryURI(ModelPackage.Literals.LIBRARY, ""), true);
    assertThat(resource, is(notNullValue()));
    assertThat(resource.getContents().size(), is(1));

    ECollection eCollection = (ECollection) resource.getContents().get(0);
    assertThat(eCollection.getValues().size(), is(2));
    Library library1 = (Library) eCollection.getValues().get(0);
    Library library2 = (Library) eCollection.getValues().get(1);

    assertThat(library1.getLocation(), is(notNullValue()));
    assertThat(library1.getLocation().getAddress(), is("Wastelands"));

    assertThat(library2.getLocation(), is(notNullValue()));
View Full Code Here

Examples of org.eclipselabs.emodeling.ECollection

    Resource resource = resourceSet.getResource(createQueryURI(ModelPackage.Literals.LIBRARY, "books.title == 'Gunslinger'"), true);
    assertThat(resource, is(notNullValue()));
    assertThat(resource.getContents().size(), is(1));

    ECollection eCollection = (ECollection) resource.getContents().get(0);
    assertThat(eCollection.getValues().size(), is(2));
    Library library1 = (Library) eCollection.getValues().get(0);
    Library library2 = (Library) eCollection.getValues().get(1);

    assertThat(library1.getLocation(), is(notNullValue()));
    assertThat(library1.getLocation().getAddress(), is("Wastelands"));

    assertThat(library2.getLocation(), is(notNullValue()));
View Full Code Here

Examples of org.eclipselabs.emodeling.ECollection

    Resource resource = resourceSet.getResource(createQueryURI(ModelPackage.Literals.LIBRARY, "(books.title == 'Gunslinger') || (books.title == 'The Shining') || (books.title == 'Thinner')"), true);
    assertThat(resource, is(notNullValue()));
    assertThat(resource.getContents().size(), is(1));

    ECollection eCollection = (ECollection) resource.getContents().get(0);
    assertThat(eCollection.getValues().size(), is(3));
    Library library1 = (Library) eCollection.getValues().get(0);
    Library library2 = (Library) eCollection.getValues().get(1);
    Library library3 = (Library) eCollection.getValues().get(2);

    assertThat(library1.getLocation(), is(notNullValue()));
    assertThat(library1.getLocation().getAddress(), is("Wastelands"));

    assertThat(library2.getLocation(), is(notNullValue()));
View Full Code Here

Examples of org.eclipselabs.emodeling.ECollection

    Resource resource = resourceSet.getResource(createQueryURI(ModelPackage.Literals.LIBRARY, "(books.title == 'Gunslinger') && (books.title == 'The Shining') && (books.title == 'Thinner')"), true);
    assertThat(resource, is(notNullValue()));
    assertThat(resource.getContents().size(), is(1));

    ECollection eCollection = (ECollection) resource.getContents().get(0);
    assertThat(eCollection.getValues().size(), is(1));
    Library library1 = (Library) eCollection.getValues().get(0);

    assertThat(library1.getLocation(), is(notNullValue()));
    assertThat(library1.getLocation().getAddress(), is("Wetlands"));
  }
View Full Code Here

Examples of org.eclipselabs.emodeling.ECollection

    Resource resource = resourceSet.getResource(createQueryURI(ModelPackage.Literals.PERSON, "name == null"), true);
    assertThat(resource, is(notNullValue()));
    assertThat(resource.getContents().size(), is(1));

    ECollection eCollection = (ECollection) resource.getContents().get(0);
    assertThat(eCollection.getValues().size(), is(1));
    Person person = (Person) eCollection.getValues().get(0);
    assertThat(person.getName(), is((String) null));
  }
View Full Code Here

Examples of org.eclipselabs.emodeling.ECollection

    Resource resource = resourceSet.getResource(createQueryURI(ModelPackage.Literals.PERSON, "name != null"), true);
    assertThat(resource, is(notNullValue()));
    assertThat(resource.getContents().size(), is(1));

    ECollection eCollection = (ECollection) resource.getContents().get(0);
    assertThat(eCollection.getValues().size(), is(1));
    Person person = (Person) eCollection.getValues().get(0);
    assertThat(person.getName(), is("Stephen King"));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.