Skip to content

Commit

Permalink
[ENTESB-4090] Fixing fuse integration (Fuse hack breaks kie-remote-cl…
Browse files Browse the repository at this point in the history
…ient usage in Fuse code)
  • Loading branch information
Marco Rietveld authored and mariofusco committed Oct 20, 2015
1 parent 155c5f9 commit afd21c8
Show file tree
Hide file tree
Showing 46 changed files with 1,654 additions and 963 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
Expand Down Expand Up @@ -62,8 +62,18 @@
public class CommonTestMethodBase extends Assert { public class CommonTestMethodBase extends Assert {
public static RuleEngineOption phreak = RuleEngineOption.PHREAK; public static RuleEngineOption phreak = RuleEngineOption.PHREAK;


protected KieSession createKieSession(KieBase kbase) {
return kbase.newKieSession();
}

protected KieSession createKieSession(KieBase kbase, KieSessionOption option) {
KieSessionConfiguration ksconf = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
ksconf.setOption(option);
return kbase.newKieSession(ksconf, null);
}

protected StatefulKnowledgeSession createKnowledgeSession(KnowledgeBase kbase) { protected StatefulKnowledgeSession createKnowledgeSession(KnowledgeBase kbase) {
return kbase.newStatefulKnowledgeSession(); return kbase.newStatefulKnowledgeSession();
} }


protected StatefulKnowledgeSession createKnowledgeSession(KnowledgeBase kbase, KieSessionOption option) { protected StatefulKnowledgeSession createKnowledgeSession(KnowledgeBase kbase, KieSessionOption option) {
Expand Down Expand Up @@ -267,7 +277,7 @@ protected InternalAgenda getInternalAgenda(StatefulKnowledgeSession session) {
return (InternalAgenda) session.getAgenda(); return (InternalAgenda) session.getAgenda();
} }


public static byte[] createJar(KieServices ks, public static byte[] createJar(KieServices ks,
ReleaseId releaseId, ReleaseId releaseId,
String... drls) { String... drls) {
KieFileSystem kfs = ks.newKieFileSystem().generateAndWritePomXML( KieFileSystem kfs = ks.newKieFileSystem().generateAndWritePomXML(
Expand All @@ -278,7 +288,7 @@ public static byte[] createJar(KieServices ks,
} }
} }
KieBuilder kb = ks.newKieBuilder(kfs).buildAll(); KieBuilder kb = ks.newKieBuilder(kfs).buildAll();
assertFalse( kb.getResults().getMessages(org.kie.api.builder.Message.Level.ERROR).toString(), assertFalse( kb.getResults().getMessages(org.kie.api.builder.Message.Level.ERROR).toString(),
kb.getResults().hasMessages(org.kie.api.builder.Message.Level.ERROR) ); kb.getResults().hasMessages(org.kie.api.builder.Message.Level.ERROR) );
InternalKieModule kieModule = (InternalKieModule) ks.getRepository() InternalKieModule kieModule = (InternalKieModule) ks.getRepository()
.getKieModule(releaseId); .getKieModule(releaseId);
Expand Down
16 changes: 10 additions & 6 deletions drools-compiler/src/test/java/org/drools/compiler/Person.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;


import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;

@Traitable @Traitable
@XmlAccessorType(XmlAccessType.FIELD)
public class Person public class Person
implements implements
Serializable, Serializable,
Expand All @@ -50,13 +54,13 @@ public class Person


private Address address; private Address address;
private Pet pet; private Pet pet;

private List<Address> addresses = new ArrayList<Address>(); private List<Address> addresses = new ArrayList<Address>();
private Map<Object, Address> namedAddresses = new HashMap<Object, Address>(0); private Map<Object, Address> namedAddresses = new HashMap<Object, Address>(0);



public Object object; public Object object;

public Object notInEqualTestObject; public Object notInEqualTestObject;


public Person() { public Person() {
Expand Down Expand Up @@ -91,10 +95,10 @@ public Option<Address> getAddressOption() {
public List<Address> getAddresses() { public List<Address> getAddresses() {
return addresses; return addresses;
} }

public List getAddressesNoGenerics() { public List getAddressesNoGenerics() {
return addresses; return addresses;
} }


public void setAddresses(List<Address> addresses) { public void setAddresses(List<Address> addresses) {
this.addresses = addresses; this.addresses = addresses;
Expand Down Expand Up @@ -353,6 +357,6 @@ public Object getObject() {


public void setObject(Object object) { public void setObject(Object object) {
this.object = object; this.object = object;
} }


} }
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
Expand All @@ -17,13 +17,15 @@


import org.drools.compiler.CommonTestMethodBase; import org.drools.compiler.CommonTestMethodBase;
import org.drools.core.BeliefSystemType; import org.drools.core.BeliefSystemType;
import org.drools.core.QueryResultsImpl;
import org.drools.core.SessionConfiguration; import org.drools.core.SessionConfiguration;
import org.drools.core.beliefsystem.BeliefSet; import org.drools.core.beliefsystem.BeliefSet;
import org.drools.core.beliefsystem.abductive.Abducible; import org.drools.core.beliefsystem.abductive.Abducible;
import org.drools.core.beliefsystem.defeasible.Defeasible; import org.drools.core.beliefsystem.defeasible.Defeasible;
import org.drools.core.common.EqualityKey; import org.drools.core.common.EqualityKey;
import org.drools.core.common.InternalFactHandle; import org.drools.core.common.InternalFactHandle;
import org.drools.core.factmodel.traits.Thing; import org.drools.core.factmodel.traits.Thing;
import org.drools.core.runtime.rule.impl.FlatQueryResults;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.kie.api.KieBase; import org.kie.api.KieBase;
Expand Down Expand Up @@ -918,9 +920,9 @@ public void testQueryAPIs() {
assertNotNull( q1 ); assertNotNull( q1 );
assertNotNull( q2 ); assertNotNull( q2 );


QueryResults q10res = session.getQueryResults( "foo", "foo" ); QueryResults q10res = new FlatQueryResults((QueryResultsImpl) session.getQueryResults( "foo", "foo" ));
QueryResults q11res = session.getQueryResults( "foo", "foo", Variable.v ); QueryResults q11res = new FlatQueryResults((QueryResultsImpl) session.getQueryResults( "foo", "foo", Variable.v ));
QueryResults q20res = session.getQueryResults( "bar", "foo", Variable.v ); QueryResults q20res = new FlatQueryResults((QueryResultsImpl) session.getQueryResults( "bar", "foo", Variable.v ));


assertEquals( 1, q10res.size() ); assertEquals( 1, q10res.size() );
assertEquals( 1, q11res.size() ); assertEquals( 1, q11res.size() );
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
Expand Down Expand Up @@ -2977,10 +2977,6 @@ public void testNoLoopAccumulate() {
assertEquals( 2, counter.get() ); assertEquals( 2, counter.get() );
} }


private KieSession createKieSession( KieBase kbase ) {
return kbase.newKieSession();
}

private KieSession getKieSessionFromResources( String... classPathResources ) { private KieSession getKieSessionFromResources( String... classPathResources ) {
KieBase kbase = loadKnowledgeBase( null, null, classPathResources ); KieBase kbase = loadKnowledgeBase( null, null, classPathResources );
return kbase.newKieSession(); return kbase.newKieSession();
Expand Down
Loading

0 comments on commit afd21c8

Please sign in to comment.