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.property.multiplemetadata;
18:
19: import org.compass.core.CompassHits;
20: import org.compass.core.CompassSession;
21: import org.compass.core.CompassTransaction;
22: import org.compass.core.test.AbstractTestCase;
23:
24: /**
25: * @author kimchy
26: */
27: public class MultipleMetaDataTests extends AbstractTestCase {
28:
29: protected String[] getMappings() {
30: return new String[] { "property/multiplemetadata/mapping.cpm.xml" };
31: }
32:
33: public void testMultipleMetaData() {
34: CompassSession session = openSession();
35: CompassTransaction tr = session.beginTransaction();
36:
37: Long id1 = new Long(1);
38: MultipleMetaData o1 = new MultipleMetaData();
39: o1.setId(id1);
40: o1.setValue1("test1");
41: o1.setValue2("test2");
42: session.save(o1);
43: Long id2 = new Long(2);
44: MultipleMetaData o2 = new MultipleMetaData();
45: o2.setId(id2);
46: o2.setValue1("test1");
47: o2.setValue2("testNO");
48: session.save(o2);
49:
50: CompassHits list = session.find("join2:test1");
51: assertEquals(2, list.getLength());
52:
53: list = session.find("value21:testNO");
54: assertEquals(1, list.getLength());
55:
56: tr.commit();
57: session.close();
58: }
59: }
|