Created
September 14, 2010 16:33
-
-
Save tsurdilo/579313 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(Arquillian.class) | |
public class KSessionTest | |
{ | |
@Deployment | |
public static JavaArchive createTestArchive() | |
{ | |
String pkgPath = KSessionTest.class.getPackage().getName().replaceAll("\\.", "/"); | |
JavaArchive archive = ShrinkWrap.create("test.jar", JavaArchive.class) | |
.addPackages(true, new DroolsModuleFilter("ksession"), KnowledgeBaseProducer.class.getPackage()) | |
.addClass(KSessionTestRules.class) | |
.addClass(KSessionTestProducer.class) | |
.addResource(pkgPath + "/ksessiontest.drl", ArchivePaths.create("ksessiontest.drl")) | |
.addResource(pkgPath + "/kbuilderconfig.properties", ArchivePaths.create("kbuilderconfig.properties")) | |
.addResource(pkgPath + "/kbaseconfig.properties", ArchivePaths.create("kbaseconfig.properties")) | |
.addManifestResource(pkgPath + "/KSessionTest-beans.xml", ArchivePaths.create("beans.xml")) | |
.addManifestResource("META-INF/services/javax.enterprise.inject.spi.Extension", ArchivePaths.create("services/javax.enterprise.inject.spi.Extension")); | |
//System.out.println(archive.toString(Formatters.VERBOSE)); | |
return archive; | |
} | |
@Test | |
public void testKSession(@DefaultConfig @Default StatefulKnowledgeSession ksession) | |
{ | |
assertNotNull(ksession); | |
assertTrue(ksession.getId() >= 0); | |
} | |
} | |
*************** KSessionTestProducer | |
@DroolsConfig(kbuilderConfigFile = "kbuilderconfig.properties", | |
kbaseConfigFile = "kbaseconfig.properties", | |
ruleResources = { | |
@RuleResource( location="classpath", path="kbasetest.drl", type="DRL", templateDataProvider="forkbasetest") | |
}) | |
@Produces | |
@DefaultConfig | |
KnowledgeBaseProducer producer; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment