本文整理汇总了Java中org.drools.compiler.kproject.ReleaseIdImpl类的典型用法代码示例。如果您正苦于以下问题:Java ReleaseIdImpl类的具体用法?Java ReleaseIdImpl怎么用?Java ReleaseIdImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReleaseIdImpl类属于org.drools.compiler.kproject包,在下文中一共展示了ReleaseIdImpl类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: refreshContainer
import org.drools.compiler.kproject.ReleaseIdImpl; //导入依赖的package包/类
public void refreshContainer(String containerName){
logger.info("refreshing container {}", containerName);
ReleaseId releaseId = new ReleaseIdImpl("org.demo.rule", containerName, "1.0.0-" + UUID.randomUUID().toString().replaceAll("-", ""));
// retrieve rules from db
List<String> rules = ruleBucket.findAll().stream().map((r -> r.getContent())).collect(Collectors.toList());
logger.info("total {} rules for [{}]", rules.size(), ruleBucket);
Resource resource = kieServices.getResources().newByteArrayResource(RuleEngineUtil.createKJar(releaseId, rules));
KieModule module = kieServices.getRepository().addKieModule(resource);
KieContainer kieContainer = kieServices.newKieContainer(module.getReleaseId());
// create container is heavy, we only create once and cache it
containerMap.put(containerName, kieContainer);
// remove the repo immediately
kieServices.getRepository().removeKieModule(module.getReleaseId());
}
示例2: doTest
import org.drools.compiler.kproject.ReleaseIdImpl; //导入依赖的package包/类
@Test
public void doTest() throws InterruptedException {
new UrlResource();
KieServices kieServices = KieServices.Factory.get();
ReleaseIdImpl releaseId = new ReleaseIdImpl(G, A, V);
KieContainer kContainer = KieServices.Factory.get().newKieContainer(
releaseId);
KieScanner kScanner = kieServices.newKieScanner(kContainer);
KieSession kSession = kContainer.newKieSession();
kScanner.start(3000);
// KieScanner will continue scanning the server looking for artifact
// update
while (true) {
Thread.sleep(3000);
kSession.fireAllRules();
}
}
示例3: doTest
import org.drools.compiler.kproject.ReleaseIdImpl; //导入依赖的package包/类
@Test
public void doTest() throws InterruptedException {
//System.setProperty("kie.maven.settings.custom", value)
KieServices kieServices = KieServices.Factory.get();
ReleaseIdImpl releaseId = new ReleaseIdImpl(G, A, V);
KieContainer kContainer = KieServices.Factory.get().newKieContainer(
releaseId);
KieScanner kScanner = kieServices.newKieScanner(kContainer);
KieSession kSession = kContainer.newKieSession();
kScanner.start(3000);
// KieScanner will continue scanning the server looking for artifact
// update
while (true) {
Thread.sleep(3000);
kSession.fireAllRules();
}
}
示例4: createContainer
import org.drools.compiler.kproject.ReleaseIdImpl; //导入依赖的package包/类
private static KieContainerResource createContainer(KieServicesClient client) {
System.out.println("== CREATING CONTAINER ==");
ReleaseId releaseId = new ReleaseId(new ReleaseIdImpl(GAV));
KieContainerResource kcr = new KieContainerResource(CONTAINER_ID, releaseId);
client.createContainer(CONTAINER_ID, kcr);
return client.createContainer(CONTAINER_ID, kcr).getResult();
}
示例5: main
import org.drools.compiler.kproject.ReleaseIdImpl; //导入依赖的package包/类
public static void main(String[] args) {
ReleaseIdImpl releaseId = new ReleaseIdImpl(G, A, V);
KieContainer kContainer = KieServices.Factory.get().newKieContainer(releaseId);
KieSession kSession = kContainer.newKieSession();
kSession.insert("William");
kSession.fireAllRules();
}
示例6: KieMLContainerImpl
import org.drools.compiler.kproject.ReleaseIdImpl; //导入依赖的package包/类
public KieMLContainerImpl(String gAV) {
this(new ReleaseIdImpl(gAV));
}
示例7: testContainerUpdate
import org.drools.compiler.kproject.ReleaseIdImpl; //导入依赖的package包/类
@Test
public void testContainerUpdate() throws IOException, URISyntaxException {
ArrayList<Object> globalList = new ArrayList<>();
KieServices ks = KieServices.Factory.get();
ReleaseIdImpl releaseIdV1 = new ReleaseIdImpl("it.redhat.test.update", "rules", "1.0.0");
KieContainer kieContainer = KieAPITestUtils.setupKieContainerFromTemplates(releaseIdV1, "rules/globals-v1-rule.drl");
KieSession kieSession = kieContainer.newKieSession();
kieSession.setGlobal("list", globalList);
Assert.assertEquals(0, globalList.size());
kieSession.insert(1L);
kieSession.fireAllRules();
Assert.assertEquals(1, globalList.size());
Assert.assertEquals(1L, globalList.get(0));
kieSession.insert(2L);
kieSession.fireAllRules();
Assert.assertEquals(2, globalList.size());
Assert.assertEquals(1L, globalList.get(0));
Assert.assertEquals(3L, globalList.get(1));
ReleaseIdImpl releaseIdV2 = new ReleaseIdImpl("it.redhat.test.update", "rules", "2.0.0");
KieAPITestUtils.buildReleaseFromTemplates(releaseIdV2, "rules/globals-v2-rule.drl");
kieContainer.updateToVersion(releaseIdV2);
kieSession.insert(4L);
kieSession.fireAllRules();
Assert.assertEquals(3, globalList.size());
Assert.assertEquals(1L, globalList.get(0));
Assert.assertEquals(3L, globalList.get(1));
Assert.assertEquals(14L, globalList.get(2));
kieSession.dispose();
}
示例8: testContainerUpdateAfterSerialization
import org.drools.compiler.kproject.ReleaseIdImpl; //导入依赖的package包/类
@Test
public void testContainerUpdateAfterSerialization() throws IOException, URISyntaxException {
ArrayList<Object> globalList = new ArrayList<>();
KieServices ks = KieServices.Factory.get();
ReleaseIdImpl releaseIdV1 = new ReleaseIdImpl("it.redhat.test.serialized", "rules", "1.0.0");
KieContainer kieContainer = KieAPITestUtils.setupKieContainerFromTemplates(releaseIdV1, "rules/globals-v1-rule.drl");
KieSession kieSession = kieContainer.newKieSession();
kieSession.setGlobal("list", globalList);
Assert.assertEquals(0, globalList.size());
kieSession.insert(1L);
kieSession.fireAllRules();
Assert.assertEquals(1, globalList.size());
Assert.assertEquals(1L, globalList.get(0));
kieSession.insert(2L);
kieSession.fireAllRules();
Assert.assertEquals(2, globalList.size());
Assert.assertEquals(1L, globalList.get(0));
Assert.assertEquals(3L, globalList.get(1));
KieSessionByteArraySerializer serializer = new KieSessionByteArraySerializer();
byte[] buffer = serializer.writeObject(createSerializableMarshaller(kieContainer.getKieBase()), kieSession);
kieSession.dispose();
ReleaseIdImpl releaseIdV2 = new ReleaseIdImpl("it.redhat.test.serialized", "rules", "2.0.0");
KieAPITestUtils.buildReleaseFromTemplates(releaseIdV2, "rules/globals-v2-rule.drl");
kieContainer.updateToVersion(releaseIdV2);
KieSession serializedSession = serializer.readSession(createSerializableMarshaller(kieContainer.getKieBase()), buffer);
serializedSession.setGlobal("list", globalList);
serializedSession.insert(4L);
serializedSession.fireAllRules();
Assert.assertEquals(3, globalList.size());
Assert.assertEquals(1L, globalList.get(0));
Assert.assertEquals(3L, globalList.get(1));
Assert.assertEquals(14L, globalList.get(2));
}
示例9: testContainerUpdateAfterSerializationWindowLength
import org.drools.compiler.kproject.ReleaseIdImpl; //导入依赖的package包/类
@Test
public void testContainerUpdateAfterSerializationWindowLength() throws IOException, URISyntaxException {
ArrayList<Object> globalList = new ArrayList<>();
KieServices ks = KieServices.Factory.get();
ReleaseIdImpl releaseIdV1 = new ReleaseIdImpl("it.redhat.jdg.v1", "rules", "1.0.0");
KieContainer kieContainer = KieAPITestUtils.setupKieContainerFromTemplates(releaseIdV1, "rules/simple-rule.drl");
KieSession kieSession = kieContainer.newKieSession();
kieSession.registerChannel("additions", globalList::add);
Assert.assertEquals(0, globalList.size());
Fact fact = generateFactTenSecondsAfter(1L, 1L);
KieSessionUtils.advanceClock(kieSession, fact);
kieSession.insert(fact);
kieSession.fireAllRules();
Assert.assertEquals(1, globalList.size());
Assert.assertEquals(1L, globalList.get(0));
fact = generateFactTenSecondsAfter(1L, 2L);
KieSessionUtils.advanceClock(kieSession, fact);
kieSession.insert(fact);
kieSession.fireAllRules();
Assert.assertEquals(2, globalList.size());
Assert.assertEquals(1L, globalList.get(0));
Assert.assertEquals(3L, globalList.get(1));
KieSessionByteArraySerializer serializer = new KieSessionByteArraySerializer();
byte[] buffer = serializer.writeObject(createSerializableMarshaller(kieContainer.getKieBase()), kieSession);
kieSession.dispose();
ReleaseIdImpl releaseIdV2 = new ReleaseIdImpl("it.redhat.jdg.v2", "rules", "2.0.0");
KieAPITestUtils.buildReleaseFromTemplates(releaseIdV2, "rules/simple-rule-v2.drl");
KieSession serializedSession = serializer.readSession(createSerializableMarshaller(kieContainer.getKieBase()), buffer);
serializedSession.registerChannel("additions", globalList::add);
//KieContainer update should be done after unmarshall
kieContainer.updateToVersion(releaseIdV2);
fact = generateFactTenSecondsAfter(1L, 4L);
KieSessionUtils.advanceClock(serializedSession, fact);
serializedSession.insert(fact);
serializedSession.fireAllRules();
Assert.assertEquals(3, globalList.size());
Assert.assertEquals(1L, globalList.get(0));
Assert.assertEquals(3L, globalList.get(1));
Assert.assertEquals(14L, globalList.get(2));
}
示例10: createApplicationContext
import org.drools.compiler.kproject.ReleaseIdImpl; //导入依赖的package包/类
@Override
protected OsgiBundleXmlApplicationContext createApplicationContext() {
return getOsgiSpringContext(new ReleaseIdImpl("dummyGroup", "dummyArtifact", "dummyVersion"),
DroolsOnBodyCamelKarafIntegrationTest.class.getResource("/org/drools/karaf/itest/camel-context.xml"));
}
示例11: createApplicationContext
import org.drools.compiler.kproject.ReleaseIdImpl; //导入依赖的package包/类
@Override
protected OsgiBundleXmlApplicationContext createApplicationContext() {
return getOsgiSpringContext(new ReleaseIdImpl("dummyGroup", "dummyArtifact", "dummyVersion"),
DroolsOnCommandCamelKarafIntegrationTest.class.getResource("/org/drools/karaf/itest/camel-context.xml"));
}
开发者ID:jboss-integration,项目名称:fuse-bxms-integ,代码行数:6,代码来源:DroolsOnCommandCamelKarafIntegrationTest.java