use of org.drools.core.meta.org.test.SubKlass in project drools by kiegroup.
the class MetadataTest method testKlassAndSubKlassWithInterfaces.
@Test
public void testKlassAndSubKlassWithInterfaces() {
SubKlass ski = new Foo();
ski.setSubProp(42);
ski.setProp("hello");
SubKlass_ sk = new SubKlass_(ski);
assertEquals(42, (int) sk.subProp.get(ski));
assertEquals("hello", sk.prop.get(ski));
sk.modify().subProp(-99).prop("bye").call();
assertEquals(-99, (int) sk.subProp.get(ski));
assertEquals("bye", sk.prop.get(ski));
System.out.println(((Foo) ski).map);
Map tgt = new HashMap();
tgt.put("prop", "bye");
tgt.put("subProp", -99);
assertEquals(tgt, ((Foo) ski).map);
}
use of org.drools.core.meta.org.test.SubKlass in project drools by kiegroup.
the class MetadataTest method testKlassAndSubKlassWithImpl.
@Test
public void testKlassAndSubKlassWithImpl() {
SubKlass ski = new SubKlassImpl();
ski.setSubProp(42);
ski.setProp("hello");
SubKlass_ sk = new SubKlass_(ski);
assertEquals(42, (int) sk.subProp.get(ski));
assertEquals("hello", sk.prop.get(ski));
sk.modify().prop("bye").subProp(-99).call();
assertEquals(-99, (int) sk.subProp.get(ski));
assertEquals("bye", sk.prop.get(ski));
}
use of org.drools.core.meta.org.test.SubKlass in project drools by kiegroup.
the class MetadataTest method testCollectionOrientedProperties.
@Test
public void testCollectionOrientedProperties() {
AnotherKlass aki0 = AnotherKlass_.newAnotherKlass("000").call();
AnotherKlass aki1 = AnotherKlass_.newAnotherKlass("001").call();
AnotherKlass aki2 = AnotherKlass_.newAnotherKlass("002").call();
AnotherKlass aki3 = AnotherKlass_.newAnotherKlass("003").call();
AnotherKlass aki4 = AnotherKlass_.newAnotherKlass("004").call();
ArrayList<AnotherKlass> initial = new ArrayList(Arrays.asList(aki0, aki1));
SubKlass ski = SubKlass_.newSubKlass(URI.create("123")).links(initial, Lit.SET).links(aki1, Lit.REMOVE).links(aki2, Lit.ADD).links(Arrays.asList(aki3, aki4), Lit.REMOVE).call();
assertEquals(Arrays.asList(aki0, aki2), ski.getLinks());
}
Aggregations