jvanzyl 2002/07/17 14:33:25
Added: src/test/java/org/apache/maven/project
ProjectInheritenceTest.java
Log:
o Test for the POM extension mechanism.
Revision Changes Path
1.1
jakarta-turbine-maven/src/test/java/org/apache/maven/project/ProjectInheritenceTest.java
Index: ProjectInheritenceTest.java
===================================================================
package org.apache.maven.project;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Maven" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Maven", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.apache.commons.lang.Strings;
import org.apache.maven.MavenUtils;
import org.apache.maven.TestConstantsTest;
public class ProjectInheritenceTest
extends TestCase
{
private String TEST_DOCUMENT = null;
private static String TEST_CLASS =
"org.apache.maven.project.Project";
public ProjectInheritenceTest(String testName)
{
super(testName);
}
public static Test suite()
{
return new TestSuite(ProjectInheritenceTest.class);
}
protected void setUp() throws Exception
{
super.setUp();
String baseDir = System.getProperty("basedir");
assertNotNull("The system property basedir was not defined.", baseDir);
String fs = System.getProperty("file.separator");
assertNotNull("The system property file.separator was not defined.", fs);
TEST_DOCUMENT = baseDir+"/src/test/extend/project-child.xml";
}
public void testProjectMapping() throws Exception
{
Project p = MavenUtils.getProject(TEST_DOCUMENT);
assertEquals("Super Extendo",p.getName());
assertEquals("super-extendo", p.getId());
assertEquals("Apache Software Foundation", p.getOrganization().getName());
assertEquals("http://jakarta.apache.org/", p.getOrganization().getUrl());
assertEquals("http://jakarta.apache.org/turbine/maven/",p.getUrl());
assertEquals("http://nagoya.apache.org/scarab/servlet/scarab/",p.getIssueTrackingUrl());
assertEquals("1.0-b5-dev", p.getCurrentVersion());
// Test Repository Info
assertEquals("http://cvs.apache.org/viewcvs/jakarta-turbine-maven/",
p.getRepository().getUrl());
assertEquals(":pserver:[EMAIL PROTECTED]:/home/cvspublic",
p.getRepository().getCvsRoot());
assertEquals("jakarta-turbine-maven", p.getRepository().getCvsModule());
// Test Mailing List info
assertEquals("Maven User List",
((MailingList)p.getMailingLists().get(0)).getName());
assertEquals("[EMAIL PROTECTED]",
((MailingList)p.getMailingLists().get(0)).getSubscribe());
assertEquals("[EMAIL PROTECTED]",
((MailingList)p.getMailingLists().get(0)).getUnsubscribe());
// Test Developer List info
assertEquals("Juancarlo Anez",
((Developer)p.getDevelopers().get(0)).getName());
assertEquals("[EMAIL PROTECTED]",
((Developer)p.getDevelopers().get(0)).getEmail());
// Test Contributor List info
assertEquals("Nathan Coast",
((Contributor)p.getContributors().get(0)).getName());
assertEquals("[EMAIL PROTECTED]",
((Contributor)p.getContributors().get(0)).getEmail());
// Test Dependencies
assertEquals("dom4j",
((Dependency)p.getDependencies().get(0)).getId());
assertEquals("1.4-dev-3",
((Dependency)p.getDependencies().get(0)).getVersion());
// This is synthesized
assertEquals("dom4j-1.4-dev-3.jar",
((Dependency)p.getDependencies().get(0)).getJar());
assertEquals("http://www.dom4j.org/",
((Dependency)p.getDependencies().get(0)).getUrl());
// Test Source Directories
assertEquals("src/java", p.getBuild().getSourceDirectory());
// Test Aspect Source Directories
//assertEquals("src/aspect", p.getBuild().getAspectSourceDirectory());
// Test Test Source Directories ;-)
assertEquals("src/test/java", p.getBuild().getUnitTestSourceDirectory());
String iuSrc = p.getBuild().getIntegrationUnitTestSourceDirectory();
assertTrue("Should be empty in maven's project descriptor: ["+iuSrc+"]",
Strings.isEmpty(iuSrc));
// Test Versions
Version v0 = (Version) p.getVersions().get(0);
assertEquals("b1", v0.getId());
assertEquals("1.0-b1", v0.getName());
assertEquals("MAVEN_1_0_B1", v0.getTag());
// Test the version map
Version v4 = (Version) p.getVersionById("b4");
assertEquals("b4", v4.getId());
assertEquals("1.0-b4", v4.getName());
assertEquals("MAVEN_1_0_B4", v4.getTag());
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>