You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by fi...@apache.org on 2005/02/16 02:07:40 UTC

svn commit: r153980 [7/8] - in incubator/jackrabbit/site: ./ apidocs/org/apache/jackrabbit/core/ apidocs/org/apache/jackrabbit/core/state/mem/ apidocs/org/apache/jackrabbit/core/state/obj/ apidocs/org/apache/jackrabbit/core/state/xml/ apidocs/org/apache/jackrabbit/core/version/ apidocs/org/apache/jackrabbit/core/xml/ xref-test/ xref-test/org/apache/jackrabbit/init/ xref-test/org/apache/jackrabbit/test/ xref-test/org/apache/jackrabbit/test/api/ xref-test/org/apache/jackrabbit/test/api/version/ xref/org/apache/jackrabbit/core/

Modified: incubator/jackrabbit/site/xref-test/org/apache/jackrabbit/test/api/version/CheckoutTest.html
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/site/xref-test/org/apache/jackrabbit/test/api/version/CheckoutTest.html?view=diff&r1=153979&r2=153980
==============================================================================
--- incubator/jackrabbit/site/xref-test/org/apache/jackrabbit/test/api/version/CheckoutTest.html (original)
+++ incubator/jackrabbit/site/xref-test/org/apache/jackrabbit/test/api/version/CheckoutTest.html Tue Feb 15 17:07:29 2005
@@ -29,80 +29,161 @@
 <a name="20" href="#20">20</a>  <strong>import</strong> javax.jcr.Node;
 <a name="21" href="#21">21</a>  <strong>import</strong> javax.jcr.ItemNotFoundException;
 <a name="22" href="#22">22</a>  <strong>import</strong> javax.jcr.UnsupportedRepositoryOperationException;
-<a name="23" href="#23">23</a>  
-<a name="24" href="#24">24</a>  <em>/**<em>*</em></em>
-<a name="25" href="#25">25</a>  <em> * &lt;code>CheckoutTest&lt;/code> covers tests related to {@link javax.jcr.Node#checkout()}</em>
-<a name="26" href="#26">26</a>  <em> * and {@link javax.jcr.Node#isCheckedOut()}.</em>
-<a name="27" href="#27">27</a>  <em> *</em>
-<a name="28" href="#28">28</a>  <em> * @test</em>
-<a name="29" href="#29">29</a>  <em> * @sources CheckoutTest.java</em>
-<a name="30" href="#30">30</a>  <em> * @executeClass org.apache.jackrabbit.test.api.version.CheckoutTest</em>
-<a name="31" href="#31">31</a>  <em> * @keywords versioning</em>
-<a name="32" href="#32">32</a>  <em> */</em>
-<a name="33" href="#33">33</a>  <strong>public</strong> <strong>class</strong> <a href="../../../../../../org/apache/jackrabbit/test/api/version/CheckoutTest.html">CheckoutTest</a> <strong>extends</strong> <a href="../../../../../../org/apache/jackrabbit/test/api/version/AbstractVersionTest.html">AbstractVersionTest</a> {
-<a name="34" href="#34">34</a>  
-<a name="35" href="#35">35</a>      <strong>protected</strong> <strong>void</strong> setUp() throws Exception {
-<a name="36" href="#36">36</a>          <strong>super</strong>.setUp();
-<a name="37" href="#37">37</a>          
-<a name="38" href="#38">38</a>          <strong>if</strong> (!versionableNode.isCheckedOut()) {
-<a name="39" href="#39">39</a>              fail(<span class="string">"A versionable node must be checked-out after persistent creation."</span>);
-<a name="40" href="#40">40</a>          }
-<a name="41" href="#41">41</a>          versionableNode.checkin();
-<a name="42" href="#42">42</a>      }
-<a name="43" href="#43">43</a>  
-<a name="44" href="#44">44</a>      <em>/**<em>*</em></em>
-<a name="45" href="#45">45</a>  <em>     * Test if Node.isCheckedOut() returns true, if the versionable node has</em>
-<a name="46" href="#46">46</a>  <em>     * been checked out before.</em>
-<a name="47" href="#47">47</a>  <em>     *</em>
-<a name="48" href="#48">48</a>  <em>     * @throws javax.jcr.RepositoryException</em>
-<a name="49" href="#49">49</a>  <em>     */</em>
-<a name="50" href="#50">50</a>      <strong>public</strong> <strong>void</strong> testIsCheckedOut() throws RepositoryException {
-<a name="51" href="#51">51</a>          versionableNode.checkout();
-<a name="52" href="#52">52</a>          assertTrue(<span class="string">"After calling Node.checkout() a versionable node N, N.isCheckedOut() must return true."</span>, versionableNode.isCheckedOut());
-<a name="53" href="#53">53</a>      }
-<a name="54" href="#54">54</a>  
-<a name="55" href="#55">55</a>      <em>/**<em>*</em></em>
-<a name="56" href="#56">56</a>  <em>     * Test calling Node.isCheckedOut() on a non-versionable.</em>
-<a name="57" href="#57">57</a>  <em>     *</em>
-<a name="58" href="#58">58</a>  <em>     * @throws RepositoryException</em>
-<a name="59" href="#59">59</a>  <em>     */</em>
-<a name="60" href="#60">60</a>      <strong>public</strong> <strong>void</strong> testIsCheckedOutNonVersionableNode() throws RepositoryException {
-<a name="61" href="#61">61</a>          <strong>boolean</strong> isCheckedOut = nonVersionableNode.isCheckedOut();
-<a name="62" href="#62">62</a>          Node vParent = <strong>null</strong>;
-<a name="63" href="#63">63</a>          <strong>try</strong> {
-<a name="64" href="#64">64</a>              vParent = nonVersionableNode.getParent();
-<a name="65" href="#65">65</a>              <strong>while</strong> (!vParent.isNodeType(mixVersionable)) {
-<a name="66" href="#66">66</a>                  vParent = vParent.getParent();
-<a name="67" href="#67">67</a>              }
-<a name="68" href="#68">68</a>          } <strong>catch</strong> (ItemNotFoundException e) {
-<a name="69" href="#69">69</a>              <em class="comment">// root reached.</em>
-<a name="70" href="#70">70</a>          }
-<a name="71" href="#71">71</a>  
-<a name="72" href="#72">72</a>          <strong>if</strong> (vParent != <strong>null</strong> &amp;&amp; vParent.isNodeType(mixVersionable)) {
-<a name="73" href="#73">73</a>              <strong>if</strong> (vParent.isCheckedOut()) {
-<a name="74" href="#74">74</a>                 assertTrue(<span class="string">"Node.isCheckedOut() must return true if the node is non-versionable and its nearest versionable ancestor is checked-out."</span>, isCheckedOut);
-<a name="75" href="#75">75</a>              } <strong>else</strong> {
-<a name="76" href="#76">76</a>                 assertFalse(<span class="string">"Node.isCheckedOut() must return false if the node is non-versionable and its nearest versionable ancestor is checked-in."</span>, isCheckedOut);
-<a name="77" href="#77">77</a>              }
-<a name="78" href="#78">78</a>          } <strong>else</strong> {
-<a name="79" href="#79">79</a>              assertTrue(<span class="string">"Node.isCheckedOut() must return true if the node is non-versionable and has no versionable ancestor"</span>, isCheckedOut);
-<a name="80" href="#80">80</a>          }
-<a name="81" href="#81">81</a>      }
-<a name="82" href="#82">82</a>  
-<a name="83" href="#83">83</a>      <em>/**<em>*</em></em>
-<a name="84" href="#84">84</a>  <em>     * Test calling Node.checkout() on a non-versionable node.</em>
-<a name="85" href="#85">85</a>  <em>     * </em>
-<a name="86" href="#86">86</a>  <em>     * @throws RepositoryException</em>
-<a name="87" href="#87">87</a>  <em>     */</em>
-<a name="88" href="#88">88</a>      <strong>public</strong> <strong>void</strong> testCheckoutNonVersionableNode() throws RepositoryException {
-<a name="89" href="#89">89</a>          <strong>try</strong> {
-<a name="90" href="#90">90</a>              nonVersionableNode.checkout();
-<a name="91" href="#91">91</a>              fail(<span class="string">"Node.checkout() on a non versionable node must throw UnsupportedRepositoryOperationException"</span>);
-<a name="92" href="#92">92</a>          } <strong>catch</strong> (UnsupportedRepositoryOperationException e) {
-<a name="93" href="#93">93</a>              <em class="comment">//success</em>
-<a name="94" href="#94">94</a>          }
-<a name="95" href="#95">95</a>      }
-<a name="96" href="#96">96</a>  }
+<a name="23" href="#23">23</a>  <strong>import</strong> javax.jcr.Value;
+<a name="24" href="#24">24</a>  <strong>import</strong> javax.jcr.PropertyIterator;
+<a name="25" href="#25">25</a>  <strong>import</strong> javax.jcr.Property;
+<a name="26" href="#26">26</a>  
+<a name="27" href="#27">27</a>  <em>/**<em>*</em></em>
+<a name="28" href="#28">28</a>  <em> * &lt;code>CheckoutTest&lt;/code> covers tests related to {@link</em>
+<a name="29" href="#29">29</a>  <em> * javax.jcr.Node#checkout()} and {@link javax.jcr.Node#isCheckedOut()}.</em>
+<a name="30" href="#30">30</a>  <em> *</em>
+<a name="31" href="#31">31</a>  <em> * @test</em>
+<a name="32" href="#32">32</a>  <em> * @sources CheckoutTest.java</em>
+<a name="33" href="#33">33</a>  <em> * @executeClass org.apache.jackrabbit.test.api.version.CheckoutTest</em>
+<a name="34" href="#34">34</a>  <em> * @keywords versioning</em>
+<a name="35" href="#35">35</a>  <em> */</em>
+<a name="36" href="#36">36</a>  <strong>public</strong> <strong>class</strong> <a href="../../../../../../org/apache/jackrabbit/test/api/version/CheckoutTest.html">CheckoutTest</a> <strong>extends</strong> <a href="../../../../../../org/apache/jackrabbit/test/api/version/AbstractVersionTest.html">AbstractVersionTest</a> {
+<a name="37" href="#37">37</a>  
+<a name="38" href="#38">38</a>      <strong>protected</strong> <strong>void</strong> setUp() throws Exception {
+<a name="39" href="#39">39</a>          <strong>super</strong>.setUp();
+<a name="40" href="#40">40</a>  
+<a name="41" href="#41">41</a>          <strong>if</strong> (!versionableNode.isCheckedOut()) {
+<a name="42" href="#42">42</a>              fail(<span class="string">"A versionable node must be checked-out after persistent creation."</span>);
+<a name="43" href="#43">43</a>          }
+<a name="44" href="#44">44</a>          versionableNode.checkin();
+<a name="45" href="#45">45</a>      }
+<a name="46" href="#46">46</a>  
+<a name="47" href="#47">47</a>      <em>/**<em>*</em></em>
+<a name="48" href="#48">48</a>  <em>     * Test if Node.isCheckedOut() returns true, if the versionable node has</em>
+<a name="49" href="#49">49</a>  <em>     * been checked out before.</em>
+<a name="50" href="#50">50</a>  <em>     */</em>
+<a name="51" href="#51">51</a>      <strong>public</strong> <strong>void</strong> testIsCheckedOut() throws RepositoryException {
+<a name="52" href="#52">52</a>          versionableNode.checkout();
+<a name="53" href="#53">53</a>          assertTrue(<span class="string">"After calling Node.checkout() a versionable node N, N.isCheckedOut() must return true."</span>, versionableNode.isCheckedOut());
+<a name="54" href="#54">54</a>      }
+<a name="55" href="#55">55</a>  
+<a name="56" href="#56">56</a>      <em>/**<em>*</em></em>
+<a name="57" href="#57">57</a>  <em>     * Test calling Node.isCheckedOut() on a non-versionable.</em>
+<a name="58" href="#58">58</a>  <em>     */</em>
+<a name="59" href="#59">59</a>      <strong>public</strong> <strong>void</strong> testIsCheckedOutNonVersionableNode() throws RepositoryException {
+<a name="60" href="#60">60</a>          <strong>boolean</strong> isCheckedOut = nonVersionableNode.isCheckedOut();
+<a name="61" href="#61">61</a>          Node vParent = <strong>null</strong>;
+<a name="62" href="#62">62</a>          <strong>try</strong> {
+<a name="63" href="#63">63</a>              vParent = nonVersionableNode.getParent();
+<a name="64" href="#64">64</a>              <strong>while</strong> (!vParent.isNodeType(mixVersionable)) {
+<a name="65" href="#65">65</a>                  vParent = vParent.getParent();
+<a name="66" href="#66">66</a>              }
+<a name="67" href="#67">67</a>          } <strong>catch</strong> (ItemNotFoundException e) {
+<a name="68" href="#68">68</a>              <em class="comment">// root reached.</em>
+<a name="69" href="#69">69</a>          }
+<a name="70" href="#70">70</a>  
+<a name="71" href="#71">71</a>          <strong>if</strong> (vParent != <strong>null</strong> &amp;&amp; vParent.isNodeType(mixVersionable)) {
+<a name="72" href="#72">72</a>              <strong>if</strong> (vParent.isCheckedOut()) {
+<a name="73" href="#73">73</a>                  assertTrue(<span class="string">"Node.isCheckedOut() must return true if the node is non-versionable and its nearest versionable ancestor is checked-out."</span>, isCheckedOut);
+<a name="74" href="#74">74</a>              } <strong>else</strong> {
+<a name="75" href="#75">75</a>                  assertFalse(<span class="string">"Node.isCheckedOut() must return false if the node is non-versionable and its nearest versionable ancestor is checked-in."</span>, isCheckedOut);
+<a name="76" href="#76">76</a>              }
+<a name="77" href="#77">77</a>          } <strong>else</strong> {
+<a name="78" href="#78">78</a>              assertTrue(<span class="string">"Node.isCheckedOut() must return true if the node is non-versionable and has no versionable ancestor"</span>, isCheckedOut);
+<a name="79" href="#79">79</a>          }
+<a name="80" href="#80">80</a>      }
+<a name="81" href="#81">81</a>  
+<a name="82" href="#82">82</a>      <em>/**<em>*</em></em>
+<a name="83" href="#83">83</a>  <em>     * Test calling Node.checkout() on a non-versionable node.</em>
+<a name="84" href="#84">84</a>  <em>     */</em>
+<a name="85" href="#85">85</a>      <strong>public</strong> <strong>void</strong> testCheckoutNonVersionableNode() throws RepositoryException {
+<a name="86" href="#86">86</a>          <strong>try</strong> {
+<a name="87" href="#87">87</a>              nonVersionableNode.checkout();
+<a name="88" href="#88">88</a>              fail(<span class="string">"Node.checkout() on a non versionable node must throw UnsupportedRepositoryOperationException"</span>);
+<a name="89" href="#89">89</a>          } <strong>catch</strong> (UnsupportedRepositoryOperationException e) {
+<a name="90" href="#90">90</a>              <em class="comment">//success</em>
+<a name="91" href="#91">91</a>          }
+<a name="92" href="#92">92</a>      }
+<a name="93" href="#93">93</a>  
+<a name="94" href="#94">94</a>      <em>/**<em>*</em></em>
+<a name="95" href="#95">95</a>  <em>     * Test if Node.checkout() doesn't throw any exception if the versionable</em>
+<a name="96" href="#96">96</a>  <em>     * node has been checked out before.</em>
+<a name="97" href="#97">97</a>  <em>     */</em>
+<a name="98" href="#98">98</a>      <strong>public</strong> <strong>void</strong> testCheckoutTwiceDoesNotThrow() throws RepositoryException {
+<a name="99" href="#99">99</a>          versionableNode.checkout();
+<a name="100" href="#100">100</a>         versionableNode.checkout();
+<a name="101" href="#101">101</a>     }
+<a name="102" href="#102">102</a> 
+<a name="103" href="#103">103</a>     <em>/**<em>*</em></em>
+<a name="104" href="#104">104</a> <em>     * Test if Node.checkout() has no effect if the versionable node has been</em>
+<a name="105" href="#105">105</a> <em>     * checked out before.</em>
+<a name="106" href="#106">106</a> <em>     * &lt;p/></em>
+<a name="107" href="#107">107</a> <em>     * As 'has no effect' means that the whole repository is in the exact same</em>
+<a name="108" href="#108">108</a> <em>     * state as before and this isn't testable easily we test here only if the</em>
+<a name="109" href="#109">109</a> <em>     * properties of the current node don't change (tested by a copy of the</em>
+<a name="110" href="#110">110</a> <em>     * original node and compare the not autocreated properties (autocreated</em>
+<a name="111" href="#111">111</a> <em>     * properties only because autocreated properties like UUID, creationdate</em>
+<a name="112" href="#112">112</a> <em>     * etc will not be equal as expected)).</em>
+<a name="113" href="#113">113</a> <em>     */</em>
+<a name="114" href="#114">114</a>     <strong>public</strong> <strong>void</strong> testCheckOutAlreadyCheckedOutNode() throws RepositoryException {
+<a name="115" href="#115">115</a>         versionableNode.checkout();
+<a name="116" href="#116">116</a> 
+<a name="117" href="#117">117</a>         <em class="comment">// build a copy of versionableNode.</em>
+<a name="118" href="#118">118</a>         String copiedNodePath = testRoot + <span class="string">"/"</span> + nodeName2;
+<a name="119" href="#119">119</a>         superuser.getWorkspace().copy(versionableNode.getPath(), copiedNodePath);
+<a name="120" href="#120">120</a>         Node copiedNode = (Node) superuser.getItem(copiedNodePath);
+<a name="121" href="#121">121</a> 
+<a name="122" href="#122">122</a>         <em class="comment">// perform 2nd checkout</em>
+<a name="123" href="#123">123</a>         versionableNode.checkout();
+<a name="124" href="#124">124</a> 
+<a name="125" href="#125">125</a>         <em class="comment">// check if the values of all not autocreated properties of</em>
+<a name="126" href="#126">126</a>         <em class="comment">// the original node are equal to the ones of the copied node.</em>
+<a name="127" href="#127">127</a>         PropertyIterator propIt = versionableNode.getProperties();
+<a name="128" href="#128">128</a>         <strong>while</strong> (propIt.hasNext()) {
+<a name="129" href="#129">129</a>             Property origProp = propIt.nextProperty();
+<a name="130" href="#130">130</a>             Property copyProp = copiedNode.getProperty(origProp.getName());
+<a name="131" href="#131">131</a>             <strong>if</strong> (!origProp.getDefinition().isAutoCreate()) {
+<a name="132" href="#132">132</a>                 <strong>if</strong> (origProp.getDefinition().isMultiple()) {
+<a name="133" href="#133">133</a>                     Value[] origValues = origProp.getValues();
+<a name="134" href="#134">134</a>                     Value[] copyValues = copyProp.getValues();
+<a name="135" href="#135">135</a>                     <strong>int</strong> i = 0;
+<a name="136" href="#136">136</a>                     <strong>while</strong> (i &lt; origValues.length) {
+<a name="137" href="#137">137</a>                         <strong>if</strong> (!origValues[i].equals(copyValues[i])) {
+<a name="138" href="#138">138</a>                             fail(<span class="string">"After calling Node.checkout() on an already checket-out versionable node must not have changed property '"</span> + origProp.getName() + <span class="string">"'."</span>);
+<a name="139" href="#139">139</a>                         }
+<a name="140" href="#140">140</a>                         i++;
+<a name="141" href="#141">141</a>                     }
+<a name="142" href="#142">142</a>                 } <strong>else</strong> {
+<a name="143" href="#143">143</a>                     <strong>if</strong> (!origProp.getValue().equals(copyProp.getValue())) {
+<a name="144" href="#144">144</a>                         fail(<span class="string">"After calling Node.checkout() on an already checket-out versionable node must not have changed property '"</span> + origProp.getName() + <span class="string">"'."</span>);
+<a name="145" href="#145">145</a>                     }
+<a name="146" href="#146">146</a>                 }
+<a name="147" href="#147">147</a>             }
+<a name="148" href="#148">148</a>         }
+<a name="149" href="#149">149</a> 
+<a name="150" href="#150">150</a>         <em class="comment">// success if passed: neither of the properties (exluding autocreated ones) changed</em>
+<a name="151" href="#151">151</a>         <em class="comment">// between first and second checkout.</em>
+<a name="152" href="#152">152</a>     }
+<a name="153" href="#153">153</a> 
+<a name="154" href="#154">154</a>     <em>/**<em>*</em></em>
+<a name="155" href="#155">155</a> <em>     * Test if Node.checkout() copies the node's jcr:baseVersion to node's</em>
+<a name="156" href="#156">156</a> <em>     * jcr:predecessors property (no save required).</em>
+<a name="157" href="#157">157</a> <em>     */</em>
+<a name="158" href="#158">158</a>     <strong>public</strong> <strong>void</strong> testCheckoutCopiesBaseValueToPredecessorProperty() throws RepositoryException {
+<a name="159" href="#159">159</a>         Value baseVersionValue = versionableNode.getProperty(jcrBaseVersion).getValue();
+<a name="160" href="#160">160</a>         versionableNode.checkout();
+<a name="161" href="#161">161</a>         Value[] predecessorsValues = versionableNode.getProperty(jcrPredecessors).getValues();
+<a name="162" href="#162">162</a> 
+<a name="163" href="#163">163</a>         <em class="comment">// loop over all values of jcr:predecessors property as it's not sure</em>
+<a name="164" href="#164">164</a>         <em class="comment">// on which position jcr:baseVersion is copied.</em>
+<a name="165" href="#165">165</a>         <strong>boolean</strong> foundBaseVersionProp = false;
+<a name="166" href="#166">166</a>         <strong>int</strong> i = 0;
+<a name="167" href="#167">167</a>         <strong>while</strong> (i &lt; predecessorsValues.length &amp;&amp; !foundBaseVersionProp) {
+<a name="168" href="#168">168</a>             <strong>if</strong> (predecessorsValues[i].equals(baseVersionValue)) {
+<a name="169" href="#169">169</a>                 foundBaseVersionProp = <strong>true</strong>;
+<a name="170" href="#170">170</a>             }
+<a name="171" href="#171">171</a>             i++;
+<a name="172" href="#172">172</a>         }
+<a name="173" href="#173">173</a>         <strong>if</strong> (!foundBaseVersionProp) {
+<a name="174" href="#174">174</a>             fail(<span class="string">"After calling Node.checkout() the current value of node's jcr:baseVersion must be copied to node's jcr:predecessors property"</span>);
+<a name="175" href="#175">175</a>         }
+<a name="176" href="#176">176</a>     }
+<a name="177" href="#177">177</a> }
 </pre>
 <hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
 </html>

Modified: incubator/jackrabbit/site/xref-test/org/apache/jackrabbit/test/api/version/VersionLabelTest.html
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/site/xref-test/org/apache/jackrabbit/test/api/version/VersionLabelTest.html?view=diff&r1=153979&r2=153980
==============================================================================
--- incubator/jackrabbit/site/xref-test/org/apache/jackrabbit/test/api/version/VersionLabelTest.html (original)
+++ incubator/jackrabbit/site/xref-test/org/apache/jackrabbit/test/api/version/VersionLabelTest.html Tue Feb 15 17:07:29 2005
@@ -27,300 +27,318 @@
 <a name="18" href="#18">18</a>  
 <a name="19" href="#19">19</a>  <strong>import</strong> javax.jcr.RepositoryException;
 <a name="20" href="#20">20</a>  <strong>import</strong> javax.jcr.UnsupportedRepositoryOperationException;
-<a name="21" href="#21">21</a>  <strong>import</strong> javax.jcr.version.VersionHistory;
-<a name="22" href="#22">22</a>  <strong>import</strong> javax.jcr.version.Version;
-<a name="23" href="#23">23</a>  <strong>import</strong> javax.jcr.version.VersionException;
-<a name="24" href="#24">24</a>  <strong>import</strong> java.util.HashSet;
-<a name="25" href="#25">25</a>  <strong>import</strong> java.util.Arrays;
-<a name="26" href="#26">26</a>  
-<a name="27" href="#27">27</a>  <em>/**<em>*</em></em>
-<a name="28" href="#28">28</a>  <em> * &lt;code>VersionLabelTest&lt;/code> covers methods related to version label such as</em>
-<a name="29" href="#29">29</a>  <em> * &lt;ul></em>
-<a name="30" href="#30">30</a>  <em> * &lt;li>{@link VersionHistory#addVersionLabel(String, String, boolean)}&lt;/li></em>
-<a name="31" href="#31">31</a>  <em> * &lt;li>{@link VersionHistory#removeVersionLabel(String)}&lt;/li></em>
-<a name="32" href="#32">32</a>  <em> * &lt;li>{@link VersionHistory#restoreByLabel(String, boolean)} &lt;/li></em>
-<a name="33" href="#33">33</a>  <em> * &lt;li>{@link VersionHistory#getVersionByLabel(String)}&lt;/li></em>
-<a name="34" href="#34">34</a>  <em> * &lt;li>{@link javax.jcr.version.VersionHistory#getVersionLabels()} &lt;/li></em>
-<a name="35" href="#35">35</a>  <em> * &lt;li>{@link javax.jcr.version.VersionHistory#hasVersionLabel(javax.jcr.version.Version, String)}&lt;/li></em>
-<a name="36" href="#36">36</a>  <em> * &lt;li>{@link VersionHistory#hasVersionLabel(String)}&lt;/li></em>
-<a name="37" href="#37">37</a>  <em> * &lt;li>{@link VersionHistory#hasVersionLabel(javax.jcr.version.Version, String)} &lt;/li></em>
-<a name="38" href="#38">38</a>  <em> * &lt;/ul></em>
-<a name="39" href="#39">39</a>  <em> *</em>
-<a name="40" href="#40">40</a>  <em> * @test</em>
-<a name="41" href="#41">41</a>  <em> * @sources VersionLabelTest.java</em>
-<a name="42" href="#42">42</a>  <em> * @executeClass org.apache.jackrabbit.test.api.version.VersionLabelTest</em>
-<a name="43" href="#43">43</a>  <em> * @keywords versioning</em>
-<a name="44" href="#44">44</a>  <em> */</em>
-<a name="45" href="#45">45</a>  <strong>public</strong> <strong>class</strong> <a href="../../../../../../org/apache/jackrabbit/test/api/version/VersionLabelTest.html">VersionLabelTest</a> <strong>extends</strong> <a href="../../../../../../org/apache/jackrabbit/test/api/version/AbstractVersionTest.html">AbstractVersionTest</a> {
-<a name="46" href="#46">46</a>  
-<a name="47" href="#47">47</a>      <strong>protected</strong> String versionLabel = <span class="string">"foo"</span>;
-<a name="48" href="#48">48</a>      <strong>protected</strong> String versionLabel2 = <span class="string">"bar"</span>;
-<a name="49" href="#49">49</a>  
-<a name="50" href="#50">50</a>      <strong>protected</strong> VersionHistory vHistory;
-<a name="51" href="#51">51</a>      <strong>protected</strong> Version rootVersion;
-<a name="52" href="#52">52</a>  
-<a name="53" href="#53">53</a>      <strong>protected</strong> <strong>void</strong> setUp() throws Exception {
-<a name="54" href="#54">54</a>          <strong>super</strong>.setUp();
-<a name="55" href="#55">55</a>  
-<a name="56" href="#56">56</a>          vHistory = versionableNode.getVersionHistory();
-<a name="57" href="#57">57</a>          rootVersion = vHistory.getRootVersion();
-<a name="58" href="#58">58</a>  
-<a name="59" href="#59">59</a>          <strong>if</strong> (vHistory.hasVersionLabel(versionLabel)) {
-<a name="60" href="#60">60</a>              fail(<span class="string">"Version label '"</span>+versionLabel+<span class="string">"' is already present in this version history. Label test cannot be performed."</span>);
-<a name="61" href="#61">61</a>          }
-<a name="62" href="#62">62</a>  
-<a name="63" href="#63">63</a>          <strong>if</strong> (vHistory.hasVersionLabel(versionLabel2)) {
-<a name="64" href="#64">64</a>              fail(<span class="string">"Version label '"</span>+versionLabel2+<span class="string">"' is already present in this version history. Label test cannot be performed."</span>);
-<a name="65" href="#65">65</a>          }
-<a name="66" href="#66">66</a>      }
-<a name="67" href="#67">67</a>  
-<a name="68" href="#68">68</a>      <strong>protected</strong> <strong>void</strong> tearDown() throws Exception {
-<a name="69" href="#69">69</a>          <strong>try</strong> {
-<a name="70" href="#70">70</a>              <em class="comment">// clean up: remove the version labels again.</em>
-<a name="71" href="#71">71</a>              vHistory.removeVersionLabel(versionLabel);
-<a name="72" href="#72">72</a>              vHistory.removeVersionLabel(versionLabel2);
-<a name="73" href="#73">73</a>          } <strong>catch</strong> (RepositoryException e) {
-<a name="74" href="#74">74</a>              <em class="comment">// ignore</em>
-<a name="75" href="#75">75</a>          }
-<a name="76" href="#76">76</a>          <strong>super</strong>.tearDown();
-<a name="77" href="#77">77</a>      }
-<a name="78" href="#78">78</a>  
-<a name="79" href="#79">79</a>      <em>/**<em>*</em></em>
-<a name="80" href="#80">80</a>  <em>     * Test if the number of labels available in the version history is increased</em>
-<a name="81" href="#81">81</a>  <em>     * by added a new label.</em>
-<a name="82" href="#82">82</a>  <em>     *</em>
-<a name="83" href="#83">83</a>  <em>     * @throws RepositoryException</em>
-<a name="84" href="#84">84</a>  <em>     * @see VersionHistory#addVersionLabel(String, String, boolean)</em>
-<a name="85" href="#85">85</a>  <em>     */</em>
-<a name="86" href="#86">86</a>      <strong>public</strong> <strong>void</strong> testAddVersionLabel() throws RepositoryException {
-<a name="87" href="#87">87</a>          <strong>int</strong> initialLength = vHistory.getVersionLabels().length;
-<a name="88" href="#88">88</a>          vHistory.addVersionLabel(rootVersion.getName(), versionLabel, false);
-<a name="89" href="#89">89</a>          String[] labels = vHistory.getVersionLabels();
-<a name="90" href="#90">90</a>  
-<a name="91" href="#91">91</a>          assertEquals(<span class="string">"A version label that has been successfully added must increes the total number of version labels available in the history."</span>, initialLength + 1, labels.length);
-<a name="92" href="#92">92</a>      }
-<a name="93" href="#93">93</a>  
-<a name="94" href="#94">94</a>      <em>/**<em>*</em></em>
-<a name="95" href="#95">95</a>  <em>     * Test if the a label added with VersionHistory.addVersionLabel(String, String, boolean)</em>
-<a name="96" href="#96">96</a>  <em>     * is present in the array returned by VersionHistory.getVersionLabels(), if</em>
-<a name="97" href="#97">97</a>  <em>     * the label has not been present before.</em>
-<a name="98" href="#98">98</a>  <em>     *</em>
-<a name="99" href="#99">99</a>  <em>     * @throws RepositoryException</em>
-<a name="100" href="#100">100</a> <em>     * @see VersionHistory#addVersionLabel(String, String, boolean)</em>
-<a name="101" href="#101">101</a> <em>     */</em>
-<a name="102" href="#102">102</a>     <strong>public</strong> <strong>void</strong> testAddVersionLabel2() throws RepositoryException {
-<a name="103" href="#103">103</a>         vHistory.addVersionLabel(rootVersion.getName(), versionLabel, false);
-<a name="104" href="#104">104</a>         String[] labels = vHistory.getVersionLabels();
-<a name="105" href="#105">105</a>         <strong>boolean</strong> found = false;
-<a name="106" href="#106">106</a>         <strong>for</strong> (<strong>int</strong> i = 0; i &lt; labels.length; i++) {
-<a name="107" href="#107">107</a>             <strong>if</strong> (labels[i].equals(versionLabel)) {
-<a name="108" href="#108">108</a>                 found = <strong>true</strong>;
-<a name="109" href="#109">109</a>                 <strong>break</strong>;
-<a name="110" href="#110">110</a>             }
-<a name="111" href="#111">111</a>         }
-<a name="112" href="#112">112</a>         assertTrue(<span class="string">"The version label that has been successfully added must be present in the array containing all labels."</span>, found);
-<a name="113" href="#113">113</a>     }
-<a name="114" href="#114">114</a> 
-<a name="115" href="#115">115</a>     <em>/**<em>*</em></em>
-<a name="116" href="#116">116</a> <em>     * Test if VersionHistory.hasVersionLabel(String) returns true, if the label</em>
-<a name="117" href="#117">117</a> <em>     * has beed successfully added before.</em>
-<a name="118" href="#118">118</a> <em>     *</em>
-<a name="119" href="#119">119</a> <em>     * @throws RepositoryException</em>
-<a name="120" href="#120">120</a> <em>     * @see VersionHistory#hasVersionLabel(String)</em>
-<a name="121" href="#121">121</a> <em>     */</em>
-<a name="122" href="#122">122</a>     <strong>public</strong> <strong>void</strong> testHasVersionLabel() throws RepositoryException {
-<a name="123" href="#123">123</a>         vHistory.addVersionLabel(rootVersion.getName(), versionLabel, false);
-<a name="124" href="#124">124</a>         assertTrue(<span class="string">"VersionHistory.hasVersionLabel(String) must return true if the label has been sucessfully added."</span>, vHistory.hasVersionLabel(versionLabel));
-<a name="125" href="#125">125</a>     }
-<a name="126" href="#126">126</a> 
-<a name="127" href="#127">127</a>     <em>/**<em>*</em></em>
-<a name="128" href="#128">128</a> <em>     * Test if VersionHistory.hasVersionLabel(Version, String) returns true, if the label</em>
-<a name="129" href="#129">129</a> <em>     * has beed successfully added before to the specified version.</em>
-<a name="130" href="#130">130</a> <em>     *</em>
-<a name="131" href="#131">131</a> <em>     * @throws RepositoryException</em>
-<a name="132" href="#132">132</a> <em>     * @see VersionHistory#hasVersionLabel(javax.jcr.version.Version, String)</em>
-<a name="133" href="#133">133</a> <em>     */</em>
-<a name="134" href="#134">134</a>     <strong>public</strong> <strong>void</strong> testHasVersionLabelForVersion() throws RepositoryException {
-<a name="135" href="#135">135</a>         vHistory.addVersionLabel(rootVersion.getName(), versionLabel, false);
-<a name="136" href="#136">136</a>         assertTrue(<span class="string">"VersionHistory.hasVersionLabel(Version, String) must return true if the label has been sucessfully added."</span>, vHistory.hasVersionLabel(rootVersion, versionLabel));
-<a name="137" href="#137">137</a>     }
-<a name="138" href="#138">138</a> 
-<a name="139" href="#139">139</a>     <em>/**<em>*</em></em>
-<a name="140" href="#140">140</a> <em>     * Test if multiple distinct version labels can be added for a given version.</em>
-<a name="141" href="#141">141</a> <em>     *</em>
-<a name="142" href="#142">142</a> <em>     * @throws RepositoryException</em>
-<a name="143" href="#143">143</a> <em>     */</em>
-<a name="144" href="#144">144</a>     <strong>public</strong> <strong>void</strong> testAddMultipleVersionLabels() throws RepositoryException {
-<a name="145" href="#145">145</a>         <strong>try</strong> {
-<a name="146" href="#146">146</a>             vHistory.addVersionLabel(rootVersion.getName(), versionLabel, false);
-<a name="147" href="#147">147</a>             vHistory.addVersionLabel(rootVersion.getName(), versionLabel2, false);
-<a name="148" href="#148">148</a>         } <strong>catch</strong> (VersionException e) {
-<a name="149" href="#149">149</a>             fail(<span class="string">"Adding multiple distict version labels to a version must be allowed."</span>);
-<a name="150" href="#150">150</a>         }
-<a name="151" href="#151">151</a>     }
-<a name="152" href="#152">152</a> 
-<a name="153" href="#153">153</a>     <em>/**<em>*</em></em>
-<a name="154" href="#154">154</a> <em>     * Test if VersionHistory.addVersionLabel(versionName, label, moveLabel)</em>
-<a name="155" href="#155">155</a> <em>     * throws VersionException the label already exists and if moveLabel is false)</em>
-<a name="156" href="#156">156</a> <em>     *</em>
-<a name="157" href="#157">157</a> <em>     * @throws RepositoryException</em>
-<a name="158" href="#158">158</a> <em>     */</em>
-<a name="159" href="#159">159</a>     <strong>public</strong> <strong>void</strong> testAddDuplicateVersionLabel() throws RepositoryException {
-<a name="160" href="#160">160</a>         vHistory.addVersionLabel(rootVersion.getName(), versionLabel, false);
-<a name="161" href="#161">161</a>         <strong>try</strong> {
-<a name="162" href="#162">162</a>             versionableNode.checkout();
-<a name="163" href="#163">163</a>             Version v = versionableNode.checkin();
-<a name="164" href="#164">164</a>             vHistory.addVersionLabel(v.getName(), versionLabel, false);
-<a name="165" href="#165">165</a> 
-<a name="166" href="#166">166</a>             fail(<span class="string">"Adding a version label that already exist in the version history must throw a VersionException."</span>);
-<a name="167" href="#167">167</a>         } <strong>catch</strong> (VersionException e) {
-<a name="168" href="#168">168</a>             <em class="comment">//success</em>
-<a name="169" href="#169">169</a>         }
-<a name="170" href="#170">170</a>     }
-<a name="171" href="#171">171</a> 
-<a name="172" href="#172">172</a>     <em>/**<em>*</em></em>
-<a name="173" href="#173">173</a> <em>     * Test if the 'moveLabel' flag moves an existing version label.</em>
-<a name="174" href="#174">174</a> <em>     *</em>
-<a name="175" href="#175">175</a> <em>     * @throws RepositoryException</em>
-<a name="176" href="#176">176</a> <em>     * @see VersionHistory#addVersionLabel(String, String, boolean)  with boolan flag equals true.</em>
-<a name="177" href="#177">177</a> <em>     */</em>
-<a name="178" href="#178">178</a>     <strong>public</strong> <strong>void</strong> testMoveLabel() throws RepositoryException {
-<a name="179" href="#179">179</a>         vHistory.addVersionLabel(rootVersion.getName(), versionLabel, false);
-<a name="180" href="#180">180</a>         <strong>try</strong> {
-<a name="181" href="#181">181</a>             versionableNode.checkout();
-<a name="182" href="#182">182</a>             Version v = versionableNode.checkin();
-<a name="183" href="#183">183</a>             vHistory.addVersionLabel(v.getName(), versionLabel, <strong>true</strong>);
-<a name="184" href="#184">184</a> 
-<a name="185" href="#185">185</a>             <strong>if</strong> (!vHistory.hasVersionLabel(v, versionLabel)) {
-<a name="186" href="#186">186</a>                fail(<span class="string">"If 'moveLabel' is true, an existing version label must be moved to the indicated version."</span>);
-<a name="187" href="#187">187</a>             }
-<a name="188" href="#188">188</a> 
-<a name="189" href="#189">189</a>         } <strong>catch</strong> (VersionException e) {
-<a name="190" href="#190">190</a>             fail(<span class="string">"If 'moveLabel' is true, an existing version label must be moved to the indicated version."</span>);
-<a name="191" href="#191">191</a>         }
-<a name="192" href="#192">192</a>     }
-<a name="193" href="#193">193</a> 
-<a name="194" href="#194">194</a>     <em>/**<em>*</em></em>
-<a name="195" href="#195">195</a> <em>     * Test the removal of an version label that does not exist (must throw VersionException).</em>
-<a name="196" href="#196">196</a> <em>     *</em>
-<a name="197" href="#197">197</a> <em>     * @throws RepositoryException</em>
-<a name="198" href="#198">198</a> <em>     */</em>
-<a name="199" href="#199">199</a>     <strong>public</strong> <strong>void</strong> testRemoveNonExistingLabel() throws RepositoryException {
-<a name="200" href="#200">200</a>         <strong>if</strong> (vHistory.hasVersionLabel(versionLabel)) {
-<a name="201" href="#201">201</a>             fail(<span class="string">"Testing the removal on a non-existing version label failed: '"</span>+versionLabel+<span class="string">"' exists on version history."</span>);
-<a name="202" href="#202">202</a>         }
-<a name="203" href="#203">203</a>         <strong>try</strong> {
-<a name="204" href="#204">204</a>             vHistory.removeVersionLabel(versionLabel);
-<a name="205" href="#205">205</a>             fail(<span class="string">"VersionHistory.removeLabel(String) must throw a VersionException if the label does not exist."</span>);
-<a name="206" href="#206">206</a>         } <strong>catch</strong> (VersionException e) {
-<a name="207" href="#207">207</a>             <em class="comment">// success</em>
-<a name="208" href="#208">208</a>         }
-<a name="209" href="#209">209</a>     }
-<a name="210" href="#210">210</a> 
-<a name="211" href="#211">211</a>     <em>/**<em>*</em></em>
-<a name="212" href="#212">212</a> <em>     * Test the removal of an version label that has successfully been added</em>
-<a name="213" href="#213">213</a> <em>     * before.</em>
-<a name="214" href="#214">214</a> <em>     *</em>
-<a name="215" href="#215">215</a> <em>     * @throws RepositoryException</em>
-<a name="216" href="#216">216</a> <em>     * @see VersionHistory#removeVersionLabel(String)</em>
-<a name="217" href="#217">217</a> <em>     */</em>
-<a name="218" href="#218">218</a>     <strong>public</strong> <strong>void</strong> testRemoveLabel() throws RepositoryException {
-<a name="219" href="#219">219</a> 
-<a name="220" href="#220">220</a>         vHistory.addVersionLabel(rootVersion.getName(), versionLabel, false);
-<a name="221" href="#221">221</a>         vHistory.removeVersionLabel(versionLabel);
-<a name="222" href="#222">222</a> 
-<a name="223" href="#223">223</a>         assertFalse(<span class="string">"VersionHistory.removeLabel(String) must remove the version label if it exists (has successfully been added before)."</span>, vHistory.hasVersionLabel(versionLabel));
-<a name="224" href="#224">224</a>     }
-<a name="225" href="#225">225</a> 
-<a name="226" href="#226">226</a>     <em>/**<em>*</em></em>
-<a name="227" href="#227">227</a> <em>     * Test if VersionHistory.getVersionByLabel(String) returns the version that</em>
-<a name="228" href="#228">228</a> <em>     * has been specified with the addVersionLabel call.</em>
-<a name="229" href="#229">229</a> <em>     *</em>
-<a name="230" href="#230">230</a> <em>     * @throws RepositoryException</em>
-<a name="231" href="#231">231</a> <em>     * @see VersionHistory#getVersionByLabel(String)</em>
-<a name="232" href="#232">232</a> <em>     */</em>
-<a name="233" href="#233">233</a>     <strong>public</strong> <strong>void</strong> testGetVersionByLabel() throws RepositoryException {
-<a name="234" href="#234">234</a>         vHistory.addVersionLabel(rootVersion.getName(), versionLabel, <strong>true</strong>);
-<a name="235" href="#235">235</a>         Version v = vHistory.getVersionByLabel(versionLabel);
-<a name="236" href="#236">236</a> 
-<a name="237" href="#237">237</a>         assertEquals(<span class="string">"VersionHistory.getVersionByLabel(String) must retrieve the particular version that was specified in addVersionLabel call."</span>, v, rootVersion);
-<a name="238" href="#238">238</a>     }
-<a name="239" href="#239">239</a> 
-<a name="240" href="#240">240</a>     <em>/**<em>*</em></em>
-<a name="241" href="#241">241</a> <em>     * Test VersionHistory.getVersionLabels() returns all labels present on the version history.</em>
-<a name="242" href="#242">242</a> <em>     *</em>
-<a name="243" href="#243">243</a> <em>     * @throws RepositoryException</em>
-<a name="244" href="#244">244</a> <em>     * @see javax.jcr.version.VersionHistory#getVersionLabels()</em>
-<a name="245" href="#245">245</a> <em>     */</em>
-<a name="246" href="#246">246</a>     <strong>public</strong> <strong>void</strong> testGetVersionLabels() throws RepositoryException {
-<a name="247" href="#247">247</a> 
-<a name="248" href="#248">248</a>         HashSet testLabels = <strong>new</strong> HashSet(Arrays.asList(vHistory.getVersionLabels()));
-<a name="249" href="#249">249</a>         versionableNode.checkout();
-<a name="250" href="#250">250</a>         Version v = versionableNode.checkin();
-<a name="251" href="#251">251</a> 
-<a name="252" href="#252">252</a>         vHistory.addVersionLabel(v.getName(), versionLabel, false);
-<a name="253" href="#253">253</a>         testLabels.add(versionLabel);
-<a name="254" href="#254">254</a>         vHistory.addVersionLabel(rootVersion.getName(), versionLabel2, false);
-<a name="255" href="#255">255</a>         testLabels.add(versionLabel2);
-<a name="256" href="#256">256</a> 
-<a name="257" href="#257">257</a>         String[] labels = vHistory.getVersionLabels();
-<a name="258" href="#258">258</a>         <strong>for</strong> (<strong>int</strong> i = 0; i &lt; labels.length; i++) {
-<a name="259" href="#259">259</a>             String l = labels[i];
-<a name="260" href="#260">260</a>             <strong>if</strong> (!testLabels.contains(l)) {
-<a name="261" href="#261">261</a>                 fail(<span class="string">"VersionHistory.getVersionLabels() must only return labels, that have been added to the history."</span>);
-<a name="262" href="#262">262</a>             }
-<a name="263" href="#263">263</a>             testLabels.remove(l);
-<a name="264" href="#264">264</a>         }
-<a name="265" href="#265">265</a> 
-<a name="266" href="#266">266</a>         assertTrue(<span class="string">"VersionHistory.getVersionLabels() must return all labels, that have been added to the history."</span>, testLabels.isEmpty());
-<a name="267" href="#267">267</a>     }
-<a name="268" href="#268">268</a> 
-<a name="269" href="#269">269</a>     <em>/**<em>*</em></em>
-<a name="270" href="#270">270</a> <em>     * Test VersionHistory.getVersionLabels(Version) only returns all labels present</em>
-<a name="271" href="#271">271</a> <em>     * for the specified version.</em>
-<a name="272" href="#272">272</a> <em>     * </em>
-<a name="273" href="#273">273</a> <em>     * @throws RepositoryException</em>
-<a name="274" href="#274">274</a> <em>     * @see VersionHistory#getVersionLabels(javax.jcr.version.Version)</em>
-<a name="275" href="#275">275</a> <em>     */</em>
-<a name="276" href="#276">276</a>     <strong>public</strong> <strong>void</strong> testGetVersionLabelsForVersion() throws RepositoryException {
-<a name="277" href="#277">277</a> 
-<a name="278" href="#278">278</a>         HashSet testLabels = <strong>new</strong> HashSet(Arrays.asList(vHistory.getVersionLabels(rootVersion)));
-<a name="279" href="#279">279</a> 
-<a name="280" href="#280">280</a>         vHistory.addVersionLabel(rootVersion.getName(), versionLabel, false);
-<a name="281" href="#281">281</a>         testLabels.add(versionLabel);
-<a name="282" href="#282">282</a> 
-<a name="283" href="#283">283</a>         <em class="comment">// add a version label to another version (not added to the testLabel set)</em>
-<a name="284" href="#284">284</a>         versionableNode.checkout();
-<a name="285" href="#285">285</a>         Version v = versionableNode.checkin();
-<a name="286" href="#286">286</a>         vHistory.addVersionLabel(v.getName(), versionLabel2, false);
-<a name="287" href="#287">287</a> 
-<a name="288" href="#288">288</a>         String[] labels = vHistory.getVersionLabels(rootVersion);
-<a name="289" href="#289">289</a>         <strong>for</strong> (<strong>int</strong> i = 0; i &lt; labels.length; i++) {
-<a name="290" href="#290">290</a>             String l = labels[i];
-<a name="291" href="#291">291</a>             <strong>if</strong> (!testLabels.contains(l)) {
-<a name="292" href="#292">292</a>                 fail(<span class="string">"VersionHistory.getVersionLabels(Version) must only return labels, that have been added for this version."</span>);
-<a name="293" href="#293">293</a>             }
-<a name="294" href="#294">294</a>             testLabels.remove(l);
-<a name="295" href="#295">295</a>         }
-<a name="296" href="#296">296</a> 
-<a name="297" href="#297">297</a>         assertTrue(<span class="string">"VersionHistory.getVersionLabels(Version)  must return all labels, that have been added for this version."</span>, testLabels.isEmpty());
-<a name="298" href="#298">298</a>     }
-<a name="299" href="#299">299</a> 
-<a name="300" href="#300">300</a>     <em>/**<em>*</em></em>
-<a name="301" href="#301">301</a> <em>     * Test calling Node.restoreByLabel(String, boolean) on a non-versionable node.</em>
-<a name="302" href="#302">302</a> <em>     *</em>
-<a name="303" href="#303">303</a> <em>     * @throws javax.jcr.RepositoryException</em>
-<a name="304" href="#304">304</a> <em>     * @see javax.jcr.Node#restoreByLabel(String, boolean)</em>
-<a name="305" href="#305">305</a> <em>     */</em>
-<a name="306" href="#306">306</a>     <strong>public</strong> <strong>void</strong> testRestoreByLabelNonVersionableNode() throws RepositoryException {
-<a name="307" href="#307">307</a>         <strong>try</strong> {
-<a name="308" href="#308">308</a>             nonVersionableNode.restoreByLabel(versionLabel, <strong>true</strong>);
-<a name="309" href="#309">309</a>             fail(<span class="string">"Node.restoreByLabel(String, boolean) on a non versionable node must throw UnsupportedRepositoryOperationException"</span>);
-<a name="310" href="#310">310</a>         } <strong>catch</strong> (UnsupportedRepositoryOperationException e) {
-<a name="311" href="#311">311</a>             <em class="comment">//success</em>
-<a name="312" href="#312">312</a>         }
-<a name="313" href="#313">313</a>     }
-<a name="314" href="#314">314</a> }
+<a name="21" href="#21">21</a>  <strong>import</strong> javax.jcr.Node;
+<a name="22" href="#22">22</a>  <strong>import</strong> javax.jcr.version.VersionHistory;
+<a name="23" href="#23">23</a>  <strong>import</strong> javax.jcr.version.Version;
+<a name="24" href="#24">24</a>  <strong>import</strong> javax.jcr.version.VersionException;
+<a name="25" href="#25">25</a>  <strong>import</strong> java.util.HashSet;
+<a name="26" href="#26">26</a>  <strong>import</strong> java.util.Arrays;
+<a name="27" href="#27">27</a>  
+<a name="28" href="#28">28</a>  <em>/**<em>*</em></em>
+<a name="29" href="#29">29</a>  <em> * &lt;code>VersionLabelTest&lt;/code> covers methods related to version label such as</em>
+<a name="30" href="#30">30</a>  <em> * &lt;ul></em>
+<a name="31" href="#31">31</a>  <em> * &lt;li>{@link VersionHistory#addVersionLabel(String, String, boolean)}&lt;/li></em>
+<a name="32" href="#32">32</a>  <em> * &lt;li>{@link VersionHistory#removeVersionLabel(String)}&lt;/li></em>
+<a name="33" href="#33">33</a>  <em> * &lt;li>{@link VersionHistory#restoreByLabel(String, boolean)} &lt;/li></em>
+<a name="34" href="#34">34</a>  <em> * &lt;li>{@link VersionHistory#getVersionByLabel(String)}&lt;/li></em>
+<a name="35" href="#35">35</a>  <em> * &lt;li>{@link javax.jcr.version.VersionHistory#getVersionLabels()} &lt;/li></em>
+<a name="36" href="#36">36</a>  <em> * &lt;li>{@link javax.jcr.version.VersionHistory#hasVersionLabel(javax.jcr.version.Version, String)}&lt;/li></em>
+<a name="37" href="#37">37</a>  <em> * &lt;li>{@link VersionHistory#hasVersionLabel(String)}&lt;/li></em>
+<a name="38" href="#38">38</a>  <em> * &lt;li>{@link VersionHistory#hasVersionLabel(javax.jcr.version.Version, String)} &lt;/li></em>
+<a name="39" href="#39">39</a>  <em> * &lt;/ul></em>
+<a name="40" href="#40">40</a>  <em> *</em>
+<a name="41" href="#41">41</a>  <em> * @test</em>
+<a name="42" href="#42">42</a>  <em> * @sources VersionLabelTest.java</em>
+<a name="43" href="#43">43</a>  <em> * @executeClass org.apache.jackrabbit.test.api.version.VersionLabelTest</em>
+<a name="44" href="#44">44</a>  <em> * @keywords versioning</em>
+<a name="45" href="#45">45</a>  <em> */</em>
+<a name="46" href="#46">46</a>  <strong>public</strong> <strong>class</strong> <a href="../../../../../../org/apache/jackrabbit/test/api/version/VersionLabelTest.html">VersionLabelTest</a> <strong>extends</strong> <a href="../../../../../../org/apache/jackrabbit/test/api/version/AbstractVersionTest.html">AbstractVersionTest</a> {
+<a name="47" href="#47">47</a>  
+<a name="48" href="#48">48</a>      <strong>protected</strong> String versionLabel = <span class="string">"foo"</span>;
+<a name="49" href="#49">49</a>      <strong>protected</strong> String versionLabel2 = <span class="string">"bar"</span>;
+<a name="50" href="#50">50</a>  
+<a name="51" href="#51">51</a>      <strong>protected</strong> VersionHistory vHistory;
+<a name="52" href="#52">52</a>      <strong>protected</strong> Version rootVersion;
+<a name="53" href="#53">53</a>  
+<a name="54" href="#54">54</a>      <strong>protected</strong> <strong>void</strong> setUp() throws Exception {
+<a name="55" href="#55">55</a>          <strong>super</strong>.setUp();
+<a name="56" href="#56">56</a>  
+<a name="57" href="#57">57</a>          vHistory = versionableNode.getVersionHistory();
+<a name="58" href="#58">58</a>          rootVersion = vHistory.getRootVersion();
+<a name="59" href="#59">59</a>  
+<a name="60" href="#60">60</a>          <strong>if</strong> (vHistory.hasVersionLabel(versionLabel)) {
+<a name="61" href="#61">61</a>              fail(<span class="string">"Version label '"</span>+versionLabel+<span class="string">"' is already present in this version history. Label test cannot be performed."</span>);
+<a name="62" href="#62">62</a>          }
+<a name="63" href="#63">63</a>  
+<a name="64" href="#64">64</a>          <strong>if</strong> (vHistory.hasVersionLabel(versionLabel2)) {
+<a name="65" href="#65">65</a>              fail(<span class="string">"Version label '"</span>+versionLabel2+<span class="string">"' is already present in this version history. Label test cannot be performed."</span>);
+<a name="66" href="#66">66</a>          }
+<a name="67" href="#67">67</a>      }
+<a name="68" href="#68">68</a>  
+<a name="69" href="#69">69</a>      <strong>protected</strong> <strong>void</strong> tearDown() throws Exception {
+<a name="70" href="#70">70</a>          <strong>try</strong> {
+<a name="71" href="#71">71</a>              <em class="comment">// clean up: remove the version labels again.</em>
+<a name="72" href="#72">72</a>              vHistory.removeVersionLabel(versionLabel);
+<a name="73" href="#73">73</a>              vHistory.removeVersionLabel(versionLabel2);
+<a name="74" href="#74">74</a>          } <strong>catch</strong> (RepositoryException e) {
+<a name="75" href="#75">75</a>              <em class="comment">// ignore</em>
+<a name="76" href="#76">76</a>          }
+<a name="77" href="#77">77</a>          <strong>super</strong>.tearDown();
+<a name="78" href="#78">78</a>      }
+<a name="79" href="#79">79</a>  
+<a name="80" href="#80">80</a>      <em>/**<em>*</em></em>
+<a name="81" href="#81">81</a>  <em>     * Test if the number of labels available in the version history is increased</em>
+<a name="82" href="#82">82</a>  <em>     * by added a new label.</em>
+<a name="83" href="#83">83</a>  <em>     *</em>
+<a name="84" href="#84">84</a>  <em>     * @throws RepositoryException</em>
+<a name="85" href="#85">85</a>  <em>     * @see VersionHistory#addVersionLabel(String, String, boolean)</em>
+<a name="86" href="#86">86</a>  <em>     */</em>
+<a name="87" href="#87">87</a>      <strong>public</strong> <strong>void</strong> testAddVersionLabel() throws RepositoryException {
+<a name="88" href="#88">88</a>          <strong>int</strong> initialLength = vHistory.getVersionLabels().length;
+<a name="89" href="#89">89</a>          vHistory.addVersionLabel(rootVersion.getName(), versionLabel, false);
+<a name="90" href="#90">90</a>          String[] labels = vHistory.getVersionLabels();
+<a name="91" href="#91">91</a>  
+<a name="92" href="#92">92</a>          assertEquals(<span class="string">"A version label that has been successfully added must increes the total number of version labels available in the history."</span>, initialLength + 1, labels.length);
+<a name="93" href="#93">93</a>      }
+<a name="94" href="#94">94</a>  
+<a name="95" href="#95">95</a>      <em>/**<em>*</em></em>
+<a name="96" href="#96">96</a>  <em>     * Test if the a label added with VersionHistory.addVersionLabel(String, String, boolean)</em>
+<a name="97" href="#97">97</a>  <em>     * is present in the array returned by VersionHistory.getVersionLabels(), if</em>
+<a name="98" href="#98">98</a>  <em>     * the label has not been present before.</em>
+<a name="99" href="#99">99</a>  <em>     *</em>
+<a name="100" href="#100">100</a> <em>     * @throws RepositoryException</em>
+<a name="101" href="#101">101</a> <em>     * @see VersionHistory#addVersionLabel(String, String, boolean)</em>
+<a name="102" href="#102">102</a> <em>     */</em>
+<a name="103" href="#103">103</a>     <strong>public</strong> <strong>void</strong> testAddVersionLabel2() throws RepositoryException {
+<a name="104" href="#104">104</a>         vHistory.addVersionLabel(rootVersion.getName(), versionLabel, false);
+<a name="105" href="#105">105</a>         String[] labels = vHistory.getVersionLabels();
+<a name="106" href="#106">106</a>         <strong>boolean</strong> found = false;
+<a name="107" href="#107">107</a>         <strong>for</strong> (<strong>int</strong> i = 0; i &lt; labels.length; i++) {
+<a name="108" href="#108">108</a>             <strong>if</strong> (labels[i].equals(versionLabel)) {
+<a name="109" href="#109">109</a>                 found = <strong>true</strong>;
+<a name="110" href="#110">110</a>                 <strong>break</strong>;
+<a name="111" href="#111">111</a>             }
+<a name="112" href="#112">112</a>         }
+<a name="113" href="#113">113</a>         assertTrue(<span class="string">"The version label that has been successfully added must be present in the array containing all labels."</span>, found);
+<a name="114" href="#114">114</a>     }
+<a name="115" href="#115">115</a> 
+<a name="116" href="#116">116</a>     <em>/**<em>*</em></em>
+<a name="117" href="#117">117</a> <em>     * Test if VersionHistory.hasVersionLabel(String) returns true, if the label</em>
+<a name="118" href="#118">118</a> <em>     * has beed successfully added before.</em>
+<a name="119" href="#119">119</a> <em>     *</em>
+<a name="120" href="#120">120</a> <em>     * @throws RepositoryException</em>
+<a name="121" href="#121">121</a> <em>     * @see VersionHistory#hasVersionLabel(String)</em>
+<a name="122" href="#122">122</a> <em>     */</em>
+<a name="123" href="#123">123</a>     <strong>public</strong> <strong>void</strong> testHasVersionLabel() throws RepositoryException {
+<a name="124" href="#124">124</a>         vHistory.addVersionLabel(rootVersion.getName(), versionLabel, false);
+<a name="125" href="#125">125</a>         assertTrue(<span class="string">"VersionHistory.hasVersionLabel(String) must return true if the label has been sucessfully added."</span>, vHistory.hasVersionLabel(versionLabel));
+<a name="126" href="#126">126</a>     }
+<a name="127" href="#127">127</a> 
+<a name="128" href="#128">128</a>     <em>/**<em>*</em></em>
+<a name="129" href="#129">129</a> <em>     * Test if VersionHistory.hasVersionLabel(Version, String) returns true, if the label</em>
+<a name="130" href="#130">130</a> <em>     * has beed successfully added before to the specified version.</em>
+<a name="131" href="#131">131</a> <em>     *</em>
+<a name="132" href="#132">132</a> <em>     * @throws RepositoryException</em>
+<a name="133" href="#133">133</a> <em>     * @see VersionHistory#hasVersionLabel(javax.jcr.version.Version, String)</em>
+<a name="134" href="#134">134</a> <em>     */</em>
+<a name="135" href="#135">135</a>     <strong>public</strong> <strong>void</strong> testHasVersionLabelForVersion() throws RepositoryException {
+<a name="136" href="#136">136</a>         vHistory.addVersionLabel(rootVersion.getName(), versionLabel, false);
+<a name="137" href="#137">137</a>         assertTrue(<span class="string">"VersionHistory.hasVersionLabel(Version, String) must return true if the label has been sucessfully added."</span>, vHistory.hasVersionLabel(rootVersion, versionLabel));
+<a name="138" href="#138">138</a>     }
+<a name="139" href="#139">139</a> 
+<a name="140" href="#140">140</a>     <em>/**<em>*</em></em>
+<a name="141" href="#141">141</a> <em>     * Test if multiple distinct version labels can be added for a given version.</em>
+<a name="142" href="#142">142</a> <em>     *</em>
+<a name="143" href="#143">143</a> <em>     * @throws RepositoryException</em>
+<a name="144" href="#144">144</a> <em>     */</em>
+<a name="145" href="#145">145</a>     <strong>public</strong> <strong>void</strong> testAddMultipleVersionLabels() throws RepositoryException {
+<a name="146" href="#146">146</a>         <strong>try</strong> {
+<a name="147" href="#147">147</a>             vHistory.addVersionLabel(rootVersion.getName(), versionLabel, false);
+<a name="148" href="#148">148</a>             vHistory.addVersionLabel(rootVersion.getName(), versionLabel2, false);
+<a name="149" href="#149">149</a>         } <strong>catch</strong> (VersionException e) {
+<a name="150" href="#150">150</a>             fail(<span class="string">"Adding multiple distict version labels to a version must be allowed."</span>);
+<a name="151" href="#151">151</a>         }
+<a name="152" href="#152">152</a>     }
+<a name="153" href="#153">153</a> 
+<a name="154" href="#154">154</a>     <em>/**<em>*</em></em>
+<a name="155" href="#155">155</a> <em>     * Test if VersionHistory.addVersionLabel(versionName, label, moveLabel)</em>
+<a name="156" href="#156">156</a> <em>     * throws VersionException the label already exists and if moveLabel is false)</em>
+<a name="157" href="#157">157</a> <em>     *</em>
+<a name="158" href="#158">158</a> <em>     * @throws RepositoryException</em>
+<a name="159" href="#159">159</a> <em>     */</em>
+<a name="160" href="#160">160</a>     <strong>public</strong> <strong>void</strong> testAddDuplicateVersionLabel() throws RepositoryException {
+<a name="161" href="#161">161</a>         vHistory.addVersionLabel(rootVersion.getName(), versionLabel, false);
+<a name="162" href="#162">162</a>         <strong>try</strong> {
+<a name="163" href="#163">163</a>             versionableNode.checkout();
+<a name="164" href="#164">164</a>             Version v = versionableNode.checkin();
+<a name="165" href="#165">165</a>             vHistory.addVersionLabel(v.getName(), versionLabel, false);
+<a name="166" href="#166">166</a> 
+<a name="167" href="#167">167</a>             fail(<span class="string">"Adding a version label that already exist in the version history must throw a VersionException."</span>);
+<a name="168" href="#168">168</a>         } <strong>catch</strong> (VersionException e) {
+<a name="169" href="#169">169</a>             <em class="comment">//success</em>
+<a name="170" href="#170">170</a>         }
+<a name="171" href="#171">171</a>     }
+<a name="172" href="#172">172</a> 
+<a name="173" href="#173">173</a>     <em>/**<em>*</em></em>
+<a name="174" href="#174">174</a> <em>     * Test if the 'moveLabel' flag moves an existing version label.</em>
+<a name="175" href="#175">175</a> <em>     *</em>
+<a name="176" href="#176">176</a> <em>     * @throws RepositoryException</em>
+<a name="177" href="#177">177</a> <em>     * @see VersionHistory#addVersionLabel(String, String, boolean)  with boolan flag equals true.</em>
+<a name="178" href="#178">178</a> <em>     */</em>
+<a name="179" href="#179">179</a>     <strong>public</strong> <strong>void</strong> testMoveLabel() throws RepositoryException {
+<a name="180" href="#180">180</a>         vHistory.addVersionLabel(rootVersion.getName(), versionLabel, false);
+<a name="181" href="#181">181</a>         <strong>try</strong> {
+<a name="182" href="#182">182</a>             versionableNode.checkout();
+<a name="183" href="#183">183</a>             Version v = versionableNode.checkin();
+<a name="184" href="#184">184</a>             vHistory.addVersionLabel(v.getName(), versionLabel, <strong>true</strong>);
+<a name="185" href="#185">185</a> 
+<a name="186" href="#186">186</a>             <strong>if</strong> (!vHistory.hasVersionLabel(v, versionLabel)) {
+<a name="187" href="#187">187</a>                fail(<span class="string">"If 'moveLabel' is true, an existing version label must be moved to the indicated version."</span>);
+<a name="188" href="#188">188</a>             }
+<a name="189" href="#189">189</a> 
+<a name="190" href="#190">190</a>         } <strong>catch</strong> (VersionException e) {
+<a name="191" href="#191">191</a>             fail(<span class="string">"If 'moveLabel' is true, an existing version label must be moved to the indicated version."</span>);
+<a name="192" href="#192">192</a>         }
+<a name="193" href="#193">193</a>     }
+<a name="194" href="#194">194</a> 
+<a name="195" href="#195">195</a>     <em>/**<em>*</em></em>
+<a name="196" href="#196">196</a> <em>     * Test the removal of an version label that does not exist (must throw VersionException).</em>
+<a name="197" href="#197">197</a> <em>     *</em>
+<a name="198" href="#198">198</a> <em>     * @throws RepositoryException</em>
+<a name="199" href="#199">199</a> <em>     */</em>
+<a name="200" href="#200">200</a>     <strong>public</strong> <strong>void</strong> testRemoveNonExistingLabel() throws RepositoryException {
+<a name="201" href="#201">201</a>         <strong>if</strong> (vHistory.hasVersionLabel(versionLabel)) {
+<a name="202" href="#202">202</a>             fail(<span class="string">"Testing the removal on a non-existing version label failed: '"</span>+versionLabel+<span class="string">"' exists on version history."</span>);
+<a name="203" href="#203">203</a>         }
+<a name="204" href="#204">204</a>         <strong>try</strong> {
+<a name="205" href="#205">205</a>             vHistory.removeVersionLabel(versionLabel);
+<a name="206" href="#206">206</a>             fail(<span class="string">"VersionHistory.removeLabel(String) must throw a VersionException if the label does not exist."</span>);
+<a name="207" href="#207">207</a>         } <strong>catch</strong> (VersionException e) {
+<a name="208" href="#208">208</a>             <em class="comment">// success</em>
+<a name="209" href="#209">209</a>         }
+<a name="210" href="#210">210</a>     }
+<a name="211" href="#211">211</a> 
+<a name="212" href="#212">212</a>     <em>/**<em>*</em></em>
+<a name="213" href="#213">213</a> <em>     * Test the removal of an version label that has successfully been added</em>
+<a name="214" href="#214">214</a> <em>     * before.</em>
+<a name="215" href="#215">215</a> <em>     *</em>
+<a name="216" href="#216">216</a> <em>     * @throws RepositoryException</em>
+<a name="217" href="#217">217</a> <em>     * @see VersionHistory#removeVersionLabel(String)</em>
+<a name="218" href="#218">218</a> <em>     */</em>
+<a name="219" href="#219">219</a>     <strong>public</strong> <strong>void</strong> testRemoveLabel() throws RepositoryException {
+<a name="220" href="#220">220</a> 
+<a name="221" href="#221">221</a>         vHistory.addVersionLabel(rootVersion.getName(), versionLabel, false);
+<a name="222" href="#222">222</a>         vHistory.removeVersionLabel(versionLabel);
+<a name="223" href="#223">223</a> 
+<a name="224" href="#224">224</a>         assertFalse(<span class="string">"VersionHistory.removeLabel(String) must remove the version label if it exists (has successfully been added before)."</span>, vHistory.hasVersionLabel(versionLabel));
+<a name="225" href="#225">225</a>     }
+<a name="226" href="#226">226</a> 
+<a name="227" href="#227">227</a>     <em>/**<em>*</em></em>
+<a name="228" href="#228">228</a> <em>     * Test if VersionHistory.getVersionByLabel(String) returns the version that</em>
+<a name="229" href="#229">229</a> <em>     * has been specified with the addVersionLabel call.</em>
+<a name="230" href="#230">230</a> <em>     *</em>
+<a name="231" href="#231">231</a> <em>     * @throws RepositoryException</em>
+<a name="232" href="#232">232</a> <em>     * @see VersionHistory#getVersionByLabel(String)</em>
+<a name="233" href="#233">233</a> <em>     */</em>
+<a name="234" href="#234">234</a>     <strong>public</strong> <strong>void</strong> testGetVersionByLabel() throws RepositoryException {
+<a name="235" href="#235">235</a>         vHistory.addVersionLabel(rootVersion.getName(), versionLabel, <strong>true</strong>);
+<a name="236" href="#236">236</a>         Version v = vHistory.getVersionByLabel(versionLabel);
+<a name="237" href="#237">237</a> 
+<a name="238" href="#238">238</a>         assertEquals(<span class="string">"VersionHistory.getVersionByLabel(String) must retrieve the particular version that was specified in addVersionLabel call."</span>, v, rootVersion);
+<a name="239" href="#239">239</a>     }
+<a name="240" href="#240">240</a> 
+<a name="241" href="#241">241</a>     <em>/**<em>*</em></em>
+<a name="242" href="#242">242</a> <em>     * Test VersionHistory.getVersionLabels() returns all labels present on the version history.</em>
+<a name="243" href="#243">243</a> <em>     *</em>
+<a name="244" href="#244">244</a> <em>     * @throws RepositoryException</em>
+<a name="245" href="#245">245</a> <em>     * @see javax.jcr.version.VersionHistory#getVersionLabels()</em>
+<a name="246" href="#246">246</a> <em>     */</em>
+<a name="247" href="#247">247</a>     <strong>public</strong> <strong>void</strong> testGetVersionLabels() throws RepositoryException {
+<a name="248" href="#248">248</a> 
+<a name="249" href="#249">249</a>         HashSet testLabels = <strong>new</strong> HashSet(Arrays.asList(vHistory.getVersionLabels()));
+<a name="250" href="#250">250</a>         versionableNode.checkout();
+<a name="251" href="#251">251</a>         Version v = versionableNode.checkin();
+<a name="252" href="#252">252</a> 
+<a name="253" href="#253">253</a>         vHistory.addVersionLabel(v.getName(), versionLabel, false);
+<a name="254" href="#254">254</a>         testLabels.add(versionLabel);
+<a name="255" href="#255">255</a>         vHistory.addVersionLabel(rootVersion.getName(), versionLabel2, false);
+<a name="256" href="#256">256</a>         testLabels.add(versionLabel2);
+<a name="257" href="#257">257</a> 
+<a name="258" href="#258">258</a>         String[] labels = vHistory.getVersionLabels();
+<a name="259" href="#259">259</a>         <strong>for</strong> (<strong>int</strong> i = 0; i &lt; labels.length; i++) {
+<a name="260" href="#260">260</a>             String l = labels[i];
+<a name="261" href="#261">261</a>             <strong>if</strong> (!testLabels.contains(l)) {
+<a name="262" href="#262">262</a>                 fail(<span class="string">"VersionHistory.getVersionLabels() must only return labels, that have been added to the history."</span>);
+<a name="263" href="#263">263</a>             }
+<a name="264" href="#264">264</a>             testLabels.remove(l);
+<a name="265" href="#265">265</a>         }
+<a name="266" href="#266">266</a> 
+<a name="267" href="#267">267</a>         assertTrue(<span class="string">"VersionHistory.getVersionLabels() must return all labels, that have been added to the history."</span>, testLabels.isEmpty());
+<a name="268" href="#268">268</a>     }
+<a name="269" href="#269">269</a> 
+<a name="270" href="#270">270</a>     <em>/**<em>*</em></em>
+<a name="271" href="#271">271</a> <em>     * Test VersionHistory.getVersionLabels(Version) only returns all labels present</em>
+<a name="272" href="#272">272</a> <em>     * for the specified version.</em>
+<a name="273" href="#273">273</a> <em>     * </em>
+<a name="274" href="#274">274</a> <em>     * @throws RepositoryException</em>
+<a name="275" href="#275">275</a> <em>     * @see VersionHistory#getVersionLabels(javax.jcr.version.Version)</em>
+<a name="276" href="#276">276</a> <em>     */</em>
+<a name="277" href="#277">277</a>     <strong>public</strong> <strong>void</strong> testGetVersionLabelsForVersion() throws RepositoryException {
+<a name="278" href="#278">278</a> 
+<a name="279" href="#279">279</a>         HashSet testLabels = <strong>new</strong> HashSet(Arrays.asList(vHistory.getVersionLabels(rootVersion)));
+<a name="280" href="#280">280</a> 
+<a name="281" href="#281">281</a>         vHistory.addVersionLabel(rootVersion.getName(), versionLabel, false);
+<a name="282" href="#282">282</a>         testLabels.add(versionLabel);
+<a name="283" href="#283">283</a> 
+<a name="284" href="#284">284</a>         <em class="comment">// add a version label to another version (not added to the testLabel set)</em>
+<a name="285" href="#285">285</a>         versionableNode.checkout();
+<a name="286" href="#286">286</a>         Version v = versionableNode.checkin();
+<a name="287" href="#287">287</a>         vHistory.addVersionLabel(v.getName(), versionLabel2, false);
+<a name="288" href="#288">288</a> 
+<a name="289" href="#289">289</a>         String[] labels = vHistory.getVersionLabels(rootVersion);
+<a name="290" href="#290">290</a>         <strong>for</strong> (<strong>int</strong> i = 0; i &lt; labels.length; i++) {
+<a name="291" href="#291">291</a>             String l = labels[i];
+<a name="292" href="#292">292</a>             <strong>if</strong> (!testLabels.contains(l)) {
+<a name="293" href="#293">293</a>                 fail(<span class="string">"VersionHistory.getVersionLabels(Version) must only return labels, that have been added for this version."</span>);
+<a name="294" href="#294">294</a>             }
+<a name="295" href="#295">295</a>             testLabels.remove(l);
+<a name="296" href="#296">296</a>         }
+<a name="297" href="#297">297</a> 
+<a name="298" href="#298">298</a>         assertTrue(<span class="string">"VersionHistory.getVersionLabels(Version)  must return all labels, that have been added for this version."</span>, testLabels.isEmpty());
+<a name="299" href="#299">299</a>     }
+<a name="300" href="#300">300</a> 
+<a name="301" href="#301">301</a>     <em>/**<em>*</em></em>
+<a name="302" href="#302">302</a> <em>     * Test calling Node.restoreByLabel(String, boolean) on a non-versionable node.</em>
+<a name="303" href="#303">303</a> <em>     *</em>
+<a name="304" href="#304">304</a> <em>     * @throws javax.jcr.RepositoryException</em>
+<a name="305" href="#305">305</a> <em>     * @see javax.jcr.Node#restoreByLabel(String, boolean)</em>
+<a name="306" href="#306">306</a> <em>     */</em>
+<a name="307" href="#307">307</a>     <strong>public</strong> <strong>void</strong> testRestoreByLabelNonVersionableNode() throws RepositoryException {
+<a name="308" href="#308">308</a>         <strong>try</strong> {
+<a name="309" href="#309">309</a>             nonVersionableNode.restoreByLabel(versionLabel, <strong>true</strong>);
+<a name="310" href="#310">310</a>             fail(<span class="string">"Node.restoreByLabel(String, boolean) on a non versionable node must throw UnsupportedRepositoryOperationException"</span>);
+<a name="311" href="#311">311</a>         } <strong>catch</strong> (UnsupportedRepositoryOperationException e) {
+<a name="312" href="#312">312</a>             <em class="comment">//success</em>
+<a name="313" href="#313">313</a>         }
+<a name="314" href="#314">314</a>     }
+<a name="315" href="#315">315</a> 
+<a name="316" href="#316">316</a>     <em>/**<em>*</em></em>
+<a name="317" href="#317">317</a> <em>     * Test if versionHistory.getVersionLabels(Version) throws a VersionException if the</em>
+<a name="318" href="#318">318</a> <em>     * specified version is not in this version history.</em>
+<a name="319" href="#319">319</a> <em>     */</em>
+<a name="320" href="#320">320</a>     <strong>public</strong> <strong>void</strong> testGetVersionLabelsForInvalidVersion() throws Exception {
+<a name="321" href="#321">321</a>         <em class="comment">// build a second versionable node below the testroot to get it's version.</em>
+<a name="322" href="#322">322</a>         Node versionableNode2 = createVersionableNode(testRootNode, nodeName2, versionableNodeType);
+<a name="323" href="#323">323</a>         Version invalidV = versionableNode2.checkin();
+<a name="324" href="#324">324</a> 
+<a name="325" href="#325">325</a>         <strong>try</strong> {
+<a name="326" href="#326">326</a>             vHistory.getVersionLabels(invalidV);
+<a name="327" href="#327">327</a>             fail(<span class="string">"VersionHistory.getVersionLabels(Version) must throw a VersionException if the specified version is not in this version history"</span>);
+<a name="328" href="#328">328</a>         } <strong>catch</strong> (VersionException ve) {
+<a name="329" href="#329">329</a>             <em class="comment">// success</em>
+<a name="330" href="#330">330</a>         }
+<a name="331" href="#331">331</a>     }
+<a name="332" href="#332">332</a> }
 </pre>
 <hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
 </html>