use of com.blazebit.persistence.view.testsuite.basic.model.EmbeddableTestEntitySimpleEmbeddableSubView in project blaze-persistence by Blazebit.
the class EmbeddableTestEntityViewTest method assertEqualViewEquals.
private void assertEqualViewEquals(EmbeddableTestEntity2 entity, EmbeddableTestEntityView view) {
assertEquals(entity.getId(), view.getId());
assertEquals(entity.getId().getIntIdEntity(), view.getIdIntIdEntity());
assertEquals(entity.getId().getIntIdEntity().getId(), view.getIdIntIdEntityId());
assertEquals(entity.getId().getIntIdEntity().getName(), view.getIdIntIdEntityName());
assertEquals(entity.getId().getKey(), view.getIdKey());
assertEquals(entity.getEmbeddable().getName(), view.getEmbeddable().getName());
assertEquals(entity.getEmbeddable().getManyToOne(), view.getEmbeddableManyToOne());
assertEquals(entity.getEmbeddable().getOneToMany(), view.getEmbeddableOneToMany());
assertEquals(entity.getEmbeddable().getElementCollection(), view.getEmbeddableElementCollection());
Set<String> set1 = new HashSet<String>();
for (EmbeddableTestEntitySimpleEmbeddable2 elem : entity.getEmbeddableSet()) {
set1.add(elem.getName());
}
Set<String> set2 = new HashSet<String>();
for (EmbeddableTestEntitySimpleEmbeddableSubView elem : view.getEmbeddableSet()) {
set2.add(elem.getName());
}
assertEquals(set1, set2);
Map<String, String> map1 = new HashMap<String, String>();
for (Map.Entry<String, EmbeddableTestEntitySimpleEmbeddable2> entry : entity.getEmbeddableMap().entrySet()) {
map1.put(entry.getKey(), entry.getValue().getName());
}
Map<String, String> map2 = new HashMap<String, String>();
for (Map.Entry<String, EmbeddableTestEntitySimpleEmbeddableSubView> entry : view.getEmbeddableMap().entrySet()) {
map2.put(entry.getKey(), entry.getValue().getName());
}
assertEquals(map1, map2);
}
use of com.blazebit.persistence.view.testsuite.basic.model.EmbeddableTestEntitySimpleEmbeddableSubView in project blaze-persistence by Blazebit.
the class EmbeddableTestEntityViewTest method assertEqualViewEquals.
private void assertEqualViewEquals(EmbeddableTestEntity2 entity, EmbeddableTestEntityViewWithSubview view) {
assertEquals(entity.getId(), view.getId());
if (entity.getId().getIntIdEntity() == null) {
assertNull(view.getIdIntIdEntity());
} else {
assertEquals(entity.getId().getIntIdEntity().getId(), view.getIdIntIdEntity().getId());
}
assertEquals(entity.getId().getIntIdEntity().getId(), view.getIdIntIdEntityId());
assertEquals(entity.getId().getIntIdEntity().getName(), view.getIdIntIdEntityName());
assertEquals(entity.getId().getKey(), view.getIdKey());
assertEquals(entity.getEmbeddable().getName(), view.getEmbeddable().getName());
if (entity.getEmbeddable().getManyToOne() == null) {
assertNull(view.getEmbeddableManyToOneView());
} else {
assertEquals(entity.getEmbeddable().getManyToOne().getId(), view.getEmbeddableManyToOneView().getId());
}
assertEquals(entity.getEmbeddable().getOneToMany().size(), view.getEmbeddableOneToManyView().size());
OUTER: for (EmbeddableTestEntity2 child : entity.getEmbeddable().getOneToMany()) {
for (EmbeddableTestEntitySubView childView : view.getEmbeddableOneToManyView()) {
if (child.getId().equals(childView.getId())) {
continue OUTER;
}
}
fail("Couldn't find child view with id: " + child.getId());
}
assertEquals(entity.getEmbeddable().getElementCollection().size(), view.getEmbeddableElementCollectionView().size());
for (Map.Entry<String, IntIdEntity> childEntry : entity.getEmbeddable().getElementCollection().entrySet()) {
IntIdEntityView childView = view.getEmbeddableElementCollectionView().get(childEntry.getKey());
assertEquals(childEntry.getValue().getId(), childView.getId());
}
Set<String> set1 = new HashSet<String>();
for (EmbeddableTestEntitySimpleEmbeddable2 elem : entity.getEmbeddableSet()) {
set1.add(elem.getName());
}
Set<String> set2 = new HashSet<String>();
for (EmbeddableTestEntitySimpleEmbeddableSubView elem : view.getEmbeddableSet()) {
set2.add(elem.getName());
}
assertEquals(set1, set2);
Map<String, String> map1 = new HashMap<String, String>();
for (Map.Entry<String, EmbeddableTestEntitySimpleEmbeddable2> entry : entity.getEmbeddableMap().entrySet()) {
map1.put(entry.getKey(), entry.getValue().getName());
}
Map<String, String> map2 = new HashMap<String, String>();
for (Map.Entry<String, EmbeddableTestEntitySimpleEmbeddableSubView> entry : view.getEmbeddableMap().entrySet()) {
map2.put(entry.getKey(), entry.getValue().getName());
}
assertEquals(map1, map2);
}
Aggregations