package org.apache.maven.it;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.it.util.ResourceExtractor;
import java.io.File;
import java.util.Arrays;
public class MavenITmng3321SkipPluginExecutionTest
extends AbstractMavenIntegrationTestCase
{
public MavenITmng3321SkipPluginExecutionTest()
{
super( "[3.0.3,)" );
}
public void testThatPluginNotSkippedForMissingPluginInSkipProperty()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3321" );
Verifier verifier = newVerifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
verifier.deleteDirectory( "target" );
verifier.getCliOptions().add( "-Dskip.plugin=org.apache.maven.its.plugins:maven-it-plugin-touch" );
verifier.executeGoal( "validate" );
verifier.assertFilePresent( "target/exec1.log" );
assertEquals( Arrays.asList( new String[]{ "ex1" } ), verifier.loadLines( "target/exec1.log", "UTF-8" ) );
verifier.assertFilePresent( "target/exec2.log" );
assertEquals( Arrays.asList( new String[]{ "ex2" } ), verifier.loadLines( "target/exec2.log", "UTF-8" ) );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
}
public void testThatPluginSkippedWhenSpecifiedInSkipProperty()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3321" );
Verifier verifier = newVerifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
verifier.deleteDirectory( "target" );
verifier.getCliOptions().add( "-Dskip.plugin=org.apache.maven.its.plugins:maven-it-plugin-log-file" );
verifier.executeGoal( "validate" );
verifier.assertFileNotPresent( "target/exec1.log" );
verifier.assertFileNotPresent( "target/exec2.log" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
}
public void testThatPluginExecutionSkippedWhenSpecifiedInSkipProperty()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3321" );
Verifier verifier = newVerifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
verifier.deleteDirectory( "target" );
verifier.getCliOptions().add( "-Dskip.plugin=org.apache.maven.its.plugins:maven-it-plugin-log-file:ex1" );
verifier.executeGoal( "validate" );
verifier.assertFileNotPresent( "target/exec1.log" );
verifier.assertFilePresent( "target/exec2.log" );
assertEquals( Arrays.asList( new String[]{ "ex2" } ), verifier.loadLines( "target/exec2.log", "UTF-8" ) );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
}
}