use of org.drools.core.rule.TypeDeclaration in project drools by kiegroup.
the class CepEspTest method testEventExpiration.
@Test(timeout = 10000)
public void testEventExpiration() throws Exception {
KieBase kbase = loadKnowledgeBase("test_CEP_EventExpiration.drl");
// read in the source
TypeDeclaration factType = ((KnowledgeBaseImpl) kbase).getTypeDeclaration(StockTick.class);
assertEquals(TimeIntervalParser.parse("1h30m")[0], factType.getExpirationOffset());
}
use of org.drools.core.rule.TypeDeclaration in project drools by kiegroup.
the class TypeDeclarationMergingTest method testOverrideFromDeeperParentInterface.
@Test
public void testOverrideFromDeeperParentInterface() {
// inherits role but not typesafe
String str = "" + "package org.drools.compiler.test \n" + "global java.util.List list \n" + "declare " + IA.class.getCanonicalName() + "\n" + " @typesafe(true)\n" + " @role(event)\n" + "end\n" + "declare " + DImpl.class.getCanonicalName() + "\n" + " @typesafe(false)\n" + "end\n";
KnowledgeBuilderImpl builder = getPackageBuilder(str);
TypeDeclaration tdecl = builder.getTypeDeclaration(DImpl.class);
assertEquals(false, tdecl.isTypesafe());
assertEquals(Role.Type.EVENT, tdecl.getRole());
}
use of org.drools.core.rule.TypeDeclaration in project drools by kiegroup.
the class TypeDeclarationMergingTest method testInheritNoneExitenceFromParentInterface.
@Test
public void testInheritNoneExitenceFromParentInterface() {
// inherits role and typesafe
String str = "" + "package org.drools.compiler.test \n" + "global java.util.List list \n" + "declare " + IB.class.getCanonicalName() + "\n" + " @typesafe(true)\n" + " @role(event)\n" + "end\n";
KnowledgeBuilderImpl builder = getPackageBuilder(str);
TypeDeclaration tdecl = builder.getTypeDeclaration(DImpl.class);
assertEquals(true, tdecl.isTypesafe());
assertEquals(Role.Type.EVENT, tdecl.getRole());
}
use of org.drools.core.rule.TypeDeclaration in project drools by kiegroup.
the class TypeDeclarationMergingTest method testInheritNoneExitenceFromParentClass.
@Test
public void testInheritNoneExitenceFromParentClass() {
// inherits role and typesafe
String str = "" + "package org.drools.compiler.test \n" + "global java.util.List list \n" + "declare " + CImpl.class.getCanonicalName() + "\n" + " @typesafe(true)\n" + " @role(event)\n" + "end\n";
KnowledgeBuilderImpl builder = getPackageBuilder(str);
TypeDeclaration tdecl = builder.getTypeDeclaration(DImpl.class);
assertEquals(true, tdecl.isTypesafe());
assertEquals(Role.Type.EVENT, tdecl.getRole());
}
use of org.drools.core.rule.TypeDeclaration in project drools by kiegroup.
the class TypeDeclarationMergingTest method testInheritExitenceFromParentInterface.
@Test
public void testInheritExitenceFromParentInterface() {
// inherits role and typesafe
String str = "" + "package org.drools.compiler.test \n" + "global java.util.List list \n" + "declare " + IB.class.getCanonicalName() + "\n" + " @typesafe(true)\n" + " @role(event)\n" + "end\n" + "declare " + DImpl.class.getCanonicalName() + "\n" + "end\n";
KnowledgeBuilderImpl builder = getPackageBuilder(str);
TypeDeclaration tdecl = builder.getTypeDeclaration(DImpl.class);
assertEquals(true, tdecl.isTypesafe());
assertEquals(Role.Type.EVENT, tdecl.getRole());
}
Aggregations