Package org.dayatang.rule

Examples of org.dayatang.rule.StatelessRuleService


  String ruleDrl = "/rule/Foo.drl";

  @Test
  public void item1() throws Exception {
        StatelessRuleService instance = StatelessRuleServiceJsr94.builder()
                .ruleServiceProvider(new RuleServiceProviderImpl())
                .ruleSource(getClass().getResourceAsStream(ruleDrl))
                .bulid();
    List<?> globalStatelessResults = instance.executeRules(createObjects());
    for (Object object : globalStatelessResults) {
      System.out.println(object);
    }
  }
View Full Code Here


  public void stateless() throws Exception {
    // Execute rule
    List<Person> objects = new ArrayList<Person>();
    objects.add(new Person(1L, "chencao"));

        StatelessRuleService instance = StatelessRuleServiceJsr94.builder()
                .ruleServiceProvider(new RuleServiceProviderImpl())
                .ruleSource(getClass().getResourceAsStream(ruleDrl))
                .bulid();

        // Execute rule
        List statelessResults = instance.executeRules(Arrays.asList(new Person(1L, "chencao")));

    // Validate
    assertEquals(1, statelessResults.size());

    Person p = (Person) statelessResults.get(0);
View Full Code Here

    // Prepare global parameter
    List globalList = new ArrayList();
    Map sessionProperties = new HashMap();
    sessionProperties.put("list", globalList);

        StatelessRuleService instance = StatelessRuleServiceJsr94.builder()
                .ruleServiceProvider(new RuleServiceProviderImpl())
                .ruleSource(getClass().getResourceAsStream(ruleDrl))
                .sessionProperties(sessionProperties)
                .bulid();

    // Execute rule
    Person firstPerson = new Person(3L, "chencao");
        instance.executeRules(Arrays.asList(firstPerson));

    // FirstPerson hasn't been changed
    assertEquals(300, firstPerson.getId().longValue());

    // Validate global
View Full Code Here

TOP

Related Classes of org.dayatang.rule.StatelessRuleService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.