1 import org.junit.Test;
2 import org.kuali.ole.DocumentStoreModelInitiallizer;
3 import org.kuali.ole.RepositoryManager;
4 import org.kuali.ole.BaseTestCase;
5 import org.slf4j.Logger;
6 import org.slf4j.LoggerFactory;
7
8 import javax.jcr.*;
9
10
11
12
13
14
15
16
17 public class DocumentStoreModelInitiallizer_UT
18 extends BaseTestCase {
19 private static final Logger LOG = LoggerFactory.getLogger(DocumentStoreModelInitiallizer_UT.class);
20
21 @Test
22 public void initDocStoreModel() throws Exception {
23 DocumentStoreModelInitiallizer documentStoreModelInitiallizer = new DocumentStoreModelInitiallizer();
24 documentStoreModelInitiallizer.init();
25 RepositoryManager repositoryManager = RepositoryManager.getRepositoryManager();
26 Session session = repositoryManager.getSession();
27 dump(session.getRootNode());
28 repositoryManager.logout(session);
29
30 }
31
32 private static void dump(Node node) throws RepositoryException {
33 LOG.info(node.getPath());
34 if (node.getName().equals("jcr:system")) {
35 return;
36 }
37
38 PropertyIterator properties = node.getProperties();
39 while (properties.hasNext()) {
40 Property property = properties.nextProperty();
41 if (property.getDefinition().isMultiple()) {
42 Value[] values = property.getValues();
43 for (int i = 0; i < values.length; i++) {
44 LOG.info(property.getPath() + " = " + values[i].getString());
45 }
46 }
47 else {
48 LOG.info(property.getPath() + " = " + property.getString());
49 }
50 }
51
52 NodeIterator nodes = node.getNodes();
53 while (nodes.hasNext()) {
54 dump(nodes.nextNode());
55 }
56 }
57 }