View Javadoc

1   /**
2    * Copyright 2005-2011 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  package org.kuali.rice.krad.datadictionary;
17  
18  import org.junit.Ignore;
19  import org.junit.Test;
20  import org.kuali.rice.krad.bo.AdHocRoutePerson;
21  import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
22  import org.kuali.test.KRADTestCase;
23  
24  import static org.junit.Assert.assertEquals;
25  
26  /**
27   * DataDictionaryLazyLoadingTest ensures that data dictionary lazy loading works as expected
28   * 
29   * @author Kuali Rice Team (rice.collab@kuali.org)
30   */
31  
32  public class DataDictionaryLazyLoadingTest extends KRADTestCase {
33  
34  	@Test
35  	public void testBusinessObjectDataDictionaryEntriesAreSame() {
36  		BusinessObjectEntry entry1 = KRADServiceLocatorWeb.getDataDictionaryService().getDataDictionary().getBusinessObjectEntry(AdHocRoutePerson.class.getName());
37  		BusinessObjectEntry entry2 = KRADServiceLocatorWeb.getDataDictionaryService().getDataDictionary().getBusinessObjectEntry(AdHocRoutePerson.class.getName());
38  		BusinessObjectEntry entry3 = KRADServiceLocatorWeb.getDataDictionaryService().getDataDictionary().getBusinessObjectEntry(AdHocRoutePerson.class.getName());
39  		
40  		assertEquals(entry1, entry2);
41  		assertEquals(entry1, entry3);
42  		assertEquals(entry2, entry3);
43  	}
44  
45  	@Test
46  	public void testDocumentDataDictionaryEntriesAreSame() {
47  		DocumentEntry entry1 = KRADServiceLocatorWeb.getDataDictionaryService().getDataDictionary().getDocumentEntry("CampusMaintenanceDocument");
48  		DocumentEntry entry2 = KRADServiceLocatorWeb.getDataDictionaryService().getDataDictionary().getDocumentEntry("CampusMaintenanceDocument");
49  		DocumentEntry entry3 = KRADServiceLocatorWeb.getDataDictionaryService().getDataDictionary().getDocumentEntry("CampusMaintenanceDocument");
50  		
51  		assertEquals(entry1, entry2);
52  		assertEquals(entry1, entry3);
53  		assertEquals(entry2, entry3);
54  	}
55  
56  }