View Javadoc
1   package org.apache.maven.scm.provider.accurev.command.blame;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *    http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import static org.hamcrest.Matchers.is;
23  import static org.hamcrest.Matchers.not;
24  import static org.hamcrest.Matchers.nullValue;
25  import static org.junit.Assert.assertThat;
26  
27  import java.io.File;
28  import java.io.InputStream;
29  
30  import org.apache.maven.scm.command.blame.BlameScmResult;
31  import org.apache.maven.scm.provider.accurev.cli.AccuRevJUnitUtil;
32  import org.apache.maven.scm.provider.accurev.command.AccuRevTckUtil;
33  import org.apache.maven.scm.tck.command.blame.BlameCommandTckTest;
34  import org.junit.After;
35  import org.junit.Before;
36  import org.junit.Test;
37  import org.junit.runner.RunWith;
38  import org.junit.runners.JUnit4;
39  
40  @RunWith( JUnit4.class )
41  public class AccuRevBlameCommandTckTest
42      extends BlameCommandTckTest
43  {
44  
45      private AccuRevTckUtil accurevTckTestUtil = new AccuRevTckUtil();
46  
47      @Override
48      protected InputStream getCustomConfiguration()
49          throws Exception
50  
51      {
52  
53          return AccuRevJUnitUtil.getPlexusConfiguration();
54      }
55  
56      @Override
57      @Test
58      public void testBlameCommand()
59          throws Exception
60      {
61  
62          super.testBlameCommand();
63      }
64  
65      @Override
66      protected void verifyResult( BlameScmResult result )
67      {
68  
69          assertThat( result, is( not( nullValue() ) ) );
70          assertThat( result.getLines().size(), is( 1 ) );
71  
72      }
73  
74      @Override
75      @Before
76      public void setUp()
77          throws Exception
78      {
79  
80          super.setUp();
81      }
82  
83      @Override
84      protected File getWorkingCopy()
85      {
86  
87          return accurevTckTestUtil.getWorkingCopy();
88      }
89  
90      @Override
91      protected File getAssertionCopy()
92      {
93  
94          return accurevTckTestUtil.getAssertionCopy();
95      }
96  
97      @Override
98      public String getScmUrl()
99          throws Exception
100     {
101 
102         return accurevTckTestUtil.getScmUrl();
103     }
104 
105     @Override
106     public void initRepo()
107         throws Exception
108     {
109 
110         accurevTckTestUtil.initRepo( getContainer() );
111     }
112 
113     @Override
114     @After
115     public void tearDown()
116         throws Exception
117     {
118 
119         try
120         {
121             accurevTckTestUtil.tearDown();
122             accurevTckTestUtil.removeWorkSpace( getWorkingCopy() );
123             accurevTckTestUtil.removeWorkSpace( getAssertionCopy() );
124 
125         }
126         finally
127         {
128             super.tearDown();
129         }
130     }
131 }