View Javadoc
1   package org.apache.maven.scm.provider.accurev.command.tag;
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 java.io.File;
23  import java.io.InputStream;
24  
25  import org.apache.maven.scm.ScmFileSet;
26  import org.apache.maven.scm.ScmTag;
27  import org.apache.maven.scm.command.checkin.CheckInScmResult;
28  import org.apache.maven.scm.command.checkout.CheckOutScmResult;
29  import org.apache.maven.scm.command.tag.TagScmResult;
30  import org.apache.maven.scm.provider.accurev.cli.AccuRevJUnitUtil;
31  import org.apache.maven.scm.provider.accurev.command.AccuRevTckUtil;
32  import org.apache.maven.scm.repository.ScmRepository;
33  import org.apache.maven.scm.tck.command.tag.TagCommandTckTest;
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 AccuRevTagCommandTckTest
42      extends TagCommandTckTest
43  {
44  
45      private AccuRevTckUtil accurevTckTestUtil = new AccuRevTckUtil();
46  
47      @Override
48      protected InputStream getCustomConfiguration()
49          throws Exception
50  
51      {
52          return AccuRevJUnitUtil.getPlexusConfiguration();
53      }
54  
55      @Override
56      @Test
57      public void testTagCommandTest()
58          throws Exception
59      {
60          super.testTagCommandTest();
61      }
62  
63      @Override
64      @Before
65      public void setUp()
66          throws Exception
67      {
68          super.setUp();
69      }
70  
71      @SuppressWarnings( "deprecation" )
72      @Test
73      public void testReleasePluginStyleTagThenCheckout()
74          throws Exception
75      {
76  
77          String tag = "test-tag";
78  
79          makeFile( getWorkingCopy(), ".acignore", "target/*\ntarget\n" );
80  
81          ScmRepository scmRepository = getScmRepository();
82  
83          addToWorkingTree( getWorkingCopy(), new File( ".acignore" ), scmRepository );
84  
85          CheckInScmResult checkinResult =
86              getScmManager().checkIn( scmRepository, new ScmFileSet( getWorkingCopy() ), "add acignore" );
87  
88          assertResultIsSuccess( checkinResult );
89  
90          TagScmResult tagResult =
91              getScmManager().getProviderByUrl( getScmUrl() ).tag( scmRepository, new ScmFileSet( getWorkingCopy() ), tag );
92  
93          assertResultIsSuccess( tagResult );
94  
95          scmRepository.getProviderRepository().setPersistCheckout( false );
96  
97          CheckOutScmResult checkoutResult =
98              getScmManager().checkOut( scmRepository, new ScmFileSet( new File( getWorkingCopy(), "target/checkout" ) ),
99                                        new ScmTag( tag ) );
100 
101         assertResultIsSuccess( checkoutResult );
102 
103     }
104 
105     @Override
106     protected File getWorkingCopy()
107     {
108         return accurevTckTestUtil.getWorkingCopy();
109     }
110 
111     @Override
112     protected File getAssertionCopy()
113     {
114         return accurevTckTestUtil.getAssertionCopy();
115     }
116 
117     @Override
118     public String getScmUrl()
119         throws Exception
120     {
121         return accurevTckTestUtil.getScmUrl();
122     }
123 
124     @Override
125     public void initRepo()
126         throws Exception
127     {
128         accurevTckTestUtil.initRepo( getContainer() );
129     }
130 
131     @Override
132     @After
133     public void tearDown()
134         throws Exception
135     {
136         try
137         {
138             accurevTckTestUtil.tearDown();
139             accurevTckTestUtil.removeWorkSpace( getWorkingCopy() );
140             accurevTckTestUtil.removeWorkSpace( getAssertionCopy() );
141 
142         }
143         finally
144         {
145             super.tearDown();
146         }
147     }
148 }