protected void connectWagon(Wagon wagon) throws ConnectionException, AuthenticationException { wagon.addTransferListener(checksumObserver); wagon.addTransferListener(mockTransferListener); wagon.connect(testRepository, getAuthInfo()); }
public void testFailedGetIfNewer() throws Exception { if (supportsGetIfNewer()) { setupRepositories(); setupWagonTestingFixtures(); message("Getting test artifact from test repository " + testRepository); Wagon wagon = getWagon(); wagon.addTransferListener(checksumObserver); wagon.connect(testRepository, getAuthInfo()); destFile = FileTestUtils.createUniqueFile(getName(), getName()); destFile.deleteOnExit(); try { wagon.getIfNewer("fubar.txt", destFile, 0); fail("File was found when it shouldn't have been"); } catch (ResourceDoesNotExistException e) { // expected assertTrue(true); } finally { wagon.removeTransferListener(checksumObserver); wagon.disconnect(); tearDownWagonTestingFixtures(); } } }
protected Wagon getWagon() throws Exception { Wagon wagon = (Wagon) lookup(Wagon.ROLE, getProtocol()); Debug debug = new Debug(); wagon.addSessionListener(debug); wagon.addTransferListener(debug); return wagon; }