maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdca...@apache.org
Subject svn commit: r618427 - in /maven/core-integration-testing/trunk/core-integration-tests/src/test: java/org/apache/maven/integrationtests/ resources/mng-3099-settingsProfilesWithNoPOM/ resources/mng-3099-settingsProfilesWithNoPOM/plugin/ resources/mng-309...
Date Mon, 04 Feb 2008 20:32:59 GMT
Author: jdcasey
Date: Mon Feb  4 12:32:57 2008
New Revision: 618427

URL: http://svn.apache.org/viewvc?rev=618427&view=rev
Log:
[MNG-3099] Integration test for user-settings profile, but not global-settings profile, since
global-settings command-line specification is not well defined for 2.1-SNAPSHOT (yet).

Added:
    maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3099SettingsProfilesWithNoPOM.java
  (with props)
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/plugin/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/plugin/pom.xml
  (with props)
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/plugin/src/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/plugin/src/main/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/plugin/src/main/java/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/plugin/src/main/java/org/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/plugin/src/main/java/org/apache/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/plugin/src/main/java/org/apache/maven/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/plugin/src/main/java/org/apache/maven/its/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/plugin/src/main/java/org/apache/maven/its/mng3099/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/plugin/src/main/java/org/apache/maven/its/mng3099/MNG3099Mojo.java
  (with props)
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/readme.txt
  (with props)
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/settings.xml
  (with props)
Modified:
    maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java

Modified: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java?rev=618427&r1=618426&r2=618427&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java
(original)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java
Mon Feb  4 12:32:57 2008
@@ -19,13 +19,14 @@
  * under the License.
  */
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
 import org.apache.maven.it.VerificationException;
 import org.apache.maven.it.Verifier;
 
 import java.io.PrintStream;
 
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
 public class IntegrationTestSuite
     extends AbstractMavenIntegrationTestCase
 {
@@ -186,6 +187,7 @@
         suite.addTestSuite( MavenIT0115CustomArtifactHandlerAndCustomLifecycleTest.class
);
         suite.addTestSuite( MavenIT0119PluginPrefixOrder.class );
 		suite.addTestSuite( MavenITmng3372DirectInvocationOfPlugins.class );
+		suite.addTestSuite( MavenITmng3099SettingsProfilesWithNoPOM.class );
         // suite.addTestSuite( MavenIT0120EjbClientDependency.class ); -- not passing for
2.0.7 either, looks to be 2.1+ ?
         return suite;
     }

Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3099SettingsProfilesWithNoPOM.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3099SettingsProfilesWithNoPOM.java?rev=618427&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3099SettingsProfilesWithNoPOM.java
(added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3099SettingsProfilesWithNoPOM.java
Mon Feb  4 12:32:57 2008
@@ -0,0 +1,80 @@
+package org.apache.maven.integrationtests;
+
+import org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * This is a sample integration test. The IT tests typically
+ * operate by having a sample project in the
+ * /src/test/resources folder along with a junit test like
+ * this one. The junit test uses the verifier (which uses
+ * the invoker) to invoke a new instance of Maven on the
+ * project in the resources folder. It then checks the
+ * results. This is a non-trivial example that shows two
+ * phases. See more information inline in the code.
+ *
+ * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
+ *
+ */
+public class MavenITmng3099SettingsProfilesWithNoPOM
+    extends AbstractMavenIntegrationTestCase
+{
+    public void testitMNG3099 ()
+        throws Exception
+    {
+        // The testdir is computed from the location of this
+        // file.
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3099-settingsProfilesWithNoPOM"
);
+
+        File plugin = new File( testDir, "plugin" );
+
+        Verifier verifier;
+
+        verifier = new Verifier( plugin.getAbsolutePath() );
+
+        verifier.executeGoal( "install" );
+
+        /*
+         * Reset the streams before executing the verifier
+         * again.
+         */
+        verifier.resetStreams();
+
+        verifier = new Verifier( testDir.getAbsolutePath() );
+
+        /*
+         * Use the settings for this test, which contains the profile we're looking for.
+         */
+        List cliOptions = new ArrayList();
+        cliOptions.add( "-s" );
+        cliOptions.add( new File( testDir, "settings.xml" ).getAbsolutePath() );
+
+        verifier.setCliOptions( cliOptions );
+
+        verifier.setAutoclean( false );
+        verifier.executeGoal( "org.apache.maven.its.mng3099:maven-mng3099-plugin:1:profile-props"
);
+
+
+        List lines = verifier.loadFile( new File( testDir, "log.txt" ), false );
+        boolean found = false;
+        for ( Iterator it = lines.iterator(); it.hasNext(); )
+        {
+            String line = (String) it.next();
+            if ( line.indexOf( "local-profile-prop=local-profile-prop-value" ) > -1 )
+            {
+                found = true;
+                break;
+            }
+        }
+
+        if ( !found )
+        {
+            fail( "Profile-injected property value: local-profile-prop-value was not found
in log output." );
+        }
+    }
+}

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3099SettingsProfilesWithNoPOM.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3099SettingsProfilesWithNoPOM.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/plugin/pom.xml?rev=618427&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/plugin/pom.xml
(added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/plugin/pom.xml
Mon Feb  4 12:32:57 2008
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	
+	<modelVersion>4.0.0</modelVersion>
+	
+	<groupId>org.apache.maven.its.mng3099</groupId>
+	<artifactId>maven-mng3099-plugin</artifactId>
+	<version>1</version>
+	<packaging>maven-plugin</packaging>
+	
+	<name>maven-mng3099-plugin</name>
+	<description>Tests properties injected as a result of active profiles in the user
settings file.</description>
+	
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-plugin-api</artifactId>
+			<version>2.0.7</version>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-project</artifactId>
+			<version>2.0.7</version>
+			<scope>compile</scope>
+		</dependency>
+	</dependencies>
+	
+</project>
\ No newline at end of file

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/plugin/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/plugin/pom.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/plugin/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/plugin/src/main/java/org/apache/maven/its/mng3099/MNG3099Mojo.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/plugin/src/main/java/org/apache/maven/its/mng3099/MNG3099Mojo.java?rev=618427&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/plugin/src/main/java/org/apache/maven/its/mng3099/MNG3099Mojo.java
(added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/plugin/src/main/java/org/apache/maven/its/mng3099/MNG3099Mojo.java
Mon Feb  4 12:32:57 2008
@@ -0,0 +1,40 @@
+package org.apache.maven.its.mng3099;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * Tests MNG-3099.
+ *
+ * @goal profile-props
+ * @requiresProject false
+ */
+public final class MNG3099Mojo extends AbstractMojo {
+
+    /**
+     * @parameter expression="${local-profile-prop}"
+     */
+    private String localProfileProp; 
+    
+    
+    public void execute() throws MojoExecutionException {
+    	
+    	this.getLog().info("local-profile-prop=" + this.localProfileProp);
+    }
+}

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/plugin/src/main/java/org/apache/maven/its/mng3099/MNG3099Mojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/plugin/src/main/java/org/apache/maven/its/mng3099/MNG3099Mojo.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/plugin/src/main/java/org/apache/maven/its/mng3099/MNG3099Mojo.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/readme.txt
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/readme.txt?rev=618427&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/readme.txt
(added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/readme.txt
Mon Feb  4 12:32:57 2008
@@ -0,0 +1 @@
+This IT checks that profiles which are brought in from settings files (and which are activated
via activeProfiles) are present even if no POM is in use.
\ No newline at end of file

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/readme.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/readme.txt
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/settings.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/settings.xml?rev=618427&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/settings.xml
(added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/settings.xml
Mon Feb  4 12:32:57 2008
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<settings 
+	xmlns="http://maven.apache.org/POM/4.0.0" 
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
+	
+	<profiles>
+		<profile>
+			<id>local-profile</id>
+			<properties>
+				<local-profile-prop>local-profile-prop-value</local-profile-prop>
+			</properties>
+		</profile>
+	</profiles>
+	
+	<activeProfiles>
+		<activeProfile>local-profile</activeProfile>
+	</activeProfiles>
+	
+</settings>

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/settings.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3099-settingsProfilesWithNoPOM/settings.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



Mime
View raw message