Package com.splunk.shuttl.archiver.model

Examples of com.splunk.shuttl.archiver.model.LocalBucket


    }
  }

  private boolean isPathReplicatedBucketWithRawdataOnly(String path)
      throws FileNotFoundException, FileNotDirectoryException {
    LocalBucket localBucket = new LocalBucket(new File(path), "doesNotMatter",
        BucketFormat.UNKNOWN);

    if (localBucket.isReplicatedBucket())
      if (listFilesThatAreNotRawdataDirNorDotFiles(localBucket).length == 0)
        return true;
    return false;
  }
View Full Code Here


    coldBucketCopier.copyColdBucket(localBucket);
    verifyZeroInteractions(lockedCopier);
  }

  public void copyColdBucket_givenReplicatedBucket_doesNotCopyBucket() {
    LocalBucket replicatedBucket = TUtilsBucket.createReplicatedBucket();
    coldBucketCopier.copyColdBucket(replicatedBucket);
    verifyZeroInteractions(lockedCopier);
  }
View Full Code Here

    coldBucketCopier.copyColdBucket(replicatedBucket);
    verifyZeroInteractions(lockedCopier);
  }

  public void copyColdBucket_givenBucketStartingNameWithNumbers_doesNotCopyBucket() {
    LocalBucket bucketStartingWithNumber = TUtilsBucket
        .createBucketWithName("31_2305E9E3-8893-4EA8-A384-4E20ACE674A5");
    coldBucketCopier.copyColdBucket(bucketStartingWithNumber);
    verifyZeroInteractions(lockedCopier);
  }
View Full Code Here

  private class CopyBucketUnderLock implements SharedLockBucketHandler {

    @Override
    public void handleSharedLockedBucket(Bucket bucket) {
      logger.info(will("call copy bucket endpoint", "bucket", bucket));
      LocalBucket localBucket = (LocalBucket) bucket;
      try {
        endpoint.call(localBucket);
        logger.info(done("calling copy bucket endpoint", "bucket", bucket));
        receipts.createReceipt(localBucket);
      } catch (RuntimeException e) {
View Full Code Here

  }

  private LocalBucket createBucketObject(File file, Bucket bucket,
      File bucketDir) {
    try {
      return new LocalBucket(bucketDir, bucket.getIndex(),
          removeExtension(file), format, bucket.getSize());
    } catch (Exception e) {
      logBucketCreationException(bucket, bucketDir, e);
      throw new RuntimeException(e);
    }
View Full Code Here

          + copyExceptions.toString());
  }

  private void exportBucketThenCopy(LocalBucket bucket, BucketFormat format,
      List<RuntimeException> copyExceptions) {
    LocalBucket exportedBucket = bucketExportController.exportBucket(bucket,
        format);
    try {
      archiveBucketTransferer.transferBucketToArchive(exportedBucket);
    } catch (RuntimeException e) {
      logException(exportedBucket, e);
View Full Code Here

  private void archiveOneBucketPerDay() {
    Date startDate = new Date(); // Today.
    Date earliest = startDate;
    for (int i = 0; i < TWO_YEARS_OF_DAYS; i++) {
      Date latest = new Date(earliest.getTime());
      LocalBucket bucket = TUtilsBucket.createBucketWithIndexAndTimeRange(
          TUtilsEndToEnd.REAL_SPLUNK_INDEX,
          earliest, latest);
      bucketArchiver.archiveBucket(bucket);
      earliest = new Date(latest.getTime() + 1 + MILLI_SECONDS_IN_A_DAY);
    }
View Full Code Here

      throws IOException {
    String host = "host";
    when(shuttlMBean.getHttpHost()).thenReturn(host);
    int port = 1234;
    when(shuttlMBean.getHttpPort()).thenReturn(port);
    LocalBucket bucket = TUtilsBucket.createBucket();

    copyBucketEndpoint.call(bucket);

    HttpPost capturedRequest = getHttpClientsExecutedRequest();
    URI capturedUri = capturedRequest.getURI();
View Full Code Here

  @Test(expectedExceptions = { NonSuccessfulBucketCopy.class })
  public void _givenCopyRequestNot200Status_throws() throws IOException {
    copyBucketEndpoint = new CallCopyBucketEndpoint(httpClient, shuttlMBean,
        new ResponseHandler());

    LocalBucket bucket = TUtilsBucket.createBucket();
    when(
        httpClient.execute(any(HttpUriRequest.class)).getStatusLine()
            .getStatusCode()).thenReturn(500);
    copyBucketEndpoint.call(bucket);
  }
View Full Code Here

    copyBucketEndpoint.call(bucket);
  }

  @Test(expectedExceptions = { NonSuccessfulBucketCopy.class })
  public void _givenCopyRequestThrows_throws() throws IOException {
    LocalBucket bucket = TUtilsBucket.createBucket();
    when(httpClient.execute(any(HttpUriRequest.class))).thenThrow(
        new IOException());
    copyBucketEndpoint.call(bucket);
  }
View Full Code Here

TOP

Related Classes of com.splunk.shuttl.archiver.model.LocalBucket

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.