001package org.apache.maven.scm.provider.jazz.command.blame; 002 003import org.apache.maven.scm.command.blame.BlameLine; 004import org.apache.maven.scm.command.blame.BlameScmResult; 005import org.apache.maven.scm.provider.jazz.command.JazzTckUtil; 006import org.apache.maven.scm.tck.command.blame.BlameCommandTckTest; 007 008import java.io.File; 009import java.util.List; 010 011/* 012 * Licensed to the Apache Software Foundation (ASF) under one 013 * or more contributor license agreements. See the NOTICE file 014 * distributed with this work for additional information 015 * regarding copyright ownership. The ASF licenses this file 016 * to you under the Apache License, Version 2.0 (the 017 * "License"); you may not use this file except in compliance 018 * with the License. You may obtain a copy of the License at 019 * 020 * http://www.apache.org/licenses/LICENSE-2.0 021 * 022 * Unless required by applicable law or agreed to in writing, 023 * software distributed under the License is distributed on an 024 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 025 * KIND, either express or implied. See the License for the 026 * specific language governing permissions and limitations 027 * under the License. 028 */ 029 030/** 031 * @author <a href="mailto:ChrisGWarp@gmail.com">Chris Graham</a> 032 */ 033public class JazzBlameCommandTckTest 034 extends BlameCommandTckTest 035{ 036 // Easy access to our Tck Test Helper class. 037 private JazzTckUtil jazzTckUtil = new JazzTckUtil(); 038 039 /** 040 * {@inheritDoc} 041 * 042 * @see org.apache.maven.scm.ScmTckTestCase#initRepo() 043 */ 044 @Override 045 public void initRepo() 046 throws Exception 047 { 048 // Create a unique repository workspace for this test. 049 jazzTckUtil.initRepo( getScmRepository() ); 050 } 051 052 /** 053 * {@inheritDoc} 054 * 055 * @see org.apache.maven.scm.ScmTckTestCase#removeRepo() 056 */ 057 @Override 058 public void removeRepo() 059 throws Exception 060 { 061 super.removeRepo(); 062 jazzTckUtil.removeRepo(); 063 } 064 065 /** 066 * {@inheritDoc} 067 * 068 * @see org.apache.maven.scm.ScmTckTestCase#getScmUrl() 069 */ 070 @Override 071 public String getScmUrl() 072 throws Exception 073 { 074 return jazzTckUtil.getScmUrl(); 075 } 076 077 /** 078 * {@inheritDoc} 079 * 080 * @see org.apache.maven.scm.tck.command.blame.BlameCommandTckTest#verifyResult(org.apache.maven.scm.command.blame.BlameScmResult) 081 */ 082 @Override 083 protected void verifyResult( BlameScmResult result ) 084 { 085 List<BlameLine> lines = result.getLines(); 086 assertEquals( "Expected 1 line in blame!", 1, lines.size() ); 087 BlameLine line = lines.get( 0 ); 088 assertNotSame( "The revision can not be zero!", "0", line.getRevision() ); 089 } 090 091 /** 092 * {@inheritDoc} 093 * 094 * @see org.apache.maven.scm.tck.command.blame.BlameCommandTckTest#isTestDateTime() 095 */ 096 @Override 097 protected boolean isTestDateTime() 098 { 099 // 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}