You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ah...@apache.org on 2009/07/28 02:17:01 UTC
svn commit: r798342 [2/2] - in /maven/plugins/trunk/maven-eclipse-plugin/src:
main/java/org/apache/maven/plugin/eclipse/
main/java/org/apache/maven/plugin/eclipse/reader/
main/java/org/apache/maven/plugin/eclipse/writers/
main/java/org/apache/maven/plu...
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/AbstractEclipsePluginIT.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/AbstractEclipsePluginIT.java?rev=798342&r1=798341&r2=798342&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/AbstractEclipsePluginIT.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/AbstractEclipsePluginIT.java Tue Jul 28 00:17:00 2009
@@ -228,7 +228,7 @@
/**
* Execute the eclipse:eclipse goal on a test project and verify generated files.
- *
+ *
* @param projectName project directory
* @throws Exception any exception generated during test
*/
@@ -240,7 +240,7 @@
/**
* Execute the eclipse:eclipse goal on a test project and verify generated files.
- *
+ *
* @param basedir basedir of mvn execution
* @throws Exception any exception generated during test
*/
@@ -252,7 +252,7 @@
/**
* Execute the eclipse:eclipse goal on a test project and verify generated files.
- *
+ *
* @param projectName project directory
* @param properties additional properties
* @param cleanGoal TODO
@@ -264,10 +264,10 @@
{
testProject( projectName, properties, cleanGoal, genGoal, false );
}
-
+
/**
* Execute the eclipse:eclipse goal on a test project and verify generated files.
- *
+ *
* @param projectName project directory
* @param properties additional properties
* @param cleanGoal TODO
@@ -275,7 +275,8 @@
* @param withInstall true to include the install goal, false to exclude it.
* @throws Exception any exception generated during test
*/
- protected void testProject( String projectName, Properties properties, String cleanGoal, String genGoal, boolean withInstall )
+ protected void testProject( String projectName, Properties properties, String cleanGoal, String genGoal,
+ boolean withInstall )
throws Exception
{
File basedir = getTestFile( "target/test-classes/projects/" + projectName );
@@ -289,13 +290,15 @@
* @param genGoal TODO
* @throws Exception any exception generated during test
*/
- protected void testProject( File basedir, Properties properties, String cleanGoal, String genGoal ) throws Exception {
+ protected void testProject( File basedir, Properties properties, String cleanGoal, String genGoal )
+ throws Exception
+ {
testProject( basedir, properties, cleanGoal, genGoal, false );
}
-
+
/**
* Execute the eclipse:eclipse goal on a test project and verify generated files.
- *
+ *
* @param basedir basedir of mvn execution
* @param properties additional properties
* @param cleanGoal TODO
@@ -303,7 +306,8 @@
* @param withInstall true to include the install goal, false to exclude it.
* @throws Exception any exception generated during test
*/
- protected void testProject( File basedir, Properties properties, String cleanGoal, String genGoal, boolean withInstall )
+ protected void testProject( File basedir, Properties properties, String cleanGoal, String genGoal,
+ boolean withInstall )
throws Exception
{
File pom = new File( basedir, "pom.xml" );
@@ -314,7 +318,8 @@
goals.add( pluginSpec + cleanGoal );
goals.add( pluginSpec + genGoal );
- if ( withInstall ) {
+ if ( withInstall )
+ {
goals.add( "install" );
}
@@ -338,7 +343,7 @@
/**
* Execute the eclipse:configure-workspace goal on a test project and verify generated files.
- *
+ *
* @param projectName project directory
* @throws Exception any exception generated during test
*/
@@ -350,7 +355,7 @@
/**
* Execute the eclipse:configure-workspace goal on a test project and verify generated files.
- *
+ *
* @param projectName project directory
* @throws Exception any exception generated during test
*/
@@ -362,7 +367,7 @@
/**
* Execute the eclipse:configure-workspace goal on a test project and verify generated files.
- *
+ *
* @param projectName project directory
* @param properties additional properties
* @param cleanGoal TODO
@@ -571,7 +576,7 @@
/**
* Assert that two XML files are equal.
- *
+ *
* @param expectedFile the expected file - only used for path information
* @param expectedFileContents the contents of the expected file
* @param actualFile the actual file - only used for path information
@@ -600,7 +605,7 @@
/**
* Assert that two text files are equals. Lines that start with # are comments and ignored.
- *
+ *
* @param expectedFile the expected file - only used for path information
* @param expectedFileContents the contents of the expected file
* @param actualFile the actual file - only used for path information
@@ -635,10 +640,9 @@
/**
* Preprocess the file so that equals comparison can be done. Preprocessing may vary based on filename.
- *
+ *
* @param file the file being processed
* @param variables if not null, then replace all keys with the corresponding values in the expected string.
- *
* @return processed input
*/
private String preprocess( File file, Map variables )
@@ -660,7 +664,6 @@
* NOTE: This is another hack to compensate for some metadata files that contain a complete XML file as the
* value for a key like "org.eclipse.jdt.ui.formatterprofiles" from "org.eclipse.jdt.ui.prefs". Line terminators
* in this value are platform-dependent.
- *
*/
if ( file.getName().endsWith( ".prefs" ) )
{
@@ -669,9 +672,7 @@
/*
* NOTE: This is a hack to compensate for files that contain generated values like dependent-object in
- * org.eclipse.wst.common.component.
- *
- * Regex would be a better solution.
+ * org.eclipse.wst.common.component. Regex would be a better solution.
*/
if ( file.getName().equals( "org.eclipse.wst.common.component" ) || file.getName().equals( ".modulemaps" )
|| file.getName().equals( "application.xml" ) )
@@ -683,7 +684,7 @@
/**
* Normalize line terminators into \n. \r\n, \r, \n all get changed into \n.
- *
+ *
* @param input the string to normalize
* @return string with line terminators normalized
*/
@@ -857,7 +858,7 @@
/**
* Locate the actual file needed for comparison. The expectedFile has the baseDir prefix removed and the resulting
* relative path used to locate the file within the projectOutputDir.
- *
+ *
* @param projectOutputDir the directory where the eclipse plugin writes files to
* @param basedir the base dir of the project being tested
* @param expectedFile the expected file used to compare to the actual file
@@ -876,13 +877,15 @@
}
catch ( IOException e )
{
- throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantcanonicalize", actualFile.getAbsolutePath() ), e ); //$NON-NLS-1$
+ throw new MojoExecutionException(
+ Messages.getString(
+ "EclipsePlugin.cantcanonicalize", actualFile.getAbsolutePath() ), e ); //$NON-NLS-1$
}
}
/**
* Test if the file contains xml content.
- *
+ *
* @param f the file to test
* @return true if the file contains xml content, false otherwise.
*/
@@ -908,7 +911,7 @@
/**
* Return the not available marker file for the specified artifact details.
- *
+ *
* @param groupId group id of artifact
* @param artifactId artifact id of artifact
* @param version version of artifact
@@ -918,8 +921,8 @@
* @throws Exception failures.
* @see IdeUtils#createArtifactWithClassifier(String, String, String, String, String, ArtifactFactory)
*/
- protected File getNotAvailableMarkerFile( String groupId, String artifactId, String version,
- String classifier, String inClassifier )
+ protected File getNotAvailableMarkerFile( String groupId, String artifactId, String version, String classifier,
+ String inClassifier )
throws Exception
{
// HACK: START
@@ -931,29 +934,29 @@
ArtifactFactory artifactFactory = new DefaultArtifactFactory();
DefaultArtifactHandler javaSourceArtifactHandler = new DefaultArtifactHandler( "java-source" );
- setVariableValueToObject( javaSourceArtifactHandler, "extension", "jar");
+ setVariableValueToObject( javaSourceArtifactHandler, "extension", "jar" );
DefaultArtifactHandler javadocArtifactHandler = new DefaultArtifactHandler( "javadoc" );
- setVariableValueToObject( javadocArtifactHandler, "extension", "jar");
+ setVariableValueToObject( javadocArtifactHandler, "extension", "jar" );
Map artifactHandlers = new HashMap();
artifactHandlers.put( "java-source", javaSourceArtifactHandler );
artifactHandlers.put( "javadoc", javadocArtifactHandler );
ArtifactHandlerManager artifactHandlerManager = new DefaultArtifactHandlerManager();
- setVariableValueToObject( artifactHandlerManager, "artifactHandlers", artifactHandlers);
- setVariableValueToObject( artifactFactory, "artifactHandlerManager", artifactHandlerManager);
+ setVariableValueToObject( artifactHandlerManager, "artifactHandlers", artifactHandlers );
+ setVariableValueToObject( artifactFactory, "artifactHandlerManager", artifactHandlerManager );
// HACK: END
Artifact artifact =
IdeUtils.createArtifactWithClassifier( groupId, artifactId, version, classifier, inClassifier,
- artifactFactory);
+ artifactFactory );
return IdeUtils.getNotAvailableMarkerFile( localRepository, artifact );
}
/**
* Assert that the not available marker file exists for the specified artifact details.
- *
+ *
* @param groupId group id of artifact
* @param artifactId artifact id of artifact
* @param version version of artifact
@@ -962,7 +965,8 @@
* @throws Exception failures
*/
protected void assertNotAvailableMarkerFileExists( String groupId, String artifactId, String version,
- String classifier, String inClassifier ) throws Exception
+ String classifier, String inClassifier )
+ throws Exception
{
File markerFile = getNotAvailableMarkerFile( groupId, artifactId, version, classifier, inClassifier );
assertTrue( "The \"Not Available\" marker file does not exist: " + markerFile, markerFile.exists() );
@@ -970,7 +974,7 @@
/**
* Assert that the not available marker file does not exist for the specified artifact details.
- *
+ *
* @param groupId group id of artifact
* @param artifactId artifact id of artifact
* @param version version of artifact
@@ -979,7 +983,8 @@
* @throws Exception failures
*/
protected void assertNotAvailableMarkerFileDoesNotExist( String groupId, String artifactId, String version,
- String classifier, String inClassifier ) throws Exception
+ String classifier, String inClassifier )
+ throws Exception
{
File markerFile = getNotAvailableMarkerFile( groupId, artifactId, version, classifier, inClassifier );
assertTrue( "The \"Not Available\" marker file incorrectly exists: " + markerFile, !markerFile.exists() );
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipseAjdtPluginIT.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipseAjdtPluginIT.java?rev=798342&r1=798341&r2=798342&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipseAjdtPluginIT.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipseAjdtPluginIT.java Tue Jul 28 00:17:00 2009
@@ -18,7 +18,6 @@
*/
package org.apache.maven.plugin.eclipse.it;
-
/**
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
* @author <a href="mailto:fgiust@apache.org">Fabrizio Giustina</a>
@@ -93,7 +92,7 @@
testProject( "project-ajdt-10-MECLIPSE-538" );
}
- public void testProjectAjdt11()
+ public void testProjectAjdt11()
throws Exception
{
testProject( "project-ajdt-11-MECLIPSE-104" );
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java?rev=798342&r1=798341&r2=798342&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java Tue Jul 28 00:17:00 2009
@@ -53,7 +53,8 @@
public void testDynamicWorkspaceLookup()
throws Exception
{
- File basedir = new File(TempEclipseWorkspace.getFixtureEclipseDynamicWorkspace().workspaceLocation, "project-Z");
+ File basedir =
+ new File( TempEclipseWorkspace.getFixtureEclipseDynamicWorkspace().workspaceLocation, "project-Z" );
testProject( basedir );
}
@@ -441,11 +442,12 @@
checkJRESettingsWithEclipseWorkspace( "project-39-a", TempEclipseWorkspace.getFixtureEclipseWithDefault13(),
null );
}
-
+
public void testProject39_b()
throws Exception
{
- checkJRESettingsWithEclipseWorkspace( "project-39-b", TempEclipseWorkspace.getFixtureEclipseWithDefault15(), null );
+ checkJRESettingsWithEclipseWorkspace( "project-39-b", TempEclipseWorkspace.getFixtureEclipseWithDefault15(),
+ null );
}
public void testProject39_c()
@@ -462,7 +464,7 @@
checkJRESettingsWithEclipseWorkspace( "project-40-a", TempEclipseWorkspace.getFixtureEclipseWithDefault13(),
jre131 );
}
-
+
public void testProject40_b()
throws Exception
{
@@ -535,10 +537,10 @@
{
testProject( "project-45" );
}
-
+
/**
- * Test not available marker file is created for sources/javadocs.
- * biz.aQute:bndlib:0.0.145 does not have sources or javadocs.
+ * Test not available marker file is created for sources/javadocs. biz.aQute:bndlib:0.0.145 does not have sources or
+ * javadocs.
*
* @throws Exception
*/
@@ -549,10 +551,10 @@
assertNotAvailableMarkerFileExists( "biz.aQute", "bndlib", "0.0.145", null, "sources" );
assertNotAvailableMarkerFileExists( "biz.aQute", "bndlib", "0.0.145", null, "javadoc" );
}
-
+
/**
- * Test not available marker file is created for sources/javadocs.
- * commons-lang:commons-lang:1.0 does not have sources but does have javadocs.
+ * Test not available marker file is created for sources/javadocs. commons-lang:commons-lang:1.0 does not have
+ * sources but does have javadocs.
*
* @throws Exception
*/
@@ -563,10 +565,10 @@
assertNotAvailableMarkerFileExists( "commons-lang", "commons-lang", "1.0", null, "sources" );
assertNotAvailableMarkerFileDoesNotExist( "commons-lang", "commons-lang", "1.0", null, "javadoc" );
}
-
+
/**
- * Test not available marker file is created for sources/javadocs.
- * does-not-exist:does-not-exist:666 doesn't exist so no markers should be created.
+ * Test not available marker file is created for sources/javadocs. does-not-exist:does-not-exist:666 doesn't exist
+ * so no markers should be created.
*
* @throws Exception
*/
@@ -576,7 +578,7 @@
testProject( "project-48" );
assertNotAvailableMarkerFileDoesNotExist( "does-not-exist", "does-not-exist", "666", null, "sources" );
assertNotAvailableMarkerFileDoesNotExist( "does-not-exist", "does-not-exist", "666", null, "javadoc" );
- }
+ }
/**
* Test forceRecheck
@@ -595,8 +597,7 @@
testProject( "project-49" );
assertNotAvailableMarkerFileDoesNotExist( "commons-lang", "commons-lang", "2.4", null, "sources" );
assertNotAvailableMarkerFileDoesNotExist( "commons-lang", "commons-lang", "2.4", null, "javadoc" );
- }
-
+ }
/**
* [MECLIPSE-415] settings are stored in wrong directory if project is not in the workspace.
@@ -607,7 +608,7 @@
throws Exception
{
testProject( "project-50-MECLIPSE-415" );
- }
+ }
/**
* [MECLIPSE-415] settings are stored in wrong directory if project is not in the workspace.
@@ -618,8 +619,8 @@
throws Exception
{
testProject( "project-51-MECLIPSE-415" );
- }
-
+ }
+
/**
* [MECLIPSE-104] Add the ability to specify source exclusions
*
@@ -630,7 +631,7 @@
{
testProject( "project-52-MECLIPSE-104" );
}
-
+
/**
* [MECLIPSE-551] Source directory and resource directory are the same
*
@@ -652,10 +653,11 @@
{
testProject( "project-54-MECLIPSE-178" );
}
-
+
/**
- * [MECLIPSE-178] symbolic links need to able to be specified in the pom
- * Test the case where a link is already existing in the .project
+ * [MECLIPSE-178] symbolic links need to able to be specified in the pom Test the case where a link is already
+ * existing in the .project
+ *
* @throws Exception
*/
public void testProject55MECLIPSE178()
@@ -663,7 +665,7 @@
{
testProject( "project-55-MECLIPSE-178" );
}
-
+
public void testJeeSimple()
throws Exception
{
@@ -677,8 +679,7 @@
testProject( "j2ee-simple" );
}
- private void checkJRESettingsWithEclipseWorkspace( String project, TempEclipseWorkspace workspace,
- String jreExec )
+ private void checkJRESettingsWithEclipseWorkspace( String project, TempEclipseWorkspace workspace, String jreExec )
throws Exception
{
Properties properties = new Properties();
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginMasterProjectIT.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginMasterProjectIT.java?rev=798342&r1=798341&r2=798342&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginMasterProjectIT.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginMasterProjectIT.java Tue Jul 28 00:17:00 2009
@@ -133,7 +133,8 @@
throws Exception
{
executeMaven2();
- assertFileEquals( new File( basedir, "module-1/expected/.wtpmodules" ), new File( basedir, "module-1/.wtpmodules" ) );
+ assertFileEquals( new File( basedir, "module-1/expected/.wtpmodules" ), new File( basedir,
+ "module-1/.wtpmodules" ) );
}
public void testModule2Project()
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/RadPluginIT.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/RadPluginIT.java?rev=798342&r1=798341&r2=798342&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/RadPluginIT.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/RadPluginIT.java Tue Jul 28 00:17:00 2009
@@ -79,7 +79,8 @@
throws Exception
{
testProject( "project-rad-7", new Properties(), "rad-clean", "rad" );
- assertFalse( "Default path should not exist because it is overridden!",
+ assertFalse(
+ "Default path should not exist because it is overridden!",
new File( getTestFile( "target/test-classes/projects/project-rad-7" ), "/src/main/webapp" ).exists() );
}
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocationsTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocationsTest.java?rev=798342&r1=798341&r2=798342&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocationsTest.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocationsTest.java Tue Jul 28 00:17:00 2009
@@ -57,7 +57,7 @@
* Project's at the workspace level do not have a .location file.
* <p>
* Therefore their project location is directly under the workspace.
- *
+ *
* @throws Exception
*/
public void testGetProjectLocation_ForProjectAtWorkspaceLevel()
@@ -78,7 +78,7 @@
* <p>
* This URI specifies the fully qualified path to the project. Which may be located outside of the workspace as
* well.
- *
+ *
* @throws Exception
*/
public void testGetProjectLocation_ForProjectsWithinProjects()
@@ -100,7 +100,7 @@
* <p>
* This URI specifies the fully qualified path to the project. Which may be located outside of the workspace as
* well.
- *
+ *
* @throws Exception
*/
public void testGetProjectLocation_ForProjectsOutsideWorkspace()
@@ -158,7 +158,7 @@
/**
* Assert that two files represent the same absolute file.
- *
+ *
* @param expectedFile
* @param actualFile
* @throws IOException
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriterUnitTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriterUnitTest.java?rev=798342&r1=798341&r2=798342&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriterUnitTest.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriterUnitTest.java Tue Jul 28 00:17:00 2009
@@ -74,7 +74,8 @@
EclipseSourceDir dir =
new EclipseSourceDir( "src/main/resources", "target/classes", true, false, null, null, false );
EclipseSourceDir testDir =
- new EclipseSourceDir( "src\\test\\resources", "target/classes/test-resources", true, true, null, null, false );
+ new EclipseSourceDir( "src\\test\\resources", "target/classes/test-resources", true, true, null, null,
+ false );
EclipseSourceDir[] dirs = { dir, testDir };
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriterTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriterTest.java?rev=798342&r1=798341&r2=798342&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriterTest.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriterTest.java Tue Jul 28 00:17:00 2009
@@ -9,7 +9,6 @@
import java.io.Reader;
import java.io.Writer;
-
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.eclipse.writers.testutils.TestEclipseWriterConfig;
import org.apache.maven.plugin.logging.SystemStreamLog;
@@ -24,103 +23,112 @@
import org.jdom.JDOMException;
import junit.framework.TestCase;
-public class EclipseProjectWriterTest extends TestCase {
- private TestFileManager fileManager = new TestFileManager( "EclipseProjectWriter.unitTest.", "" );
- public EclipseProjectWriterTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
-
- }
-
- protected void tearDown() throws Exception {
- fileManager.cleanUp();
- }
-
- public void testWrite_preservingLinkedResources() throws MojoExecutionException, JDOMException, IOException, XmlPullParserException {
-
- //create the config and the logger
- TestEclipseWriterConfig config = new TestEclipseWriterConfig();
- TestLog log = new TestLog();
-
- //setup the eclipse project
- File basedir = fileManager.createTempDir();
- config.setProjectBaseDir( basedir );
- config.setEclipseProjectDirectory( basedir );
- config.setEclipseProjectName( "test-project" );
- MavenProject project = new MavenProject();
- config.setProject(project);
- EclipseProjectWriter projectWriter = new EclipseProjectWriter();
- //create the .project file and start writing the contents
- File dotProject = new File( config.getEclipseProjectDirectory(), ".project" );
- Writer w = new OutputStreamWriter( new FileOutputStream( dotProject ), "UTF-8" );
- XMLWriter writer = new PrettyPrintXMLWriter( w );
-
- writer.startElement("projectDescription");
-
- writer.startElement("name");
- writer.writeText("test-project");
- writer.endElement();//name
-
- writer.startElement("linkedResources");
- writer.startElement("link");
-
- writer.startElement("name");
- writer.writeText("linkTest");
- writer.endElement();//name
-
- writer.startElement("type");
- writer.writeText("2");
- writer.endElement();//type
-
- writer.startElement("location");
- writer.writeText(basedir+"/dummyName");
- writer.endElement(); //location
-
- writer.endElement();//link
- writer.endElement();//linkedResources
- writer.endElement();//projectDescription
-
- IOUtil.close( w );
- //parse the file we just created in order to keep manually-added linkedResources
- //pre setup
- Reader reader = null;
- reader = new InputStreamReader( new FileInputStream( dotProject ), "UTF-8" );
- Xpp3Dom dom = Xpp3DomBuilder.build( reader );
- Xpp3Dom linkedResourcesElement = dom.getChild("linkedResources");
- Xpp3Dom[] existingLinks = linkedResourcesElement.getChildren("link");
- String existingName = existingLinks[0].getChild("name").getValue();
- String existingType = existingLinks[0].getChild("type").getValue();
- String existingLocation = existingLinks[0].getChild("location").getValue();
- reader.close();
- //call the projectwriter to write the .project file
- projectWriter.init( log, config );
- projectWriter.write();
- //post check..compare the pre values to make sure the writer preserves the LinkedResources
- reader = new InputStreamReader( new FileInputStream( dotProject ), "UTF-8" );
- Xpp3Dom linkedResourcesElement1 = dom.getChild("linkedResources");
- assertNotNull("No linkedResources present", linkedResourcesElement1);
- Xpp3Dom[] currentLinks = linkedResourcesElement.getChildren("link");
- String currentName = existingLinks[0].getChild("name").getValue();
- String currentType = existingLinks[0].getChild("type").getValue();
- String currentLocation = existingLinks[0].getChild("location").getValue();
- assertEquals("link name is not equal", existingName,currentName);
- assertEquals("link type is not equal", existingType,currentType);
- assertEquals("link location is not equal", existingLocation,currentLocation);
-
- reader.close();
-
-
-
- }
- private static final class TestLog
- extends SystemStreamLog
- {
- public boolean isDebugEnabled()
- {
- return true;
- }
- }
+public class EclipseProjectWriterTest
+ extends TestCase
+{
+ private TestFileManager fileManager = new TestFileManager( "EclipseProjectWriter.unitTest.", "" );
+
+ public EclipseProjectWriterTest( String name )
+ {
+ super( name );
+ }
+
+ protected void setUp()
+ throws Exception
+ {
+
+ }
+
+ protected void tearDown()
+ throws Exception
+ {
+ fileManager.cleanUp();
+ }
+
+ public void testWrite_preservingLinkedResources()
+ throws MojoExecutionException, JDOMException, IOException, XmlPullParserException
+ {
+
+ // create the config and the logger
+ TestEclipseWriterConfig config = new TestEclipseWriterConfig();
+ TestLog log = new TestLog();
+
+ // setup the eclipse project
+ File basedir = fileManager.createTempDir();
+ config.setProjectBaseDir( basedir );
+ config.setEclipseProjectDirectory( basedir );
+ config.setEclipseProjectName( "test-project" );
+ MavenProject project = new MavenProject();
+ config.setProject( project );
+ EclipseProjectWriter projectWriter = new EclipseProjectWriter();
+ // create the .project file and start writing the contents
+ File dotProject = new File( config.getEclipseProjectDirectory(), ".project" );
+ Writer w = new OutputStreamWriter( new FileOutputStream( dotProject ), "UTF-8" );
+ XMLWriter writer = new PrettyPrintXMLWriter( w );
+
+ writer.startElement( "projectDescription" );
+
+ writer.startElement( "name" );
+ writer.writeText( "test-project" );
+ writer.endElement();// name
+
+ writer.startElement( "linkedResources" );
+ writer.startElement( "link" );
+
+ writer.startElement( "name" );
+ writer.writeText( "linkTest" );
+ writer.endElement();// name
+
+ writer.startElement( "type" );
+ writer.writeText( "2" );
+ writer.endElement();// type
+
+ writer.startElement( "location" );
+ writer.writeText( basedir + "/dummyName" );
+ writer.endElement(); // location
+
+ writer.endElement();// link
+ writer.endElement();// linkedResources
+ writer.endElement();// projectDescription
+
+ IOUtil.close( w );
+ // parse the file we just created in order to keep manually-added linkedResources
+ // pre setup
+ Reader reader = null;
+ reader = new InputStreamReader( new FileInputStream( dotProject ), "UTF-8" );
+ Xpp3Dom dom = Xpp3DomBuilder.build( reader );
+ Xpp3Dom linkedResourcesElement = dom.getChild( "linkedResources" );
+ Xpp3Dom[] existingLinks = linkedResourcesElement.getChildren( "link" );
+ String existingName = existingLinks[0].getChild( "name" ).getValue();
+ String existingType = existingLinks[0].getChild( "type" ).getValue();
+ String existingLocation = existingLinks[0].getChild( "location" ).getValue();
+ reader.close();
+ // call the projectwriter to write the .project file
+ projectWriter.init( log, config );
+ projectWriter.write();
+ // post check..compare the pre values to make sure the writer preserves the LinkedResources
+ reader = new InputStreamReader( new FileInputStream( dotProject ), "UTF-8" );
+ Xpp3Dom linkedResourcesElement1 = dom.getChild( "linkedResources" );
+ assertNotNull( "No linkedResources present", linkedResourcesElement1 );
+ Xpp3Dom[] currentLinks = linkedResourcesElement.getChildren( "link" );
+ String currentName = existingLinks[0].getChild( "name" ).getValue();
+ String currentType = existingLinks[0].getChild( "type" ).getValue();
+ String currentLocation = existingLinks[0].getChild( "location" ).getValue();
+ assertEquals( "link name is not equal", existingName, currentName );
+ assertEquals( "link type is not equal", existingType, currentType );
+ assertEquals( "link location is not equal", existingLocation, currentLocation );
+
+ reader.close();
+
+ }
+
+ private static final class TestLog
+ extends SystemStreamLog
+ {
+ public boolean isDebugEnabled()
+ {
+ return true;
+ }
+ }
}
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/EclipseWtpComponent15WriterTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/EclipseWtpComponent15WriterTest.java?rev=798342&r1=798341&r2=798342&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/EclipseWtpComponent15WriterTest.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/EclipseWtpComponent15WriterTest.java Tue Jul 28 00:17:00 2009
@@ -44,58 +44,61 @@
*
* @author Steffen Grunwald
*/
-public class EclipseWtpComponent15WriterTest extends TestCase {
-
- private TestFileManager fileManager = new TestFileManager(
- "EclipseWtpComponent15Writer.unitTest.", "");
-
- protected void tearDown() throws IOException {
+public class EclipseWtpComponent15WriterTest
+ extends TestCase
+{
+
+ private TestFileManager fileManager = new TestFileManager( "EclipseWtpComponent15Writer.unitTest.", "" );
+
+ protected void tearDown()
+ throws IOException
+ {
fileManager.cleanUp();
}
/**
* Tests the creation of the ejb module references in the org.eclipse.wst.common.component file for:
* <ul>
- * <li>component file of EAR
- * <li>WTP 1.5
- * <li>dep is referenced project
+ * <li>component file of EAR
+ * <li>WTP 1.5
+ * <li>dep is referenced project
* </ul>
- *
* The archivename is expected to be jar - independent from the packaging (ejb).
*
* @throws MojoExecutionException Exception
* @throws IOException Exception
- * @throws JDOMException Exception
+ * @throws JDOMException Exception
*/
public void testWriteEjbComponentMECLIPSE455()
- throws MojoExecutionException, IOException, JDOMException {
+ throws MojoExecutionException, IOException, JDOMException
+ {
TestEclipseWriterConfig config = new TestEclipseWriterConfig();
- config.setWtpVersion(1.5f);
- config.setEclipseProjectName("test-project");
+ config.setWtpVersion( 1.5f );
+ config.setEclipseProjectName( "test-project" );
File basedir = fileManager.createTempDir();
- File pom = new File(basedir, "pom.xml");
+ File pom = new File( basedir, "pom.xml" );
pom.createNewFile();
-
+
MavenProject project = new MavenProject();
- project.setFile(pom);
-
- config.setProject(project);
- config.setProjectBaseDir(basedir);
-
- config.setEclipseProjectDirectory(basedir);
- config.setPackaging("ear");
-
+ project.setFile( pom );
+
+ config.setProject( project );
+ config.setProjectBaseDir( basedir );
+
+ config.setEclipseProjectDirectory( basedir );
+ config.setPackaging( "ear" );
+
// add an ejb3 and ejb packaged dependency
- config.setDeps(new IdeDependency[]{createDep("ejb"), createDep("jar")});
-
+ config.setDeps( new IdeDependency[] { createDep( "ejb" ), createDep( "jar" ) } );
+
EclipseWtpComponentWriter lWriter = new EclipseWtpComponent15Writer();
Log log = new TestLog();
- lWriter.init(log, config);
+ lWriter.init( log, config );
lWriter.write();
@@ -105,34 +108,38 @@
Document doc = builder.build( new File( basedir, ".settings/org.eclipse.wst.common.component" ) );
XPath archiveNames = XPath.newInstance( "//dependent-module/@archiveName" );
-
- assertEquals("Must be 2 modules", 2, archiveNames.selectNodes( doc ).size());
+
+ assertEquals( "Must be 2 modules", 2, archiveNames.selectNodes( doc ).size() );
for ( Iterator it = archiveNames.selectNodes( doc ).iterator(); it.hasNext(); )
{
Attribute attribute = (Attribute) it.next();
-
+
String archiveName = attribute.getValue();
- String extension = archiveName.substring(archiveName.lastIndexOf(".") + 1).toLowerCase();
-
- assertEquals("Must be of type jar", "jar", extension);
+ String extension = archiveName.substring( archiveName.lastIndexOf( "." ) + 1 ).toLowerCase();
+
+ assertEquals( "Must be of type jar", "jar", extension );
}
-
+
}
- private IdeDependency createDep(String packagingType) {
+ private IdeDependency createDep( String packagingType )
+ {
IdeDependency dependency = new IdeDependency();
- dependency.setGroupId("g");
- dependency.setArtifactId(packagingType + "Artifact");
- dependency.setVersion("v");
- dependency.setReferencedProject(true);
- dependency.setAddedToClasspath(true);
- dependency.setEclipseProjectName(packagingType + "Project");
- dependency.setType(packagingType);
+ dependency.setGroupId( "g" );
+ dependency.setArtifactId( packagingType + "Artifact" );
+ dependency.setVersion( "v" );
+ dependency.setReferencedProject( true );
+ dependency.setAddedToClasspath( true );
+ dependency.setEclipseProjectName( packagingType + "Project" );
+ dependency.setType( packagingType );
return dependency;
}
- private static final class TestLog extends SystemStreamLog {
- public boolean isDebugEnabled() {
+ private static final class TestLog
+ extends SystemStreamLog
+ {
+ public boolean isDebugEnabled()
+ {
return true;
}
}
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/ide/IdeUtilsTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/ide/IdeUtilsTest.java?rev=798342&r1=798341&r2=798342&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/ide/IdeUtilsTest.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/ide/IdeUtilsTest.java Tue Jul 28 00:17:00 2009
@@ -80,7 +80,7 @@
// Likely it is because D refers to a CD drive that is not ready.
return;
}
-
+
String actual = IdeUtils.toRelativeAndFixSeparator( basedir, fileToAdd, false );
String expected = "D:/ide/workspace/maven/maven-eclipse-plugin/target/main-output";