Package com.taobao.metamorphosis.cluster

Examples of com.taobao.metamorphosis.cluster.Partition


    private void checkTopic2(
            final ConcurrentHashMap<String, ConcurrentHashMap<Partition, TopicPartitionRegInfo>> topicRegistry) {
        final ConcurrentHashMap<Partition, TopicPartitionRegInfo> partMap2 = topicRegistry.get("topic2");
        assertNotNull(partMap2);
        assertEquals(1, partMap2.size());
        assertTrue(partMap2.containsKey(new Partition("0-0")));
        assertFalse(partMap2.containsKey(new Partition("1-0")));
    }
View Full Code Here



    @Test
    public void testAsyncSendMessageMessage() throws MetaClientException, NotifyRemotingException {
        String topic = "test-topic";
        Partition partition = new Partition(0, 0);
        String serverUrl = "meta://127.0.0.1:8123";
        Message message = new Message(topic, "test".getBytes());
        EasyMock.resetToNice(remotingClient);
        EasyMock.expect(producerZooKeeper.selectPartition(topic, message, partitionSelector)).andReturn(partition);
        EasyMock.expect(producerZooKeeper.selectBroker(topic, partition)).andReturn(serverUrl);
View Full Code Here


    @Test
    public void testHandle() throws Exception {
        String topic = "test-topic";
        Partition partition = new Partition(0, 0);
        String serverUrl = "meta://127.0.0.1:8123";
        Message message = new Message(topic, "test".getBytes());
        EasyMock.resetToNice(remotingClient);
        EasyMock.expect(producerZooKeeper.selectPartition(topic, message, partitionSelector)).andReturn(partition);
        EasyMock.expect(producerZooKeeper.selectBroker(topic, partition)).andReturn(serverUrl);
View Full Code Here

    @Test
    public void testProcessRequestNormal() throws Exception {

        final String topic = "topic1";
        final int maxSize = 1024;
        final Partition partition = new Partition("0-0");
        final long offset = 12;
        final Broker broker = new Broker(0, "meta://localhost:0");
        final int msgId = 1111;
        final byte[] data =
                MessageUtils.makeMessageBuffer(msgId,
                    new PutCommand(topic, partition.getPartition(), "hello".getBytes(), null, 0, 0)).array();
        final FetchRequest request =
                new FetchRequest(broker, 0, new TopicPartitionRegInfo(topic, partition, offset), maxSize);

        final FetchRequestRunner runner = this.fetchManager.new FetchRequestRunner();
View Full Code Here

    @Test
    public void testProcessRequestNormalWithFilter() throws Exception {

        final String topic = "topic1";
        final int maxSize = 1024;
        final Partition partition = new Partition("0-0");
        final long offset = 12;
        final Broker broker = new Broker(0, "meta://localhost:0");
        final int msgId = 1111;
        final byte[] data =
                MessageUtils.makeMessageBuffer(msgId,
                    new PutCommand(topic, partition.getPartition(), "hello".getBytes(), null, 0, 0)).array();
        final FetchRequest request =
                new FetchRequest(broker, 0, new TopicPartitionRegInfo(topic, partition, offset), maxSize);

        final FetchRequestRunner runner = this.fetchManager.new FetchRequestRunner();
View Full Code Here

    @Test
    public void testProcessRequestWithMessageFilterNotAccept() throws Exception {

        final String topic = "topic1";
        final int maxSize = 1024;
        final Partition partition = new Partition("0-0");
        final long offset = 12;
        final Broker broker = new Broker(0, "meta://localhost:0");
        final int msgId = 1111;
        final byte[] data =
                MessageUtils.makeMessageBuffer(msgId,
                    new PutCommand(topic, partition.getPartition(), "hello".getBytes(), null, 0, 0)).array();
        final FetchRequest request =
                new FetchRequest(broker, 0, new TopicPartitionRegInfo(topic, partition, offset), maxSize);

        final FetchRequestRunner runner = this.fetchManager.new FetchRequestRunner();
View Full Code Here

    @Test
    public void testProcessRequestWithMessageFilterThrowException() throws Exception {

        final String topic = "topic1";
        final int maxSize = 1024;
        final Partition partition = new Partition("0-0");
        final long offset = 12;
        final Broker broker = new Broker(0, "meta://localhost:0");
        final int msgId = 1111;
        final byte[] data =
                MessageUtils.makeMessageBuffer(msgId,
                    new PutCommand(topic, partition.getPartition(), "hello".getBytes(), null, 0, 0)).array();
        final FetchRequest request =
                new FetchRequest(broker, 0, new TopicPartitionRegInfo(topic, partition, offset), maxSize);

        final FetchRequestRunner runner = this.fetchManager.new FetchRequestRunner();
View Full Code Here

    @Test
    public void testProcessRequestInvalidMessage() throws Exception {

        final String topic = "topic1";
        final int maxSize = 1024;
        final Partition partition = new Partition("0-0");
        final long offset = 12;
        final Broker broker = new Broker(0, "meta://localhost:0");
        final int msgId = 1111;
        final byte[] data =
                makeInvalidMessageBuffer(msgId,
                    new PutCommand(topic, partition.getPartition(), "hello".getBytes(), null, 0, 0)).array();
        final FetchRequest request =
                new FetchRequest(broker, 0, new TopicPartitionRegInfo(topic, partition, offset), maxSize);

        final FetchRequestRunner runner = this.fetchManager.new FetchRequestRunner();
View Full Code Here

        // �����һ�Σ����Ȼ����
        this.consumerConfig.setMaxFetchRetries(0);

        final String topic = "topic1";
        final int maxSize = 1024;
        final Partition partition = new Partition("0-0");
        final long offset = 12;
        final Broker broker = new Broker(0, "meta://localhost:0");
        final byte[] data =
                MessageUtils.makeMessageBuffer(1111,
                    new PutCommand(topic, partition.getPartition(), "hello".getBytes(), null, 0, 0)).array();
        final FetchRequest request =
                new FetchRequest(broker, 0, new TopicPartitionRegInfo(topic, partition, offset), maxSize);
        request.incrementRetriesAndGet();
        assertEquals(1, request.getRetries());
        EasyMock.expect(this.consumer.fetch(request, -1, null)).andReturn(new MessageIterator(topic, data));
View Full Code Here

    @Test
    public void testProcessRequestDelayed() throws Exception {
        // this.mockConsumerReInitializeFetchManager();
        final String topic = "topic1";
        final int maxSize = 1024;
        final Partition partition = new Partition("0-0");
        final long offset = 12;
        final Broker broker = new Broker(0, "meta://localhost:0");
        final FetchRequest request =
                new FetchRequest(broker, 0, new TopicPartitionRegInfo(topic, partition, offset), maxSize);
View Full Code Here

TOP

Related Classes of com.taobao.metamorphosis.cluster.Partition

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.