Package org.eclipselabs.mongoemf.junit.model

Examples of org.eclipselabs.mongoemf.junit.model.TargetObject.eClass()


    TargetObject targetObject = ModelFactory.eINSTANCE.createTargetObject();
    targetObject.setSingleAttribute("junit");

    // Test : Store the object to MongoDB

    saveObject(targetObject, createObjectURI(targetObject.eClass(), id), null);

    // Verify : Check that the object was stored correctly, and that is has the ID we specified.

    TargetObject actual = EChecker.checkObject(targetObject, createResourceSet());
    assertThat(EChecker.getID(actual), is(id.toString()));
View Full Code Here


    TargetObject targetObject = ModelFactory.eINSTANCE.createTargetObject();
    targetObject.setSingleAttribute("junit");

    // Test : Store the object to MongoDB

    saveObject(targetObject, createObjectURI(targetObject.eClass(), id), null);

    // Verify : Check that the object was stored correctly, and that is has the ID we specified.

    TargetObject actual = EChecker.checkObject(targetObject, createResourceSet());
    assertThat(EChecker.getID(actual), is(id));
View Full Code Here

    // Test : Store the object to MongoDB

    HashMap<String, Object> options = new HashMap<String, Object>(1);
    options.put(Options.OPTION_WRITE_CONCERN, WriteConcern.SAFE);

    saveObject(targetObject, createCollectionURI(targetObject.eClass()), options);

    // Verify : Check that the object was stored correctly.

    EChecker.checkObject(targetObject, createResourceSet());
  }
View Full Code Here

    String id = "ID";

    TargetObject targetObject = ModelFactory.eINSTANCE.createTargetObject();
    targetObject.setSingleAttribute("junit");

    saveObject(targetObject, createObjectURI(targetObject.eClass(), id), null);

    // Test : Update the object and store it back to MongoDB

    targetObject.setSingleAttribute("updated");
    targetObject.eResource().save(null);
View Full Code Here

    targetObject.eResource().delete(null);

    // Verify : The target object was deleted

    assertThat(getCollection(targetObject.eClass()).getCount(), is(0L));
  }

  @Test
  public void testBatchInsert() throws IOException
  {
View Full Code Here

    // Test : Query for the object using an invalid operator - this can happen if you forget to
    // enclose the value in ''

    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

    // Verify : Check that the object was stored correctly and there is only one object in the
    // collection.

    EChecker.checkObject(targetObject, createResourceSet());
    assertThat(getCollection(targetObject.eClass()).getCount(), is(1L));
  }

  @Test
  public void testTargetObjectUpdateArrayAttribute() throws IOException
  {
View Full Code Here

    // Verify : Check that the object was stored correctly and there is only one object in the
    // collection.

    EChecker.checkObject(targetObject, createResourceSet());
    assertThat(getCollection(targetObject.eClass()).getCount(), is(1L));
  }

  @Test
  public void testUnsettableAttributeSetToNULL() throws IOException
  {
View Full Code Here

    TargetObject targetObject = ModelFactory.eINSTANCE.createTargetObject();
    targetObject.setSingleAttribute("junit");

    // Test : Save the target object with a short (invalid) URI

    saveObject(targetObject, createObjectURI(targetObject.eClass(), new ObjectId()).appendSegment(""), null);
  }

  @Test(expected = IOException.class)
  public void testLongURI() throws IOException
  {
View Full Code Here

    TargetObject targetObject = ModelFactory.eINSTANCE.createTargetObject();
    targetObject.setSingleAttribute("junit");

    // Test : Save the target object with a long (invalid) URI

    saveObject(targetObject, createCollectionURI(targetObject.eClass()).trimSegments(1), null);
  }

  @Test
  public void testExists() throws IOException
  {
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.