@Test
 public void testModFlagProperties() {
   assertEquals(
       TestTools.makeSet("str1_CHANGED", "long1_CHANGED"),
       TestTools.extractModProperties(
           getMetadata()
               .getEntityBinding(
                   "org.hibernate.envers.test.integration.basic.BasicTestEntity1_AUD"),
           "_CHANGED"));
 }
  @Test
  public void testHistoryOfContact() {
    assert getAuditReader()
        .find(Contact.class, pc_id, 1)
        .getAddresses()
        .equals(TestTools.makeSet(new Address(a1_id, "a1")));

    assert getAuditReader()
        .find(Contact.class, pc_id, 2)
        .getAddresses()
        .equals(TestTools.makeSet(new Address(a1_id, "a1"), new Address(a2_id, "a2")));
  }
Ejemplo n.º 3
0
  @Test
  public void testHistoryOfEdId2() {
    ListRefIngEntity ing1 = getEntityManager().find(ListRefIngEntity.class, ing1_id);
    ListRefIngEntity ing2 = getEntityManager().find(ListRefIngEntity.class, ing2_id);

    ListRefEdEntity rev1 = getAuditReader().find(ListRefEdEntity.class, ed2_id, 1);
    ListRefEdEntity rev2 = getAuditReader().find(ListRefEdEntity.class, ed2_id, 2);
    ListRefEdEntity rev3 = getAuditReader().find(ListRefEdEntity.class, ed2_id, 3);

    assert TestTools.checkCollection(rev1.getReffering());
    assert TestTools.checkCollection(rev2.getReffering(), ing1);
    assert TestTools.checkCollection(rev3.getReffering(), ing1, ing2);
  }
  @Test
  public void testHistoryOfColl1() {
    StrTestEntity str1 = getEntityManager().find(StrTestEntity.class, str1_id);

    SetRefCollEntity rev1 = getAuditReader().find(SetRefCollEntity.class, coll1_id, 1);
    SetRefCollEntity rev2 = getAuditReader().find(SetRefCollEntity.class, coll1_id, 2);

    assert rev1.getCollection().equals(TestTools.makeSet());
    assert rev2.getCollection().equals(TestTools.makeSet(str1));

    assert "coll1".equals(rev1.getData());
    assert "coll2".equals(rev2.getData());
  }
  @Test
  public void testHistoryOfPersonalContact() {
    System.out.println(getAuditReader().find(PersonalContact.class, pc_id, 1).getAddresses());
    assert getAuditReader()
        .find(PersonalContact.class, pc_id, 1)
        .getAddresses()
        .equals(TestTools.makeSet(new Address(a1_id, "a1")));

    assert getAuditReader()
        .find(PersonalContact.class, pc_id, 2)
        .getAddresses()
        .equals(TestTools.makeSet(new Address(a1_id, "a1"), new Address(a2_id, "a2")));
  }
Ejemplo n.º 6
0
  @Test(dependsOnMethods = "createData")
  public void testHistoryOfMap1() {
    StrTestEntity str1 = getEntityManager().find(StrTestEntity.class, str1_id);
    StrTestEntity str2 = getEntityManager().find(StrTestEntity.class, str2_id);
    IntTestEntity int1 = getEntityManager().find(IntTestEntity.class, int1_id);
    IntTestEntity int2 = getEntityManager().find(IntTestEntity.class, int2_id);

    TernaryMapEntity rev1 = getAuditReader().find(TernaryMapEntity.class, map1_id, 1);
    TernaryMapEntity rev2 = getAuditReader().find(TernaryMapEntity.class, map1_id, 2);
    TernaryMapEntity rev3 = getAuditReader().find(TernaryMapEntity.class, map1_id, 3);

    assertEquals(rev1.getMap(), TestTools.makeMap(int1, str1));
    assertEquals(rev2.getMap(), TestTools.makeMap(int1, str1, int2, str2));
    assertEquals(rev3.getMap(), TestTools.makeMap(int2, str1));
  }
  @Test
  public void testHistoryOfUniId1() {
    StrTestEntity str1 = getEntityManager().find(StrTestEntity.class, str1_id);

    DetachedNamingTestEntity rev1 =
        getAuditReader().find(DetachedNamingTestEntity.class, uni1_id, 1);
    DetachedNamingTestEntity rev2 =
        getAuditReader().find(DetachedNamingTestEntity.class, uni1_id, 2);

    assert rev1.getCollection().equals(TestTools.makeSet());
    assert rev2.getCollection().equals(TestTools.makeSet(str1));

    assert "data1".equals(rev1.getData());
    assert "data1".equals(rev2.getData());
  }