Package javax.rules.admin

Examples of javax.rules.admin.RuleExecutionSet


    public void addRuleExecutionSet(final String bindUri,
                                    final InputStream resourceAsStream) throws Exception {
        final Reader ruleReader = new InputStreamReader( resourceAsStream );

        final RuleExecutionSet ruleExecutionSet = this.ruleSetProvider.createRuleExecutionSet( ruleReader,
                                                                                               null );

        this.ruleAdministrator.registerRuleExecutionSet( bindUri,
                                                         ruleExecutionSet,
                                                         null );
View Full Code Here


    public void addRuleExecutionSet(final String bindUri,
                                    final InputStream resourceAsStream,
                                    final java.util.Map properties) throws Exception {
        final Reader ruleReader = new InputStreamReader( resourceAsStream );

        final RuleExecutionSet ruleExecutionSet = this.ruleSetProvider.createRuleExecutionSet( ruleReader,
                                                                                               properties );

        this.ruleAdministrator.registerRuleExecutionSet( bindUri,
                                                         ruleExecutionSet,
                                                         properties );
View Full Code Here

    }
       
        for ( final Iterator i = registrations.iterator(); i.hasNext(); ) {
            final String aBindUri = (String) i.next();
            // FIXME: provide the correct properties
            RuleExecutionSet aRuleSet = null;
           
      try {
        aRuleSet = this.repository.getRuleExecutionSet( aBindUri, null );
      } catch (RuleExecutionSetRepositoryException e) {
        String s = "Error while retrieving rule execution set bound to: " + aBindUri;
View Full Code Here

    /**
     * Test createRuleExecutionSet from Serializable.
     */
    @Test
    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.
     */
    @Test
    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

    }

    @Test
    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

    }

    @Test
    public void testCreateFromInputStream() throws Exception {
        final InputStream rulesStream = RuleEngineTestBase.class.getResourceAsStream( this.bindUri );
        final RuleExecutionSet ruleSet = this.ruleSetProvider.createRuleExecutionSet( rulesStream,
                                                                                      null );
        assertEquals( "rule set name",
                      "SistersRules",
                      ruleSet.getName() );
        assertEquals( "number of rules",
                      1,
                      ruleSet.getRules().size() );
    }
View Full Code Here

        final InputStream inputStream = null;
        try {
            final PackageBuilder builder = new PackageBuilder();
            builder.addPackageFromDrl( new InputStreamReader( RuleEngineTestBase.class.getResourceAsStream( this.bindUri ) ) );
            final Package pkg = builder.getPackage();
            final RuleExecutionSet ruleExecutionSet = this.ruleSetProvider.createRuleExecutionSet( pkg,
                                                                                                   null );
            assertEquals( "rule set name",
                          "SistersRules",
                          ruleExecutionSet.getName() );
            assertEquals( "number of rules",
                          1,
                          ruleExecutionSet.getRules().size() );
        } catch ( final IOException e ) {
            fail( "Couldn't create the RuleExecutionSet. " + "Test threw an IOException." );
        } finally {
            if ( inputStream != null ) {
                try {
View Full Code Here

     * Test createRuleExecutionSet from Reader.
     */
    @Test
    public void testCreateFromReader() throws Exception {
        final Reader ruleReader = new InputStreamReader( RuleEngineTestBase.class.getResourceAsStream( this.bindUri ) );
        final RuleExecutionSet ruleSet = this.ruleSetProvider.createRuleExecutionSet( ruleReader,
                                                                                      null );
        assertEquals( "rule set name",
                      "SistersRules",
                      ruleSet.getName() );
        assertEquals( "number of rules",
                      1,
                      ruleSet.getRules().size() );
    }
View Full Code Here

     */
    public RuleExecutionSetMetadata getRuleExecutionSetMetadata() {
        String theBindUri = null;
        for ( final Iterator i = this.repository.getRegistrations().iterator(); i.hasNext(); ) {
            final String aBindUri = (String) i.next();
            final RuleExecutionSet aRuleSet = this.repository.getRuleExecutionSet( aBindUri );
            if ( aRuleSet == this.ruleExecutionSet ) {
                theBindUri = aBindUri;
                break;
            }
        }
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.