Package com.vercer.engine.persist

Source Code of com.vercer.engine.persist.JoinTableTest$A

package com.vercer.engine.persist;

import com.google.appengine.api.datastore.Query;
import com.vercer.engine.persist.ObjectDatastore;
import com.vercer.engine.persist.annotation.AnnotationObjectDatastore;

import static org.junit.Assert.fail;

public class JoinTableTest extends LocalDatastoreTestCase
{

  public int countTestCases()
  {
    return 0;
  }

  public static class A
  {
  }

  public static class B
  {
  }

  public static class AB
  {
    A a;
    B b;

    public AB()
    {
    }

    public AB(A a, B b)
    {
      // To change body of created methods use File | Settings | File
      // Templates.
      this.a = a;
      this.b = b;
    }
  }

  @org.junit.Test
  public void testJoinTable()
  {
    ObjectDatastore ds = new AnnotationObjectDatastore();

    A a;
    B b;
    ds.store(a = new A());
    ds.store(b = new B());
    ds.store(new AB(a, b));

    final AB ab = ds.find().type(AB.class).addFilter("a", Query.FilterOperator.EQUAL,
        ds.associatedKey(a)).returnResultsNow().next();

    if (!ab.b.equals(b))
      fail();
  }

}
TOP

Related Classes of com.vercer.engine.persist.JoinTableTest$A

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.