1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.rice.krad.jpa;
18
19 import org.junit.Test;
20 import org.kuali.rice.coreservice.impl.parameter.ParameterBo;
21 import org.kuali.rice.krad.bo.PersistableBusinessObjectExtension;
22 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
23 import org.kuali.rice.krad.service.LegacyDataAdapter;
24 import org.kuali.rice.krad.test.KRADTestCase;
25 import org.kuali.rice.krad.test.document.bo.Account;
26 import org.kuali.rice.krad.test.document.bo.AccountExtension;
27 import org.kuali.rice.krad.util.KRADUtils;
28
29 import static org.junit.Assert.assertNotNull;
30 import static org.junit.Assert.assertTrue;
31
32 public class LegacyDataAdapterTest extends KRADTestCase {
33
34 private LegacyDataAdapter legacyDataAdapter;
35
36 @Override
37 public void setUp() throws Exception {
38 super.setUp();
39 legacyDataAdapter = KRADServiceLocatorWeb.getLegacyDataAdapter();
40 }
41
42 @Test
43 public void testGetPropertyType() throws Exception {
44
45 ParameterBo param = KRADUtils.createNewObjectFromClass(ParameterBo.class);
46 Class propertyType = legacyDataAdapter.getPropertyType(param, "namespaceCode");
47 assertTrue("PropertyType is String",propertyType.isAssignableFrom(String.class));
48
49 propertyType = legacyDataAdapter.getPropertyType(param, "component.name");
50 assertTrue("PropertyType is String",propertyType.isAssignableFrom(String.class));
51
52 propertyType = legacyDataAdapter.getPropertyType(param, "component.namespace.name");
53 assertTrue("PropertyType is String",propertyType.isAssignableFrom(String.class));
54 }
55
56
57
58
59
60
61 @Test
62 @Legacy
63 public void testGetExtension_Legacy() throws Exception {
64 testGetExtension();
65 }
66
67
68
69
70
71
72 @Test
73 public void testGetExtension() throws Exception {
74 Account account = new Account();
75 PersistableBusinessObjectExtension extension = account.getExtension();
76 assertNotNull(extension);
77 assertTrue(extension instanceof AccountExtension);
78
79 extension = legacyDataAdapter.getExtension(Account.class);
80 assertNotNull(extension);
81 assertTrue(extension instanceof AccountExtension);
82 }
83
84 }