use of org.openntf.domino.design.DatabaseDesign in project org.openntf.domino by OpenNTF.
the class DesignClassTest method testDb.
protected void testDb(final Database db) {
DatabaseDesign design = db.getDesign();
System.out.println("Design: " + design.getClass().getName());
DesignCollection<DesignBase> allDesign = design.getDesignElements("@ALL");
Map<Class<?>, AtomicInteger> counter = new HashMap<Class<?>, AtomicInteger>();
for (DesignBase des : allDesign) {
if (!counter.containsKey(des.getClass())) {
counter.put(des.getClass(), new AtomicInteger());
}
counter.get(des.getClass()).incrementAndGet();
}
int i = 0;
int j = 0;
for (ODPMapping mapping : ODPMapping.values()) {
Class<? extends DesignBase> cls = mapping.getInstanceClass();
if (cls == OtherDesignElement.class) {
} else {
DesignCollection<? extends DesignBase> ret = design.getDesignElements(cls);
j = 0;
for (@SuppressWarnings("unused") DesignBase b : ret) {
i++;
j++;
}
int cnt;
if (!counter.containsKey(cls)) {
cnt = 0;
} else {
cnt = counter.get(cls).get();
}
if (j == cnt) {
System.out.println(j + "\t " + cnt + "\t" + cls.getName());
} else {
System.err.println(j + "\t " + cnt + "\t" + cls.getName());
}
// if (j == 0)
// System.err.println("No design element of " + cls.getName() + " found");
}
}
System.out.println("Total design elements " + i);
}
use of org.openntf.domino.design.DatabaseDesign in project org.openntf.domino by OpenNTF.
the class TestDatabasePropertyWrapper method testProperty.
public void testProperty(DbProperties prop) {
HashMap<DbProperties, Boolean> props = new HashMap<DbProperties, Boolean>();
props.put(prop, true);
DatabaseDesign design = getNewSessionDesign();
design.setDatabaseProperties(props);
design.save();
design = getNewSessionDesign();
ArrayList<DbProperties> retProps = (ArrayList<DbProperties>) design.getDatabaseProperties();
assertTrue(retProps.contains(prop));
design = getNewSessionDesign();
props.put(prop, false);
design.setDatabaseProperties(props);
design.save();
design = getNewSessionDesign();
retProps = (ArrayList<DbProperties>) design.getDatabaseProperties();
assertFalse(retProps.contains(prop));
}
Aggregations