@@ -0,0 +1,1831 @@
+package org.drools.example.api.defaultkiesession;%0A%0Aimport org.junit.Test;%0Aimport org.kie.api.KieServices;%0Aimport org.kie.api.builder.KieBuilder;%0Aimport org.kie.api.runtime.KieSession;%0A%0Aimport java.io.ByteArrayOutputStream;%0Aimport java.io.File;%0Aimport java.io.IOException;%0Aimport java.io.PrintStream;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Apublic class DefaultKieSessionFromFSExampleTest %7B%0A%0A    @Test%0A    public void testGo() %7B%0A        ByteArrayOutputStream baos = new ByteArrayOutputStream();%0A        PrintStream ps = new PrintStream(baos);%0A        go(ps);%0A        ps.close();%0A%0A        String actual = new String(baos.toByteArray());%0A        String expected = %22%22 +%0A                          %22Dave: Hello, HAL. Do you read me, HAL?%5Cn%22 +%0A                          %22HAL: Dave. I read you.%5Cn%22;%0A        assertEquals(expected, actual);%0A    %7D%0A%0A    public void go(PrintStream out) %7B%0A        String currentFolder = null;%0A        try %7B%0A            currentFolder = new File(%22.%22).getCanonicalPath();%0A        %7D catch (IOException e) %7B%0A            throw new RuntimeException(e);%0A        %7D%0A%0A        File rootFolder = null;%0A        if (currentFolder.endsWith(%22drools%22)) %7B%0A            rootFolder = new File(%22drools-examples-api/default-kiesession%22);%0A        %7D else if (currentFolder.endsWith(%22drools-examples-api%22)) %7B%0A            rootFolder = new File(%22default-kiesession%22);%0A        %7D else %7B%0A            rootFolder = new File(%22.%22);%0A        %7D%0A%0A        KieServices ks = KieServices.Factory.get();%0A        KieBuilder kieBuilder = ks.newKieBuilder(rootFolder).buildAll();%0A%0A        KieSession kSession = ks.newKieContainer(kieBuilder.getKieModule().getReleaseId()).newKieSession();%0A        kSession.setGlobal(%22out%22, out);%0A        kSession.insert(new Message(%22Dave%22, %22Hello, HAL. Do you read me, HAL?%22));%0A        kSession.fireAllRules();%0A    %7D%0A%7D%0A

add test case creating a KieBuilder from a file system folder