Search in sources :

Example 1 with KlassImpl

use of org.drools.core.meta.org.test.KlassImpl in project drools by kiegroup.

the class MetadataTest method testNewInstance.

@Test
public void testNewInstance() {
    Klass klass = Klass_.newKlass(URI.create("test")).call();
    assertNotNull(klass);
    assertTrue(klass instanceof KlassImpl);
    SubKlass klass2 = SubKlass_.newSubKlass(URI.create("test2")).subProp(42).prop("hello").call();
    assertEquals("hello", klass2.getProp());
    assertEquals(42, (int) klass2.getSubProp());
}
Also used : AnotherKlass(org.drools.core.meta.org.test.AnotherKlass) Klass(org.drools.core.meta.org.test.Klass) SubKlass(org.drools.core.meta.org.test.SubKlass) SubKlass(org.drools.core.meta.org.test.SubKlass) SubKlassImpl(org.drools.core.meta.org.test.SubKlassImpl) AnotherKlassImpl(org.drools.core.meta.org.test.AnotherKlassImpl) KlassImpl(org.drools.core.meta.org.test.KlassImpl) Test(org.junit.Test)

Example 2 with KlassImpl

use of org.drools.core.meta.org.test.KlassImpl in project drools by kiegroup.

the class MetadataTest method testMetadataInternals.

@Test
public void testMetadataInternals() {
    SubKlass_<SubKlass> sk = new SubKlass_(new SubKlassImpl());
    Klass_<Klass> k = new Klass_(new KlassImpl());
    AnotherKlass_<AnotherKlass> ak = new AnotherKlass_(new AnotherKlassImpl());
    assertEquals(4, ak.getMetaClassInfo().getProperties().length);
    assertEquals(4, sk.getMetaClassInfo().getProperties().length);
    assertEquals(4, k.getMetaClassInfo().getProperties().length);
    assertEquals("subProp", sk.getMetaClassInfo().getProperties()[2].getName());
}
Also used : AnotherKlass(org.drools.core.meta.org.test.AnotherKlass) Klass(org.drools.core.meta.org.test.Klass) SubKlass(org.drools.core.meta.org.test.SubKlass) AnotherKlass_(org.drools.core.meta.org.test.AnotherKlass_) Klass_(org.drools.core.meta.org.test.Klass_) SubKlass_(org.drools.core.meta.org.test.SubKlass_) SubKlass_(org.drools.core.meta.org.test.SubKlass_) SubKlassImpl(org.drools.core.meta.org.test.SubKlassImpl) AnotherKlass(org.drools.core.meta.org.test.AnotherKlass) SubKlass(org.drools.core.meta.org.test.SubKlass) SubKlassImpl(org.drools.core.meta.org.test.SubKlassImpl) AnotherKlassImpl(org.drools.core.meta.org.test.AnotherKlassImpl) KlassImpl(org.drools.core.meta.org.test.KlassImpl) AnotherKlassImpl(org.drools.core.meta.org.test.AnotherKlassImpl) AnotherKlass_(org.drools.core.meta.org.test.AnotherKlass_) Test(org.junit.Test)

Aggregations

AnotherKlass (org.drools.core.meta.org.test.AnotherKlass)2 AnotherKlassImpl (org.drools.core.meta.org.test.AnotherKlassImpl)2 Klass (org.drools.core.meta.org.test.Klass)2 KlassImpl (org.drools.core.meta.org.test.KlassImpl)2 SubKlass (org.drools.core.meta.org.test.SubKlass)2 SubKlassImpl (org.drools.core.meta.org.test.SubKlassImpl)2 Test (org.junit.Test)2 AnotherKlass_ (org.drools.core.meta.org.test.AnotherKlass_)1 Klass_ (org.drools.core.meta.org.test.Klass_)1 SubKlass_ (org.drools.core.meta.org.test.SubKlass_)1