@Test
public void remoteKAgentRuleTest() throws IOException, IOException, IOException, IOException, InterruptedException {
StatefulKnowledgeSession ksession = createSession();
ksession.setGlobal("myGlobalObj", new MyObject("myglobalObj"));
MyObject obj1 = new MyObject("obj1");
ksession.insert(obj1);
int fired = ksession.fireAllRules();
Assert.assertEquals(1, fired);
String changeSetString = "<change-set xmlns='http://drools.org/drools-5.0/change-set'>"
+ "<add>"
+ "<resource type=\"DRL\" source=\"classpath:simple.drl\" />"
+ "</add>"
+ "</change-set>"
+ "";
Resource changeSetRes = new ByteArrayResource(changeSetString.getBytes());
((InternalResource) changeSetRes).setResourceType(ResourceType.CHANGE_SET);
KnowledgeAgent kAgent = GridHelper.getKnowledgeAgentRemoteClient(remoteN1.getId(), "ksession-rules");
kAgent.applyChangeSet(changeSetRes);
Thread.sleep(5000);
MyObject obj2 = new MyObject("obj2");
ksession.insert(obj2);
fired = ksession.fireAllRules();
Assert.assertEquals(2, fired);