Package com.splunk.shuttl.archiver.archive

Examples of com.splunk.shuttl.archiver.archive.BucketFormat


    return BucketFormat.UNKNOWN;
  }

  private BucketFormat chooseFormatBasedOnPrioritizingOrDefaults(
      List<BucketFormat> availableFormats) {
    BucketFormat chosenFormat = null;
    if (existsPrioritizedFormats())
      chosenFormat = chooseFromPrioritizedFormat(availableFormats);
    if (chosenFormat == null)
      chosenFormat = chooseFromDefaultsAndAvailableFormats(availableFormats);
    return chosenFormat;
View Full Code Here


    return bucketsWithFormat;
  }

  private Bucket getBucketWithResolvedFormat(Bucket bucket) {
    List<BucketFormat> availableFormats = getAvailableFormatsForBucket(bucket);
    BucketFormat chosenFormat = bucketFormatChooser
        .chooseBucketFormat(availableFormats);
    String pathToBucketWithChosenBucket = pathResolver
        .resolveArchivedBucketPath(bucket.getIndex(), bucket.getName(),
            chosenFormat);
    return createBucketWithErrorHandling(bucket, chosenFormat,
View Full Code Here

   * @param bucket
   *          to restore to {@link BucketFormat#SPLUNK_BUCKET}.
   * @return bucket in {@link BucketFormat#SPLUNK_BUCKET}
   */
  public LocalBucket restoreToSplunkBucketFormat(LocalBucket bucket) {
    BucketFormat format = bucket.getFormat();
    if (format.equals(BucketFormat.SPLUNK_BUCKET))
      return bucket;
    else if (importers.containsKey(format))
      return importers.get(format).importBucket(bucket);
    else
      throw new UnsupportedOperationException();
View Full Code Here

  }

  public void resolveArchivedBucketPath_givenIndexBucketNameAndFormat_pathEqualsFormatsHomePlusFormat() {
    String index = "index";
    String bucketName = "bucketName";
    BucketFormat format = BucketFormat.UNKNOWN;
    String expectedBucketPath = pathResolver.getFormatsHome(index, bucketName)
        + "/" + format;
    String actualBucketPath = pathResolver.resolveArchivedBucketPath(index,
        bucketName, format);
    assertEquals(expectedBucketPath, actualBucketPath);
View Full Code Here

  @Test(groups = { "fast-unit" })
  public void chooseBucketFormat_givenEmptyList_unknown() {
    List<BucketFormat> emptyList = Arrays.asList();
    assertTrue(emptyList.isEmpty());
    BucketFormat actualFormat = bucketFormatChooser
        .chooseBucketFormat(emptyList);
    assertEquals(BucketFormat.UNKNOWN, actualFormat);
  }
View Full Code Here

        .chooseBucketFormat(emptyList);
    assertEquals(BucketFormat.UNKNOWN, actualFormat);
  }

  public void chooseBucketFormat_givenListWithOneBucketFormat_returnThatFormat() {
    BucketFormat format = BucketFormat.SPLUNK_BUCKET;
    List<BucketFormat> singleBucketFormat = Arrays.asList(format);
    assertEquals(1, singleBucketFormat.size());

    BucketFormat chosenFormat = bucketFormatChooser
        .chooseBucketFormat(singleBucketFormat);
    assertEquals(format, chosenFormat);
  }
View Full Code Here

        .thenReturn(prioritizedFormats);
    List<BucketFormat> formats = Arrays.asList(
        BucketFormatChooser.DEFAULT_FORMAT_WHEN_NO_PRIORITIZING,
        BucketFormat.UNKNOWN);

    BucketFormat chosenFormat = bucketFormatChooser.chooseBucketFormat(formats);
    assertEquals(BucketFormatChooser.DEFAULT_FORMAT_WHEN_NO_PRIORITIZING,
        chosenFormat);
  }
View Full Code Here

  public void chooseBucketFormat_givenNoPrioritizedFormatsAndDefaultWhenNoPrioritizingDoesntExist_chooseFirstFormat() {
    List<BucketFormat> prioritizedFormats = new ArrayList<BucketFormat>();
    assertTrue(prioritizedFormats.isEmpty());
    when(configuration.getBucketFormatPriority())
        .thenReturn(prioritizedFormats);
    BucketFormat firstFormat = BucketFormat.UNKNOWN;
    List<BucketFormat> formats = Arrays.asList(firstFormat,
        BucketFormat.UNKNOWN);
    assertFalse(formats
        .contains(BucketFormatChooser.DEFAULT_FORMAT_WHEN_NO_PRIORITIZING));

    BucketFormat chosenFormat = bucketFormatChooser.chooseBucketFormat(formats);
    assertEquals(BucketFormat.UNKNOWN, chosenFormat);
  }
View Full Code Here

  @Test(groups = { "fast-unit" })
  public void chooseBucketFormat_givenUnknownFormatIsMostPrioritized_chooseUnknownFormatOutOfSplunkAndUnknown() {
    List<BucketFormat> formats = Arrays.asList(BucketFormat.SPLUNK_BUCKET,
        BucketFormat.UNKNOWN);

    BucketFormat chosenFormat = bucketFormatChooser.chooseBucketFormat(formats);
    assertEquals(chosenFormat, BucketFormat.UNKNOWN);
  }
View Full Code Here

  public void chooseBucketFormat_givenUnknownFormatNotInAvailableFormats_returnSecondPriorityFormat() {
    List<BucketFormat> secondPriorityFormat = Arrays.asList(
        BucketFormat.SPLUNK_BUCKET, BucketFormat.SPLUNK_BUCKET);
    assertEquals(2, secondPriorityFormat.size());

    BucketFormat chosenFormat = bucketFormatChooser
        .chooseBucketFormat(secondPriorityFormat);
    assertEquals(chosenFormat, BucketFormat.SPLUNK_BUCKET);
  }
View Full Code Here

TOP

Related Classes of com.splunk.shuttl.archiver.archive.BucketFormat

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.