Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.drools.jboss.integration;
 
 import  org.jboss.arquillian.container.test.api.Deployment;
 import  org.jboss.arquillian.junit.Arquillian;
 import  org.jboss.shrinkwrap.api.ArchivePaths;
 import  org.jboss.shrinkwrap.api.ShrinkWrap;
 import  org.jboss.shrinkwrap.api.asset.EmptyAsset;
 import  org.jboss.shrinkwrap.api.spec.JavaArchive;
import  org.jboss.shrinkwrap.api.spec.WebArchive;
import  org.jboss.shrinkwrap.resolver.api.maven.Maven;
import  org.kie.api.cdi.KSession;
import  org.kie.api.runtime.KieSession;
import static junit.framework.Assert.assertEquals;
import static junit.framework.TestCase.assertNotNull;
@Ignore @RunWith(Arquillian.class)
public class KieArchiveTest {
    @Deployment
    public static WebArchive createDeployment() {
        File[] libs = Maven.resolver()
                           .loadPomFromFile("pom.xml").resolve("org.drools:drools-compiler",
                                                               "com.google.protobuf:protobuf-java")
                           .withTransitivity().asFile();
        JavaArchive kjar = ShrinkWrap.create(JavaArchive.class)
                .addClass(TestFactDeclaredInJar.class)
                .addAsResource("basic/sample.drl")
                .addAsResource("META-INF/kmodule.xml")
                .addAsResource("META-INF/maven/pom.properties");
        WebArchive drools = ShrinkWrap.create(WebArchive.class)
                .addAsLibraries(libs)
                .addAsLibrary(kjar)
                .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
        ..println(drools.toString(true));
        return drools;
    }
    @Inject
    @KSession("basicKSession")
    KieSession basicKieSession;
    @Test
    public void test() {
        List list = new ArrayList();
        .setGlobal("resultList"list);
        .insert(new TestFactDeclaredInJar());
        .fireAllRules();
        assertEquals(2, list.size());
    }
New to GrepCode? Check out our FAQ X