本文整理汇总了Java中org.kie.internal.io.ResourceFactory.newClassPathResource方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceFactory.newClassPathResource方法的具体用法?Java ResourceFactory.newClassPathResource怎么用?Java ResourceFactory.newClassPathResource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kie.internal.io.ResourceFactory
的用法示例。
在下文中一共展示了ResourceFactory.newClassPathResource方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testExecuteUsingKieAPI
import org.kie.internal.io.ResourceFactory; //导入方法依赖的package包/类
/**
* Test execute using kie api.
*
* @throws Exception the exception
*/
@Test
public void testExecuteUsingKieAPI() throws Exception {
// get the resource
Resource dt = ResourceFactory.newClassPathResource("/data/IntegrationExampleTest.xls", getClass());
// create the builder
KieSession ksession = getKieSession(dt);
ksession.insert(new Cheese("stilton", 42));
ksession.insert(new Person("michael", "stilton", 42));
final List<String> list = new ArrayList<String>();
ksession.setGlobal("list", list);
ksession.fireAllRules();
assertEquals(1, list.size());
assertEquals("Old man stilton", list.get(0));
}
示例2: addClassPathResource
import org.kie.internal.io.ResourceFactory; //导入方法依赖的package包/类
@Override
public KnowledgeService addClassPathResource(String resourceName, Handler<AsyncResult<Void>> handler) {
Resource resource = ResourceFactory.newClassPathResource(resourceName);
environmentBuilder.addAsset(resource, resource.getResourceType());
handler.handle(Future.succeededFuture());
return this;
}
示例3: testExecuteJBRULES3005
import org.kie.internal.io.ResourceFactory; //导入方法依赖的package包/类
/**
* Test execute jbrule s3005.
*
* @throws Exception the exception
*/
@Test
public void testExecuteJBRULES3005() throws Exception {
Resource dt = ResourceFactory.newClassPathResource("/data/IntegrationExampleTest.xls", getClass());
KieSession ksession = getKieSession(dt);
// ASSERT AND FIRE
ksession.insert(new Cheese("stilton", 42));
ksession.insert(new Person("michael", "stilton", 42));
final List<String> list = new ArrayList<String>();
ksession.setGlobal("list", list);
ksession.fireAllRules();
assertEquals(1, list.size());
assertEquals("Old man stilton", list.get(0));
}