View Javadoc
1   /*
2    * Copyright 2006-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.kuali.rice.krad.datadictionary;
18  
19  import org.junit.Before;
20  import org.junit.Test;
21  import org.kuali.rice.kew.doctype.bo.DocumentType;
22  import org.kuali.rice.kew.doctype.bo.DocumentTypeEBO;
23  import org.kuali.rice.kew.doctype.service.DocumentTypeService;
24  import org.kuali.rice.kew.service.KEWServiceLocator;
25  import org.kuali.rice.krad.service.DataDictionaryService;
26  import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
27  import org.kuali.rice.krad.service.impl.DictionaryValidationServiceImpl;
28  import org.kuali.rice.krad.test.KRADTestCase;
29  import org.springframework.context.support.ClassPathXmlApplicationContext;
30  
31  import java.util.List;
32  import java.util.Map;
33  
34  import static org.junit.Assert.assertTrue;
35  import static org.junit.Assert.assertNotNull;
36  import static org.junit.Assert.assertEquals;
37  
38  public class DataDictionaryTest extends KRADTestCase {
39      private DataDictionaryService ddService;
40      private DocumentTypeService dtService;
41  
42      @Before
43      public void setUp() throws Exception {
44          super.setUp();
45          ddService = KRADServiceLocatorWeb.getDataDictionaryService();
46          dtService = KEWServiceLocator.getDocumentTypeService();
47      }
48  
49      @Test
50      public void testDocumentTypeEBO() throws Exception {
51          DataDictionary dataDictionary = ddService.getDataDictionary();
52          Map<String, DocumentEntry> documentEntry = dataDictionary.getDocumentEntries();
53          DocumentEntry entry = documentEntry.get("DocumentTypeEBO");
54          DocumentTypeEBO documentType = dtService.findByName(entry.getDocumentTypeName());
55          assertNotNull(documentType);
56          assertNotNull(documentType.getDocTypeParentId());
57          assertNotNull(documentType.getDocumentTypeId());
58          assertEquals("Travel Authorization Document",documentType.getLabel());
59          assertEquals("DocumentTypeEBO",documentType.getName());
60          assertEquals("Create a New Travel Authorization Document",documentType.getDescription());
61          assertTrue(documentType.isActive());
62      }
63  }