01: /*
02: * Copyright 2005-2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.core.datadictionary;
18:
19: import org.junit.Test;
20: import org.kuali.core.bo.AdHocRoutePerson;
21: import org.kuali.rice.KNSServiceLocator;
22: import org.kuali.test.KNSTestBase;
23: import org.kuali.test.KNSWithTestSpringContext;
24:
25: /**
26: * Test to ensure that data dictionary lazy loading works as expected.
27: *
28: * @author Kuali Rice Team (kuali-rice@googlegroups.com)
29: */
30: @KNSWithTestSpringContext
31: public class DataDictionaryLazyLoadingTest extends KNSTestBase {
32:
33: @Test
34: public void testBusinessObjectDataDictionaryEntriesAreSame() {
35: BusinessObjectEntry entry1 = KNSServiceLocator
36: .getDataDictionaryService().getDataDictionary()
37: .getBusinessObjectEntry(
38: AdHocRoutePerson.class.getName());
39: BusinessObjectEntry entry2 = KNSServiceLocator
40: .getDataDictionaryService().getDataDictionary()
41: .getBusinessObjectEntry(
42: AdHocRoutePerson.class.getName());
43: BusinessObjectEntry entry3 = KNSServiceLocator
44: .getDataDictionaryService().getDataDictionary()
45: .getBusinessObjectEntry(
46: AdHocRoutePerson.class.getName());
47:
48: assertEquals(entry1, entry2);
49: assertEquals(entry1, entry3);
50: assertEquals(entry2, entry3);
51: }
52:
53: @Test
54: public void testDocumentDataDictionaryEntriesAreSame() {
55: DocumentEntry entry1 = KNSServiceLocator
56: .getDataDictionaryService().getDataDictionary()
57: .getDocumentEntry("CampusMaintenanceDocument");
58: DocumentEntry entry2 = KNSServiceLocator
59: .getDataDictionaryService().getDataDictionary()
60: .getDocumentEntry("CampusMaintenanceDocument");
61: DocumentEntry entry3 = KNSServiceLocator
62: .getDataDictionaryService().getDataDictionary()
63: .getDocumentEntry("CampusMaintenanceDocument");
64:
65: assertEquals(entry1, entry2);
66: assertEquals(entry1, entry3);
67: assertEquals(entry2, entry3);
68: }
69:
70: }
|