Checkstyle fixes: code reformatting, package.html, javadocs.
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@413935 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
251907e813
commit
b2a440a8d9
@ -35,12 +35,16 @@ public class DistributionArtifactTypeHandler implements ArtifactTypeHandler
|
|||||||
* @param project the project for the artifact
|
* @param project the project for the artifact
|
||||||
* @param type The type of the artifact
|
* @param type The type of the artifact
|
||||||
* @return the path
|
* @return the path
|
||||||
|
* @throws MavenException MavenException
|
||||||
*/
|
*/
|
||||||
public String constructRepositoryDirectoryPath(String type, Project project) throws MavenException
|
public String constructRepositoryDirectoryPath( String type, Project project )
|
||||||
|
throws MavenException
|
||||||
{
|
{
|
||||||
StringBuffer path = new StringBuffer();
|
StringBuffer path = new StringBuffer();
|
||||||
|
|
||||||
path.append( project.getArtifactDirectory() );
|
path.append( project.getArtifactDirectory() );
|
||||||
path.append( "/distributions/" );
|
path.append( "/distributions/" );
|
||||||
|
|
||||||
return path.toString();
|
return path.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,36 +55,50 @@ public class DistributionArtifactTypeHandler implements ArtifactTypeHandler
|
|||||||
* @param type The type of the artifact
|
* @param type The type of the artifact
|
||||||
* @param version The version of the artifact (may be a snapshot)
|
* @param version The version of the artifact (may be a snapshot)
|
||||||
* @return the path
|
* @return the path
|
||||||
|
* @throws MavenException MavenException
|
||||||
*/
|
*/
|
||||||
public String constructRepositoryFullPath(String type, Project project, String version) throws MavenException
|
public String constructRepositoryFullPath( String type, Project project,
|
||||||
|
String version ) throws MavenException
|
||||||
{
|
{
|
||||||
StringBuffer path = new StringBuffer(constructRepositoryDirectoryPath(type, project));
|
StringBuffer path =
|
||||||
|
new StringBuffer( constructRepositoryDirectoryPath( type, project ) );
|
||||||
|
|
||||||
path.append( project.getArtifactId() );
|
path.append( project.getArtifactId() );
|
||||||
path.append( "-" );
|
path.append( "-" );
|
||||||
path.append( version );
|
path.append( version );
|
||||||
if (!type.startsWith("distribution")) {
|
|
||||||
throw new MavenException("Type is not a distribution (is " + type + ")");
|
if ( !type.startsWith( "distribution" ) )
|
||||||
|
{
|
||||||
|
throw new MavenException( "Type is not a distribution (is " + type
|
||||||
|
+ ")" );
|
||||||
}
|
}
|
||||||
|
|
||||||
String subtype = type.substring( 12 );
|
String subtype = type.substring( 12 );
|
||||||
if (subtype.startsWith("-src")) {
|
|
||||||
|
if ( subtype.startsWith( "-src" ) )
|
||||||
|
{
|
||||||
path.append( "-src" );
|
path.append( "-src" );
|
||||||
subtype = subtype.substring( 4 );
|
subtype = subtype.substring( 4 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (subtype.equals("-targz")) {
|
if ( subtype.equals( "-targz" ) )
|
||||||
|
{
|
||||||
path.append( ".tar.gz" );
|
path.append( ".tar.gz" );
|
||||||
}
|
}
|
||||||
else if (subtype.equals("-tarbz2")) {
|
else if ( subtype.equals( "-tarbz2" ) )
|
||||||
|
{
|
||||||
path.append( ".tar.bz2" );
|
path.append( ".tar.bz2" );
|
||||||
}
|
}
|
||||||
else if (subtype.equals("-zip")) {
|
else if ( subtype.equals( "-zip" ) )
|
||||||
|
{
|
||||||
path.append( ".zip" );
|
path.append( ".zip" );
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
throw new MavenException("Unrecognised distribution type (is " + type + ")");
|
{
|
||||||
|
throw new MavenException( "Unrecognised distribution type (is "
|
||||||
|
+ type + ")" );
|
||||||
}
|
}
|
||||||
|
|
||||||
return path.toString();
|
return path.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
11
dist/src/main/org/apache/maven/dist/package.html
vendored
Normal file
11
dist/src/main/org/apache/maven/dist/package.html
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>org.apache.maven.dist</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
Contains utility classes for the dist plugin.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -17,12 +17,12 @@ package org.apache.maven.dist;
|
|||||||
* ====================================================================
|
* ====================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import org.apache.maven.MavenException;
|
import org.apache.maven.MavenException;
|
||||||
import org.apache.maven.project.Project;
|
import org.apache.maven.project.Project;
|
||||||
import org.apache.maven.repository.ArtifactTypeHandler;
|
import org.apache.maven.repository.ArtifactTypeHandler;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This will do until wagon debuts.
|
* This will do until wagon debuts.
|
||||||
*
|
*
|
||||||
@ -31,10 +31,16 @@ import junit.framework.TestCase;
|
|||||||
*/
|
*/
|
||||||
public class DistributionArtifactTypeHandlerTest extends TestCase
|
public class DistributionArtifactTypeHandlerTest extends TestCase
|
||||||
{
|
{
|
||||||
private Project project;
|
/** A test version string. */
|
||||||
private ArtifactTypeHandler handler;
|
|
||||||
private static final String VERSION = "VERSION";
|
private static final String VERSION = "VERSION";
|
||||||
|
|
||||||
|
/** A test project. */
|
||||||
|
private Project project;
|
||||||
|
|
||||||
|
/** A test ArtifactTypeHandler. */
|
||||||
|
private ArtifactTypeHandler handler;
|
||||||
|
|
||||||
|
/** JUnit setup: initialize project and handler. */
|
||||||
public void setUp() throws Exception
|
public void setUp() throws Exception
|
||||||
{
|
{
|
||||||
project = new Project();
|
project = new Project();
|
||||||
@ -43,52 +49,78 @@ public class DistributionArtifactTypeHandlerTest extends TestCase
|
|||||||
handler = new DistributionArtifactTypeHandler();
|
handler = new DistributionArtifactTypeHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testConstructRepositoryDirectoryPath() throws Exception
|
/** Test constructRepositoryDirectoryPath. */
|
||||||
|
public void testConstructRepositoryDirectoryPath()
|
||||||
|
throws Exception
|
||||||
{
|
{
|
||||||
assertEquals( "check artifact directory", "groupId/distributions/",
|
assertEquals( "check artifact directory", "groupId/distributions/",
|
||||||
handler.constructRepositoryDirectoryPath("distribution-targz", project));
|
handler.constructRepositoryDirectoryPath( "distribution-targz",
|
||||||
|
project ) );
|
||||||
assertEquals( "check artifact directory", "groupId/distributions/",
|
assertEquals( "check artifact directory", "groupId/distributions/",
|
||||||
handler.constructRepositoryDirectoryPath("distribution-tarbz2", project));
|
handler.constructRepositoryDirectoryPath( "distribution-tarbz2",
|
||||||
|
project ) );
|
||||||
assertEquals( "check artifact directory", "groupId/distributions/",
|
assertEquals( "check artifact directory", "groupId/distributions/",
|
||||||
handler.constructRepositoryDirectoryPath("distribution-zip", project));
|
handler.constructRepositoryDirectoryPath( "distribution-zip",
|
||||||
|
project ) );
|
||||||
assertEquals( "check artifact directory", "groupId/distributions/",
|
assertEquals( "check artifact directory", "groupId/distributions/",
|
||||||
handler.constructRepositoryDirectoryPath("distribution-src-targz", project));
|
handler.constructRepositoryDirectoryPath(
|
||||||
|
"distribution-src-targz", project ) );
|
||||||
assertEquals( "check artifact directory", "groupId/distributions/",
|
assertEquals( "check artifact directory", "groupId/distributions/",
|
||||||
handler.constructRepositoryDirectoryPath("distribution-src-tarbz2", project));
|
handler.constructRepositoryDirectoryPath(
|
||||||
|
"distribution-src-tarbz2", project ) );
|
||||||
assertEquals( "check artifact directory", "groupId/distributions/",
|
assertEquals( "check artifact directory", "groupId/distributions/",
|
||||||
handler.constructRepositoryDirectoryPath("distribution-src-zip", project));
|
handler.constructRepositoryDirectoryPath( "distribution-src-zip",
|
||||||
|
project ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testConstructRepositoryFullPath() throws Exception
|
/** Test constructRepositoryFullPath. */
|
||||||
|
public void testConstructRepositoryFullPath()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
try {
|
|
||||||
handler.constructRepositoryFullPath( "foo", project, VERSION );
|
handler.constructRepositoryFullPath( "foo", project, VERSION );
|
||||||
fail( "expected exception" );
|
fail( "expected exception" );
|
||||||
}
|
}
|
||||||
catch (MavenException expected) {
|
catch ( MavenException expected )
|
||||||
|
{
|
||||||
assertTrue( "expected exception", true );
|
assertTrue( "expected exception", true );
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try
|
||||||
handler.constructRepositoryFullPath("distribution", project, VERSION);
|
{
|
||||||
|
handler.constructRepositoryFullPath( "distribution", project,
|
||||||
|
VERSION );
|
||||||
fail( "expected exception" );
|
fail( "expected exception" );
|
||||||
}
|
}
|
||||||
catch (MavenException expected) {
|
catch ( MavenException expected )
|
||||||
|
{
|
||||||
assertTrue( "expected exception", true );
|
assertTrue( "expected exception", true );
|
||||||
}
|
}
|
||||||
|
|
||||||
assertEquals("check artifact path", "groupId/distributions/artifactId-VERSION.tar.gz",
|
assertEquals( "check artifact path",
|
||||||
handler.constructRepositoryFullPath("distribution-targz", project, VERSION));
|
"groupId/distributions/artifactId-VERSION.tar.gz",
|
||||||
assertEquals("check artifact path", "groupId/distributions/artifactId-VERSION.tar.bz2",
|
handler.constructRepositoryFullPath( "distribution-targz", project,
|
||||||
handler.constructRepositoryFullPath("distribution-tarbz2", project, VERSION));
|
VERSION ) );
|
||||||
assertEquals("check artifact path", "groupId/distributions/artifactId-VERSION.zip",
|
assertEquals( "check artifact path",
|
||||||
handler.constructRepositoryFullPath("distribution-zip", project, VERSION));
|
"groupId/distributions/artifactId-VERSION.tar.bz2",
|
||||||
assertEquals("check artifact path", "groupId/distributions/artifactId-VERSION-src.tar.gz",
|
handler.constructRepositoryFullPath( "distribution-tarbz2",
|
||||||
handler.constructRepositoryFullPath("distribution-src-targz", project, VERSION));
|
project, VERSION ) );
|
||||||
assertEquals("check artifact path", "groupId/distributions/artifactId-VERSION-src.tar.bz2",
|
assertEquals( "check artifact path",
|
||||||
handler.constructRepositoryFullPath("distribution-src-tarbz2", project, VERSION));
|
"groupId/distributions/artifactId-VERSION.zip",
|
||||||
assertEquals("check artifact path", "groupId/distributions/artifactId-VERSION-src.zip",
|
handler.constructRepositoryFullPath( "distribution-zip", project,
|
||||||
handler.constructRepositoryFullPath("distribution-src-zip", project, VERSION));
|
VERSION ) );
|
||||||
|
assertEquals( "check artifact path",
|
||||||
|
"groupId/distributions/artifactId-VERSION-src.tar.gz",
|
||||||
|
handler.constructRepositoryFullPath( "distribution-src-targz",
|
||||||
|
project, VERSION ) );
|
||||||
|
assertEquals( "check artifact path",
|
||||||
|
"groupId/distributions/artifactId-VERSION-src.tar.bz2",
|
||||||
|
handler.constructRepositoryFullPath( "distribution-src-tarbz2",
|
||||||
|
project, VERSION ) );
|
||||||
|
assertEquals( "check artifact path",
|
||||||
|
"groupId/distributions/artifactId-VERSION-src.zip",
|
||||||
|
handler.constructRepositoryFullPath( "distribution-src-zip",
|
||||||
|
project, VERSION ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
11
dist/src/test/org/apache/maven/dist/package.html
vendored
Normal file
11
dist/src/test/org/apache/maven/dist/package.html
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>org.apache.maven.dist</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
Test classes for org.apache.maven.test.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user