DatabaseStructureType.MULTI, CACHE_DISABLED));
}
private void checkDBUsecasesTreeOfNodeHasNotPrimaryTypeProperties1(ManageableRepository repository) throws Exception
{
TesterRepositoryCheckController checkController = new TesterRepositoryCheckController(repository);
NodeImpl node1 = (NodeImpl)addTestNode(repository);
NodeImpl node2 = (NodeImpl)addTestNode(repository, node1.getUUID());
NodeImpl node3 = (NodeImpl)addTestNode(repository, node2.getUUID());
assertResult(checkController.checkDataBase(), checkController.getLastReportPath(), true);
removePropertyInDB(repository, (PropertyImpl)node3.getProperty("jcr:primaryType"));
removePropertyInDB(repository, (PropertyImpl)node2.getProperty("jcr:primaryType"));
removePropertyInDB(repository, (PropertyImpl)node1.getProperty("jcr:primaryType"));
assertResult(checkController.checkDataBase(), checkController.getLastReportPath(), false);
InconsistencyRepair repair = getNodeRemover(repository);
// check correctness repairing child with parent without primaryType property
Connection conn = getConnection(repository);
ResultSet resultSet = getResultSetWithNode(repository, conn, node3);
resultSet.next();
repair.doRepair(resultSet);
resultSet.close();
conn.close();
// check correctness repairing parent with child without primaryType property
conn = getConnection(repository);
resultSet = getResultSetWithNode(repository, conn, node1);
resultSet.next();
repair.doRepair(resultSet);
resultSet.close();
conn.close();
// check correctness repairing node already removed in previous check
Map<String, String> strFields = new HashMap<String, String>();
strFields.put(DBConstants.COLUMN_PARENTID, "already-removed-parentId");
strFields.put(DBConstants.COLUMN_NAME, "[]" + node2.getName());
strFields.put(DBConstants.COLUMN_ID, node2.getIdentifier());
Map<String, Integer> intFields = new HashMap<String, Integer>();
intFields.put(DBConstants.COLUMN_NORDERNUM, 1);
intFields.put(DBConstants.COLUMN_VERSION, 0);
intFields.put(DBConstants.COLUMN_INDEX, 0);
resultSet = new FakeResultSet(strFields, intFields);
repair.doRepair(resultSet);
assertResult(checkController.checkDataBase(), checkController.getLastReportPath(), true);
helper.removeRepository(container, repository.getConfiguration().getName());
}