Package com.taobao.metamorphosis.network

Examples of com.taobao.metamorphosis.network.GetCommand


        final IoBuffer head = IoBuffer.wrap(("value " + 2 * str.length() + " " + opaque + "\r\n").getBytes());
        conn.transferFrom(head, null, this.fileMessageSet.channel(), 0, 2 * str.length());
        EasyMock.expectLastCall();
        EasyMock.replay(conn);

        subSet.write(new GetCommand("test", "boyan-test", -1, 0, 1024 * 1024, opaque), new SessionContextImpl(null,
            conn));
        EasyMock.verify(conn);
    }
View Full Code Here


        this.conn.response(new BooleanCommand(HttpStatus.NotFound, "The topic `" + this.topic
            + "` in partition `" + partition + "` is not exists", opaque));
        EasyMock.expectLastCall();
        this.mocksControl.replay();

        final GetCommand request = new GetCommand(this.topic, this.group, partition, opaque, 1024 * 1024, opaque);
        this.getProcessor.handleRequest(request, this.conn);
        this.mocksControl.verify();
        assertEquals(1, this.statsManager.getCmdGetMiss());
        assertEquals(1, this.statsManager.getCmdGets());
        assertEquals(0, this.statsManager.getCmdOffsets());
View Full Code Here

        this.conn
        .response(new BooleanCommand(HttpStatus.BadRequest, "Bad request,invalid max size:" + maxSize, opaque));
        EasyMock.expectLastCall();
        this.mocksControl.replay();

        final GetCommand request = new GetCommand(this.topic, this.group, partition, opaque, maxSize, opaque);
        this.getProcessor.handleRequest(request, this.conn);
        this.mocksControl.verify();
        assertEquals(0, this.statsManager.getCmdGetMiss());
        assertEquals(1, this.statsManager.getCmdGets());
        assertEquals(0, this.statsManager.getCmdOffsets());
View Full Code Here

                + offset, opaque));
        EasyMock.expect(store.getMaxOffset()).andReturn(offset);
        EasyMock.expectLastCall();
        this.mocksControl.replay();

        final GetCommand request = new GetCommand(this.topic, this.group, partition, offset, maxSize, opaque);
        this.getProcessor.handleRequest(request, this.conn);
        this.mocksControl.verify();
        assertEquals(1, this.statsManager.getCmdGetMiss());
        assertEquals(1, this.statsManager.getCmdGets());
        assertEquals(0, this.statsManager.getCmdOffsets());
View Full Code Here

                + offset, opaque));
        EasyMock.expect(store.getMaxOffset()).andReturn(offset - 1);
        EasyMock.expectLastCall();
        this.mocksControl.replay();

        final GetCommand request = new GetCommand(this.topic, this.group, partition, offset, maxSize, opaque);
        this.getProcessor.handleRequest(request, this.conn);
        this.mocksControl.verify();
        assertEquals(1, this.statsManager.getCmdGetMiss());
        assertEquals(1, this.statsManager.getCmdGets());
        assertEquals(0, this.statsManager.getCmdOffsets());
View Full Code Here

        this.conn.response(new BooleanCommand(HttpStatus.Moved, String.valueOf(realMaxOffset), opaque));
        EasyMock.expect(store.getMaxOffset()).andReturn(realMaxOffset);
        EasyMock.expectLastCall();
        this.mocksControl.replay();

        final GetCommand request = new GetCommand(this.topic, this.group, partition, offset, maxSize, opaque);
        this.getProcessor.handleRequest(request, this.conn);
        this.mocksControl.verify();
        assertEquals(1, this.statsManager.getCmdGetMiss());
        assertEquals(1, this.statsManager.getCmdGets());
        assertEquals(1, this.statsManager.getCmdOffsets());
View Full Code Here

        EasyMock.expect(store.getNearestOffset(offset)).andReturn(newOffset);
        this.conn.response(new BooleanCommand(HttpStatus.Moved, String.valueOf(newOffset), opaque));
        EasyMock.expectLastCall();
        this.mocksControl.replay();

        final GetCommand request = new GetCommand(this.topic, this.group, partition, offset, maxSize, opaque);
        this.getProcessor.handleRequest(request, this.conn);
        this.mocksControl.verify();
        assertEquals(1, this.statsManager.getCmdGetMiss());
        assertEquals(1, this.statsManager.getCmdGets());
        assertEquals(1, this.statsManager.getCmdOffsets());
View Full Code Here

        final long offset = 10;
        final MessageStore store = this.mocksControl.createMock(MessageStore.class);
        EasyMock.expect(this.storeManager.getMessageStore(this.topic, partition)).andReturn(store);
        final MessageSet set = this.mocksControl.createMock(MessageSet.class);
        EasyMock.expect(store.slice(offset, maxSize)).andReturn(set);
        final GetCommand request = new GetCommand(this.topic, this.group, partition, offset, maxSize, opaque);
        set.write(request, this.sessionContext);
        EasyMock.expectLastCall();
        this.mocksControl.replay();

        this.getProcessor.handleRequest(request, this.conn);
View Full Code Here

                    null, 0, opaque));
        final MessageStore store = this.mocksControl.createMock(MessageStore.class);
        EasyMock.expect(this.storeManager.getMessageStore(this.topic, partition)).andReturn(store);
        final MessageSet set = this.mocksControl.createMock(MessageSet.class);
        EasyMock.expect(store.slice(offset, maxSize)).andReturn(set);
        final GetCommand request = new GetCommand(this.topic, this.group, partition, offset, maxSize, opaque);
        set.read((ByteBuffer) EasyMock.anyObject());
        EasyMock.expectLastCall().andAnswer(new IAnswer<Void>() {

            @Override
            public Void answer() throws Throwable {
View Full Code Here

                    null, 0, opaque));
        final MessageStore store = this.mocksControl.createMock(MessageStore.class);
        EasyMock.expect(this.storeManager.getMessageStore(this.topic, partition)).andReturn(store);
        final MessageSet set = this.mocksControl.createMock(MessageSet.class);
        EasyMock.expect(store.slice(offset, maxSize)).andReturn(set);
        final GetCommand request = new GetCommand(this.topic, this.group, partition, offset, maxSize, opaque);
        set.read((ByteBuffer) EasyMock.anyObject());
        EasyMock.expectLastCall().andAnswer(new IAnswer<Void>() {

            @Override
            public Void answer() throws Throwable {
View Full Code Here

TOP

Related Classes of com.taobao.metamorphosis.network.GetCommand

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.