Skip to content

Commit

Permalink
[#74] rework integration tests pt.2
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarwell committed Oct 26, 2023
1 parent ee7d0b4 commit b5ab1d2
Show file tree
Hide file tree
Showing 41 changed files with 180 additions and 84 deletions.
17 changes: 17 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@
<artifactId>slf4j-api</artifactId>
<version>1.7.9</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.9</version>
</dependency>

<!-- needed to debug plugin under m2e -->
<dependency>
Expand Down Expand Up @@ -210,6 +215,18 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>9.4.51.v20230217</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-http</artifactId>
<version>9.4.51.v20230217</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon;
package org.mojohaus.mojo.wagon;

/*
* Licensed to the Apache Software Foundation (ASF) under one
Expand Down Expand Up @@ -80,4 +80,4 @@ private void disconnectWagon( Wagon wagon )
}
}

}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon;
package org.mojohaus.mojo.wagon;

/*
* Licensed to the Apache Software Foundation (ASF) under one
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon;
package org.mojohaus.mojo.wagon;

/*
* Licensed to the Apache Software Foundation (ASF) under one
Expand Down Expand Up @@ -92,4 +92,4 @@ public void execute()
protected abstract void execute( Wagon wagon )
throws MojoExecutionException, WagonException, IOException;

}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon;
package org.mojohaus.mojo.wagon;

/*
* Licensed to the Apache Software Foundation (ASF) under one
Expand All @@ -21,8 +21,8 @@

import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Parameter;
import org.codehaus.mojo.wagon.shared.WagonDownload;
import org.codehaus.mojo.wagon.shared.WagonFileSet;
import org.mojohaus.mojo.wagon.shared.WagonDownload;
import org.mojohaus.mojo.wagon.shared.WagonFileSet;

/**
* Contains common configuration to scan for Wagon's files
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon;
package org.mojohaus.mojo.wagon;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
Expand All @@ -7,9 +7,9 @@
import org.apache.maven.project.MavenProject;
import org.apache.maven.settings.Settings;
import org.apache.maven.wagon.Wagon;
import org.codehaus.mojo.wagon.shared.WagonFactory;
import org.codehaus.mojo.wagon.shared.WagonFileSet;
import org.codehaus.mojo.wagon.shared.WagonUtils;
import org.mojohaus.mojo.wagon.shared.WagonFactory;
import org.mojohaus.mojo.wagon.shared.WagonFileSet;
import org.mojohaus.mojo.wagon.shared.WagonUtils;

/**
* Provides base functionality for dealing with I/O using wagon.
Expand Down Expand Up @@ -61,4 +61,4 @@ protected WagonFileSet getWagonFileSet( String fromDir, String includes, String
{
return WagonUtils.getWagonFileSet( fromDir, includes, excludes, caseSensitive, toDir );
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon;
package org.mojohaus.mojo.wagon;

/*
* Licensed to the Apache Software Foundation (ASF) under one
Expand Down Expand Up @@ -26,8 +26,8 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.wagon.Wagon;
import org.apache.maven.wagon.WagonException;
import org.codehaus.mojo.wagon.shared.WagonCopy;
import org.codehaus.mojo.wagon.shared.WagonFileSet;
import org.mojohaus.mojo.wagon.shared.WagonCopy;
import org.mojohaus.mojo.wagon.shared.WagonFileSet;

/**
* Copy artifacts from one Wagon repository to another Wagon repository.
Expand Down Expand Up @@ -78,4 +78,4 @@ protected void copy( Wagon srcWagon, Wagon targetWagon )
wagonCopy.copy( srcWagon, fileSet, targetWagon, optimize, this.getLog() );
}

}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon;
package org.mojohaus.mojo.wagon;

/*
* Licensed to the Apache Software Foundation (ASF) under one
Expand All @@ -25,7 +25,7 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.wagon.Wagon;
import org.apache.maven.wagon.WagonException;
import org.codehaus.mojo.wagon.shared.WagonFileSet;
import org.mojohaus.mojo.wagon.shared.WagonFileSet;

/**
* Transfers a set of files from a remote URL to a specified local directory.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon;
package org.mojohaus.mojo.wagon;

/*
* Licensed to the Apache Software Foundation (ASF) under one
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon;
package org.mojohaus.mojo.wagon;

/*
* Licensed to the Apache Software Foundation (ASF) under one
Expand All @@ -24,7 +24,7 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.wagon.Wagon;
import org.apache.maven.wagon.WagonException;
import org.codehaus.mojo.wagon.shared.WagonDownload;
import org.mojohaus.mojo.wagon.shared.WagonDownload;

/**
* Check for the existing of remote resource.
Expand Down Expand Up @@ -56,4 +56,4 @@ protected void execute( Wagon wagon )
}
}

}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon;
package org.mojohaus.mojo.wagon;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon;
package org.mojohaus.mojo.wagon;

/*
* Licensed to the Apache Software Foundation (ASF) under one
Expand All @@ -25,7 +25,7 @@
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.wagon.Wagon;
import org.apache.maven.wagon.WagonException;
import org.codehaus.mojo.wagon.shared.MavenRepoMerger;
import org.mojohaus.mojo.wagon.shared.MavenRepoMerger;

/**
* Merge artifacts from one Maven repository to another Maven repository.
Expand All @@ -45,4 +45,4 @@ protected void copy( Wagon srcWagon, Wagon targetWagon )
mavenRepoMerger.merge( srcWagon, targetWagon, optimize, this.getLog() );
}

}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon;
package org.mojohaus.mojo.wagon;

/*
* Licensed to the Apache Software Foundation (ASF) under one
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon;
package org.mojohaus.mojo.wagon;

/*
* Licensed to the Apache Software Foundation (ASF) under one
Expand Down Expand Up @@ -29,7 +29,7 @@
import org.apache.maven.shared.model.fileset.FileSet;
import org.apache.maven.wagon.Wagon;
import org.apache.maven.wagon.WagonException;
import org.codehaus.mojo.wagon.shared.WagonUpload;
import org.mojohaus.mojo.wagon.shared.WagonUpload;
import org.codehaus.plexus.util.StringUtils;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon;
package org.mojohaus.mojo.wagon;

/*
* Licensed to the Apache Software Foundation (ASF) under one
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon.shared;
package org.mojohaus.mojo.wagon.shared;

/*
* Licensed to the Apache Software Foundation (ASF) under one
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon.shared;
package org.mojohaus.mojo.wagon.shared;

/*
* Licensed to the Apache Software Foundation (ASF) under one
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon.shared;
package org.mojohaus.mojo.wagon.shared;

/*
* Licensed to the Apache Software Foundation (ASF) under one
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon.shared;
package org.mojohaus.mojo.wagon.shared;

import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Server;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon.shared;
package org.mojohaus.mojo.wagon.shared;

/*
* Licensed to the Apache Software Foundation (ASF) under one
Expand All @@ -23,7 +23,6 @@
import java.io.IOException;
import java.util.Arrays;

import org.apache.maven.plugin.logging.Log;
import org.apache.maven.shared.model.fileset.FileSet;
import org.apache.maven.shared.model.fileset.util.FileSetManager;
import org.apache.maven.wagon.CommandExecutor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon.shared;
package org.mojohaus.mojo.wagon.shared;

/*
* Licensed to the Apache Software Foundation (ASF) under one
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon.shared;
package org.mojohaus.mojo.wagon.shared;

/*
* Licensed to the Apache Software Foundation (ASF) under one
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon.shared;
package org.mojohaus.mojo.wagon.shared;

/*
* Licensed to the Apache Software Foundation (ASF) under one
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon.shared;
package org.mojohaus.mojo.wagon.shared;

/*
* Licensed to the Apache Software Foundation (ASF) under one
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon.shared;
package org.mojohaus.mojo.wagon.shared;

/*
* Licensed to the Apache Software Foundation (ASF) under one
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon.shared;
package org.mojohaus.mojo.wagon.shared;

import org.apache.maven.settings.Settings;
import org.apache.maven.wagon.Wagon;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon.shared;
package org.mojohaus.mojo.wagon.shared;

/*
* Licensed to the Apache Software Foundation (ASF) under one
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon.shared;
package org.mojohaus.mojo.wagon.shared;

/*
* Licensed to the Apache Software Foundation (ASF) under one
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon.shared;
package org.mojohaus.mojo.wagon.shared;

import org.codehaus.plexus.util.StringUtils;

Expand Down
49 changes: 49 additions & 0 deletions src/test/java/org/mojohaus/mojo/wagon/AbstractJettyIT.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package org.mojohaus.mojo.wagon;

import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.handler.DefaultHandler;
import org.eclipse.jetty.server.handler.HandlerList;
import org.eclipse.jetty.server.handler.ResourceHandler;
import org.junit.After;
import org.junit.Before;

public abstract class AbstractJettyIT {

private Server server;
private int port;

@Before
public void runJetty() throws Exception {
server = new Server();
ServerConnector connector = new ServerConnector(server);
connector.setPort(0);
connector.setHost("localhost");
server.addConnector(connector);

ResourceHandler resource_handler = new ResourceHandler();
resource_handler.setDirectoriesListed(true);
resource_handler.setResourceBase(getDirectoryToServe());

HandlerList handlers = new HandlerList();
handlers.setHandlers(new Handler[] { resource_handler, new DefaultHandler() });
server.setHandler(handlers);

server.start();
this.port = connector.getLocalPort();
}


@After
public void tearDown() throws Exception {
server.stop();
}

protected int getServerPort() {
return this.port;
}

protected abstract String getDirectoryToServe();

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.codehaus.mojo.wagon;
package org.mojohaus.mojo.wagon;

import java.io.File;

Expand Down
Loading

0 comments on commit b5ab1d2

Please sign in to comment.