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 private static void dump(Node node) throws RepositoryException {
32 LOG.info(node.getPath());
33 if (node.getName().equals("jcr:system")) {
34 return;
35 }
36
37 PropertyIterator properties = node.getProperties();
38 while (properties.hasNext()) {
39 Property property = properties.nextProperty();
40 if (property.getDefinition().isMultiple()) {
41 Value[] values = property.getValues();
42 for (int i = 0; i < values.length; i++) {
43 LOG.info(property.getPath() + " = " + values[i].getString());
44 }
45 }
46 else {
47 LOG.info(property.getPath() + " = " + property.getString());
48 }
49 }
50
51 NodeIterator nodes = node.getNodes();
52 while (nodes.hasNext()) {
53 dump(nodes.nextNode());
54 }
55 }
56 }