public void testPackageWithRuleflow() throws Exception { RulesRepository repo = getRepo(); PackageItem pkg = repo.createPackage("testPackageWithRuleFlow", ""); AssetItem model = pkg.addAsset("model", "qed"); model.updateFormat(AssetFormats.MODEL); model.updateBinaryContentAttachment(this.getClass().getResourceAsStream("/billasurf.jar")); model.checkin(""); ServiceImplementation.updateDroolsHeader( "import com.billasurf.Board\n global com.billasurf.Person customer", pkg); AssetItem rule1 = pkg.addAsset("rule_1", ""); rule1.updateFormat(AssetFormats.DRL); rule1.updateContent("rule 'rule1' \n when Board() \n then customer.setAge(42); \n end"); rule1.checkin(""); AssetItem ruleFlow = pkg.addAsset("ruleFlow", ""); ruleFlow.updateFormat(AssetFormats.RULE_FLOW_RF); ruleFlow.updateBinaryContentAttachment(this.getClass().getResourceAsStream("/ruleflow.rfm")); ruleFlow.checkin(""); ContentPackageAssembler asm = new ContentPackageAssembler(pkg); assertFalse(asm.hasErrors()); Map flows = asm.getBinaryPackage().getRuleFlows(); assertNotNull(flows); assertEquals(1, flows.size()); Object flow = flows.values().iterator().next(); assertNotNull(flow); assertTrue(flow instanceof RuleFlowProcess); // now check we can do some MVEL stuff from the classloader... List<JarInputStream> jars = BRMSPackageBuilder.getJars(pkg); PackageBuilder builder = BRMSPackageBuilder.getInstance(jars); ClassLoader newCL = builder.getPackageBuilderConfiguration().getClassLoader(); ClassLoader oldCL = Thread.currentThread().getContextClassLoader(); // set the CL for the current thread so MVEL can find it Thread.currentThread().setContextClassLoader(newCL); Object o = MVEL.eval("new com.billasurf.Board()"); assertEquals("com.billasurf.Board", o.getClass().getName()); System.err.println(o.toString()); Thread.currentThread().setContextClassLoader(oldCL); builder.addPackageFromDrl(new StringReader("package foo\n import com.billasurf.Board")); Object o2 = builder.getPackageRegistry("foo").getTypeResolver().resolveType("Board"); assertNotNull(o2); assertEquals("com.billasurf.Board", ((Class) o2).getName()); }