maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From michael-o <...@git.apache.org>
Subject [GitHub] maven-integration-testing pull request #14: MNG-3092: Adds integration tests...
Date Tue, 14 Jun 2016 21:18:29 GMT
Github user michael-o commented on a diff in the pull request:

    https://github.com/apache/maven-integration-testing/pull/14#discussion_r67059081
  
    --- Diff: core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3092VersionRangeResultFilterExtensionTest.java
---
    @@ -0,0 +1,132 @@
    +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.Verifier;
    +import org.apache.maven.it.util.ResourceExtractor;
    +
    +import java.io.File;
    +import java.util.HashMap;
    +import java.util.List;
    +import java.util.Map;
    +
    +/**
    + * This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-3092">MNG-3092</a>.
    + *
    + * <pre>
    + *   <dependencies>
    + *     <dependency>
    + *       <groupId>org.apache.maven.its.mng3092</groupId>
    + *       <artifactId>a</artifactId>
    + *       <version>[1.0,2.0)</version>
    + *     </dependency>
    + *   </dependencies>
    + * </pre>
    + *
    + * @author Benjamin Bentmann
    + */
    +public class MavenITmng3092VersionRangeResultFilterExtensionTest
    +        extends AbstractMavenIntegrationTestCase
    +{
    +
    +    public MavenITmng3092VersionRangeResultFilterExtensionTest()
    +    {
    +        super( "[3.4.0-SNAPSHOT,)" );
    +    }
    +
    +    /**
    +     * Verify that the Maven default behavior will be used without a VersionRangeResultFilter
extension.
    +     */
    +    public void testDefault()
    +            throws Exception
    +    {
    +        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3092"
);
    +
    +        Verifier verifier = newVerifier( testDir.getAbsolutePath() );
    +        verifier.setAutoclean( false );
    +        verifier.deleteDirectory( "target" );
    +        verifier.deleteArtifacts( "org.apache.maven.its.mng3092" );
    +        verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties()
);
    +        verifier.filterFile( "pom-mng-3092.xml", "pom.xml", "UTF-8", verifier.newDefaultFilterProperties()
);
    +        verifier.addCliOption( "--settings" );
    +        verifier.addCliOption( "settings.xml" );
    +        verifier.executeGoal( "validate" );
    +        verifier.verifyErrorFreeLog();
    +        verifier.resetStreams();
    +
    +        List<String> classpath = verifier.loadLines( "target/classpath.txt", "UTF-8"
);
    +        assertTrue( classpath.toString(), classpath.contains( "a-2.0-SNAPSHOT.jar" )
);
    +    }
    +
    +    /**
    +     * Verify that the Maven VersionRangeResultFilter extension behavior is active and
checks that non snapshot
    +     * version will be used.
    +     */
    +    public void testVersionRangeResultFilterExtesionSystemproperties()
    +            throws Exception
    +    {
    +        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3092"
);
    +        File extensionDir = new File( testDir, "filter-extension" );
    +
    +        final Map<String, String> filterProperties = new HashMap<>();
    +        filterProperties.put( "@baseurl@", "file://" + testDir.getAbsolutePath() );
    +
    +        Verifier verifier;
    +        verifier = newVerifier( testDir.getAbsolutePath() );
    +        verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProperties
);
    +        verifier.filterFile( "extension.xml", ".mvn/extension.xml", "UTF-8", filterProperties
);
    +
    +        // install the test extension
    +        verifier = newVerifier( extensionDir.getAbsolutePath(), "remote" );
    +        verifier.filterFile( "pom.xml", "pom.xml", "UTF-8", filterProperties );
    +        verifier.addCliOption( "-f" );
    +        verifier.addCliOption( extensionDir.getAbsolutePath() + "/pom.xml" );
    +        verifier.addCliOption( "-Drat.skip=true" );
    +        verifier.setLogFileName( "install-extension.log" );
    +
    +        verifier.executeGoal( "install" );
    +        verifier.resetStreams();
    +        verifier.verifyErrorFreeLog();
    +
    +        // validate the test project
    +        verifier = newVerifier( testDir.getAbsolutePath() );
    +        verifier.setAutoclean( true );
    +        verifier.setDebug( true );
    +        verifier.setMavenDebug( true );
    +        verifier.filterFile( "pom-mng-3092.xml", "pom.xml", "UTF-8", filterProperties
);
    +
    +        verifier.addCliOption( "--settings" );
    +        verifier.addCliOption( testDir.getAbsolutePath() + "/settings.xml" );
    +
    +        verifier.addCliOption( "-Dmaven.ext.class.path="
    +                + verifier.getArtifactPath( "org.apache.maven.its.extensions", "versionrange-resultfilter-extension",
    +                        "3.4.0-SNAPSHOT", "jar" ) );
    --- End diff --
    
    Problamatic, see below.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Mime
View raw message