DemoDumpGenerator { public void dump() throws Exception { BootstrapInitializer boot = meshInternal.boot(); DemoDataProvider provider = new DemoDataProvider(meshInternal.database(), meshInternal.meshLocalClientImpl(), boot); invokeDump(boot, provider); }  static void main(String[] args); MeshComponent getMeshInternal(); void init(); void init(MeshOptions options); void dump(); void cleanup();  }
@Test public void testSetup() throws Exception { generator.dump(); db.tx(tx -> { RoleDaoWrapper roleDao = tx.data().roleDao(); UserDaoWrapper userDao = tx.data().userDao(); GroupDaoWrapper groupDao = tx.data().groupDao(); ProjectDaoWrapper projectDao = tx.data().projectDao(); ContentDaoWrapper contentDao = tx.data().contentDao(); NodeDaoWrapper nodeDao = tx.data().nodeDao(); HibProject project = projectDao.findByName("demo"); assertTrue(project.getNodeRoot().computeCount() > 0); HibUser user = userDao.findByUsername("webclient"); assertNotNull("The webclient user should have been created but could not be found.", user); assertFalse("The webclient user should also have at least one group assigned to it.", !userDao.getGroups(user).iterator().hasNext()); HibGroup group = userDao.getGroups(user).iterator().next(); HibRole role = groupDao.getRoles(group).iterator().next(); assertNotNull("The webclient group should also have a role assigned to it", role); assertTrue("The webclient role has not read permission on the user.", roleDao.hasPermission(role, InternalPermission.READ_PERM, user)); assertTrue("The webclient user has no permission on itself.", userDao.hasPermission(user, user, InternalPermission.READ_PERM)); assertTrue("The webclient user has no read permission on the user root node..", userDao.hasPermission(user, boot.meshRoot().getUserRoot(), InternalPermission.READ_PERM)); assertTrue("We expected to find at least 5 nodes.", project.getNodeRoot().computeCount() > 5); assertNotNull(nodeDao.findByUuid(project, "df8beb3922c94ea28beb3922c94ea2f6")); for (Node node : project.getNodeRoot().findAll()) { NodeGraphFieldContainer container = contentDao.getLatestDraftFieldContainer(node, "en"); String languageTag = "en"; String projectUuid = node.getProject().getUuid(); String branchUuid = node.getProject().getInitialBranch().getUuid(); String schemaContainerVersionUuid = container.getSchemaContainerVersion().getUuid(); ContainerType type = PUBLISHED; String indexName = ContentDaoWrapper.composeIndexName(projectUuid, branchUuid, schemaContainerVersionUuid, type); String documentId = ContentDaoWrapper.composeDocumentId(node.getUuid(), languageTag); if (searchProvider.getDocument(indexName, documentId).blockingGet() == null) { String msg = "The search document for node {" + node.getUuid() + "} container {" + languageTag + "} could not be found within index {" + indexName + "} - {" + documentId + "}"; fail(msg); } } tx.success(); }); }