Package org.eclipselabs.mongoemf.junit.model

Examples of org.eclipselabs.mongoemf.junit.model.PrimaryObject.eResource()


    // Test : Delete the target object and reload the primary object

    targetObject.eResource().delete(null);
    ResourceSet testResourceSet = createResourceSet();
    Resource resource = testResourceSet.getResource(primaryObject.eResource().getURI(), true);

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

    assertThat(resource, is(notNullValue()));
    assertThat(resource.getContents().size(), is(1));
View Full Code Here


    {
      PrimaryObject targetObject = ModelFactory.eINSTANCE.createPrimaryObject();
      targetObject.setName("target");
      saveObject(targetObject);
      primaryObject.setContainmentReferenceSameCollectioin(targetObject);
      targetObject.eResource().unload();
    }

    saveObject(resourceSet, primaryObject);

    // Verify that proxies aren't resolved as a result of saving to Mongo DB.
View Full Code Here

    PrimaryObject primaryObject = ModelFactory.eINSTANCE.createPrimaryObject();
    primaryObject.setUnsettableAttribute(null);
    saveObject(primaryObject);

    ResourceSet resourceSet = createResourceSet();
    Resource resource = resourceSet.getResource(primaryObject.eResource().getURI(), true);
    PrimaryObject object = (PrimaryObject) resource.getContents().get(0);
    assertTrue(object.isSetUnsettableAttribute());
    assertThat(object.getUnsettableAttribute(), is(nullValue()));
  }
View Full Code Here

  {
    PrimaryObject primaryObject = ModelFactory.eINSTANCE.createPrimaryObject();
    saveObject(primaryObject);

    ResourceSet resourceSet = createResourceSet();
    Resource resource = resourceSet.getResource(primaryObject.eResource().getURI(), true);
    PrimaryObject object = (PrimaryObject) resource.getContents().get(0);
    assertFalse(object.isSetUnsettableAttribute());
  }

  @Test
View Full Code Here

    PrimaryObject primaryObject = ModelFactory.eINSTANCE.createPrimaryObject();
    primaryObject.setUnsettableAttributeWithNonNullDefault(null);
    saveObject(primaryObject);

    ResourceSet resourceSet = createResourceSet();
    Resource resource = resourceSet.getResource(primaryObject.eResource().getURI(), true);
    PrimaryObject object = (PrimaryObject) resource.getContents().get(0);
    assertFalse(object.isSetUnsettableAttribute());
    assertThat(object.getUnsettableAttribute(), is(nullValue()));
  }
View Full Code Here

  {
    PrimaryObject primaryObject = ModelFactory.eINSTANCE.createPrimaryObject();
    saveObject(primaryObject);

    ResourceSet resourceSet = createResourceSet();
    Resource resource = resourceSet.getResource(primaryObject.eResource().getURI(), true);
    PrimaryObject object = (PrimaryObject) resource.getContents().get(0);
    assertFalse(object.isSetUnsettableAttribute());
  }

  @Test
View Full Code Here

    PrimaryObject primaryObject = ModelFactory.eINSTANCE.createPrimaryObject();
    primaryObject.setUnsettableReference(null);
    saveObject(primaryObject);

    ResourceSet resourceSet = createResourceSet();
    Resource resource = resourceSet.getResource(primaryObject.eResource().getURI(), true);
    PrimaryObject object = (PrimaryObject) resource.getContents().get(0);
    assertTrue(object.isSetUnsettableReference());
    assertThat(object.getUnsettableReference(), is(nullValue()));
  }
View Full Code Here

  {
    PrimaryObject primaryObject = ModelFactory.eINSTANCE.createPrimaryObject();
    saveObject(primaryObject);

    ResourceSet resourceSet = createResourceSet();
    Resource resource = resourceSet.getResource(primaryObject.eResource().getURI(), true);
    PrimaryObject object = (PrimaryObject) resource.getContents().get(0);
    assertFalse(object.isSetUnsettableReference());
  }

  @Test
View Full Code Here

    primaryObject.getMultipleContainmentReferenceProxies().add(targetObject2);

    saveObject(resourceSet, primaryObject);

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    primaryObject.eResource().save(out, null);

    ResourceSet testResourceSet = createResourceSet();

    testResourceSet.getURIConverter().getURIMap().put(URI.createURI("../TargetObject/"), targetObject1.eResource().getURI().trimSegments(1).appendSegment(""));
    Resource libraryXMI = new XMIResourceFactoryImpl().createResource(URI.createURI(temporaryFolder.newFile("model.xmi").getAbsolutePath()));
View Full Code Here

    saveObject(resourceSet, primaryObject);

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    Map<Object, Object> options = new HashMap<Object, Object>();
    options.put(XMLResource.OPTION_BINARY, Boolean.TRUE);
    primaryObject.eResource().save(out, options);

    {
      ResourceSet testResourceSet = createResourceSet();

      testResourceSet.getURIConverter().getURIMap().put(URI.createURI("../TargetObject/"), targetObject1.eResource().getURI().trimSegments(1).appendSegment(""));
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.