View Javadoc
1   package org.kuali.ole.utility;
2   
3   import org.junit.Test;
4   import org.kuali.ole.OleDocStoreData;
5   import org.kuali.ole.docstore.model.enums.DocFormat;
6   import org.kuali.ole.docstore.model.enums.DocType;
7   import org.slf4j.Logger;
8   import org.slf4j.LoggerFactory;
9   
10  import java.util.ArrayList;
11  import java.util.List;
12  import java.util.Map;
13  
14  /**
15   * Created by IntelliJ IDEA.
16   * User: SR8455
17   * Date: 12/20/12
18   * Time: 3:34 PM
19   * To change this template use File | Settings | File Templates.
20   */
21  public class OleDocStoreData_UT {
22  
23      private static final Logger LOG = LoggerFactory.getLogger(OleDocStoreData_UT.class);
24  
25      @Test
26      public void testCoverage() throws Exception {
27          LOG.info("testing");
28      }
29  
30      @Test
31      public void testOleDocStoreData() throws Exception {
32  
33          OleDocStoreData oleDocStoreData = new OleDocStoreData();
34          oleDocStoreData.setCategory("Fictional");
35          if (oleDocStoreData.getCategory() != null) {
36              LOG.info("Category" + oleDocStoreData.getCategory());
37          }
38  
39          List<String> docTypeList = new ArrayList<String>();
40          docTypeList.add("BIB");
41          docTypeList.add("HOLDINGS");
42          docTypeList.add("ITEM");
43          oleDocStoreData.setDoctypes(docTypeList);
44          if (oleDocStoreData.getDoctypes() != null) {
45              LOG.info("DOCTYPES");
46              for (String docType : oleDocStoreData.getDoctypes()) {
47                  LOG.info(docType);
48              }
49          }
50          if (oleDocStoreData.getFormats() != null) {
51              LOG.info("FORMATS");
52              for (String format : oleDocStoreData.getFormats()) {
53                  LOG.info(format);
54              }
55          }
56          if (oleDocStoreData.getTypeFormatMap() != null) {
57              LOG.info("FORMAT MAP");
58              for (Map.Entry<String, List<String>> entry : oleDocStoreData.getTypeFormatMap().entrySet()) {
59                  LOG.info(entry.getKey());
60                  for (String stringList : entry.getValue()) {
61                      LOG.info(stringList);
62                  }
63              }
64          }
65          oleDocStoreData.addFormat("BIB", DocFormat.DOC.getCode());
66          oleDocStoreData.addDocType("INSTANCE");
67          oleDocStoreData.addLevelInfoForFormat(null, null);
68          oleDocStoreData.setFormatLevelsMap(null);
69          oleDocStoreData.setTypeFormatMapWithNodeCount(null);
70  
71          if (oleDocStoreData.getFormatLevelsMap() != null) {
72              LOG.info("FORMAT LEVELS");
73              for (Map.Entry<String, Integer> entry : oleDocStoreData.getFormatLevelsMap().entrySet()) {
74                  LOG.info(entry.getKey());
75                  LOG.info(entry.getValue().toString());
76              }
77          }
78  
79          if (oleDocStoreData.getTypeFormatMapWithNodeCount() != null) {
80              LOG.info("TYPE FORMAT MAP WITH NODE COUNT");
81              for (Map.Entry<String, Map<String, Long>> entry : oleDocStoreData.getTypeFormatMapWithNodeCount().entrySet()) {
82                  LOG.info(entry.getKey());
83                  for (Map.Entry<String, Long> entry2 : entry.getValue().entrySet()) {
84                      LOG.info(entry2.getKey());
85                      LOG.info(entry2.getValue().toString());
86                  }
87              }
88          }
89  
90  
91      }
92  
93  }