You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ep...@apache.org on 2006/04/06 09:06:50 UTC
svn commit: r391919 - in /maven/plugins/trunk/maven-idea-plugin/src/test:
clean-plugin-configs/ clean-plugin-configs/min-plugin-config.xml
java/org/apache/maven/plugin/idea/IdeaCleanTest.java
Author: epunzalan
Date: Thu Apr 6 00:06:49 2006
New Revision: 391919
URL: http://svn.apache.org/viewcvs?rev=391919&view=rev
Log:
PR: MIDEA-43
Added tests for idea:clean goal
Added:
maven/plugins/trunk/maven-idea-plugin/src/test/clean-plugin-configs/
maven/plugins/trunk/maven-idea-plugin/src/test/clean-plugin-configs/min-plugin-config.xml
maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/IdeaCleanTest.java
Added: maven/plugins/trunk/maven-idea-plugin/src/test/clean-plugin-configs/min-plugin-config.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-idea-plugin/src/test/clean-plugin-configs/min-plugin-config.xml?rev=391919&view=auto
==============================================================================
--- maven/plugins/trunk/maven-idea-plugin/src/test/clean-plugin-configs/min-plugin-config.xml (added)
+++ maven/plugins/trunk/maven-idea-plugin/src/test/clean-plugin-configs/min-plugin-config.xml Thu Apr 6 00:06:49 2006
@@ -0,0 +1,30 @@
+<!--
+ ~
+ ~ 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.
+ ~
+ -->
+
+<project>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-idea-plugin</artifactId>
+ <configuration>
+ <project implementation="org.apache.maven.plugin.idea.stubs.SimpleMavenProjectStub"/>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Added: maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/IdeaCleanTest.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/IdeaCleanTest.java?rev=391919&view=auto
==============================================================================
--- maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/IdeaCleanTest.java (added)
+++ maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/IdeaCleanTest.java Thu Apr 6 00:06:49 2006
@@ -0,0 +1,64 @@
+package org.apache.maven.plugin.idea;
+
+import org.apache.maven.plugin.Mojo;
+import org.apache.maven.plugin.idea.stubs.TestCounter;
+import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+
+import java.io.File;
+
+/*
+ *
+ * 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.
+ *
+ */
+
+/**
+ * @author Edwin Punzalan
+ */
+public class IdeaCleanTest
+ extends AbstractMojoTestCase
+{
+ public void testClean()
+ throws Exception
+ {
+ File pluginXmlFile = new File( getBasedir(), "src/test/clean-plugin-configs/min-plugin-config.xml" );
+
+ File basedir = new File( "target/test-harness/" + ( TestCounter.currentCount() + 1 ) );
+ assertTrue( "Prepare test base directory", basedir.mkdirs() );
+
+ String artifactId = "plugin-test-" + ( TestCounter.currentCount() + 1 );
+
+ File iprFile = new File( basedir, artifactId + ".ipr" );
+ assertTrue( "Test creation of project files", iprFile.createNewFile() );
+
+ File imlFile = new File( basedir, artifactId + ".iml" );
+ assertTrue( "Test creation of project files", imlFile.createNewFile() );
+
+ File iwsFile = new File( basedir, artifactId + ".iws" );
+ assertTrue( "Test creation of project files", iwsFile.createNewFile() );
+
+ Mojo mojo = lookupMojo( "clean", pluginXmlFile );
+
+ mojo.execute();
+
+ assertFalse( "Test idea project file was deleted", iprFile.exists() );
+
+ assertFalse( "Test idea module file was deleted", imlFile.exists() );
+
+ assertFalse( "Test idea workspace file was deleted", iwsFile.exists() );
+
+ assertTrue( "Test project dir was not deleted", basedir.exists() );
+ }
+}