You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2010/04/09 22:33:13 UTC
svn commit: r932582 - in /maven/archetype/trunk/archetype-common/src/test:
java/org/apache/maven/archetype/source/CatalogArchetypeDataSinkTest.java
java/org/apache/maven/archetype/source/WikiArchetypeDataSourceTest.java
sources/wiki/wiki-source.txt
Author: hboutemy
Date: Fri Apr 9 20:33:13 2010
New Revision: 932582
URL: http://svn.apache.org/viewvc?rev=932582&view=rev
Log:
test refactoring
Modified:
maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/source/CatalogArchetypeDataSinkTest.java
maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/source/WikiArchetypeDataSourceTest.java
maven/archetype/trunk/archetype-common/src/test/sources/wiki/wiki-source.txt
Modified: maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/source/CatalogArchetypeDataSinkTest.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/source/CatalogArchetypeDataSinkTest.java?rev=932582&r1=932581&r2=932582&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/source/CatalogArchetypeDataSinkTest.java (original)
+++ maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/source/CatalogArchetypeDataSinkTest.java Fri Apr 9 20:33:13 2010
@@ -5,13 +5,11 @@ import org.apache.maven.archetype.catalo
import org.apache.maven.archetype.catalog.io.xpp3.ArchetypeCatalogXpp3Reader;
import org.codehaus.plexus.PlexusTestCase;
-import java.io.File;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
-import java.util.Properties;
/** @author Jason van Zyl */
public class CatalogArchetypeDataSinkTest
@@ -60,32 +58,4 @@ public class CatalogArchetypeDataSinkTes
assertEquals( "http://magicbunny.com/maven2", a1.getRepository() );
}
-
- public void testPuttingTheWikiSourceIntoACatalogSink()
- throws Exception
- {
- Writer writer = new StringWriter();
-
- ArchetypeDataSink sink = new CatalogArchetypeDataSink();
-
- Properties p = new Properties();
-
- File wikiSource = new File( getBasedir(), "src/test/sources/wiki/wiki-source.txt" );
-
- assertTrue( wikiSource.exists() );
-
- ArchetypeDataSource ads = new InternalCatalogArchetypeDataSource();
-
- sink.putArchetypes( ads, p, writer );
-
- StringReader reader = new StringReader( writer.toString() );
-
- ArchetypeCatalogXpp3Reader catalogReader = new ArchetypeCatalogXpp3Reader();
-
- ArchetypeCatalog catalog = catalogReader.read( reader );
-
- int catalogSize = catalog.getArchetypes().size();
-
- assertEquals( WikiArchetypeDataSourceTest.ARCHETYPES_COUNT, catalogSize );
- }
}
Modified: maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/source/WikiArchetypeDataSourceTest.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/source/WikiArchetypeDataSourceTest.java?rev=932582&r1=932581&r2=932582&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/source/WikiArchetypeDataSourceTest.java (original)
+++ maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/source/WikiArchetypeDataSourceTest.java Fri Apr 9 20:33:13 2010
@@ -1,29 +1,77 @@
package org.apache.maven.archetype.source;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.maven.archetype.catalog.Archetype;
+import org.apache.maven.archetype.catalog.ArchetypeCatalog;
+import org.apache.maven.archetype.test.WikiArchetypeDataSource;
import org.codehaus.plexus.PlexusTestCase;
-import java.util.List;
+import java.io.File;
import java.util.Properties;
-import org.apache.maven.archetype.ArchetypeManager;
/** @author Jason van Zyl */
public class WikiArchetypeDataSourceTest
extends PlexusTestCase
{
- static final int ARCHETYPES_COUNT = 58;
+ private static final String[][] REFERENCE =
+ {
+ { "appfuse-basic-jsf", "org.appfuse.archetypes", "2.0", "http://static.appfuse.org/releases",
+ "AppFuse archetype for creating a web application with Hibernate, Spring and JSF" },
+ { "maven-archetype-profiles", "org.apache.maven.archetypes", "RELEASE", "http://repo1.maven.org/maven2", "" },
+ { "struts2-archetype-starter", "org.apache.struts", "2.0.9-SNAPSHOT",
+ "http://people.apache.org/repo/m2-snapshot-repository",
+ "A starter Struts 2 application with Sitemesh, DWR, and Spring" },
+ { "maven-archetype-har", "net.sf.maven-har", "0.9", "", "Hibernate Archive" },
+ { "maven-archetype-archetype", "org.apache.maven.archetypes", "RELEASE", "", "" }
+ };
public void testWikiArchetypeDataSource()
throws Exception
{
+ File wikiSource = new File( getBasedir(), "src/test/sources/wiki/wiki-source.txt" );
+
+ assertTrue( wikiSource.exists() );
+
Properties p = new Properties();
- ArchetypeDataSource ads = new InternalCatalogArchetypeDataSource();
- List archetypes = ads.getArchetypeCatalog( p ).getArchetypes();
+ p.put( "url", wikiSource.toURL().toExternalForm() );
+
+ ArchetypeDataSource ads = new WikiArchetypeDataSource();
+
+ ArchetypeCatalog catalog = ads.getArchetypeCatalog( p );
+
+ int catalogSize = catalog.getArchetypes().size();
+
+ assertEquals( REFERENCE.length, catalogSize );
- assertEquals( ARCHETYPES_COUNT, archetypes.size() );
+ for ( int i = 0; i < catalogSize; i++ )
+ {
+ String[] reference = REFERENCE[i];
- ArchetypeManager a = (ArchetypeManager) lookup( ArchetypeManager.class.getName() );
- archetypes = a.getInternalCatalog().getArchetypes();
+ Archetype ar = (Archetype) catalog.getArchetypes().get( i );
- assertEquals( ARCHETYPES_COUNT, archetypes.size() );
+ assertEquals( "#" + i + " artifactId", reference[0], ar.getArtifactId() );
+ assertEquals( "#" + i + " groupId", reference[1], ar.getGroupId() );
+ assertEquals( "#" + i + " version", reference[2], ar.getVersion() );
+ assertEquals( "#" + i + " repository", reference[3], ar.getRepository() );
+ assertEquals( "#" + i + " description", reference[4], ar.getDescription() );
+ }
}
}
Modified: maven/archetype/trunk/archetype-common/src/test/sources/wiki/wiki-source.txt
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/test/sources/wiki/wiki-source.txt?rev=932582&r1=932581&r2=932582&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/test/sources/wiki/wiki-source.txt (original)
+++ maven/archetype/trunk/archetype-common/src/test/sources/wiki/wiki-source.txt Fri Apr 9 20:33:13 2010
@@ -3,7 +3,7 @@
<head>
<title>View Source - Codehaus</title>
-
+
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<script language="javascript">
@@ -12,16 +12,16 @@
</script>
<link rel="stylesheet" href="/s/811/1/3/_/styles/main-action.css" type="text/css" />
-
+
<meta name="robots" content="noindex,nofollow">
<meta name="robots" content="noarchive">
<link rel="shortcut icon" href="/images/icons/favicon.ico">
<link rel="icon" type="image/png" href="/images/icons/favicon.png">
-
+
<script type="text/javascript" src="/s/811/1/_/decorators/effects.js"></script>
-
-
+
+
</head>
<body onload="placeFocus()">
@@ -55,42 +55,10 @@
<br>A quick reference of available archetypes and their repositories. This list is designed so it can be automatically retrieved from archetype front-ends such as Archy - [http://code.google.com/p/archy]. Only archetypes that don't have any "released" artifacts need a version number.
<br>|| Artifact || Group || Version || Repository || Description ||
<br>| appfuse-basic-jsf | org.appfuse.archetypes | 2.0 | [http://static.appfuse.org/releases] | AppFuse archetype for creating a web application with Hibernate, Spring and JSF |
-<br>| appfuse-basic-spring | org.appfuse.archetypes | 2.0 | [http://static.appfuse.org/releases] | AppFuse archetype for creating a web application with Hibernate, Spring and Spring MVC |
-<br>| appfuse-basic-struts | org.appfuse.archetypes | 2.0 | [http://static.appfuse.org/releases] | AppFuse archetype for creating a web application with Hibernate, Spring and Struts 2 |
-<br>| appfuse-basic-tapestry | org.appfuse.archetypes | 2.0 | [http://static.appfuse.org/releases] | AppFuse archetype for creating a web application with Hibernate, Spring and Tapestry 4 |
-<br>| appfuse-core | org.appfuse.archetypes | 2.0 | [http://static.appfuse.org/releases] | AppFuse archetype for creating a jar application with Hibernate and Spring and XFire |
-<br>| appfuse-modular-jsf | org.appfuse.archetypes | 2.0 | [http://static.appfuse.org/releases] | AppFuse archetype for creating a modular application with Hibernate, Spring and JSF |
-<br>| appfuse-modular-spring | org.appfuse.archetypes | 2.0 | [http://static.appfuse.org/releases] | AppFuse archetype for creating a modular application with Hibernate, Spring and Spring MVC |
-<br>| appfuse-modular-struts | org.appfuse.archetypes | 2.0 | [http://static.appfuse.org/releases] | AppFuse archetype for creating a modular application with Hibernate, Spring and Struts 2 |
-<br>| appfuse-modular-tapestry | org.appfuse.archetypes | 2.0 | [http://static.appfuse.org/releases] | AppFuse archetype for creating a modular application with Hibernate, Spring and Tapestry 4 |
-<br>| maven-archetype-j2ee-simple | org.apache.maven.archetypes | | [http://repo1.maven.org/maven2] | A simple J2EE Java application |
-<br>| maven-archetype-marmalade-mojo | org.apache.maven.archetypes | | [http://repo1.maven.org/maven2] | A Maven plugin development project using marmalade |
-<br>| maven-archetype-mojo | org.apache.maven.archetypes | | [http://repo1.maven.org/maven2] | A Maven Java plugin development project |
-<br>| maven-archetype-portlet | org.apache.maven.archetypes | | [http://repo1.maven.org/maven2] | A simple portlet application |
<br>| maven-archetype-profiles | org.apache.maven.archetypes | | [http://repo1.maven.org/maven2] | |
-<br>| maven-archetype-quickstart | org.apache.maven.archetypes | | [http://repo1.maven.org/maven2] | |
-<br>| maven-archetype-simple | org.apache.maven.archetypes | | [http://repo1.maven.org/maven2] | |
-<br>| maven-archetype-site-simple | org.apache.maven.archetypes | | [http://repo1.maven.org/maven2] | A simple site generation project |
-<br>| maven-archetype-site | org.apache.maven.archetypes | | [http://repo1.maven.org/maven2] | A more complex site project |
-<br>| maven-archetype-webapp | org.apache.maven.archetypes | | [http://repo1.maven.org/maven2] | A simple Java web application |
<br>| struts2-archetype-starter | org.apache.struts | 2.0.9-SNAPSHOT | [http://people.apache.org/repo/m2-snapshot-repository] | A starter Struts 2 application with Sitemesh, DWR, and Spring |
-<br>| struts2-archetype-blank | org.apache.struts | 2.0.9-SNAPSHOT | [http://people.apache.org/repo/m2-snapshot-repository] | A minimal Struts 2 application |
-<br>| struts2-archetype-portlet | org.apache.struts | 2.0.9-SNAPSHOT | [http://people.apache.org/repo/m2-snapshot-repository] | A minimal Struts 2 application that can be deployed as a portlet |
-<br>| struts2-archetype-dbportlet | org.apache.struts | 2.0.9-SNAPSHOT | [http://people.apache.org/repo/m2-snapshot-repository] | A starter Struts 2 portlet that demonstrates a simple CRUD interface with db backing |
-<br>| struts2-archetype-plugin | org.apache.struts | 2.0.9-SNAPSHOT | [http://people.apache.org/repo/m2-snapshot-repository] | A Struts 2 plugin |
-<br>| shale-archetype-blank | org.apache.shale | 1.0.3-SNAPSHOT | [http://people.apache.org/repo/m2-snapshot-repository] | A blank Shale web application with JSF |
-<br>| maven-adf-archetype | org.apache.myfaces.adfbuild | 1.0-SNAPSHOT | [http://people.apache.org/repo/m2-snapshot-repository] | Archetype to ease the burden of creating a new application based with ADF |
-<br>| data-app | net.databinder | 0.4 | [http://repo1.maven.org/maven2] | A new Databinder application with sources and resources. |
-<br>| jini-service-archetype | org.jini.maven-jini-plugin | 2.0 | [http://repo1.maven.org/maven2] | Archetype for Jini service project creation |
-<br>| softeu-archetype-seam | org.apache.maven.archetypes | | [http://maven.softeu.cz/] | JSF+Facelets+Seam Archetype |
-<br>| softeu-archetype-seam-simple | org.apache.maven.archetypes | | [http://maven.softeu.cz/] | JSF+Facelets+Seam (no persistence) Archetype |
-<br>| softeu-archetype-jsf | org.apache.maven.archetypes | | [http://maven.softeu.cz/] | JSF+Facelets Archetype |
-<br>| jpa-maven-archetype | com.rfc.maven.archetypes | | [http://maven.rodcoffin.com/repo] | JPA application |
-<br>| spring-osgi-bundle-archetype | org.springframework.osgi | 1.0-m3-SNAPSHOT | [http://static.springframework.org/maven2-snapshots] | Spring-OSGi archetype |
-<br>| confluence-plugin-archetype | com.atlassian.maven.archetypes | | [http://repository.atlassian.com/maven2] | Atlassian Confluence plugin archetype |
-<br>| maven-archetype-har | net.sf.maven-har | 0.9 | [http://repo1.maven.org/maven2] | Hibernate Archive |
-<br>| maven-archetype-sar | net.sf.maven-sar | 0.9 | [http://repo1.maven.org/maven2] | JBoss Service Archive |
-<br>| wicket-archetype-quickstart | org.apache.wicket | 1.3.0-beta3 | [http://repo1.maven.org/maven2] | A simple Apache Wicket project |
+<br>| maven-archetype-har | net.sf.maven-har | 0.9 | | [Hibernate|http://hibernate.org] Archive |
+<br>| maven-archetype-archetype | org.apache.maven.archetypes | | | |
<br>
<br>h3. Additional Information
<br>