try {
NotesDatabase connectorDatabase = session.getDatabase(
connectorSession.getServer(), connectorSession.getDatabase());
NotesView databaseView = connectorDatabase.getView(
NCCONST.VIEWDATABASES);
NotesDocument databaseDocument = databaseView.getFirstDocument();
while (databaseDocument != null) {
String server =
databaseDocument.getItemValueString(NCCONST.DITM_SERVER);
String replicaId =
databaseDocument.getItemValueString(NCCONST.DITM_REPLICAID);
NotesDocId id = new NotesDocId();
id.setHost(server + connectorSession.getDomain(server));
id.setReplicaId(replicaId);
String replicaUrl = id.getReplicaUrl();
int count = 0;
for (Document doc : documents) {
String docid = getValue(doc, SpiConstants.PROPNAME_DOCID);
if (docid.equals(replicaUrl + "/"
+ NCCONST.DB_ACL_INHERIT_TYPE_ANDBOTH)) {
count++;
assertEquals(
SpiConstants.AclInheritanceType.AND_BOTH_PERMIT.toString(),
getValue(doc, SpiConstants.PROPNAME_ACLINHERITANCETYPE));
} else if (docid.equals(replicaUrl + "/"
+ NCCONST.DB_ACL_INHERIT_TYPE_PARENTOVERRIDES)) {
count++;
assertEquals(
SpiConstants.AclInheritanceType.PARENT_OVERRIDES.toString(),
getValue(doc, SpiConstants.PROPNAME_ACLINHERITANCETYPE));
}
}
// TODO: sometimes we get multiple acl records on
// repeated test runs. Fix the connector so that can't
// happen.
//assertEquals(replicaUrl, 2, count);
assertTrue("Not enough database acls found for " + replicaUrl
+ "\n" + documents, 2 >= count);
NotesDocument tmp = databaseDocument;
databaseDocument = databaseView.getNextDocument(tmp);
tmp.recycle();
}
} finally {
connectorSession.closeNotesSession(session);
}
}