zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ZOOKEEPER-2939) Deal with maxbuffer as it relates to proposals
Date Mon, 08 Jan 2018 20:41:00 GMT

    [ https://issues.apache.org/jira/browse/ZOOKEEPER-2939?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16317021#comment-16317021
] 

ASF GitHub Bot commented on ZOOKEEPER-2939:
-------------------------------------------

Github user afine commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/440#discussion_r160236436
  
    --- Diff: src/java/test/org/apache/zookeeper/server/quorum/LeaderBeanTest.java ---
    @@ -0,0 +1,119 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.zookeeper.server.quorum;
    +
    +import org.apache.jute.OutputArchive;
    +import org.apache.jute.Record;
    +import org.apache.zookeeper.server.Request;
    +import org.apache.zookeeper.server.ZKDatabase;
    +import org.apache.zookeeper.server.persistence.FileTxnSnapLog;
    +import org.apache.zookeeper.server.quorum.flexible.QuorumVerifier;
    +import org.apache.zookeeper.server.util.SerializeUtils;
    +import org.apache.zookeeper.test.ClientBase;
    +import org.apache.zookeeper.txn.TxnHeader;
    +import org.junit.After;
    +import org.junit.Before;
    +import org.junit.Test;
    +import org.mockito.invocation.InvocationOnMock;
    +import org.mockito.stubbing.Answer;
    +
    +import java.io.File;
    +import java.io.IOException;
    +
    +import static org.junit.Assert.assertEquals;
    +import static org.junit.Assert.assertNotEquals;
    +import static org.mockito.Matchers.any;
    +import static org.mockito.Matchers.anyString;
    +import static org.mockito.Mockito.doAnswer;
    +import static org.mockito.Mockito.mock;
    +
    +public class LeaderBeanTest {
    +    private Leader leader;
    +    private LeaderBean leaderBean;
    +    private FileTxnSnapLog fileTxnSnapLog;
    +    private LeaderZooKeeperServer zks;
    +    private QuorumPeer qp;
    +
    +    @Before
    +    public void setUp() throws IOException {
    +        qp = new QuorumPeer();
    +        QuorumVerifier quorumVerifierMock = mock(QuorumVerifier.class);
    +        qp.setQuorumVerifier(quorumVerifierMock, false);
    +        File tmpDir = ClientBase.createEmptyTestDir();
    +        fileTxnSnapLog = new FileTxnSnapLog(new File(tmpDir, "data"),
    +                new File(tmpDir, "data_txnlog"));
    +        ZKDatabase zkDb = new ZKDatabase(fileTxnSnapLog);
    +
    +        zks = new LeaderZooKeeperServer(fileTxnSnapLog, qp, zkDb);
    +        leader = new Leader(qp, zks);
    +        leaderBean = new LeaderBean(leader, zks);
    +    }
    +
    +    @After
    +    public void tearDown() throws IOException {
    +        fileTxnSnapLog.close();
    +    }
    +
    +    @Test
    +    public void testGetName() {
    +        assertEquals("Leader", leaderBean.getName());
    +    }
    +
    +    @Test
    +    public void testGetCurrentZxid() {
    +        // Arrange
    +        zks.setZxid(1);
    +
    +        // Assert
    +        assertEquals("0x1", leaderBean.getCurrentZxid());
    +    }
    +
    +    @Test
    +    public void testGetElectionTimeTaken() {
    +        // Arrange
    +        qp.setElectionTimeTaken(1);
    +
    +        // Assert
    +        assertEquals(1, leaderBean.getElectionTimeTaken());
    +    }
    +
    +    private Request createMockRequest() throws IOException {
    --- End diff --
    
    is this ever used?


> Deal with maxbuffer as it relates to proposals
> ----------------------------------------------
>
>                 Key: ZOOKEEPER-2939
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2939
>             Project: ZooKeeper
>          Issue Type: Sub-task
>          Components: jute, server
>            Reporter: Andor Molnar
>            Assignee: Andor Molnar
>             Fix For: 3.5.4, 3.6.0
>
>
> Monitor real-time Jute buffer usage as it relates to proposals.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message