Package com.splunk.shuttl.archiver.model

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


    bucket = mock(Bucket.class);
  }

  public void _givenSuccessfulImportAndSizeResolving_returnImportedBucketWithSize()
      throws Exception {
    LocalBucket importedBucket = TUtilsBucket.createBucket();
    Bucket sizedBucket = mock(Bucket.class);
    stub(sizedBucket.getSize()).toReturn(121L);
    when(
        bucketImportController
            .restoreToSplunkBucketFormat(any(LocalBucket.class)))
        .thenReturn(importedBucket);
    when(bucketSizeResolver.resolveBucketSize(any(Bucket.class))).thenReturn(
        sizedBucket);
    LocalBucket actualBucket = getsBucketsFromArchive
        .getBucketFromArchive(bucket);

    assertEquals(importedBucket.getDirectory(), actualBucket.getDirectory());
    assertEquals(importedBucket.getEarliest(), actualBucket.getEarliest());
    assertEquals(importedBucket.getLatest(), actualBucket.getLatest());
    assertEquals(importedBucket.getIndex(), actualBucket.getIndex());
    assertEquals(importedBucket.getFormat(), actualBucket.getFormat());
    assertEquals(importedBucket.getName(), actualBucket.getName());
    assertEquals(importedBucket.getPath(), actualBucket.getPath());
    assertEquals(sizedBucket.getSize(), actualBucket.getSize());
  }
View Full Code Here


    UtilsBucket.getCsvFile(emptyBucket);
  }

  @Test(expectedExceptions = { NoFileFoundException.class })
  public void getCsvFile_noCsvFile_throwsRuntimeException() {
    LocalBucket bucketWithoutCsvFile = TUtilsBucket.createBucket();
    UtilsBucket.getCsvFile(bucketWithoutCsvFile);
  }
View Full Code Here

      String peer1Host, String peer1Port, String peer2Host, String peer2Port,
      String headHost, String headShuttlPort, String splunkUser,
      String splunkPass) throws IOException, JSONException {
    String index = TUtilsEndToEnd.REAL_SPLUNK_INDEX;

    LocalBucket peer1Bucket = DistributedCommons.putBucketInPeerThawDirectory(
        peer1Host, peer1Port, splunkUser, splunkPass, index);
    LocalBucket peer2Bucket = DistributedCommons.putBucketInPeerThawDirectory(
        peer2Host, peer2Port, splunkUser, splunkPass, index);

    try {
      JSONObject json = listThawedByCallingHead(headHost, headShuttlPort, index);
      assertBucketsWereListed(json, peer1Bucket, peer2Bucket);
View Full Code Here

    assertEquals(1, buckets.size());
    assertEquals(BucketFormat.SPLUNK_BUCKET_TGZ, buckets.get(0).getFormat());
  }

  private Bucket getTgzBucketArchived() {
    LocalBucket bucket = TUtilsBucket.createRealBucket();
    archiveBucket(bucket, bucketArchiver);
    return bucket;
  }
View Full Code Here

      String peer2ShuttlPort, String searchHeadHost,
      String searchHeadShuttlPort, String splunkHome) throws IOException,
      JSONException {

    String index = TUtilsEndToEnd.REAL_SPLUNK_INDEX;
    LocalBucket b1 = TUtilsBucket.createBucketWithIndex(index);
    LocalBucket b2 = TUtilsBucket.createBucketWithIndex(index);

    try {
      DistributedCommons.archiveBucketAtSearchPeer(b1, peer1Host,
          Integer.parseInt(peer1ShuttlPort));
      DistributedCommons.archiveBucketAtSearchPeer(b2, peer2Host,
View Full Code Here

    tearDownLocalConfig(config);
    FileUtils.deleteQuietly(archiverData);
  }

  public void Archiver_givenExistingBucket_archiveIt() throws IOException {
    LocalBucket bucket = TUtilsBucket.createBucket();
    int filesInBucket = bucket.getDirectory().listFiles().length;

    bucketArchiver.archiveBucket(bucket);

    String bucketArchivePath = pathResolver.resolveArchivePath(bucket);
    List<String> pathsInBucketDirectoryInArchive = archiveFileSystem
View Full Code Here

  }

  private void givenTwoFailedBucketAttempts_archivesTheThirdBucketAndTheTwoFailedBuckets()
      throws IOException {
    // Setup buckets
    LocalBucket firstFailingBucket = TUtilsBucket.createBucket();
    LocalBucket secondFailingBucket = TUtilsBucket.createBucket();
    LocalBucket successfulBucket = TUtilsBucket.createBucket();

    // Test
    failingBucketFreezerWithoutRecovery.freezeBucket(firstFailingBucket
        .getIndex(), firstFailingBucket.getDirectory().getAbsolutePath());
    failingBucketFreezerWithoutRecovery.freezeBucket(secondFailingBucket
        .getIndex(), secondFailingBucket.getDirectory().getAbsolutePath());

    // Verify bucket archiving failed.
    String firstBucketPath = pathResolver
        .resolveArchivePath(firstFailingBucket);
    String secondBucketPath = pathResolver
        .resolveArchivePath(secondFailingBucket);
    assertFalse(hadoopFileSystem.exists(new Path(firstBucketPath)));
    assertFalse(hadoopFileSystem.exists(new Path(secondBucketPath)));

    successfulBucketFreezerWithRecovery.freezeBucket(successfulBucket
        .getIndex(), successfulBucket.getDirectory().getAbsolutePath());
    TUtilsFunctional.waitForAsyncArchiving();

    // Verification
    String thirdBucketPath = pathResolver.resolveArchivePath(successfulBucket);
    assertTrue(hadoopFileSystem.exists(new Path(firstBucketPath)));
View Full Code Here

      "cluster.slave2.splunk.home" })
  public void _archiveTwoBucketsWithDifferentIndexes_listBothIndexesAtSearchHead(
      String peer1Host, String peer1ShuttlPort, String peer2Host,
      String peer2ShuttlPort, String searchHeadHost,
      String searchHeadShuttlPort, String splunkHome) throws JSONException {
    LocalBucket b1 = TUtilsBucket.createBucket();
    LocalBucket b2 = TUtilsBucket.createBucketWithIndex(b1.getIndex() + "x");

    try {
      DistributedCommons.archiveBucketAtSearchPeer(b1, peer1Host,
          Integer.parseInt(peer1ShuttlPort));
      DistributedCommons.archiveBucketAtSearchPeer(b2, peer2Host,
View Full Code Here

      String peer1ShuttlPort, String peer2Host, String peer2ShuttlPort,
      String searchHeadHost, String searchHeadShuttlPort, String splunkHome)
      throws JSONException {
    String index = "some-index-string";

    LocalBucket b1 = TUtilsBucket.createBucketWithIndex(index);
    LocalBucket b2 = TUtilsBucket.createBucketWithIndex(index);

    try {
      DistributedCommons.archiveBucketAtSearchPeer(b1, peer1Host,
          Integer.parseInt(peer1ShuttlPort));
      DistributedCommons.archiveBucketAtSearchPeer(b2, peer2Host,
View Full Code Here

    assertTrue(movedBuckets.contains(movedBucketAnotherIndex));
  }

  public void getMovedBuckets_givenTwoBucketsWithSameIndexInMoveLocation_listWithTheTwoBuckets() {
    String index = "a";
    LocalBucket movedBucket = createBucketInMoveLocationWithIndexPreserved(index);
    LocalBucket movedBucketSameIndex = TUtilsBucket
        .createBucketInDirectoryWithIndex(movedBucket.getDirectory()
            .getParentFile(), index);

    // Assertions on buckets.
    assertEquals(movedBucket.getIndex(), movedBucketSameIndex.getIndex());
    assertEquals(movedBucket.getDirectory().getParent(), movedBucketSameIndex
        .getDirectory().getParent());

    List<Bucket> movedBuckets = bucketMover.getMovedBuckets();
    assertEquals(2, movedBuckets.size());
    assertTrue(movedBuckets.contains(movedBucket));
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.