public void testBRXMLWithDSLMixedIn() throws Exception { RulesRepository repo = getRepo(); // create our package PackageItem pkg = repo.createPackage("testBRLWithDSLMixedIn", ""); ServiceImplementation.updateDroolsHeader("import org.drools.Person", pkg); AssetItem rule1 = pkg.addAsset("rule2", ""); rule1.updateFormat(AssetFormats.BUSINESS_RULE); AssetItem dsl = pkg.addAsset("MyDSL", ""); dsl.updateFormat(AssetFormats.DSL); dsl.updateContent( "[when]This is a sentence=Person()\n[then]say {hello}=System.err.println({hello});"); dsl.checkin(""); RuleModel model = new RuleModel(); model.name = "rule2"; FactPattern pattern = new FactPattern("Person"); pattern.boundName = "p"; ActionSetField action = new ActionSetField("p"); ActionFieldValue value = new ActionFieldValue("age", "42", SuggestionCompletionEngine.TYPE_NUMERIC); action.addFieldValue(value); model.addLhsItem(pattern); model.addRhsItem(action); DSLSentence dslCondition = new DSLSentence(); dslCondition.sentence = "This is a sentence"; model.addLhsItem(dslCondition); DSLSentence dslAction = new DSLSentence(); dslAction.sentence = "say {42}"; model.addRhsItem(dslAction); rule1.updateContent(BRXMLPersistence.getInstance().marshal(model)); rule1.checkin(""); repo.save(); // now add a rule with no DSL model = new RuleModel(); model.name = "ruleNODSL"; pattern = new FactPattern("Person"); pattern.boundName = "p"; action = new ActionSetField("p"); value = new ActionFieldValue("age", "42", SuggestionCompletionEngine.TYPE_NUMERIC); action.addFieldValue(value); model.addLhsItem(pattern); model.addRhsItem(action); AssetItem ruleNODSL = pkg.addAsset("ruleNoDSL", ""); ruleNODSL.updateFormat(AssetFormats.BUSINESS_RULE); ruleNODSL.updateContent(BRXMLPersistence.getInstance().marshal(model)); ruleNODSL.checkin(""); pkg = repo.loadPackage("testBRLWithDSLMixedIn"); ContentPackageAssembler asm = new ContentPackageAssembler(pkg); assertFalse(asm.hasErrors()); Package bpkg = asm.getBinaryPackage(); assertEquals(2, bpkg.getRules().length); }