maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r399140 - in /maven/plugins/trunk/maven-release-plugin/src: main/java/org/apache/maven/plugins/release/exec/ test/java/org/apache/maven/plugins/release/exec/
Date Wed, 03 May 2006 04:59:03 GMT
Author: brett
Date: Tue May  2 21:59:00 2006
New Revision: 399140

URL: http://svn.apache.org/viewcvs?rev=399140&view=rev
Log:
[MRELEASE-98] exec tests

Added:
    maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/exec/TeeConsumerTest.java
  (with props)
Modified:
    maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/exec/TeeConsumer.java
    maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/exec/ForkedMavenExecutorTest.java

Modified: maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/exec/TeeConsumer.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/exec/TeeConsumer.java?rev=399140&r1=399139&r2=399140&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/exec/TeeConsumer.java
(original)
+++ maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/exec/TeeConsumer.java
Tue May  2 21:59:00 2006
@@ -63,4 +63,9 @@
     {
         return content.toString();
     }
+
+    public String toString()
+    {
+        return getContent();
+    }
 }

Modified: maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/exec/ForkedMavenExecutorTest.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/exec/ForkedMavenExecutorTest.java?rev=399140&r1=399139&r2=399140&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/exec/ForkedMavenExecutorTest.java
(original)
+++ maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/exec/ForkedMavenExecutorTest.java
Tue May  2 21:59:00 2006
@@ -68,6 +68,32 @@
         assertTrue( true );
     }
 
+    public void testExecutionWithCustomPomFile()
+        throws MavenExecutorException
+    {
+        File workingDirectory = getTestFile( "target/working-directory" );
+
+        Process process = createMockProcess( 0 );
+
+        Mock commandLineMock = createMockCommandLine( workingDirectory, process );
+        expectDefaultArguments( commandLineMock );
+
+        String arguments = "-f my-pom.xml";
+        commandLineMock.expects( new InvokeOnceMatcher() ).method( "createArgument" ).will(
+            new ReturnStub( createArgumentLineMock( arguments ) ) );
+
+        Mock mock = new Mock( CommandLineFactory.class );
+
+        mock.expects( new InvokeOnceMatcher() ).method( "createCommandLine" ).with( new IsEqual(
"mvn" ) ).will(
+            new ReturnStub( commandLineMock.proxy() ) );
+
+        executor.setCommandLineFactory( (CommandLineFactory) mock.proxy() );
+
+        executor.executeGoals( workingDirectory, "clean integration-test", false, "my-pom.xml",
null );
+
+        assertTrue( true );
+    }
+
     public void testExecutionWithArguments()
         throws MavenExecutorException
     {

Added: maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/exec/TeeConsumerTest.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/exec/TeeConsumerTest.java?rev=399140&view=auto
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/exec/TeeConsumerTest.java
(added)
+++ maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/exec/TeeConsumerTest.java
Tue May  2 21:59:00 2006
@@ -0,0 +1,57 @@
+package org.apache.maven.plugins.release.exec;
+
+/*
+ * Copyright 2005-2006 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 junit.framework.TestCase;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+
+/**
+ * Test the consumer that tees output both to a stream and into an internal buffer for later.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class TeeConsumerTest
+    extends TestCase
+{
+    private TeeConsumer consumer;
+
+    private ByteArrayOutputStream out;
+
+    private static final String LS = System.getProperty( "line.separator" );
+
+    protected void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        out = new ByteArrayOutputStream();
+        consumer = new TeeConsumer( new PrintStream( out ), "xxx " );
+    }
+
+    public void testConsumeLine()
+    {
+        consumer.consumeLine( "line" );
+
+        assertEquals( "Check output", "xxx line" + LS, out.toString() );
+
+        assertEquals( "Check content", "line" + LS, consumer.getContent() );
+
+        assertEquals( "Check toString", "line" + LS, consumer.toString() );
+    }
+}

Propchange: maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/exec/TeeConsumerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/exec/TeeConsumerTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



Mime
View raw message