示例#1
0
  @Ignore("alias property not supported yet")
  public void testBCollection() throws Exception {
    CompassSession session = openSession();

    A a = new A();
    a.id = 1;
    a.value = "value";
    a.bs = new ArrayList<B>();
    B b = new B();
    b.value = "bvalue11";
    b.value2 = "bvalue12";
    a.bs.add(b);
    b = new B();
    b.value = "bvalue21";
    b.value = "bvalue22";
    a.bs.add(b);
    session.save(a);

    Resource resource = session.loadResource(A.class, 1);
    assertNotNull(resource);
    assertEquals(7, resource.getProperties().length);
    assertEquals("A", resource.getAlias());
    assertEquals(4, resource.getProperties("value").length);

    session.close();
  }
示例#2
0
  @Ignore("alias property not supported yet")
  public void testBwoValues() throws Exception {
    CompassSession session = openSession();

    A a = new A();
    a.id = 1;
    a.value = "value";
    B b = new B();
    b.value = "bvalue";
    b.value2 = "bvalue2";
    a.b = b;
    session.save(a);

    Resource resource = session.loadResource(A.class, 1);
    assertNotNull(resource);
    assertEquals(6, resource.getProperties().length);
    assertEquals("A", resource.getAlias());
    assertEquals(3, resource.getProperties("value").length);

    a = (A) session.load(A.class, 1);
    assertEquals(1, a.id.longValue());
    assertNull(a.value);
    assertNull(a.b);

    session.close();
  }