01: /*
02: * Copyright 2004-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
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.compass.core.test.nounmarshall.setting;
18:
19: import org.compass.core.CompassSession;
20: import org.compass.core.CompassTransaction;
21: import org.compass.core.Resource;
22: import org.compass.core.config.CompassEnvironment;
23: import org.compass.core.config.CompassSettings;
24: import org.compass.core.test.AbstractTestCase;
25:
26: /**
27: * @author kimchy
28: */
29: public class SettingTests extends AbstractTestCase {
30:
31: protected String[] getMappings() {
32: return new String[] { "nounmarshall/setting/A.cpm.xml" };
33: }
34:
35: protected void addSettings(CompassSettings settings) {
36: settings.setBooleanSetting(
37: CompassEnvironment.Osem.SUPPORT_UNMARSHALL, false);
38: }
39:
40: public void testNoUnmarshall() throws Exception {
41: CompassSession session = openSession();
42: CompassTransaction tr = session.beginTransaction();
43:
44: A a = new A();
45: a.id = 1;
46: a.value = "value";
47: a.value2 = "value2";
48: session.save(a);
49:
50: Resource resource = session.loadResource(A.class, new Long(1));
51: assertNotNull(resource);
52: assertEquals(5, resource.getProperties().length);
53: assertEquals("a", resource.getAlias());
54: assertEquals(2, resource.getProperties("value").length);
55:
56: a = session.load(A.class, 1);
57: assertEquals(1, a.id);
58: assertNull(a.value);
59: assertNull(a.value2);
60:
61: tr.commit();
62: session.close();
63: }
64:
65: }
|