Examples of ECollection


Examples of org.eclipselabs.emodeling.ECollection

    Resource resource = resourceSet.getResource(createQueryURI(ModelPackage.Literals.PERSON, "(name != 'Dean Kontz') && (name != 'Stephen King') && (name != 'Bryan Hunt')"), 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("Ed Merks"));
  }
View Full Code Here

Examples of org.eclipselabs.emodeling.ECollection

    Resource resource = resourceSet.getResource(createQueryURI(ModelPackage.Literals.PERSON, "name=='Stephen King'"), 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 author = (Person) eCollection.getValues().get(0);

    assertThat(author.getName(), is("Stephen King"));
  }
View Full Code Here

Examples of org.eclipselabs.emodeling.ECollection

    resource.getContents().add(eTypes);
    resource.save(null);

    resourceSet = createResourceSet();
    resource = resourceSet.getResource(createQueryURI(org.eclipselabs.mongoemf.junit.model.ModelPackage.Literals.ETYPES, "eInt == 0"), true);
    ECollection eCollection = (ECollection) resource.getContents().get(0);
    assertThat(eCollection.getValues().size(), is(1));
    ETypes target = (ETypes) eCollection.getValues().get(0);
    assertThat(target.getEInt(), is(0));
    assertThat(target.getELong(), is(1L));
  }
View Full Code Here

Examples of org.eclipselabs.emodeling.ECollection

    resource.save(null);

    resourceSet = createResourceSet();
    resource = resourceSet.getResource(
        createQueryURI(org.eclipselabs.mongoemf.junit.model.ModelPackage.Literals.ETYPES, "eDate >= " + EcoreFactory.eINSTANCE.convertToString(EcorePackage.Literals.EDATE, new Date())), true);
    ECollection eCollection = (ECollection) resource.getContents().get(0);
    assertThat(eCollection.getValues().size(), is(1));
  }
View Full Code Here

Examples of org.eclipselabs.emodeling.ECollection

    ResourceSet resourceSet = createResourceSet();
    Resource resource = resourceSet.getResource(createCollectionURI(targetObject.eClass()).appendQuery(URI.encodeQuery("singleAttribute==4d", false)), true);

    // Verify : The query should not return any results;

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

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

    // Verify : Check that the objects were stored correctly

    assertThat(resource.getContents().size(), is(1));
    assertThat(resource.getContents().get(0), is(instanceOf(ECollection.class)));

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

Examples of org.eclipselabs.emodeling.ECollection

    // Verify : The resouce should contain a Result with proxies to all of the stored objects

    assertThat(resource.getContents().size(), is(1));
    assertThat(resource.getContents().get(0), is(instanceOf(ECollection.class)));

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

    for (int i = 0; i < numberTargets; i++)
    {
      assertThat(eCollection.getValues().get(i), is(instanceOf(TargetObject.class)));
      TargetObject targetObject = (TargetObject) eCollection.getValues().get(i);
      assertThat(targetObject.getSingleAttribute(), is("junit " + i));
    }
  }
View Full Code Here

Examples of org.eclipselabs.emodeling.ECollection

    System.out.println("Loading data");

    controller.startCPUProfiling(ProfilingModes.CPU_TRACING, filters.toString(), Controller.DEFAULT_WALLTIME_SPEC);
    resource = resourceSet.getResource(uri.appendQuery(""), true);
    ECollection eCollection = (ECollection) resource.getContents().get(0);

    System.out.println("Loading from a Result");

    for (EObject object : eCollection.getValues());

    System.out.println("Stopping profile");
    controller.stopCPUProfiling();
    System.out.println("Capturing snapshot");
    System.out.println("Collection load snapshot: " + controller.captureSnapshot(ProfilingModes.SNAPSHOT_WITHOUT_HEAP));
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.