Beispiel #1
0
  protected void fileRoundTripTesting() throws Exception {
    message("File round trip testing ...");

    int expectedSize = putFile();

    assertNotNull("check checksum is not null", checksumObserver.getActualChecksum());

    assertEquals(
        "compare checksums",
        "6b144b7285ffd6b0bc8300da162120b9",
        checksumObserver.getActualChecksum());

    checksumObserver = new ChecksumObserver();

    getFile(expectedSize);

    assertNotNull("check checksum is not null", checksumObserver.getActualChecksum());

    assertEquals(
        "compare checksums",
        "6b144b7285ffd6b0bc8300da162120b9",
        checksumObserver.getActualChecksum());

    // Now compare the conents of the artifact that was placed in
    // the repository with the contents of the artifact that was
    // retrieved from the repository.

    String sourceContent = FileUtils.fileRead(sourceFile);

    String destContent = FileUtils.fileRead(destFile);

    assertEquals(sourceContent, destContent);
  }
Beispiel #2
0
  protected void assertGetIfNewerTest(
      ProgressAnswer progressAnswer, boolean expectedResult, int expectedSize) throws IOException {
    if (expectedResult) {
      verifyMock(progressAnswer, expectedSize);

      assertNotNull("check checksum is not null", checksumObserver.getActualChecksum());

      assertEquals(
          "compare checksums",
          "6b144b7285ffd6b0bc8300da162120b9",
          checksumObserver.getActualChecksum());

      // Now compare the contents of the artifact that was placed in
      // the repository with the contents of the artifact that was
      // retrieved from the repository.

      String sourceContent = FileUtils.fileRead(sourceFile);
      String destContent = FileUtils.fileRead(destFile);
      assertEquals(sourceContent, destContent);
    } else {
      verify(mockTransferListener);

      reset(mockTransferListener);

      assertNull("check checksum is null", checksumObserver.getActualChecksum());

      assertFalse(destFile.exists());
    }
  }