use of org.drools.testcoverage.common.model.InternationalAddress in project drools by kiegroup.
the class OOPathDslTest method dslWithOOPathAndSpecialChars.
/**
* Shows it's possible to use OOPath including some characters that are significant for both DSL and OOPath.
*/
@Test
public void dslWithOOPathAndSpecialChars() {
final String dsl = "[when]Person comes from \"{state}\"=person : " + "Person( /address#InternationalAddress[ state == \"{state}\" ] )\n";
final String drl = "package P\n" + "\n" + "import org.drools.testcoverage.common.model.InternationalAddress\n" + "import org.drools.testcoverage.common.model.Person\n" + "\n" + "rule R\n" + "when\n" + " Person comes from \"Peaceful State\"\n" + "then\n" + "end";
KieSession kieSession = new KieHelper().addContent(dsl, ResourceType.DSL).addContent(drl, ResourceType.DSLR).build().newKieSession();
final Person person = new Person("Bruno", 21);
person.setAddress(new InternationalAddress("Some Street", 10, "Beautiful City", "Peaceful State"));
kieSession.insert(person);
assertThat(kieSession.fireAllRules()).isEqualTo(1);
}
use of org.drools.testcoverage.common.model.InternationalAddress in project drools by kiegroup.
the class OOPathDtablesTest method prepareData.
private Person[] prepareData() {
final Person bruno = new Person("Bruno", 25);
bruno.setAddress(new InternationalAddress("Some Street", 10, "Nice City", "Safecountry"));
final Person robert = new Person("Robert", 17);
robert.setAddress(new InternationalAddress("Some Street", 12, "Small City", "Riskyland"));
final Person joe = new Person("Joe", 11);
joe.setAddress(new InternationalAddress("Some Street", 13, "Big City", "Safecountry"));
final Person mike = new Person("Mike", 25);
mike.setAddress(new Address("Some Street", 14, "Local City"));
return new Person[] { bruno, robert, joe, mike };
}
Aggregations