Search in sources :

Example 6 with KieFileSystemImpl

use of org.drools.compiler.kie.builder.impl.KieFileSystemImpl in project drools by kiegroup.

the class KieBuilderTest method testInvalidPomXmlGAV.

@Test
public void testInvalidPomXmlGAV() throws ClassNotFoundException, InterruptedException, IOException {
    String namespace = "org.kie.test";
    KieModuleModel kProj = createKieProject(namespace);
    ReleaseId releaseId = new ReleaseIdImpl("", "", "");
    KieFileSystem kfs = KieServices.Factory.get().newKieFileSystem();
    generatePomXML(kfs, releaseId);
    generateMessageClass(kfs, namespace);
    generateRule(kfs, namespace);
    MemoryFileSystem mfs = ((KieFileSystemImpl) kfs).asMemoryFileSystem();
    KieBuilder kieBuilder = createKieBuilder(kfs);
    kieBuilder.buildAll();
    assertTrue(kieBuilder.getResults().hasMessages(Level.ERROR));
}
Also used : ReleaseIdImpl(org.drools.compiler.kproject.ReleaseIdImpl) MemoryFileSystem(org.drools.compiler.compiler.io.memory.MemoryFileSystem) KieFileSystem(org.kie.api.builder.KieFileSystem) KieFileSystemImpl(org.drools.compiler.kie.builder.impl.KieFileSystemImpl) KieModuleModel(org.kie.api.builder.model.KieModuleModel) ReleaseId(org.kie.api.builder.ReleaseId) KieBuilder(org.kie.api.builder.KieBuilder) Test(org.junit.Test)

Example 7 with KieFileSystemImpl

use of org.drools.compiler.kie.builder.impl.KieFileSystemImpl in project drools by kiegroup.

the class KieBuilderTest method testEmptyProjectXml.

@Test
public void testEmptyProjectXml() throws ClassNotFoundException, InterruptedException, IOException {
    String namespace = "org.kie.test";
    KieServices ks = KieServices.Factory.get();
    KieModuleModel kProj = ks.newKieModuleModel();
    ReleaseId releaseId = KieServices.Factory.get().newReleaseId(namespace, "memory", "1.0-SNAPSHOT");
    KieFileSystem kfs = KieServices.Factory.get().newKieFileSystem();
    generateKProjectXML(kfs, namespace, kProj);
    generatePomXML(kfs, releaseId);
    generateMessageClass(kfs, namespace);
    generateRule(kfs, namespace);
    MemoryFileSystem mfs = ((KieFileSystemImpl) kfs).asMemoryFileSystem();
    createAndTestKieContainer(releaseId, createKieBuilder(kfs), null);
}
Also used : MemoryFileSystem(org.drools.compiler.compiler.io.memory.MemoryFileSystem) KieFileSystem(org.kie.api.builder.KieFileSystem) KieFileSystemImpl(org.drools.compiler.kie.builder.impl.KieFileSystemImpl) KieModuleModel(org.kie.api.builder.model.KieModuleModel) KieServices(org.kie.api.KieServices) ReleaseId(org.kie.api.builder.ReleaseId) Test(org.junit.Test)

Example 8 with KieFileSystemImpl

use of org.drools.compiler.kie.builder.impl.KieFileSystemImpl in project drools by kiegroup.

the class KieBuilderTest method testOnDisc.

@Test
public void testOnDisc() throws ClassNotFoundException, InterruptedException, IOException {
    String namespace = "org.kie.test";
    KieModuleModel kProj = createKieProject(namespace);
    ReleaseId releaseId = KieServices.Factory.get().newReleaseId(namespace, "memory", "1.0-SNAPSHOT");
    KieFileSystem kfs = KieServices.Factory.get().newKieFileSystem();
    generateAll(kfs, namespace, releaseId, kProj);
    MemoryFileSystem mfs = ((KieFileSystemImpl) kfs).asMemoryFileSystem();
    File file = fileManager.getRootDirectory();
    mfs.writeAsFs(file);
    createAndTestKieContainer(releaseId, createKieBuilder(kfs), namespace);
}
Also used : MemoryFileSystem(org.drools.compiler.compiler.io.memory.MemoryFileSystem) KieFileSystem(org.kie.api.builder.KieFileSystem) KieFileSystemImpl(org.drools.compiler.kie.builder.impl.KieFileSystemImpl) KieModuleModel(org.kie.api.builder.model.KieModuleModel) ReleaseId(org.kie.api.builder.ReleaseId) File(java.io.File) Test(org.junit.Test)

Aggregations

KieFileSystemImpl (org.drools.compiler.kie.builder.impl.KieFileSystemImpl)8 ReleaseId (org.kie.api.builder.ReleaseId)8 MemoryFileSystem (org.drools.compiler.compiler.io.memory.MemoryFileSystem)7 Test (org.junit.Test)7 KieFileSystem (org.kie.api.builder.KieFileSystem)7 KieModuleModel (org.kie.api.builder.model.KieModuleModel)5 KieServices (org.kie.api.KieServices)3 File (java.io.File)2 KieBuilder (org.kie.api.builder.KieBuilder)2 ArrayList (java.util.ArrayList)1 InternalKieModule (org.drools.compiler.kie.builder.impl.InternalKieModule)1 InternalKieScanner (org.drools.compiler.kie.builder.impl.InternalKieScanner)1 MemoryKieModule (org.drools.compiler.kie.builder.impl.MemoryKieModule)1 ReleaseIdImpl (org.drools.compiler.kproject.ReleaseIdImpl)1 KieModuleModelImpl (org.drools.compiler.kproject.models.KieModuleModelImpl)1 KieBaseModel (org.kie.api.builder.model.KieBaseModel)1 KieScannerEvent (org.kie.api.event.kiescanner.KieScannerEvent)1 KieScannerEventListener (org.kie.api.event.kiescanner.KieScannerEventListener)1 KieScannerStatusChangeEvent (org.kie.api.event.kiescanner.KieScannerStatusChangeEvent)1 KieScannerUpdateResultsEvent (org.kie.api.event.kiescanner.KieScannerUpdateResultsEvent)1