01: package org.compass.core.test.genericscol;
02:
03: import java.util.ArrayList;
04:
05: import org.compass.core.CompassSession;
06: import org.compass.core.CompassTransaction;
07: import org.compass.core.test.AbstractTestCase;
08:
09: /**
10: * @author kimchy
11: */
12: public class GenericsColTests extends AbstractTestCase {
13:
14: protected String[] getMappings() {
15: return new String[] { "genericscol/genericscol.cpm.xml" };
16: }
17:
18: public void testXmlMappingWithGenericsCollection() throws Exception {
19: CompassSession session = openSession();
20: CompassTransaction tr = session.beginTransaction();
21:
22: A a = new A();
23: a.id = 1;
24: B b1 = new B();
25: b1.value = "value1";
26: B b2 = new B();
27: b2.value = "value2";
28: a.bs = new ArrayList<B>();
29: a.bs.add(b1);
30: a.bs.add(b2);
31: session.save(a);
32:
33: tr.commit();
34: session.close();
35: }
36:
37: }
|