Examples of IdGenerator


Examples of org.drools.reteoo.ReteooBuilder.IdGenerator

    }

    @Test
    public void testMemory() {
        ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();
        IdGenerator idGenerator = ruleBase.getReteooBuilder().getIdGenerator();
       
        final ReteooWorkingMemory workingMemory = ( ReteooWorkingMemory ) ruleBase.newStatefulSession();

        final ObjectTypeNode objectTypeNode = new ObjectTypeNode( idGenerator.getNextId(),
                                                                  this.entryPoint,
                                                                  new ClassObjectType( String.class ),
                                                                  buildContext );

        final ObjectTypeNodeMemory memory = (ObjectTypeNodeMemory) workingMemory.getNodeMemory( objectTypeNode );
View Full Code Here

Examples of org.drools.reteoo.ReteooBuilder.IdGenerator

    }

    @Test
    public void testIsAssignableFrom() {
        ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();
        IdGenerator idGenerator = ruleBase.getReteooBuilder().getIdGenerator();
        final Rete source = new Rete((InternalRuleBase) ruleBase);

        ObjectTypeNode objectTypeNode = new ObjectTypeNode( idGenerator.getNextId(),
                                                            this.entryPoint,
                                                            new ClassObjectType( String.class ),
                                                            buildContext );

        assertFalse( objectTypeNode.isAssignableFrom( new ClassObjectType( new Object().getClass() ) ) );
        assertFalse( objectTypeNode.isAssignableFrom( new ClassObjectType( new Integer( 5 ).getClass() ) ) );
        assertTrue( objectTypeNode.isAssignableFrom( new ClassObjectType( "string".getClass() ) ) );

        objectTypeNode = new ObjectTypeNode( idGenerator.getNextId(),
                                             this.entryPoint,
                                             new ClassObjectType( Object.class ),
                                             buildContext );

        assertTrue( objectTypeNode.isAssignableFrom( new ClassObjectType( new Object().getClass() ) ) );
View Full Code Here

Examples of org.drools.reteoo.ReteooBuilder.IdGenerator

    }

    @Test
    public void testRetractObject() throws Exception {
        ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();
        IdGenerator idGenerator = ruleBase.getReteooBuilder().getIdGenerator();
        final PropagationContext context = new PropagationContextImpl( 0,
                                                                       PropagationContext.ASSERTION,
                                                                       null,
                                                                       null,
                                                                       null );

        final ReteooWorkingMemory workingMemory = (ReteooWorkingMemory)ruleBase.newStatefulSession();

        final Rete source = new Rete((InternalRuleBase) ruleBase);

        final ObjectTypeNode objectTypeNode = new ObjectTypeNode( idGenerator.getNextId(),
                                                                  this.entryPoint,
                                                                  new ClassObjectType( String.class ),
                                                                  buildContext );

        final MockObjectSink sink = new MockObjectSink();
View Full Code Here

Examples of org.drools.reteoo.ReteooBuilder.IdGenerator

                                                                       null,
                                                                       null,
                                                                       null );

        ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();
        IdGenerator idGenerator = ruleBase.getReteooBuilder().getIdGenerator();
        final ReteooWorkingMemory workingMemory = ( ReteooWorkingMemory ) ruleBase.newStatefulSession();

        final Rete source = ruleBase.getRete();
       
        final EntryPointNode entryPoint = new EntryPointNode( 0,
                                                              source,
                                                              buildContext );
        entryPoint.attach();

        final ObjectTypeNode objectTypeNode = new ObjectTypeNode( idGenerator.getNextId(),
                                                                  entryPoint,
                                                                  new ClassObjectType( Person.class ),
                                                                  buildContext );

        final MockObjectSink sink = new MockObjectSink();
View Full Code Here

Examples of org.drools.reteoo.ReteooBuilder.IdGenerator

     * Test auto-deactivation of RuleFlowGroup.
     */
    @Test
    public void testRuleFlowGroup4() {
        ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();
        IdGenerator idGenerator = ruleBase.getReteooBuilder().getIdGenerator();
        final InternalWorkingMemory workingMemory = (InternalWorkingMemory) ruleBase.newStatefulSession();;

        final DefaultAgenda agenda = (DefaultAgenda) workingMemory.getAgenda();

        // create rule0
        final Consequence consequence0 = new Consequence() {
            private static final long serialVersionUID = 510l;

            public void evaluate(KnowledgeHelper knowledgeHelper,
                                 WorkingMemory w) {
                // do nothing
            }

            public void readExternal(ObjectInput in) throws IOException,
                                                    ClassNotFoundException {

            }

            public void writeExternal(ObjectOutput out) throws IOException {

            }

            public String getName() {
                return "default";
            }
        };

        final Rule rule0 = new Rule( "test-rule0" );
        rule0.setRuleFlowGroup( "rule-flow-group-0" );
        rule0.setConsequence( consequence0 );

        final RuleTerminalNode node0 = new RuleTerminalNode( idGenerator.getNextId(),
                                                             new MockTupleSource( idGenerator.getNextId() ),
                                                             rule0,
                                                             rule0.getLhs(),
                                                             0,
                                                             buildContext );

View Full Code Here

Examples of org.drools.reteoo.ReteooBuilder.IdGenerator

                                              buildContext );
        this.entryPoint.attach();
    }
   
    public void testAttach() throws Exception {
        IdGenerator idGenerator = ruleBase.getReteooBuilder().getIdGenerator();

        final Rete source = this.ruleBase.getRete();   

        final ObjectType objectType = new ClassObjectType( String.class );

        int id = idGenerator.getNextId();
        final ObjectTypeNode objectTypeNode = new ObjectTypeNode( id,
                                                                  this.entryPoint,
                                                                  objectType,
                                                                  buildContext );
View Full Code Here

Examples of org.drools.reteoo.ReteooBuilder.IdGenerator

                                                                       null,
                                                                       null,
                                                                       null );

        ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();
        IdGenerator idGenerator = ruleBase.getReteooBuilder().getIdGenerator();

        final ReteooWorkingMemory workingMemory = ( ReteooWorkingMemory ) ruleBase.newStatefulSession();

        final Rete source = ruleBase.getRete();

        final EntryPointNode entryPoint = new EntryPointNode( 0,
                                                              source,
                                                              buildContext );
        entryPoint.attach();

        final ObjectTypeNode objectTypeNode = new ObjectTypeNode( idGenerator.getNextId(),
                                                                  entryPoint,
                                                                  new ClassObjectType( String.class ),
                                                                  buildContext );

        final MockObjectSink sink = new MockObjectSink();
View Full Code Here

Examples of org.drools.reteoo.ReteooBuilder.IdGenerator

                      memory.size() );
    }

    public void testMemory() {
        ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();
        IdGenerator idGenerator = ruleBase.getReteooBuilder().getIdGenerator();  
       
        final ReteooWorkingMemory workingMemory = ( ReteooWorkingMemory ) ruleBase.newStatefulSession();

        final ObjectTypeNode objectTypeNode = new ObjectTypeNode( idGenerator.getNextId(),
                                                                  this.entryPoint,
                                                                  new ClassObjectType( String.class ),
                                                                  buildContext );

        final ObjectHashSet memory = (ObjectHashSet) workingMemory.getNodeMemory( objectTypeNode );
View Full Code Here

Examples of org.drools.reteoo.ReteooBuilder.IdGenerator

        assertNotNull( memory );
    }

    public void testIsAssignableFrom() {
        ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase();
        IdGenerator idGenerator = ruleBase.getReteooBuilder().getIdGenerator();
        final Rete source = new Rete((InternalRuleBase) ruleBase);

        ObjectTypeNode objectTypeNode = new ObjectTypeNode( idGenerator.getNextId(),
                                                            this.entryPoint,
                                                            new ClassObjectType( String.class ),
                                                            buildContext );

        assertFalse( objectTypeNode.isAssignableFrom( new ClassObjectType( new Object().getClass() ) ) );
        assertFalse( objectTypeNode.isAssignableFrom( new ClassObjectType( new Integer( 5 ).getClass() ) ) );
        assertTrue( objectTypeNode.isAssignableFrom( new ClassObjectType( "string".getClass() ) ) );

        objectTypeNode = new ObjectTypeNode( idGenerator.getNextId(),
                                             this.entryPoint,
                                             new ClassObjectType( Object.class ),
                                             buildContext );

        assertTrue( objectTypeNode.isAssignableFrom( new ClassObjectType( new Object().getClass() ) ) );
View Full Code Here

Examples of org.exoplatform.services.database.table.IDGenerator

      {
         dbType_ = STANDARD_DB_TYPE;
      }

      tableManager_ = DBTableManager.createDBTableManager(this);
      idGenerator_ = new IDGenerator(this);
      queryManager_ = new QueryBuilder(dbType_);
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.