Package com.taobao.metamorphosis.network

Examples of com.taobao.metamorphosis.network.GetCommand


        final int maxSize = 1024;
        final long offset = 10;

        this.metaConfig.setTopics(Arrays.asList(this.topic));
        this.metaConfig.closePartitions(this.topic, partition, partition);
        final GetCommand request = new GetCommand(this.topic, this.group, partition, offset, maxSize, opaque);
        this.conn.response(new BooleanCommand(HttpStatus.Forbidden, "Partition["
                + this.metaConfig.getBrokerId() + "-" + request.getPartition() + "] has been closed", request.getOpaque()));
        EasyMock.expectLastCall();

        this.mocksControl.replay();

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


        final String group = jettyRequest.getParameter("group");
        final long offset = Long.parseLong(jettyRequest.getParameter("offset"));
        final int maxSize = Integer.parseInt(jettyRequest.getParameter("maxsize"));

        try {
            final GetCommand getCommand = this.convert2GetCommand(topic, partition, group, offset, maxSize);
            final ResponseCommand responseCommand = this.commandProcessor.processGetCommand(getCommand, null, false);
            if (responseCommand instanceof DataCommand) {
                response.setStatus(HttpStatus.Success);
                response.getOutputStream().write(((DataCommand) responseCommand).getData());
            }
View Full Code Here

    }


    private GetCommand convert2GetCommand(final String topic, final int partition, final String group,
            final long offset, final int maxSize) {
        return new GetCommand(topic, group, partition, offset, maxSize, 0);
    }
View Full Code Here

        EasyMock.expect(this.remotingClient.isConnected(url)).andReturn(true);
        EasyMock.expectLastCall();
        EasyMock.expect(this.producerZooKeeper.selectBroker(topic, partition)).andReturn(url);
        EasyMock.expect(
            this.remotingClient.invokeToGroup(url,
                new GetCommand(topic, this.consumerConfig.getGroup(), partition.getPartition(), offset, maxSize,
                    Integer.MIN_VALUE), 10000, TimeUnit.MILLISECONDS)).andReturn(
                        new DataCommand(data, Integer.MIN_VALUE));
        this.mocksControl.replay();
        OpaqueGenerator.resetOpaque();
        assertEquals(messageIterator, this.consumer.get(topic, partition, offset, maxSize));
View Full Code Here

        EasyMock.expectLastCall();
        EasyMock.expect(this.remotingClient.isConnected(url)).andReturn(true);
        EasyMock.expect(this.producerZooKeeper.selectBroker(topic, partition)).andReturn(url);
        EasyMock.expect(
            this.remotingClient.invokeToGroup(url,
                new GetCommand(topic, this.consumerConfig.getGroup(), partition.getPartition(), offset, maxSize,
                    Integer.MIN_VALUE), 10000, TimeUnit.MILLISECONDS)).andReturn(
                        new BooleanCommand(500, "test error", Integer.MIN_VALUE));
        this.mocksControl.replay();
        try {
            OpaqueGenerator.resetOpaque();
View Full Code Here

        EasyMock.expectLastCall();
        EasyMock.expect(this.remotingClient.isConnected(url)).andReturn(true);
        EasyMock.expect(this.producerZooKeeper.selectBroker(topic, partition)).andReturn(url);
        EasyMock.expect(
            this.remotingClient.invokeToGroup(url,
                new GetCommand(topic, this.consumerConfig.getGroup(), partition.getPartition(), offset, maxSize,
                    Integer.MIN_VALUE), 10000, TimeUnit.MILLISECONDS)).andReturn(
                        new BooleanCommand(404, "not found", Integer.MIN_VALUE));
        this.mocksControl.replay();
        OpaqueGenerator.resetOpaque();
        assertNull(this.consumer.get(topic, partition, offset, maxSize));
View Full Code Here

                    this.remotingClient.connectWithRef(serverUrl, listener);
                }
                return null;
            }

            final GetCommand getCmd =
                    new GetCommand(fetchRequest.getTopic(), this.consumerConfig.getGroup(),
                        fetchRequest.getPartition(), currentOffset, fetchRequest.getMaxSize(),
                        OpaqueGenerator.getNextOpaque());
            final ResponseCommand response = this.remotingClient.invokeToGroup(serverUrl, getCmd, timeout, timeUnit);
            if (response instanceof DataCommand) {
                final DataCommand dataCmd = (DataCommand) response;
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.