Examples of consume()


Examples of org.simpleframework.http.message.TokenConsumer.consume()

   public void testTokenConsumer() throws IOException {
      Allocator allocator = new ArrayAllocator();
      TokenConsumer consumer = new TokenConsumer(allocator, "\r\n".getBytes());
      Cursor cursor = new StreamCursor("\r\n");
     
      consumer.consume(cursor);
     
      assertEquals(cursor.ready(), -1);
      assertTrue(consumer.isFinished())
   }
  
View Full Code Here

Examples of org.tanukisoftware.wrapper.event.WrapperControlEvent.consume()

        WrapperControlEvent controlEvent = new WrapperControlEvent( event, eventName );
        if ( ignore )
        {
            // Preconsume the event if it is set to be ignored, but go ahead and fire it so
            //  user can can still have the oportunity to recognize it.
            controlEvent.consume();
        }
        fireWrapperEvent( controlEvent );
       
        if ( !controlEvent.isConsumed() )
        {
View Full Code Here

Examples of org.terasology.logic.inventory.events.BeforeItemPutInInventory.consume()

        Mockito.when(inventory.send(Matchers.any(BeforeItemPutInInventory.class))).then(
                new Answer<Object>() {
                    @Override
                    public Object answer(InvocationOnMock invocation) throws Exception {
                        BeforeItemPutInInventory event = (BeforeItemPutInInventory) invocation.getArguments()[0];
                        event.consume();
                        return null;
                    }
                }
        );
View Full Code Here

Examples of org.terasology.logic.inventory.events.BeforeItemRemovedFromInventory.consume()

        Mockito.when(inventory.send(Matchers.any(BeforeItemRemovedFromInventory.class))).then(
                new Answer<Object>() {
                    @Override
                    public Object answer(InvocationOnMock invocation) throws Exception {
                        BeforeItemRemovedFromInventory event = (BeforeItemRemovedFromInventory) invocation.getArguments()[0];
                        event.consume();
                        return null;
                    }
                }
        );
View Full Code Here

Examples of org.waveprotocol.wave.model.document.bootstrap.BootstrapDocument.consume()

      for (int j = 0; j < 20; j++) {
        RandomProvider ra = RandomProviderImpl.ofSeed(i * 20 + j);
        RandomProvider rb = RandomProviderImpl.ofSeed(i * 20 + j + 1);
        DocOp a = RandomDocOpGenerator.generate(ra, p, doc);
        DocOp b = RandomDocOpGenerator.generate(rb, p, doc);
        doc.consume(a);
        assertTrue(eq.equal(a, a));
        // The combination of RandomProvider and RandomDocOpGenerator doesn't
        // really guarantee this property, but it happens to be true with the
        // random seeds that occur here.
        assertFalse(eq.equal(a, b));
View Full Code Here

Examples of org.waveprotocol.wave.model.document.bootstrap.BootstrapDocument.consume()

    DocOpGenerator generator = new DocOpGenerator();
    for (int iteration = 0; iteration < NUM_ITERATIONS; ++iteration) {
      System.out.println("Iteration: " + iteration);
      BootstrapDocument document= new BootstrapDocument();
      for (int i = 0; i < INITIAL_MUTATION_COUNT; ++i) {
        document.consume(generator.randomOperation(document, r));
      }
      for (int i = 0; i < FEATURE_ITERATION_COUNT; ++i) {
        DocOp clientOp = generator.randomOperation(document, r);
        DocOp serverOp = generator.randomOperation(document, r);
        OperationPair<DocOp> pair = Transformer.transform(clientOp, serverOp);
View Full Code Here

Examples of org.waveprotocol.wave.model.document.bootstrap.BootstrapDocument.consume()

            ReferenceTransformer.transform(clientOp, serverOp);
        assertTrue(OpComparators.SYNTACTIC_IDENTITY.equal(
            pair.clientOp(), referencePair.clientOp()));
        assertTrue(OpComparators.SYNTACTIC_IDENTITY.equal(
            pair.serverOp(), referencePair.serverOp()));
        document.consume(clientOp);
        document.consume(pair.serverOp());
      }
    }
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.bootstrap.BootstrapDocument.consume()

        assertTrue(OpComparators.SYNTACTIC_IDENTITY.equal(
            pair.clientOp(), referencePair.clientOp()));
        assertTrue(OpComparators.SYNTACTIC_IDENTITY.equal(
            pair.serverOp(), referencePair.serverOp()));
        document.consume(clientOp);
        document.consume(pair.serverOp());
      }
    }
  }

}
View Full Code Here

Examples of org.waveprotocol.wave.model.document.bootstrap.BootstrapDocument.consume()

    boolean expected = t.build(d, m);

    BootstrapDocument doc = new BootstrapDocument();

    // initialize document
    doc.consume(d.finishUnchecked());

    // check whether m would apply
    ViolationCollector v = new ViolationCollector();
    ValidationResult result =
        DocOpValidator.validate(v, t.getSchemaConstraints(), doc, m.finishUnchecked());
View Full Code Here

Examples of org.waveprotocol.wave.model.document.bootstrap.BootstrapDocument.consume()

        docAsOp = doc.asOperation();
        validate(DocOpAutomaton.EMPTY_DOCUMENT, docAsOp);
        IndexedDocument<Node, Element, Text> copy = DocProviders.POJO.build(docAsOp,
            DocumentSchema.NO_SCHEMA_CONSTRAINTS);
        BootstrapDocument copy2 = new BootstrapDocument();
        copy2.consume(docAsOp);

        // CONSUME
        doc.consume(op);
        checkDoc.consume(op);
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.