Package javax.rules.admin

Examples of javax.rules.admin.RuleExecutionSet


            // This rule execution set is part of the TCK.
            InputStream inStream = new FileInputStream( "example1.xml" );
            System.out.println("Acquired InputStream to example1.xml: " + inStream );

            // parse the ruleset from the XML document
            RuleExecutionSet res1 = ruleAdministrator.getLocalRuleExecutionSetProvider( null ).createRuleExecutionSet( inStream, null );
            inStream.close();
            System.out.println( "Loaded RuleExecutionSet: " + res1);

            // register the RuleExecutionSet
            String uri = res1.getName();
            ruleAdministrator.registerRuleExecutionSet(uri, res1, null );
            System.out.println( "Bound RuleExecutionSet to URI: " + uri);

            // Get a RuleRuntime and invoke the rule engine.
            System.out.println( "\nRuntime API\n" );
View Full Code Here


      // This rule execution set is part of the TCK.
      InputStream inStream = new FileInputStream( "example4.xml" );
      System.out.println("Acquired InputStream to example4.xml: " + inStream );

      // parse the ruleset from the XML document
      RuleExecutionSet res1 = ruleAdministrator.getLocalRuleExecutionSetProvider( null ).createRuleExecutionSet( inStream, null );
      inStream.close();
      System.out.println( "Loaded RuleExecutionSet: " + res1);

      // register the RuleExecutionSet
      String uri = res1.getName();
      ruleAdministrator.registerRuleExecutionSet(uri, res1, null );
      System.out.println( "Bound RuleExecutionSet to URI: " + uri);

      // Get a RuleRuntime and invoke the rule engine.
      System.out.println( "\nRuntime API\n" );
View Full Code Here

      // This rule execution set is part of the TCK.
      InputStream inStream = new FileInputStream( "example5.xml" );
      System.out.println("Acquired InputStream to example5.xml: " + inStream );

      // parse the ruleset from the XML document
      RuleExecutionSet res1 = ruleAdministrator.getLocalRuleExecutionSetProvider( null ).createRuleExecutionSet( inStream, null );
      inStream.close();
      System.out.println( "Loaded RuleExecutionSet: " + res1);

      // register the RuleExecutionSet
      String uri = res1.getName();
      ruleAdministrator.registerRuleExecutionSet(uri, res1, null );
      System.out.println( "Bound RuleExecutionSet to URI: " + uri);

      // Get a RuleRuntime and invoke the rule engine.
      System.out.println( "\nRuntime API\n" );
View Full Code Here

      // This rule execution set is part of the TCK.
      InputStream inStream = new FileInputStream( "example3.xml" );
      System.out.println("Acquired InputStream to example3.xml: " + inStream );

      // parse the ruleset from the XML document
      RuleExecutionSet res1 = ruleAdministrator.getLocalRuleExecutionSetProvider( null ).createRuleExecutionSet( inStream, null );
      inStream.close();
      System.out.println( "Loaded RuleExecutionSet: " + res1);

      // register the RuleExecutionSet
      String uri = res1.getName();
      ruleAdministrator.registerRuleExecutionSet(uri, res1, null );
      System.out.println( "Bound RuleExecutionSet to URI: " + uri);

      // Get a RuleRuntime and invoke the rule engine.
      System.out.println( "\nRuntime API\n" );
View Full Code Here

        final RuleServiceProvider serviceProvider = RuleServiceProviderManager.getRuleServiceProvider( url );
        final RuleAdministrator ruleAdministrator = serviceProvider.getRuleAdministrator();

        // register the ruleset
        final InputStream inStream = this.getClass().getResourceAsStream( ruleset );
        final RuleExecutionSet res1 = ruleAdministrator.getLocalRuleExecutionSetProvider( null ).createRuleExecutionSet( inStream,
                                                                                                                         null );

        inStream.close();
        final String uri = res1.getName();
        System.out.println( uri );
        ruleAdministrator.registerRuleExecutionSet( uri,
                                                    res1,
                                                    null );
        return serviceProvider;
View Full Code Here

    /**
     * Test rule set name and description.
     */
    public void testRule() throws Exception {
        final InputStream in = RuleEngineTestBase.class.getResourceAsStream( this.bindUri );
        final RuleExecutionSet ruleSet = this.ruleSetProvider.createRuleExecutionSet( in,
                                                                                      null );
        assertEquals( "number of rules",
                      1,
                      ruleSet.getRules().size() );

        assertEquals( "rule set name",
                      "SistersRules",
                      ruleSet.getName() );
        assertEquals( "SistersRules",
                      ruleSet.getDescription() );
        assertNull( "rule set default filter",
                    ruleSet.getDefaultObjectFilter() );
    }
View Full Code Here

    /**
     * Test rule name and description.
     */
    public void testRule() throws Exception {
        final InputStream in = RuleEngineTestBase.class.getResourceAsStream( this.bindUri );
        final RuleExecutionSet ruleExecutionSet = this.ruleSetProvider.createRuleExecutionSet( in,
                                                                                               null );
        final List rules = ruleExecutionSet.getRules();
        assertEquals( "number of rules",
                      1,
                      rules.size() );

        final Rule rule01 = (Rule) ruleExecutionSet.getRules().get( 0 );
        assertEquals( "rule name",
                      "FindSisters",
                      rule01.getName() );
        assertEquals( "rule description",
                      "FindSisters",
View Full Code Here

    /**
     * Test createRuleExecutionSet from Serializable.
     */
    public void testCreateFromSerializable() throws Exception {
        final RuleExecutionSet ruleExecutionSet = this.ruleSetProvider.createRuleExecutionSet( this.pkg,
                                                                                               null );
        assertEquals( "rule set name",
                      "SistersRules",
                      ruleExecutionSet.getName() );
        assertEquals( "number of rules",
                      1,
                      ruleExecutionSet.getRules().size() );
    }
View Full Code Here

    /**
     * Test createRuleExecutionSet from URI.
     */
    public void testCreateFromURI() throws Exception {
        final String rulesUri = RuleEngineTestBase.class.getResource( this.bindUri ).toExternalForm();
        final RuleExecutionSet testRuleSet = this.ruleSetProvider.createRuleExecutionSet( rulesUri,
                                                                                          null );
        assertEquals( "rule set name",
                      "SistersRules",
                      testRuleSet.getName() );
        assertEquals( "number of rules",
                      1,
                      testRuleSet.getRules().size() );
    }
View Full Code Here

                      testRuleSet.getRules().size() );
    }

    public void testIncompatibleSerializableCreation() throws Exception {
        try {
            final RuleExecutionSet testRuleSet = this.ruleSetProvider.createRuleExecutionSet( new ArrayList(),
                                                                                              null );
            fail( "Should have thrown an IllegalArgumentException. ArrayList " + "objects are not valid AST representations. " + testRuleSet );
        } catch ( final IllegalArgumentException e ) {
            /*
             * this is supposed to happen if you pass in a serializable object
View Full Code Here

TOP

Related Classes of javax.rules.admin.RuleExecutionSet

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.