View Javadoc
1   package org.apache.maven.scm.provider.jazz.command.blame;
2   
3   import org.apache.maven.scm.command.blame.BlameLine;
4   import org.apache.maven.scm.command.blame.BlameScmResult;
5   import org.apache.maven.scm.provider.jazz.command.JazzTckUtil;
6   import org.apache.maven.scm.tck.command.blame.BlameCommandTckTest;
7   
8   import java.io.File;
9   import java.util.List;
10  
11  /*
12   * Licensed to the Apache Software Foundation (ASF) under one
13   * or more contributor license agreements.  See the NOTICE file
14   * distributed with this work for additional information
15   * regarding copyright ownership.  The ASF licenses this file
16   * to you under the Apache License, Version 2.0 (the
17   * "License"); you may not use this file except in compliance
18   * with the License.  You may obtain a copy of the License at
19   *
20   * http://www.apache.org/licenses/LICENSE-2.0
21   *
22   * Unless required by applicable law or agreed to in writing,
23   * software distributed under the License is distributed on an
24   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
25   * KIND, either express or implied.  See the License for the
26   * specific language governing permissions and limitations
27   * under the License.
28   */
29  
30  /**
31   * @author <a href="mailto:ChrisGWarp@gmail.com">Chris Graham</a>
32   */
33  public class JazzBlameCommandTckTest
34      extends BlameCommandTckTest
35  {
36      // Easy access to our Tck Test Helper class.
37      private JazzTckUtil jazzTckUtil = new JazzTckUtil();
38  
39      /**
40       * {@inheritDoc}
41       *
42       * @see org.apache.maven.scm.ScmTckTestCase#initRepo()
43       */
44      @Override
45      public void initRepo()
46          throws Exception
47      {
48          // Create a unique repository workspace for this test.
49          jazzTckUtil.initRepo( getScmRepository() );
50      }
51  
52      /**
53       * {@inheritDoc}
54       *
55       * @see org.apache.maven.scm.ScmTckTestCase#removeRepo()
56       */
57      @Override
58      public void removeRepo()
59          throws Exception
60      {
61          super.removeRepo();
62          jazzTckUtil.removeRepo();
63      }
64  
65      /**
66       * {@inheritDoc}
67       *
68       * @see org.apache.maven.scm.ScmTckTestCase#getScmUrl()
69       */
70      @Override
71      public String getScmUrl()
72          throws Exception
73      {
74          return jazzTckUtil.getScmUrl();
75      }
76  
77      /**
78       * {@inheritDoc}
79       *
80       * @see org.apache.maven.scm.tck.command.blame.BlameCommandTckTest#verifyResult(org.apache.maven.scm.command.blame.BlameScmResult)
81       */
82      @Override
83      protected void verifyResult( BlameScmResult result )
84      {
85          List<BlameLine> lines = result.getLines();
86          assertEquals( "Expected 1 line in blame!", 1, lines.size() );
87          BlameLine line = lines.get( 0 );
88          assertNotSame( "The revision can not be zero!", "0", line.getRevision() );
89      }
90  
91      /**
92       * {@inheritDoc}
93       *
94       * @see org.apache.maven.scm.tck.command.blame.BlameCommandTckTest#isTestDateTime()
95       */
96      @Override
97      protected boolean isTestDateTime()
98      {
99          // The scm annotate command does not return the time, only the date, so we turn the comparison off
100         return false;
101     }
102 
103     /**
104      * {@inheritDoc}
105      *
106      * @see org.apache.maven.scm.ScmTestCase#getWorkingCopy()
107      */
108     @Override
109     protected File getWorkingCopy()
110     {
111         return jazzTckUtil.getWorkingCopy();
112     }
113 }