Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1399 - in development/laboratory/maven/magic-migrate/src: main/net/dpml/magic/maven/migrate test/net/dpml/magic/maven/migrate

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mraad23 AT earthlink.net
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r1399 - in development/laboratory/maven/magic-migrate/src: main/net/dpml/magic/maven/migrate test/net/dpml/magic/maven/migrate
  • Date: Fri, 07 Jan 2005 05:37:51 +0100

Author: mraad23 AT earthlink.net
Date: Fri Jan 7 05:37:51 2005
New Revision: 1399

Modified:

development/laboratory/maven/magic-migrate/src/main/net/dpml/magic/maven/migrate/FileExistsException.java

development/laboratory/maven/magic-migrate/src/main/net/dpml/magic/maven/migrate/Migrate.java

development/laboratory/maven/magic-migrate/src/test/net/dpml/magic/maven/migrate/MigateTest.java
Log:
Adjusted code style based on
http://www.dpml.net/central/about/community/process/code.html

Modified:
development/laboratory/maven/magic-migrate/src/main/net/dpml/magic/maven/migrate/FileExistsException.java
==============================================================================
---
development/laboratory/maven/magic-migrate/src/main/net/dpml/magic/maven/migrate/FileExistsException.java
(original)
+++
development/laboratory/maven/magic-migrate/src/main/net/dpml/magic/maven/migrate/FileExistsException.java
Fri Jan 7 05:37:51 2005
@@ -1,24 +1,52 @@
+/*
+ Copyright 2004 Stephen J McConnell
+ Copyright 2004 Niclas Hedhman
+
+ 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.
+ */
+
package net.dpml.magic.maven.migrate;

+import java.io.IOException;
+import java.io.File;
+
/**
* Exception to be thrown when a file already exists.
+ *
+ * @author <a href="mailto:mraad23 AT earthlink.net";>Mansour Raad</a>
*/
-public class FileExistsException extends java.io.IOException {
- private java.io.File _file;
+public class FileExistsException
+ extends IOException
+{
+ private File m_file; // The existing file.
+
+ /**
+ * Create a instance with a reference to the existing file.
+ *
+ * @param file the existing file.
+ */
+ public FileExistsException( File file )
+ {
+ m_file = file;
+ }

- /**
- * Create a instance with a reference to the existing file.
- *
- * @param file the existing file.
- */
- public FileExistsException(java.io.File file) {
- _file = file;
- }
-
- /**
- * @return the file that already exists.
- */
- public java.io.File getFile() {
- return _file;
- }
+ /**
+ * @return the file that already exists.
+ */
+ public File getFile()
+ {
+ return m_file;
+ }
}

Modified:
development/laboratory/maven/magic-migrate/src/main/net/dpml/magic/maven/migrate/Migrate.java
==============================================================================
---
development/laboratory/maven/magic-migrate/src/main/net/dpml/magic/maven/migrate/Migrate.java
(original)
+++
development/laboratory/maven/magic-migrate/src/main/net/dpml/magic/maven/migrate/Migrate.java
Fri Jan 7 05:37:51 2005
@@ -19,285 +19,362 @@

package net.dpml.magic.maven.migrate;

+import org.apache.maven.project.Project;
+import org.apache.maven.project.Dependency;
+import org.apache.maven.MavenException;
+import org.apache.maven.MavenUtils;
+import org.dom4j.Document;
+import org.dom4j.DocumentHelper;
+import org.dom4j.Element;
+import org.dom4j.io.OutputFormat;
+import org.dom4j.io.XMLWriter;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.FileWriter;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.BufferedWriter;
+
+
/**
* TODO Create a map of the version numbers.
*/

-public class Migrate {
+public class Migrate
+{
+
+ public void migrate(
+ Project proj,
+ String dpml
+ )
+ {
+ }
+
+ public void createDpml(
+ Project proj,
+ String dpml
+ )
+ {
+ System.out.println( "Project:" + proj.getName() );
+ System.out.println( "DPML_HOME=" + dpml );
+ if( dpml == null )
+ {
+ dpml = System.getProperty( "user.home" + "/.dpml" );
+ }
+ System.out.println( "dpml = " + dpml );
+ File dpml_home = new File( dpml );
+ dpml_home.mkdirs();
+
+ File bindir = new File( dpml_home, "bin" );
+ bindir.mkdirs();
+
+ File transitdir = new File( dpml_home, "transit/authority" );
+ transitdir.mkdirs();
+
+ File cachedir = new File( dpml_home, "main" );
+ cachedir.mkdirs();
+
+ File docsdir = new File( dpml_home, "docs" );
+ docsdir.mkdirs();
+
+ String magicPath = proj.getDependencyPath( "dpml-magic" );
+ System.out.println( "Magic path=" + magicPath );
+
+ String transitPath = proj.getDependencyPath( "dpml-transit" );
+ System.out.println( "Transit path=" + transitPath );
+
+
+ }
+
+ public void createBuilds(
+ Project proj,
+ String dpml
+ )
+ throws IOException, MavenException
+ {
+ File cwd = new File( "." );
+ processDir( cwd );
+ }
+
+ /**
+ * Create build and index file recursuvely from the given base dir.
+ *
+ * @param basedir the base directory.
+ * @throws IOException if and IO error occured.
+ * @throws MavenException if a maven error occured.
+ */
+ public void createBuilds( File basedir ) throws IOException,
MavenException
+ {
+ processDir( basedir );
+ }
+
+ /**
+ * Process the current directory. Here we get a list of all the entries
in the current directory.
+ * If the current entry contains a project.xml file, then we create a
standard build.xml and an index.xml.
+ * Otherwise we create a reactor build.xml file and dive into that entry
and repeat the above process.
+ *
+ * @param basedir the base directory.
+ * @throws IOException if an IO error occured.
+ * @throws MavenException if a maven error occured.
+ */
+ private void processDir( File basedir ) throws IOException,
MavenException
+ {
+ File[] entries = basedir.listFiles();
+ if( isProjectDir( entries ) )
+ {
+ Project mavenProject = getMavenProject( basedir );
+ createStandardBuild( basedir, mavenProject );
+ createStandardIndex( basedir, mavenProject );
+ }
+ else
+ {
+ createReactorBuild( basedir );
+ recurse( entries );
+ }
+ }
+
+ /**
+ * Create index.xml file.
+ *
+ * @param basedir the base directory.
+ * @param project the maven project.
+ */
+ private void createStandardIndex(
+ File basedir,
+ Project project
+ ) throws IOException
+ {
+
+ Document document = DocumentHelper.createDocument();
+ Element index = document.addElement( "index" );
+ // importMetroModule(index);
+ createProject( index, project );
+ writeIndexDotXml( basedir, document );
+ }
+
+ private Project getMavenProject( File basedir ) throws MavenException
+ {
+ File mavenFile = new File( basedir, "project.xml" ); // Create file
with parent file, or NPE will be thrown.
+ return MavenUtils.getProject( mavenFile, null, false );
+ }
+
+ /**
+ * Write a document to index.xml.
+ *
+ * @param basedir where to write the file.
+ * @param document the document to write.
+ * @throws IOException if IO error occured.
+ */
+ private void writeIndexDotXml(
+ File basedir,
+ Document document
+ ) throws IOException
+ {
+ FileWriter fileWriter = new FileWriter( new File( basedir,
"index.xml" ) );
+ try
+ {
+ OutputFormat outputFormat = OutputFormat.createPrettyPrint();
+ outputFormat.setEncoding( "ISO-8859-1" );
+ XMLWriter xmlWriter = new XMLWriter( fileWriter, outputFormat );
+ xmlWriter.write( document );
+ xmlWriter.flush();
+ }
+ finally
+ {
+ fileWriter.close();
+ }
+ }
+
+ /**
+ * Create the project tag.
+ *
+ * @param index the index element.
+ * @param project the maven project.
+ */
+ private void createProject(
+ Element index,
+ Project project
+ )
+ {
+ addResources( index, project );
+ Element projectElement = index.addElement( "project" );
+ projectElement.addAttribute( "basedir", "." );
+ Element infoElement = projectElement.addElement( "info" );
+ infoElement.addElement( "group" ).addText( project.getGroupId() );
+ infoElement.addElement( "name" ).addText( project.getName() );
+ infoElement.addElement( "version" ).addText(
project.getCurrentVersion() );
+ addDependencies( projectElement, project );
+ }
+
+ /**
+ * Add the project dependencies.
+ *
+ * @param projectElement the project element.
+ * @param project the maven project.
+ */
+ private void addDependencies(
+ Element projectElement,
+ Project project
+ )
+ {
+ Element dependenciesElement = projectElement.addElement(
"dependencies" );
+ java.util.List list = project.getDependencies();
+ int size = list.size();
+ for( int i = 0; i < size; i++ )
+ {
+ Dependency dependency = (Dependency) list.get( i );
+ Element dependencyElement = dependenciesElement.addElement(
"dependency" );
+ dependencyElement.addAttribute( "key",
dependency.getArtifactId() );
+ // Handle special case if artifactId is junit
+ if( "junit".equals( dependency.getArtifactId() ) )
+ {
+ dependencyElement.addAttribute( "test", "true"
).addAttribute( "runtime", "false" );
+ }
+ }
+ }
+
+ /**
+ * Add the project resources.
+ *
+ * @param index the index element.
+ * @param project the maven project.
+ */
+ private void addResources(
+ Element index,
+ Project project
+ )
+ {
+ java.util.List list = project.getDependencies();
+ int size = list.size();
+ for( int i = 0; i < size; i++ )
+ {
+ Dependency dependency = (Dependency) list.get( i );
+ Element infoElement = index.addElement( "resource" ).addElement(
"info" );
+ infoElement.addElement( "group" ).addText(
dependency.getGroupId() );
+ infoElement.addElement( "name" ).addText(
dependency.getArtifactId() );
+ infoElement.addElement( "version" ).addText(
dependency.getVersion() );
+ infoElement.addElement( "type" ).addText( dependency.getType() );
+ }
+ }
+
+ /**
+ * import metro module tag.
+ *
+ * @param indexElement the index element.
+ */
+ private void importMetroModule( Element indexElement )
+ {
+ indexElement.addElement( "import" ).addAttribute( "uri",
"artifact:module:dpml/metro/dpml-metro#SNAPSHOT" );
+ }
+
+ private void recurse( File[] entries ) throws IOException, MavenException
+ {
+ for( int i = 0; i < entries.length; i++ )
+ {
+ processDir( entries[i] );
+ }
+ }
+
+ /**
+ * Check if the directory contains a 'src' entry..
+ *
+ * @param files array of files.
+ * @return true if one of the entries is 'src', false otherwise.
+ */
+ private boolean isProjectDir( File[] files )
+ {
+ boolean foundSrc = false;
+ for( int i = 0; i < files.length; i++ )
+ {
+ if( "src".equals( files[i].getName() ) )
+ {
+ foundSrc = true;
+ break;
+ }
+ }
+ return foundSrc;
+ }
+
+
+ /**
+ * <project name="dpml-tutorial-hello" default="install" basedir="."
+ * xmlns:magic="antlib:net.dpml.magic"
xmlns:x="plugin:dpml/magic/dpml-magic-core" >
+ * <p/>
+ * <magic:import uri="artifact:template:dpml/magic/standard"/>
+ * <p/>
+ * <target name="build" depends="standard.build">
+ * <x:block name="tutorial" embed="MAIN">
+ * <x:component name="hello" class="tutorial.HelloComponent"/>
+ * </x:block>
+ * </target>
+ * <p/>
+ * </project>
+ */
+ private void createStandardBuild(
+ File dir,
+ Project mavenProject
+ )
+ throws IOException
+ {
+ StringBuffer content = new StringBuffer( 500 );
+ content.append( "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" );
+ content.append( "<project name=\"" + mavenProject.getName() + "\"
default=\"install\" basedir=\".\"\n" );
+ content.append( " xmlns:magic=\"antlib:net.dpml.magic\">\n" );
+ content.append( "\n" );
+ content.append( " <magic:import
uri=\"artifact:template:dpml/magic/standard\"/>\n" );
+ content.append( "\n" );
+ content.append( "</project>\n" );
+ write( dir, content.toString() );
+ }
+
+
+ private void createReactorBuild( File dir )
+ throws IOException
+ {
+ StringBuffer content = new StringBuffer( 500 );
+ content.append( "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" );
+ content.append( "<project name=\"maven-migrate\" default=\"default\"
basedir=\".\"\n" );
+ content.append( " xmlns:magic=\"antlib:net.dpml.magic\">\n" );
+ content.append( "\n" );
+ content.append( " <magic:import
uri=\"artifact:template:dpml/magic/reactor\"/>\n" );
+ content.append( "\n" );
+ content.append( "</project>\n" );
+ write( dir, content.toString() );
+ }

- public void migrate(org.apache.maven.project.Project proj,
- String dpml) {
- }
-
- public void createDpml(org.apache.maven.project.Project proj,
- String dpml) {
- System.out.println("Project:" + proj.getName());
- System.out.println("DPML_HOME=" + dpml);
- if (dpml == null) {
- dpml = System.getProperty("user.home" + "/.dpml");
- }
- System.out.println("dpml = " + dpml);
- java.io.File dpml_home = new java.io.File(dpml);
- dpml_home.mkdirs();
-
- java.io.File bindir = new java.io.File(dpml_home, "bin");
- bindir.mkdirs();
-
- java.io.File transitdir = new java.io.File(dpml_home,
"transit/authority");
- transitdir.mkdirs();
-
- java.io.File cachedir = new java.io.File(dpml_home, "main");
- cachedir.mkdirs();
-
- java.io.File docsdir = new java.io.File(dpml_home, "docs");
- docsdir.mkdirs();
-
- String magicPath = proj.getDependencyPath("dpml-magic");
- System.out.println("Magic path=" + magicPath);
-
- String transitPath = proj.getDependencyPath("dpml-transit");
- System.out.println("Transit path=" + transitPath);
-
-
- }
-
- public void createBuilds(org.apache.maven.project.Project proj,
- String dpml)
- throws java.io.IOException, org.apache.maven.MavenException {
- java.io.File cwd = new java.io.File(".");
- processDir(cwd);
- }
-
- /**
- * Create build and index file recursuvely from the given base dir.
- *
- * @param basedir the base directory.
- * @throws java.io.IOException if and IO error occured.
- * @throws org.apache.maven.MavenException
- * if a maven error occured.
- */
- public void createBuilds(final java.io.File basedir) throws
java.io.IOException, org.apache.maven.MavenException {
- processDir(basedir);
- }
-
- /**
- * Process the current directory. Here we get a list of all the entries
in the current directory.
- * If the current entry contains a project.xml file, then we create a
standard build.xml and an index.xml.
- * Otherwise we create a reactor build.xml file and dive into that entry
and repeat the above process.
- *
- * @param basedir the base directory.
- * @throws java.io.IOException if an IO error occured.
- * @throws org.apache.maven.MavenException
- * if a maven error occured.
- */
- private void processDir(java.io.File basedir)
- throws java.io.IOException, org.apache.maven.MavenException {
- java.io.File[] entries = basedir.listFiles();
- if (isProjectDir(entries)) {
- final org.apache.maven.project.Project mavenProject =
getMavenProject(basedir);
- createStandardBuild(basedir, mavenProject);
- createStandardIndex(basedir, mavenProject);
- } else {
- createReactorBuild(basedir);
- recurse(entries);
- }
- }
-
- /**
- * Create index.xml file.
- *
- * @param basedir the base directory.
- * @param project the maven project.
- */
- private void createStandardIndex(java.io.File basedir,
org.apache.maven.project.Project project) throws java.io.IOException {
-
- final org.dom4j.Document document =
org.dom4j.DocumentHelper.createDocument();
- final org.dom4j.Element index = document.addElement("index");
- // importMetroModule(index);
- createProject(index, project);
- writeIndexDotXml(basedir, document);
- }
-
- private org.apache.maven.project.Project getMavenProject(java.io.File
basedir) throws org.apache.maven.MavenException {
- final java.io.File mavenFile = new java.io.File(basedir, "project.xml");
// Create file with parent file, or NPE will be thrown.
- return org.apache.maven.MavenUtils.getProject(mavenFile, null, false);
- }
-
- /**
- * Write a document to index.xml.
- *
- * @param basedir where to write the file.
- * @param document the document to write.
- * @throws java.io.IOException if IO error occured.
- */
- private void writeIndexDotXml(java.io.File basedir, org.dom4j.Document
document) throws java.io.IOException {
- final java.io.FileWriter fileWriter = new java.io.FileWriter(new
java.io.File(basedir, "index.xml"));
- try {
- final org.dom4j.io.OutputFormat outputFormat =
org.dom4j.io.OutputFormat.createPrettyPrint();
- outputFormat.setEncoding("ISO-8859-1");
- final org.dom4j.io.XMLWriter xmlWriter = new
org.dom4j.io.XMLWriter(fileWriter, outputFormat);
- xmlWriter.write(document);
- xmlWriter.flush();
- } finally {
- fileWriter.close();
- }
- }
-
- /**
- * Create the project tag.
- *
- * @param index the index element.
- * @param project the maven project.
- */
- private void createProject(org.dom4j.Element index,
org.apache.maven.project.Project project) {
- addResources(index, project);
- final org.dom4j.Element projectElement = index.addElement("project");
- projectElement.addAttribute("basedir", ".");
- final org.dom4j.Element infoElement = projectElement.addElement("info");
- infoElement.addElement("group").addText(project.getGroupId());
- infoElement.addElement("name").addText(project.getName());
- infoElement.addElement("version").addText(project.getCurrentVersion());
- addDependencies(projectElement, project);
- }
-
- /**
- * Add the project dependencies.
- *
- * @param projectElement the project element.
- * @param project the maven project.
- */
- private void addDependencies(org.dom4j.Element projectElement,
org.apache.maven.project.Project project) {
- final org.dom4j.Element dependenciesElement =
projectElement.addElement("dependencies");
- final java.util.List list = project.getDependencies();
- final int size = list.size();
- for (int i = 0; i < size; i++) {
- final org.apache.maven.project.Dependency dependency =
(org.apache.maven.project.Dependency) list.get(i);
- final org.dom4j.Element dependencyElement =
dependenciesElement.addElement("dependency");
- dependencyElement.addAttribute("key", dependency.getArtifactId());
- // Handle special case if artifactId is junit
- if ("junit".equals(dependency.getArtifactId())) {
- dependencyElement.addAttribute("test",
"true").addAttribute("runtime", "false");
- }
- }
- }
-
- /**
- * Add the project resources.
- *
- * @param index the index element.
- * @param project the maven project.
- */
- private void addResources(org.dom4j.Element index,
org.apache.maven.project.Project project) {
- final java.util.List list = project.getDependencies();
- int size = list.size();
- for (int i = 0; i < size; i++) {
- final org.apache.maven.project.Dependency dependency =
(org.apache.maven.project.Dependency) list.get(i);
- final org.dom4j.Element infoElement =
index.addElement("resource").addElement("info");
- infoElement.addElement("group").addText(dependency.getGroupId());
- infoElement.addElement("name").addText(dependency.getArtifactId());
- infoElement.addElement("version").addText(dependency.getVersion());
- infoElement.addElement("type").addText(dependency.getType());
- }
- }
-
- /**
- * import metro module tag.
- *
- * @param indexElement the index element.
- */
- private void importMetroModule(org.dom4j.Element indexElement) {
- indexElement.addElement("import").addAttribute("uri",
"artifact:module:dpml/metro/dpml-metro#SNAPSHOT");
- }
-
- private void recurse(java.io.File[] entries) throws java.io.IOException,
org.apache.maven.MavenException {
- for (int i = 0; i < entries.length; i++)
- processDir(entries[i]);
- }
-
- /**
- * Check if the directory contains a 'src' entry..
- *
- * @param files array of files.
- * @return true if one of the entries is 'src', false otherwise.
- */
- private boolean isProjectDir(java.io.File[] files) {
- boolean foundProjectDotXml = false;
- for (int i = 0; i < files.length; i++) {
- if ("src".equals(files[i].getName())) {
- foundProjectDotXml = true;
- break;
- }
- }
- return foundProjectDotXml;
- }
-
-
- /**
- * <project name="dpml-tutorial-hello" default="install" basedir="."
- * xmlns:magic="antlib:net.dpml.magic"
xmlns:x="plugin:dpml/magic/dpml-magic-core" >
- * <p/>
- * <magic:import uri="artifact:template:dpml/magic/standard"/>
- * <p/>
- * <target name="build" depends="standard.build">
- * <x:block name="tutorial" embed="MAIN">
- * <x:component name="hello" class="tutorial.HelloComponent"/>
- * </x:block>
- * </target>
- * <p/>
- * </project>
- */
- private void createStandardBuild(java.io.File dir,
org.apache.maven.project.Project mavenProject)
- throws java.io.IOException {
- StringBuffer content = new StringBuffer(500);
- content.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
- content.append("<project name=\"" + mavenProject.getName() + "\"
default=\"install\" basedir=\".\"\n");
- content.append(" xmlns:magic=\"antlib:net.dpml.magic\">\n");
- content.append("\n");
- content.append(" <magic:import
uri=\"artifact:template:dpml/magic/standard\"/>\n");
- content.append("\n");
- content.append("</project>\n");
- write(dir, content.toString());
- }
-
-
- private void createReactorBuild(java.io.File dir)
- throws java.io.IOException {
- StringBuffer content = new StringBuffer(500);
- content.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
- content.append("<project name=\"maven-migrate\" default=\"default\"
basedir=\".\"\n");
- content.append(" xmlns:magic=\"antlib:net.dpml.magic\">\n");
- content.append("\n");
- content.append(" <magic:import
uri=\"artifact:template:dpml/magic/reactor\"/>\n");
- content.append("\n");
- content.append("</project>\n");
- write(dir, content.toString());
- }
-
- /**
- * Write the content of a string to a file.
- *
- * @param dir where to write the file.
- * @param content the content to write.
- * @throws FileExistsException if the file already exists.
- * @throws java.io.IOException if cannot write the file.
- */
- private void write(java.io.File dir,
- String content)
- throws FileExistsException, java.io.IOException {
- java.io.File f = new java.io.File(dir, "build.xml");
- if (f.exists()) {
- throw new FileExistsException(f);
- }
- final java.io.FileOutputStream fos = new java.io.FileOutputStream(f);
- try {
- java.io.OutputStreamWriter osw = new java.io.OutputStreamWriter(fos,
"UTF-8");
- java.io.BufferedWriter writer = new java.io.BufferedWriter(osw);
- writer.write(content);
- writer.flush();
- writer.close();
- } finally {
- fos.close();
+ /**
+ * Write the content of a string to a file.
+ *
+ * @param dir where to write the file.
+ * @param content the content to write.
+ * @throws FileExistsException if the file already exists.
+ * @throws IOException if cannot write the file.
+ */
+ private void write(
+ File dir,
+ String content
+ )
+ throws FileExistsException, IOException
+ {
+ File f = new File( dir, "build.xml" );
+ if( f.exists() )
+ {
+ throw new FileExistsException( f );
+ }
+ FileOutputStream fos = new FileOutputStream( f );
+ try
+ {
+ OutputStreamWriter osw = new OutputStreamWriter( fos, "UTF-8" );
+ BufferedWriter writer = new BufferedWriter( osw );
+ writer.write( content );
+ writer.flush();
+ writer.close();
+ }
+ finally
+ {
+ fos.close();
+ }
}
- }

}
\ No newline at end of file

Modified:
development/laboratory/maven/magic-migrate/src/test/net/dpml/magic/maven/migrate/MigateTest.java
==============================================================================
---
development/laboratory/maven/magic-migrate/src/test/net/dpml/magic/maven/migrate/MigateTest.java
(original)
+++
development/laboratory/maven/magic-migrate/src/test/net/dpml/magic/maven/migrate/MigateTest.java
Fri Jan 7 05:37:51 2005
@@ -1,17 +1,44 @@
+/*
+ Copyright 2004 Stephen J McConnell
+ Copyright 2004 Niclas Hedhman
+
+ 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.
+ */
package net.dpml.magic.maven.migrate;

+import junit.framework.TestCase;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+import org.apache.maven.MavenException;
+
/**
* @author <a href="mailto:mraad AT e-iit.com";>mansour</a>
- * @version $Revision$ $Date$
*/
public class MigateTest
- extends junit.framework.TestCase {
+ extends TestCase
+{

- public void testMigrate() throws java.net.URISyntaxException,
org.apache.maven.MavenException, java.io.IOException {
- final Migrate migrate = new Migrate();
- final java.io.File basedir = new java.io.File(".");
+ public void testMigrate() throws URISyntaxException, MavenException,
IOException
+ {
+ final Migrate migrate = new Migrate();
+ final File basedir = new File( "." );
/*
- final java.io.File mavenFile = new java.io.File(basedir, "project.xml");
// Create file with parent file, or NPE will be thrown.
+ final File mavenFile = new File(basedir, "project.xml"); // Create file
with parent file, or NPE will be thrown.
final org.apache.maven.project.Project project =
org.apache.maven.MavenUtils.getProject(mavenFile, null, false);
migrate.createBuilds(project, null);
final java.util.List list = project.getDependencies();
@@ -20,6 +47,6 @@
System.out.println(dependency.getGroupId()+"
"+dependency.getArtifact()+" "+dependency.getVersion());
}
*/
- migrate.createBuilds(basedir);
- }
+ migrate.createBuilds( basedir );
+ }
}
\ No newline at end of file



  • svn commit: r1399 - in development/laboratory/maven/magic-migrate/src: main/net/dpml/magic/maven/migrate test/net/dpml/magic/maven/migrate, mraad23, 01/06/2005

Archive powered by MHonArc 2.6.24.

Top of Page