Package com.google.code.gaeom.test

Source Code of com.google.code.gaeom.test.TestUnactivatedLoading$Foo

package com.google.code.gaeom.test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

import com.google.appengine.api.datastore.Key;
import com.google.code.gaeom.ObjectStore;
import com.google.code.gaeom.ObjectStoreSession;

/**
* @author Peter Murray <gaeom@pmurray.com>
*/
public class TestUnactivatedLoading extends AbstractLocalTest
{
  public static class Foo
  {
    String name;

    @SuppressWarnings("unused")
    private Foo()
    {
    }

    public Foo(String name)
    {
      this.name = name;
    }
  }

  @Test
  public void testUnactivatedLoad()
  {
    ObjectStore os = ObjectStore.Factory.create();
    ObjectStoreSession oss = os.beginSession();
    Key key = oss.store(new Foo("Fred Flintstone")).now();

    ObjectStoreSession oss2 = os.beginSession();
    Foo foo = oss2.load(key).unactivated().now();
    assertTrue(foo.name == null);
    assertEquals(key, oss2.getKey(foo));
  }
}
TOP

Related Classes of com.google.code.gaeom.test.TestUnactivatedLoading$Foo

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.