public void testCreate() throws Exception {
int count = getHive().getNodes().size();
NodeDao dao = new NodeDao(getDataSource(getConnectString(getHiveDatabaseName())));
assertEquals(count, dao.loadAll().size());
Node full = createFullyPopulatedNode();
Node minimal = createMinimalNode();
dao.create(full);
dao.create(minimal);
List<Node> nodes = dao.loadAll();
assertEquals(2 + count, nodes.size());
Node fetchedFull = null;
Node fetchedMinimal = null;
for (Node n : nodes)
if (n.getName().equals(full.getName()))
fetchedFull = n;
else if (n.getName().equals(minimal.getName()))
fetchedMinimal = n;
assertNotNull(fetchedFull);
assertNotNull(fetchedMinimal);
assertEquals(full, fetchedFull);
assertEquals(minimal, fetchedMinimal);
assertFalse(fetchedFull.getStatus().equals(Status.readOnly));
assertFalse(fetchedMinimal.getStatus().equals(Status.readOnly));
}