blob: 2cf5d83cfcc6d617902646f7f5fb5dcf9f8c86d3 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>Apache Mesos: src/tests/zookeeper.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">Apache Mesos
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File&#160;List</span></a></li>
<li><a href="globals.html"><span>File&#160;Members</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_d93a1d4020dea85bb71b237545b5e722.html">tests</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">zookeeper.hpp</div> </div>
</div><!--header-->
<div class="contents">
<a href="src_2tests_2zookeeper_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="comment">// Licensed to the Apache Software Foundation (ASF) under one</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment">// or more contributor license agreements. See the NOTICE file</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="comment">// distributed with this work for additional information</span></div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="comment">// regarding copyright ownership. The ASF licenses this file</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="comment">// to you under the Apache License, Version 2.0 (the</span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="comment">// &quot;License&quot;); you may not use this file except in compliance</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="comment">// with the License. You may obtain a copy of the License at</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="comment">// http://www.apache.org/licenses/LICENSE-2.0</span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="comment">// Unless required by applicable law or agreed to in writing, software</span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="comment">// distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="comment">// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="comment">// See the License for the specific language governing permissions and</span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;<span class="comment">// limitations under the License.</span></div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;</div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="preprocessor">#ifndef __TESTS_ZOOKEEPER_HPP__</span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define __TESTS_ZOOKEEPER_HPP__</span></div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;<span class="preprocessor">#include &lt;stdint.h&gt;</span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;</div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;<span class="preprocessor">#include &lt;condition_variable&gt;</span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;<span class="preprocessor">#include &lt;mutex&gt;</span></div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160;<span class="preprocessor">#include &lt;queue&gt;</span></div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160;</div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160;<span class="preprocessor">#include &lt;gtest/gtest.h&gt;</span></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160;</div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="duration_8hpp.html">stout/duration.hpp</a>&gt;</span></div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160;</div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="zookeeper__test__server_8hpp.html">tests/zookeeper_test_server.hpp</a>&quot;</span></div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160;</div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160;<span class="keyword">namespace </span>mesos {</div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160;<span class="keyword">namespace </span>internal {</div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160;<span class="keyword">namespace </span>tests {</div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160;</div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160;<span class="comment">// Helper for invoking ZooKeeper::get(path, ...) in order to check the</span></div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160;<span class="comment">// data stored at a specified znode path.</span></div>
<div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="namespacemesos_1_1internal_1_1tests.html#aa7a94900be6f4aa53a7c4088ac5dae58"> 38</a></span>&#160;inline ::testing::AssertionResult <a class="code" href="namespacemesos_1_1internal_1_1tests.html#aa7a94900be6f4aa53a7c4088ac5dae58">AssertZKGet</a>(</div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* expectedExpr,</div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* zkExpr,</div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160; <span class="keyword">const</span> <span class="keywordtype">char</span>* pathExpr,</div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160; <span class="keyword">const</span> std::string&amp; expected,</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160; <a class="code" href="classZooKeeper.html">ZooKeeper</a>* zk,</div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; <span class="keyword">const</span> std::string&amp; path)</div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160;{</div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160; std::string result;</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160; <span class="keywordtype">int</span> code = zk-&gt;<a class="code" href="classZooKeeper.html#accad8e8d68a1940c2035bd66f8b5d017">get</a>(path, <span class="keyword">false</span>, &amp;result, <span class="keyword">nullptr</span>);</div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; <span class="keywordflow">if</span> (code == ZOK) {</div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160; <span class="keywordflow">if</span> (expected == result) {</div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; return ::testing::AssertionSuccess();</div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160; } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160; return ::testing::AssertionFailure()</div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160; &lt;&lt; <span class="stringliteral">&quot;Expected data at znode &#39;&quot;</span> &lt;&lt; pathExpr &lt;&lt; <span class="stringliteral">&quot;&#39; &quot;</span></div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160; &lt;&lt; <span class="stringliteral">&quot;to be &#39;&quot;</span> &lt;&lt; expected &lt;&lt; <span class="stringliteral">&quot;&#39;, but actually &#39;&quot;</span> &lt;&lt; result &lt;&lt; <span class="stringliteral">&quot;&#39;&quot;</span>;</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160; }</div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160; } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160; return ::testing::AssertionFailure()</div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160; &lt;&lt; <span class="stringliteral">&quot;(&quot;</span> &lt;&lt; zkExpr &lt;&lt; <span class="stringliteral">&quot;).get(&quot;</span> &lt;&lt; pathExpr &lt;&lt; <span class="stringliteral">&quot;, ...): &quot;</span></div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160; &lt;&lt; zk-&gt;<a class="code" href="classZooKeeper.html#a11bc55cad3b21bd049a1b1c07638d210">message</a>(code);</div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160; }</div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160;}</div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160;</div>
<div class="line"><a name="l00063"></a><span class="lineno"><a class="line" href="src_2tests_2zookeeper_8hpp.html#a4b975dd9370d648227fac3b60f05d018"> 63</a></span>&#160;<span class="preprocessor">#define ASSERT_ZK_GET(expected, zk, path) \</span></div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160;<span class="preprocessor"> ASSERT_PRED_FORMAT3(mesos::internal::tests::AssertZKGet, expected, zk, path)</span></div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160;</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160;<span class="comment">// A fixture for tests that need to interact with a ZooKeeper server</span></div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160;<span class="comment">// ensemble. Tests can access the in process ZooKeeperTestServer via</span></div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160;<span class="comment">// the variable &#39;server&#39;. This test fixture ensures the server is</span></div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160;<span class="comment">// started before each test and shutdown after it so that each test is</span></div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160;<span class="comment">// presented with a ZooKeeper ensemble with no data or watches.</span></div>
<div class="line"><a name="l00072"></a><span class="lineno"><a class="line" href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest.html"> 72</a></span>&#160;<span class="keyword">class </span><a class="code" href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest.html">ZooKeeperTest</a> : <span class="keyword">public</span> ::testing::Test</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160;{</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; <span class="comment">// A watcher that is useful to install in a ZooKeeper client for</span></div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160; <span class="comment">// tests. Allows easy blocking on expected events.</span></div>
<div class="line"><a name="l00077"></a><span class="lineno"><a class="line" href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher.html"> 77</a></span>&#160; <span class="keyword">class </span><a class="code" href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher.html">TestWatcher</a> : <span class="keyword">public</span> <a class="code" href="classWatcher.html">Watcher</a></div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160; {</div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; <span class="comment">// Encapsulates all the state of a ZooKeeper watcher event.</span></div>
<div class="line"><a name="l00081"></a><span class="lineno"><a class="line" href="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event.html"> 81</a></span>&#160; <span class="keyword">struct </span><a class="code" href="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event.html">Event</a> {</div>
<div class="line"><a name="l00082"></a><span class="lineno"><a class="line" href="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event.html#aaff6c0390d06d84ff74ba1bddb9f57d9"> 82</a></span>&#160; <a class="code" href="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event.html#aaff6c0390d06d84ff74ba1bddb9f57d9">Event</a>(<span class="keywordtype">int</span> _type, <span class="keywordtype">int</span> _state, <span class="keyword">const</span> std::string&amp; _path)</div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160; : <a class="code" href="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event.html#ac0d29e60c4e42c93fcd2c5f702f27d45">type</a>(_type), <a class="code" href="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event.html#af21c5db710ec98fb430d015c4f1a10ee">state</a>(_state), <a class="code" href="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event.html#aa8bc57088e1ceffa9d909e8eb53db3a9">path</a>(_path) {}</div>
<div class="line"><a name="l00084"></a><span class="lineno"><a class="line" href="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event.html#ac0d29e60c4e42c93fcd2c5f702f27d45"> 84</a></span>&#160; <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event.html#ac0d29e60c4e42c93fcd2c5f702f27d45">type</a>;</div>
<div class="line"><a name="l00085"></a><span class="lineno"><a class="line" href="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event.html#af21c5db710ec98fb430d015c4f1a10ee"> 85</a></span>&#160; <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event.html#af21c5db710ec98fb430d015c4f1a10ee">state</a>;</div>
<div class="line"><a name="l00086"></a><span class="lineno"><a class="line" href="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event.html#aa8bc57088e1ceffa9d909e8eb53db3a9"> 86</a></span>&#160; <span class="keyword">const</span> std::string <a class="code" href="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event.html#aa8bc57088e1ceffa9d909e8eb53db3a9">path</a>;</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160; };</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160;</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160; <a class="code" href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher.html#ab4b05bbe71dcbcf364a76d2539526940">TestWatcher</a>() = <span class="keywordflow">default</span>;</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160; <span class="keyword">virtual</span> <a class="code" href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher.html#aa97d430aa962767c34e8be2520275af5">~TestWatcher</a>() = <span class="keywordflow">default</span>;</div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160;</div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher.html#a747c1b1809456584e2d9d6be312484ce">process</a>(</div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>&#160; <span class="keywordtype">int</span> <a class="code" href="namespacemesos_1_1internal_1_1fs.html#a2343e2642db514496ba8380776487fba">type</a>,</div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>&#160; <span class="keywordtype">int</span> state,</div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160; int64_t sessionId,</div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160; <span class="keyword">const</span> std::string&amp; path);</div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160;</div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160; <span class="comment">// Blocks until the session event of the given state fires.</span></div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160; <span class="keywordtype">void</span> <a class="code" href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher.html#ac5a9f0ce8ba90b0408483a90f7fe7ef3">awaitSessionEvent</a>(<span class="keywordtype">int</span> state);</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160;</div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160; <span class="comment">// Blocks until a node appears at the given path.</span></div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160; <span class="keywordtype">void</span> <a class="code" href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher.html#a2d07a135077c9e85664f227da959ce7e">awaitCreated</a>(<span class="keyword">const</span> std::string&amp; path);</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160;</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160; <span class="comment">// Blocks until an event is fired matching the given predicate.</span></div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160; <a class="code" href="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event.html">Event</a> <a class="code" href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher.html#a2d7a87e9cf2ebdc15d78b6d4f65f226f">awaitEvent</a>(<span class="keyword">const</span> lambda::function&lt;<span class="keywordtype">bool</span>(<a class="code" href="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event.html">Event</a>)&gt;&amp; matches);</div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160;</div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160; <span class="comment">// Blocks until an event is fired.</span></div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; <a class="code" href="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event.html">Event</a> <a class="code" href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher.html#a2d7a87e9cf2ebdc15d78b6d4f65f226f">awaitEvent</a>();</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160;</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160; <span class="keyword">private</span>:</div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160; std::queue&lt;Event&gt; events;</div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160; std::mutex mutex;</div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160; std::condition_variable cond;</div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160; };</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160;</div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160; <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest.html#a8bbd933c9e18c30b6c6e0502a31b5b9e">SetUpTestCase</a>();</div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160;</div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160;<span class="keyword">protected</span>:</div>
<div class="line"><a name="l00119"></a><span class="lineno"><a class="line" href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest.html#a0c17ec16b01ffd0e8c594c13e948e559"> 119</a></span>&#160; <a class="code" href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest.html#a0c17ec16b01ffd0e8c594c13e948e559">ZooKeeperTest</a>() : <a class="code" href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest.html#a548f2c77206020dee1715f8a6e831910">server</a>(new <a class="code" href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTestServer.html">ZooKeeperTestServer</a>()) {}</div>
<div class="line"><a name="l00120"></a><span class="lineno"><a class="line" href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest.html#a8bd250b63bbf7c7a8e2172481dd3dce3"> 120</a></span>&#160; <span class="keyword">virtual</span> <a class="code" href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest.html#a8bd250b63bbf7c7a8e2172481dd3dce3">~ZooKeeperTest</a>() { <span class="keyword">delete</span> <a class="code" href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest.html#a548f2c77206020dee1715f8a6e831910">server</a>; }</div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160;</div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest.html#afdc92ab78854948c614686209235a64c">SetUp</a>();</div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160;</div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160; <span class="comment">// A very long session timeout that simulates no timeout for test cases.</span></div>
<div class="line"><a name="l00125"></a><span class="lineno"><a class="line" href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest.html#a717d7babbd00c019cc3a3852009b2e7d"> 125</a></span>&#160; <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="classDuration.html">Duration</a> <a class="code" href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest.html#a717d7babbd00c019cc3a3852009b2e7d">NO_TIMEOUT</a>;</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160;</div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160; <span class="comment">// TODO(benh): Share the same ZooKeeperTestServer across all tests?</span></div>
<div class="line"><a name="l00128"></a><span class="lineno"><a class="line" href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest.html#a548f2c77206020dee1715f8a6e831910"> 128</a></span>&#160; <a class="code" href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTestServer.html">ZooKeeperTestServer</a>* <a class="code" href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest.html#a548f2c77206020dee1715f8a6e831910">server</a>;</div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160;};</div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160;</div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160;} <span class="comment">// namespace tests {</span></div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160;} <span class="comment">// namespace internal {</span></div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160;} <span class="comment">// namespace mesos {</span></div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160;</div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>&#160;<span class="preprocessor">#endif // __ZOOKEEPER_TEST_HPP__</span></div>
<div class="ttc" id="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event_html_ac0d29e60c4e42c93fcd2c5f702f27d45"><div class="ttname"><a href="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event.html#ac0d29e60c4e42c93fcd2c5f702f27d45">mesos::internal::tests::ZooKeeperTest::TestWatcher::Event::type</a></div><div class="ttdeci">const int type</div><div class="ttdef"><b>Definition:</b> zookeeper.hpp:84</div></div>
<div class="ttc" id="classZooKeeper_html"><div class="ttname"><a href="classZooKeeper.html">ZooKeeper</a></div><div class="ttdef"><b>Definition:</b> zookeeper.hpp:115</div></div>
<div class="ttc" id="zookeeper__test__server_8hpp_html"><div class="ttname"><a href="zookeeper__test__server_8hpp.html">zookeeper_test_server.hpp</a></div></div>
<div class="ttc" id="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event_html_aaff6c0390d06d84ff74ba1bddb9f57d9"><div class="ttname"><a href="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event.html#aaff6c0390d06d84ff74ba1bddb9f57d9">mesos::internal::tests::ZooKeeperTest::TestWatcher::Event::Event</a></div><div class="ttdeci">Event(int _type, int _state, const std::string &amp;_path)</div><div class="ttdef"><b>Definition:</b> zookeeper.hpp:82</div></div>
<div class="ttc" id="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_html_a8bbd933c9e18c30b6c6e0502a31b5b9e"><div class="ttname"><a href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest.html#a8bbd933c9e18c30b6c6e0502a31b5b9e">mesos::internal::tests::ZooKeeperTest::SetUpTestCase</a></div><div class="ttdeci">static void SetUpTestCase()</div></div>
<div class="ttc" id="classDuration_html"><div class="ttname"><a href="classDuration.html">Duration</a></div><div class="ttdef"><b>Definition:</b> duration.hpp:32</div></div>
<div class="ttc" id="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event_html_af21c5db710ec98fb430d015c4f1a10ee"><div class="ttname"><a href="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event.html#af21c5db710ec98fb430d015c4f1a10ee">mesos::internal::tests::ZooKeeperTest::TestWatcher::Event::state</a></div><div class="ttdeci">const int state</div><div class="ttdef"><b>Definition:</b> zookeeper.hpp:85</div></div>
<div class="ttc" id="namespacemesos_1_1internal_1_1tests_html_aa7a94900be6f4aa53a7c4088ac5dae58"><div class="ttname"><a href="namespacemesos_1_1internal_1_1tests.html#aa7a94900be6f4aa53a7c4088ac5dae58">mesos::internal::tests::AssertZKGet</a></div><div class="ttdeci">inline::testing::AssertionResult AssertZKGet(const char *expectedExpr, const char *zkExpr, const char *pathExpr, const std::string &amp;expected, ZooKeeper *zk, const std::string &amp;path)</div><div class="ttdef"><b>Definition:</b> zookeeper.hpp:38</div></div>
<div class="ttc" id="classWatcher_html"><div class="ttname"><a href="classWatcher.html">Watcher</a></div><div class="ttdoc">This interface specifies the public interface an event handler class must implement. </div><div class="ttdef"><b>Definition:</b> zookeeper.hpp:59</div></div>
<div class="ttc" id="duration_8hpp_html"><div class="ttname"><a href="duration_8hpp.html">duration.hpp</a></div></div>
<div class="ttc" id="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_html_afdc92ab78854948c614686209235a64c"><div class="ttname"><a href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest.html#afdc92ab78854948c614686209235a64c">mesos::internal::tests::ZooKeeperTest::SetUp</a></div><div class="ttdeci">virtual void SetUp()</div></div>
<div class="ttc" id="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_html"><div class="ttname"><a href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher.html">mesos::internal::tests::ZooKeeperTest::TestWatcher</a></div><div class="ttdef"><b>Definition:</b> zookeeper.hpp:77</div></div>
<div class="ttc" id="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_html_a8bd250b63bbf7c7a8e2172481dd3dce3"><div class="ttname"><a href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest.html#a8bd250b63bbf7c7a8e2172481dd3dce3">mesos::internal::tests::ZooKeeperTest::~ZooKeeperTest</a></div><div class="ttdeci">virtual ~ZooKeeperTest()</div><div class="ttdef"><b>Definition:</b> zookeeper.hpp:120</div></div>
<div class="ttc" id="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_html_a0c17ec16b01ffd0e8c594c13e948e559"><div class="ttname"><a href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest.html#a0c17ec16b01ffd0e8c594c13e948e559">mesos::internal::tests::ZooKeeperTest::ZooKeeperTest</a></div><div class="ttdeci">ZooKeeperTest()</div><div class="ttdef"><b>Definition:</b> zookeeper.hpp:119</div></div>
<div class="ttc" id="classZooKeeper_html_accad8e8d68a1940c2035bd66f8b5d017"><div class="ttname"><a href="classZooKeeper.html#accad8e8d68a1940c2035bd66f8b5d017">ZooKeeper::get</a></div><div class="ttdeci">int get(const std::string &amp;path, bool watch, std::string *result, Stat *stat)</div><div class="ttdoc">gets the data associated with a node synchronously. </div></div>
<div class="ttc" id="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_html_a548f2c77206020dee1715f8a6e831910"><div class="ttname"><a href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest.html#a548f2c77206020dee1715f8a6e831910">mesos::internal::tests::ZooKeeperTest::server</a></div><div class="ttdeci">ZooKeeperTestServer * server</div><div class="ttdef"><b>Definition:</b> zookeeper.hpp:128</div></div>
<div class="ttc" id="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_html_ac5a9f0ce8ba90b0408483a90f7fe7ef3"><div class="ttname"><a href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher.html#ac5a9f0ce8ba90b0408483a90f7fe7ef3">mesos::internal::tests::ZooKeeperTest::TestWatcher::awaitSessionEvent</a></div><div class="ttdeci">void awaitSessionEvent(int state)</div></div>
<div class="ttc" id="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_html_a747c1b1809456584e2d9d6be312484ce"><div class="ttname"><a href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher.html#a747c1b1809456584e2d9d6be312484ce">mesos::internal::tests::ZooKeeperTest::TestWatcher::process</a></div><div class="ttdeci">virtual void process(int type, int state, int64_t sessionId, const std::string &amp;path)</div></div>
<div class="ttc" id="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_html_a717d7babbd00c019cc3a3852009b2e7d"><div class="ttname"><a href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest.html#a717d7babbd00c019cc3a3852009b2e7d">mesos::internal::tests::ZooKeeperTest::NO_TIMEOUT</a></div><div class="ttdeci">static const Duration NO_TIMEOUT</div><div class="ttdef"><b>Definition:</b> zookeeper.hpp:125</div></div>
<div class="ttc" id="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event_html_aa8bc57088e1ceffa9d909e8eb53db3a9"><div class="ttname"><a href="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event.html#aa8bc57088e1ceffa9d909e8eb53db3a9">mesos::internal::tests::ZooKeeperTest::TestWatcher::Event::path</a></div><div class="ttdeci">const std::string path</div><div class="ttdef"><b>Definition:</b> zookeeper.hpp:86</div></div>
<div class="ttc" id="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_html_aa97d430aa962767c34e8be2520275af5"><div class="ttname"><a href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher.html#aa97d430aa962767c34e8be2520275af5">mesos::internal::tests::ZooKeeperTest::TestWatcher::~TestWatcher</a></div><div class="ttdeci">virtual ~TestWatcher()=default</div></div>
<div class="ttc" id="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_html_ab4b05bbe71dcbcf364a76d2539526940"><div class="ttname"><a href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher.html#ab4b05bbe71dcbcf364a76d2539526940">mesos::internal::tests::ZooKeeperTest::TestWatcher::TestWatcher</a></div><div class="ttdeci">TestWatcher()=default</div></div>
<div class="ttc" id="namespacemesos_1_1internal_1_1fs_html_a2343e2642db514496ba8380776487fba"><div class="ttname"><a href="namespacemesos_1_1internal_1_1fs.html#a2343e2642db514496ba8380776487fba">mesos::internal::fs::type</a></div><div class="ttdeci">Try&lt; uint32_t &gt; type(const std::string &amp;path)</div></div>
<div class="ttc" id="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_html_a2d07a135077c9e85664f227da959ce7e"><div class="ttname"><a href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher.html#a2d07a135077c9e85664f227da959ce7e">mesos::internal::tests::ZooKeeperTest::TestWatcher::awaitCreated</a></div><div class="ttdeci">void awaitCreated(const std::string &amp;path)</div></div>
<div class="ttc" id="classmesos_1_1internal_1_1tests_1_1ZooKeeperTestServer_html"><div class="ttname"><a href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTestServer.html">mesos::internal::tests::ZooKeeperTestServer</a></div><div class="ttdef"><b>Definition:</b> zookeeper_test_server.hpp:36</div></div>
<div class="ttc" id="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event_html"><div class="ttname"><a href="structmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_1_1Event.html">mesos::internal::tests::ZooKeeperTest::TestWatcher::Event</a></div><div class="ttdef"><b>Definition:</b> zookeeper.hpp:81</div></div>
<div class="ttc" id="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_html"><div class="ttname"><a href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest.html">mesos::internal::tests::ZooKeeperTest</a></div><div class="ttdef"><b>Definition:</b> zookeeper.hpp:72</div></div>
<div class="ttc" id="classZooKeeper_html_a11bc55cad3b21bd049a1b1c07638d210"><div class="ttname"><a href="classZooKeeper.html#a11bc55cad3b21bd049a1b1c07638d210">ZooKeeper::message</a></div><div class="ttdeci">std::string message(int code) const </div><div class="ttdoc">return a message describing the return code. </div></div>
<div class="ttc" id="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher_html_a2d7a87e9cf2ebdc15d78b6d4f65f226f"><div class="ttname"><a href="classmesos_1_1internal_1_1tests_1_1ZooKeeperTest_1_1TestWatcher.html#a2d7a87e9cf2ebdc15d78b6d4f65f226f">mesos::internal::tests::ZooKeeperTest::TestWatcher::awaitEvent</a></div><div class="ttdeci">Event awaitEvent()</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>