Package com.google.code.gaeom.test

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

package com.google.code.gaeom.test;

import java.util.Map;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

import com.google.code.gaeom.ObjectStore;
import com.google.code.gaeom.ObjectStoreSession;
import com.google.code.gaeom.annotation.Serialize;
import com.google.common.collect.Maps;

/**
* @author Peter Murray <gaeom@pmurray.com>
*/
public class TestSerializable extends AbstractLocalTest
{
  public static class Foo
  {
    @Serialize
    Map<String, Object> map = Maps.newHashMap();
  }
 
  @Test
  public void testSerializable()
  {
    ObjectStoreSession oss = ObjectStore.Factory.create().beginSession();
   
    Foo foo = new Foo();
   
    foo.map.put("abc", "def");
    foo.map.put("xyz", 23L);
   
    Map<String, Object> backup = foo.map;
   
    oss.store(foo).now();
   
    foo.map = null;
   
    oss.refresh(foo).now();
   
    assertEquals(backup, foo.map);
  }
}
TOP

Related Classes of com.google.code.gaeom.test.TestSerializable$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.