-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2e35945
commit 96aba15
Showing
43 changed files
with
223 additions
and
354 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,20 +54,15 @@ protected void closeConnection() throws ConnectionException {} | |
|
||
protected void openConnectionInternal() throws ConnectionException, AuthenticationException {} | ||
|
||
public void get(String resourceName, File destination) | ||
throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException {} | ||
public void get(String resourceName, File destination) {} | ||
|
||
public boolean getIfNewer(String resourceName, File destination, long timestamp) | ||
throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { | ||
public boolean getIfNewer(String resourceName, File destination, long timestamp) { | ||
return false; | ||
} | ||
|
||
public void put(File source, String destination) | ||
throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException {} | ||
public void put(File source, String destination) {} | ||
} | ||
|
||
private String basedir; | ||
|
||
private WagonMock wagon = null; | ||
|
||
private File destination; | ||
|
@@ -81,9 +76,9 @@ public void put(File source, String destination) | |
private TransferListener transferListener = null; | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
public void setUp() { | ||
|
||
basedir = System.getProperty("basedir"); | ||
String basedir = System.getProperty("basedir"); | ||
|
||
destination = new File(basedir, "target/folder/subfolder"); | ||
|
||
|
@@ -198,15 +193,13 @@ public void testProxyConfiguration() throws ConnectionException, AuthenticationE | |
final ProxyInfo socksProxyInfo = new ProxyInfo(); | ||
socksProxyInfo.setType("http"); | ||
|
||
ProxyInfoProvider proxyInfoProvider = new ProxyInfoProvider() { | ||
public ProxyInfo getProxyInfo(String protocol) { | ||
if ("http".equals(protocol) || "dav".equals(protocol)) { | ||
return httpProxyInfo; | ||
} else if ("scp".equals(protocol)) { | ||
return socksProxyInfo; | ||
} | ||
return null; | ||
ProxyInfoProvider proxyInfoProvider = protocol -> { | ||
if ("http".equals(protocol) || "dav".equals(protocol)) { | ||
return httpProxyInfo; | ||
} else if ("scp".equals(protocol)) { | ||
return socksProxyInfo; | ||
} | ||
return null; | ||
}; | ||
|
||
Repository repository = new Repository(); | ||
|
@@ -299,9 +292,7 @@ public void testSessionCloseEvents() throws Exception { | |
} | ||
|
||
@Test | ||
public void testSessionCloseRefusedEventConnectionException() throws Exception { | ||
Repository repository = new Repository(); | ||
|
||
public void testSessionCloseRefusedEventConnectionException() { | ||
sessionListener.sessionDisconnecting(anyObject(SessionEvent.class)); | ||
sessionListener.sessionError(anyObject(SessionEvent.class)); | ||
replay(sessionListener); | ||
|
@@ -438,7 +429,7 @@ public void testRepositoryPermissionsOverride() throws ConnectionException, Auth | |
|
||
@Test | ||
public void testRepositoryUserName() throws ConnectionException, AuthenticationException { | ||
Repository repository = new Repository("id", "http://bporter:[email protected]/path/to/resource"); | ||
Repository repository = new Repository("id", "https://bporter:[email protected]/path/to/resource"); | ||
|
||
AuthenticationInfo authenticationInfo = new AuthenticationInfo(); | ||
authenticationInfo.setUserName("brett"); | ||
|
@@ -452,7 +443,7 @@ public void testRepositoryUserName() throws ConnectionException, AuthenticationE | |
|
||
@Test | ||
public void testRepositoryUserNameNotGivenInCredentials() throws ConnectionException, AuthenticationException { | ||
Repository repository = new Repository("id", "http://bporter:[email protected]/path/to/resource"); | ||
Repository repository = new Repository("id", "https://bporter:[email protected]/path/to/resource"); | ||
|
||
AuthenticationInfo authenticationInfo = new AuthenticationInfo(); | ||
wagon.connect(repository, authenticationInfo); | ||
|
@@ -501,11 +492,11 @@ public void testPostProcessListeners() throws TransferFailedException, IOExcepti | |
} | ||
|
||
static final class ProgressAnswer implements IAnswer { | ||
private ByteArrayOutputStream baos = new ByteArrayOutputStream(); | ||
private final ByteArrayOutputStream baos = new ByteArrayOutputStream(); | ||
|
||
private int size; | ||
|
||
public Object answer() throws Throwable { | ||
public Object answer() { | ||
byte[] buffer = (byte[]) getCurrentArguments()[1]; | ||
int length = (Integer) getCurrentArguments()[2]; | ||
baos.write(buffer, 0, length); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,8 +25,6 @@ | |
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import org.apache.maven.wagon.authorization.AuthorizationException; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Jason van Zyl</a> | ||
* | ||
|
@@ -41,7 +39,7 @@ public WagonMock(boolean errorInputStream) { | |
this.errorInputStream = errorInputStream; | ||
} | ||
|
||
public void fillInputData(InputData inputData) throws TransferFailedException { | ||
public void fillInputData(InputData inputData) { | ||
|
||
InputStream is; | ||
|
||
|
@@ -61,7 +59,7 @@ public void fillInputData(InputData inputData) throws TransferFailedException { | |
inputData.setInputStream(is); | ||
} | ||
|
||
public void fillOutputData(OutputData outputData) throws TransferFailedException { | ||
public void fillOutputData(OutputData outputData) { | ||
|
||
OutputStream os; | ||
|
||
|
@@ -90,12 +88,11 @@ public int getTimeout() { | |
return timeout; | ||
} | ||
|
||
public List<String> getFileList(String destinationDirectory) | ||
throws TransferFailedException, AuthorizationException { | ||
return Collections.<String>emptyList(); | ||
public List<String> getFileList(String destinationDirectory) { | ||
return Collections.emptyList(); | ||
} | ||
|
||
public boolean resourceExists(String resourceName) throws AuthorizationException { | ||
public boolean resourceExists(String resourceName) { | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,12 +50,12 @@ | |
* @author <a href="mailto:[email protected]">Jason van Zyl</a> | ||
*/ | ||
public abstract class WagonTestCase extends PlexusTestCase { | ||
protected static Logger logger = LoggerFactory.getLogger(WagonTestCase.class); | ||
protected final Logger logger = LoggerFactory.getLogger(getClass()); | ||
|
||
static final class ProgressAnswer implements IAnswer { | ||
private int size; | ||
|
||
public Object answer() throws Throwable { | ||
public Object answer() { | ||
int length = (Integer) getCurrentArguments()[2]; | ||
size += length; | ||
return null; | ||
|
@@ -163,7 +163,7 @@ protected void setupRepositories() throws Exception { | |
} | ||
} | ||
|
||
protected void customizeContext() throws Exception { | ||
protected void customizeContext() { | ||
getContainer().addContextValue("test.repository", localRepositoryPath); | ||
} | ||
|
||
|
@@ -184,7 +184,7 @@ protected RepositoryPermissions getPermissions() { | |
} | ||
|
||
protected Wagon getWagon() throws Exception { | ||
Wagon wagon = (Wagon) lookup(Wagon.ROLE, getProtocol()); | ||
Wagon wagon = lookup(Wagon.ROLE, getProtocol()); | ||
|
||
Debug debug = new Debug(); | ||
|
||
|
@@ -648,7 +648,7 @@ public void testWagonGetFileList() throws Exception { | |
|
||
String dirName = "file-list"; | ||
|
||
String filenames[] = new String[] { | ||
String[] filenames = new String[] { | ||
"test-resource.txt", "test-resource.pom", "test-resource b.txt", "more-resources.dat", ".index.txt" | ||
}; | ||
|
||
|
@@ -674,7 +674,7 @@ public void testWagonGetFileList() throws Exception { | |
// WAGON-250 | ||
list = wagon.getFileList(""); | ||
assertNotNull("file list should not be null.", list); | ||
assertTrue("file list should contain items (actually contains '" + list + "').", !list.isEmpty()); | ||
assertFalse("file list should contain items (actually contains '" + list + "').", list.isEmpty()); | ||
assertTrue(list.contains("file-list/")); | ||
assertFalse(list.contains("file-list")); | ||
assertFalse(list.contains(".")); | ||
|
Oops, something went wrong.