01: package org.compass.annotations.test.nounmarshall.setting;
02:
03: import org.compass.annotations.test.AbstractAnnotationsTestCase;
04: import org.compass.core.CompassSession;
05: import org.compass.core.CompassTransaction;
06: import org.compass.core.Resource;
07: import org.compass.core.config.CompassConfiguration;
08: import org.compass.core.config.CompassEnvironment;
09: import org.compass.core.config.CompassSettings;
10:
11: /**
12: * @author kimchy
13: */
14: public class SettingTests extends AbstractAnnotationsTestCase {
15:
16: protected void addSettings(CompassSettings settings) {
17: settings.setBooleanSetting(
18: CompassEnvironment.Osem.SUPPORT_UNMARSHALL, false);
19: }
20:
21: protected void addExtraConf(CompassConfiguration conf) {
22: conf.addClass(A.class);
23: }
24:
25: public void testNoUnmarshall() throws Exception {
26: CompassSession session = openSession();
27: CompassTransaction tr = session.beginTransaction();
28:
29: A a = new A();
30: a.id = 1;
31: a.value = "value";
32: a.value2 = "value2";
33: session.save(a);
34:
35: Resource resource = session.loadResource(A.class, 1);
36: assertNotNull(resource);
37: assertEquals(5, resource.getProperties().length);
38: assertEquals("A", resource.getAlias());
39: assertEquals(2, resource.getProperties("value").length);
40: assertEquals("A#1#", resource.getUID());
41:
42: a = session.load(A.class, 1);
43: assertEquals(1, a.id.longValue());
44: assertNull(a.value);
45: assertNull(a.value2);
46:
47: tr.commit();
48: session.close();
49: }
50:
51: }
|