001package org.apache.maven.scm.tck.command.untag; 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 org.apache.maven.scm.CommandParameter; 023import org.apache.maven.scm.CommandParameters; 024import org.apache.maven.scm.ScmException; 025import org.apache.maven.scm.ScmFileSet; 026import org.apache.maven.scm.ScmTag; 027import org.apache.maven.scm.ScmTagParameters; 028import org.apache.maven.scm.ScmTckTestCase; 029import org.apache.maven.scm.command.checkout.CheckOutScmResult; 030import org.apache.maven.scm.command.tag.TagScmResult; 031import org.apache.maven.scm.command.untag.UntagScmResult; 032import org.apache.maven.scm.provider.ScmProvider; 033import org.apache.maven.scm.repository.ScmRepository; 034 035/** 036 * This test tests the untag command. 037 */ 038public abstract class UntagCommandTckTest 039 extends ScmTckTestCase 040{ 041 042 protected String getTagName() 043 { 044 return "test-untag"; 045 } 046 047 public void testUntagCommandTest() 048 throws Exception 049 { 050 String tag = getTagName(); 051 ScmProvider scmProvider = getScmManager().getProviderByUrl( getScmUrl() ); 052 ScmRepository scmRepository = getScmRepository(); 053 ScmFileSet files = new ScmFileSet( getWorkingCopy() ); 054 TagScmResult tagResult = scmProvider.tag( scmRepository, files, tag, new ScmTagParameters() ); 055 056 assertResultIsSuccess( tagResult ); 057 CommandParameters params = new CommandParameters(); 058 params.setString( CommandParameter.TAG_NAME, tag ); 059 060 UntagScmResult untagResult = scmProvider.untag( scmRepository, files, params ); 061 062 assertResultIsSuccess( untagResult ); 063 064 try 065 { 066 untagResult = scmProvider.untag( scmRepository, files, params ); 067 assertFalse( untagResult.isSuccess() ); // already been deleted 068 } 069 catch ( ScmException ignored ) 070 { 071 } 072 073 try 074 { 075 CheckOutScmResult checkoutResult = 076 getScmManager().checkOut( scmRepository, new ScmFileSet( getAssertionCopy() ), new ScmTag( tag ) ); 077 assertFalse( checkoutResult.isSuccess() ); // can't check out a deleted tags 078 } 079 catch ( ScmException ignored ) 080 { 081 } 082 } 083 084}