当前位置: 首页>>代码示例>>Java>>正文


Java ReleaseIdImpl类代码示例

本文整理汇总了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());
    }
 
开发者ID:barrykalok,项目名称:spring-boot-drools-example,代码行数:21,代码来源:RuleService.java

示例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();
	}
}
 
开发者ID:jesuino,项目名称:bpms6-examples,代码行数:18,代码来源:KieScannerTest.java

示例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();
	}
}
 
开发者ID:jesuino,项目名称:bpms6-examples,代码行数:18,代码来源:KieScannerRemoteTest.java

示例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();
}
 
开发者ID:jesuino,项目名称:kie-ml,代码行数:8,代码来源:KieServerMLClientTest.java

示例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();
}
 
开发者ID:jesuino,项目名称:bpms6-examples,代码行数:8,代码来源:Main.java

示例6: KieMLContainerImpl

import org.drools.compiler.kproject.ReleaseIdImpl; //导入依赖的package包/类
public KieMLContainerImpl(String gAV) {
	this(new ReleaseIdImpl(gAV));
}
 
开发者ID:jesuino,项目名称:kie-ml,代码行数:4,代码来源:KieMLContainerImpl.java

示例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();
}
 
开发者ID:redhat-italy,项目名称:hacep,代码行数:42,代码来源:TestKieSessionUpdate.java

示例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));
}
 
开发者ID:redhat-italy,项目名称:hacep,代码行数:48,代码来源:TestKieSessionUpdate.java

示例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));
}
 
开发者ID:redhat-italy,项目名称:hacep,代码行数:55,代码来源:TestKieSessionUpdate.java

示例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"));
}
 
开发者ID:jboss-integration,项目名称:fuse-bxms-integ,代码行数:6,代码来源:DroolsOnBodyCamelKarafIntegrationTest.java

示例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


注:本文中的org.drools.compiler.kproject.ReleaseIdImpl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。