maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1143433 - /maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/ArchetypeCatalogsTest.java
Date Wed, 06 Jul 2011 14:26:47 GMT
Author: olamy
Date: Wed Jul  6 14:26:47 2011
New Revision: 1143433

URL: http://svn.apache.org/viewvc?rev=1143433&view=rev
Log:
code cleanup and formatting

Modified:
    maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/ArchetypeCatalogsTest.java

Modified: maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/ArchetypeCatalogsTest.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/ArchetypeCatalogsTest.java?rev=1143433&r1=1143432&r2=1143433&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/ArchetypeCatalogsTest.java
(original)
+++ maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/ArchetypeCatalogsTest.java
Wed Jul  6 14:26:47 2011
@@ -17,30 +17,19 @@ package org.apache.maven.archetype;
  *  under the License.
  */
 
-import java.io.File;
-import java.io.FileWriter;
-import java.io.Writer;
-import java.net.URL;
 import org.apache.commons.io.IOUtils;
 import org.apache.maven.archetype.catalog.Archetype;
 import org.apache.maven.archetype.catalog.ArchetypeCatalog;
 import org.apache.maven.archetype.catalog.io.xpp3.ArchetypeCatalogXpp3Writer;
-import org.codehaus.cargo.container.deployable.DeployableType;
-import org.codehaus.cargo.container.deployable.WAR;
-import org.codehaus.cargo.container.deployer.Deployer;
-import org.codehaus.cargo.container.deployer.URLDeployableMonitor;
-import org.codehaus.cargo.container.jetty.Jetty6xEmbeddedLocalContainer;
-import org.codehaus.cargo.container.jetty.Jetty6xEmbeddedLocalDeployer;
-import org.codehaus.cargo.container.jetty.Jetty6xEmbeddedStandaloneLocalConfiguration;
-import org.codehaus.cargo.container.property.ServletPropertySet;
-import org.codehaus.cargo.generic.deployable.DefaultDeployableFactory;
-import org.codehaus.cargo.generic.deployable.DeployableFactory;
 import org.codehaus.plexus.PlexusTestCase;
 import org.mortbay.jetty.Server;
 import org.mortbay.jetty.webapp.WebAppContext;
 
+import java.io.File;
+import java.io.FileWriter;
+import java.io.Writer;
+
 /**
- *
  * @author rafale
  */
 public class ArchetypeCatalogsTest
@@ -52,13 +41,14 @@ public class ArchetypeCatalogsTest
 
         ArchetypeManager archetype = (ArchetypeManager) lookup( ArchetypeManager.class.getName()
);
 
-        ArchetypeCatalog result = archetype.getRemoteCatalog( "http://localhost:"+ port +
"/repo/" );
+        ArchetypeCatalog result = archetype.getRemoteCatalog( "http://localhost:" + port
+ "/repo/" );
 
         assertEquals( 1, result.getArchetypes().size() );
         assertEquals( "groupId", ( (Archetype) result.getArchetypes().get( 0 ) ).getGroupId()
);
         assertEquals( "artifactId", ( (Archetype) result.getArchetypes().get( 0 ) ).getArtifactId()
);
         assertEquals( "1", ( (Archetype) result.getArchetypes().get( 0 ) ).getVersion() );
-        assertEquals( "http://localhost:"+ port + "/repo/", ( (Archetype) result.getArchetypes().get(
0 ) ).getRepository() );
+        assertEquals( "http://localhost:" + port + "/repo/",
+                      ( (Archetype) result.getArchetypes().get( 0 ) ).getRepository() );
     }
 
     public void testLocalCatalog()
@@ -67,17 +57,18 @@ public class ArchetypeCatalogsTest
 
         ArchetypeManager archetype = (ArchetypeManager) lookup( ArchetypeManager.class.getName()
);
 
-        ArchetypeCatalog result = archetype.getLocalCatalog( getTestFile( "target/test-classes/repositories/test-catalog"
).
-            getAbsolutePath() );
+        ArchetypeCatalog result =
+            archetype.getLocalCatalog( getTestFile( "target/test-classes/repositories/test-catalog"
).
+                getAbsolutePath() );
 
         assertEquals( 1, result.getArchetypes().size() );
         assertEquals( "groupId", ( (Archetype) result.getArchetypes().get( 0 ) ).getGroupId()
);
         assertEquals( "artifactId", ( (Archetype) result.getArchetypes().get( 0 ) ).getArtifactId()
);
         assertEquals( "1", ( (Archetype) result.getArchetypes().get( 0 ) ).getVersion() );
-        assertEquals( "http://localhost:"+ port + "/repo/", ( (Archetype) result.getArchetypes().get(
0 ) ).getRepository() );
+        assertEquals( "http://localhost:" + port + "/repo/",
+                      ( (Archetype) result.getArchetypes().get( 0 ) ).getRepository() );
     }
 
-    //private Jetty6xEmbeddedLocalContainer cargo;
 
     private Server server;
 
@@ -87,24 +78,22 @@ public class ArchetypeCatalogsTest
         throws Exception
     {
         super.setUp();
-        //        Start Cargo
 
         System.setProperty( "org.apache.maven.archetype.repository.directory",
-            getTestPath( "target/test-classes/repositories/test-catalog" ) );
+                            getTestPath( "target/test-classes/repositories/test-catalog"
) );
 
+        // Start Jetty
         server = new Server( 0 );
 
-
         WebAppContext webapp = new WebAppContext();
-        webapp.setContextPath("/repo");
-        webapp.setWar("target/wars/archetype-repository.war");
-        server.setHandler(webapp);
+        webapp.setContextPath( "/repo" );
+        webapp.setWar( "target/wars/archetype-repository.war" );
+        server.setHandler( webapp );
 
         server.start();
 
         port = server.getConnectors()[0].getLocalPort();
 
-
         File catalogDirectory = getTestFile( "target/test-classes/repositories/test-catalog"
);
         catalogDirectory.mkdirs();
 
@@ -115,7 +104,7 @@ public class ArchetypeCatalogsTest
         generatedArchetype.setGroupId( "groupId" );
         generatedArchetype.setArtifactId( "artifactId" );
         generatedArchetype.setVersion( "1" );
-        generatedArchetype.setRepository( "http://localhost:"+ port + "/repo/" );
+        generatedArchetype.setRepository( "http://localhost:" + port + "/repo/" );
         catalog.addArchetype( generatedArchetype );
 
         File catalogFile = new File( catalogDirectory, "archetype-catalog.xml" );
@@ -123,37 +112,13 @@ public class ArchetypeCatalogsTest
         Writer writer = new FileWriter( catalogFile );
         catalogWriter.write( writer, catalog );
         IOUtils.closeQuietly( writer );
-
-
-
-
-
-
-        /*
-
-
-
-        DeployableFactory factory = new DefaultDeployableFactory();
-        WAR war = (WAR) factory.createDeployable( Jetty6xEmbeddedLocalContainer.ID,
-            "target/wars/archetype-repository.war",
-            DeployableType.WAR );
-
-        war.setContext( "/repo" );
-
-        Deployer deployer = new Jetty6xEmbeddedLocalDeployer( cargo );
-        deployer.deploy( war,
-            new URLDeployableMonitor( new URL( "http://localhost:" + port + "/repo/dummy"
) ) );
-        deployer.start( war );
-
-        */
     }
 
     protected void tearDown()
         throws Exception
     {
         super.tearDown();
-        //        Stop Cargo
+        // Stop Jetty
         server.stop();
-        //cargo.stop();
     }
 }



Mime
View raw message