示例#1
0
  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();
      }
    }
  }
示例#2
0
  private void getIfNewer(long timestamp, boolean expectedResult, int expectedSize)
      throws Exception {
    Wagon wagon = getWagon();

    ProgressAnswer progressAnswer = setupGetIfNewerTest(wagon, expectedResult, expectedSize);

    connectWagon(wagon);

    boolean result = wagon.getIfNewer(this.resource, destFile, timestamp);
    assertEquals(expectedResult, result);

    disconnectWagon(wagon);

    assertGetIfNewerTest(progressAnswer, expectedResult, expectedSize);

    tearDownWagonTestingFixtures();
  }