Class ZkTestServer


  • public class ZkTestServer
    extends Object
    • Field Detail

      • SOLRHOME

        public static Path SOLRHOME
      • zkServer

        protected final org.apache.solr.cloud.ZkTestServer.ZKServerMain zkServer
      • rootClient

        protected volatile org.apache.solr.common.cloud.SolrZkClient rootClient
      • chRootClient

        protected volatile org.apache.solr.common.cloud.SolrZkClient chRootClient
    • Method Detail

      • getZkHost

        public String getZkHost()
      • getZkAddress

        public String getZkAddress()
      • getZkAddress

        public String getZkAddress​(String chroot)
        Get a connection string for this server with a given chroot
        Parameters:
        chroot - the chroot
        Returns:
        the connection string
      • ensurePathExists

        public void ensurePathExists​(String path)
                              throws IOException
        Check that a path exists in this server
        Parameters:
        path - the path to check
        Throws:
        IOException - if an IO exception occurs
      • getPort

        public int getPort()
      • expire

        public void expire​(long sessionId)
      • getZKDatabase

        public org.apache.zookeeper.server.ZKDatabase getZKDatabase()
      • setZKDatabase

        public void setZKDatabase​(org.apache.zookeeper.server.ZKDatabase zkDb)
      • waitForServerDown

        public static boolean waitForServerDown​(String hp,
                                                long timeoutMs)
      • waitForServerUp

        public static boolean waitForServerUp​(String hp,
                                              long timeoutMs)
      • send4LetterWord

        public static String send4LetterWord​(String host,
                                             int port,
                                             String cmd)
                                      throws IOException
        Send the 4letterword
        Parameters:
        host - the destination host
        port - the destination port
        cmd - the 4letterword
        Returns:
        server response
        Throws:
        IOException
      • getTheTickTime

        public int getTheTickTime()
      • setTheTickTime

        public void setTheTickTime​(int theTickTime)
      • getZkDir

        public Path getZkDir()
      • getLimiter

        public org.apache.solr.cloud.ZkTestServer.ZKServerMain.WatchLimiter getLimiter()
      • getMaxSessionTimeout

        public int getMaxSessionTimeout()
      • getMinSessionTimeout

        public int getMinSessionTimeout()
      • setMaxSessionTimeout

        public void setMaxSessionTimeout​(int maxSessionTimeout)
      • setMinSessionTimeout

        public void setMinSessionTimeout​(int minSessionTimeout)
      • putConfig

        public static void putConfig​(String confName,
                                     org.apache.solr.common.cloud.SolrZkClient zkClient,
                                     Path solrhome,
                                     String name)
                              throws Exception
        Throws:
        Exception
      • putConfig

        public static void putConfig​(String confName,
                                     org.apache.solr.common.cloud.SolrZkClient zkClient,
                                     Path solrhome,
                                     String srcName,
                                     String destName)
                              throws Exception
        Throws:
        Exception
      • tryCleanSolrZkNode

        public void tryCleanSolrZkNode()
                                throws Exception
        Throws:
        Exception
      • getZkClient

        public org.apache.solr.common.cloud.SolrZkClient getZkClient()