Search in sources :

Example 11 with TypeMetaInfo

use of org.drools.core.rule.TypeMetaInfo in project drools by kiegroup.

the class JavaBeansEventRoleTest method testFullyQualifiedDeclarativeTypeName.

@Test
public void testFullyQualifiedDeclarativeTypeName() throws Exception {
    String declaration = "package org.drools.compiler;\n" + "public class Bean {}";
    String drl = "declare org.drools.compiler.Bean\n" + "  @role(event)\n" + "end";
    KieServices ks = KieServices.Factory.get();
    KieFileSystem kfs = ks.newKieFileSystem().write("src/main/java/org/drools/compiler/Bean.java", declaration).write("src/main/resources/bean1.drl", drl);
    final KieBuilder kieBuilder = ks.newKieBuilder(kfs);
    final KieModule kieModule = kieBuilder.buildAll().getKieModule();
    final KieModuleMetaData kieModuleMetaData = KieModuleMetaData.Factory.newKieModuleMetaData(kieModule);
    final String packageName = "org.drools.compiler";
    final String className = "Bean";
    final Class clazz = kieModuleMetaData.getClass(packageName, className);
    final TypeMetaInfo typeMetaInfo = kieModuleMetaData.getTypeMetaInfo(clazz);
    assertTrue(typeMetaInfo.isEvent());
}
Also used : TypeMetaInfo(org.drools.core.rule.TypeMetaInfo) KieFileSystem(org.kie.api.builder.KieFileSystem) KieServices(org.kie.api.KieServices) KieBuilder(org.kie.api.builder.KieBuilder) KieModule(org.kie.api.builder.KieModule) KieModuleMetaData(org.kie.scanner.KieModuleMetaData) Test(org.junit.Test)

Aggregations

TypeMetaInfo (org.drools.core.rule.TypeMetaInfo)11 Test (org.junit.Test)6 KieServices (org.kie.api.KieServices)6 KieModule (org.kie.api.builder.KieModule)5 KieModuleMetaData (org.kie.scanner.KieModuleMetaData)5 InternalKieModule (org.drools.compiler.kie.builder.impl.InternalKieModule)4 KieBuilder (org.kie.api.builder.KieBuilder)4 KieFileSystem (org.kie.api.builder.KieFileSystem)4 HashSet (java.util.HashSet)3 Set (java.util.Set)3 KieModuleMetaInfo (org.drools.core.rule.KieModuleMetaInfo)3 ReleaseId (org.kie.api.builder.ReleaseId)3 KieModuleModel (org.kie.api.builder.model.KieModuleModel)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 InternalKnowledgeBuilder (org.drools.compiler.builder.InternalKnowledgeBuilder)2 PackageRegistry (org.drools.compiler.compiler.PackageRegistry)2 ClassDefinition (org.drools.core.factmodel.ClassDefinition)2 JavaDialectRuntimeData (org.drools.core.rule.JavaDialectRuntimeData)2 TypeDeclaration (org.drools.core.rule.TypeDeclaration)2