001package org.apache.maven.scm.provider.accurev.command.blame;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *    http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import static org.hamcrest.Matchers.is;
023import static org.hamcrest.Matchers.not;
024import static org.hamcrest.Matchers.nullValue;
025import static org.junit.Assert.assertThat;
026
027import java.io.File;
028import java.io.InputStream;
029
030import org.apache.maven.scm.command.blame.BlameScmResult;
031import org.apache.maven.scm.provider.accurev.cli.AccuRevJUnitUtil;
032import org.apache.maven.scm.provider.accurev.command.AccuRevTckUtil;
033import org.apache.maven.scm.tck.command.blame.BlameCommandTckTest;
034import org.junit.After;
035import org.junit.Before;
036import org.junit.Test;
037import org.junit.runner.RunWith;
038import org.junit.runners.JUnit4;
039
040@RunWith( JUnit4.class )
041public class AccuRevBlameCommandTckTest
042    extends BlameCommandTckTest
043{
044
045    private AccuRevTckUtil accurevTckTestUtil = new AccuRevTckUtil();
046
047    @Override
048    protected InputStream getCustomConfiguration()
049        throws Exception
050
051    {
052
053        return AccuRevJUnitUtil.getPlexusConfiguration();
054    }
055
056    @Override
057    @Test
058    public void testBlameCommand()
059        throws Exception
060    {
061
062        super.testBlameCommand();
063    }
064
065    @Override
066    protected void verifyResult( BlameScmResult result )
067    {
068
069        assertThat( result, is( not( nullValue() ) ) );
070        assertThat( result.getLines().size(), is( 1 ) );
071
072    }
073
074    @Override
075    @Before
076    public void setUp()
077        throws Exception
078    {
079
080        super.setUp();
081    }
082
083    @Override
084    protected File getWorkingCopy()
085    {
086
087        return accurevTckTestUtil.getWorkingCopy();
088    }
089
090    @Override
091    protected File getAssertionCopy()
092    {
093
094        return accurevTckTestUtil.getAssertionCopy();
095    }
096
097    @Override
098    public String getScmUrl()
099        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}