Package com.netflix.priam.aws

Examples of com.netflix.priam.aws.S3BackupPath


    public void testFileUpload() throws Exception
    {
        MockS3PartUploader.setup();
        S3FileSystem fs = injector.getInstance(S3FileSystem.class);
        // String snapshotfile = "target/data/Keyspace1/Standard1/backups/201108082320/Keyspace1-Standard1-ia-1-Data.db";
        S3BackupPath backupfile = injector.getInstance(S3BackupPath.class);
        backupfile.parseLocal(new File(FILE_PATH), BackupFileType.SNAP);
        fs.upload(backupfile, backupfile.localReader());
        Assert.assertEquals(1, MockS3PartUploader.compattempts);
    }
View Full Code Here


    {
        MockS3PartUploader.setup();
        MockS3PartUploader.partFailure = true;
        S3FileSystem fs = injector.getInstance(S3FileSystem.class);
        String snapshotfile = "target/data/Keyspace1/Standard1/backups/201108082320/Keyspace1-Standard1-ia-1-Data.db";
        S3BackupPath backupfile = injector.getInstance(S3BackupPath.class);
        backupfile.parseLocal(new File(snapshotfile), BackupFileType.SNAP);
        try
        {
            fs.upload(backupfile, backupfile.localReader());
        }
        catch (BackupRestoreException e)
        {
            // ignore
        }
View Full Code Here

    {
        MockS3PartUploader.setup();
        MockS3PartUploader.completionFailure = true;
        S3FileSystem fs = injector.getInstance(S3FileSystem.class);
        String snapshotfile = "target/data/Keyspace1/Standard1/backups/201108082320/Keyspace1-Standard1-ia-1-Data.db";
        S3BackupPath backupfile = injector.getInstance(S3BackupPath.class);
        backupfile.parseLocal(new File(snapshotfile), BackupFileType.SNAP);
        try
        {
            fs.upload(backupfile, backupfile.localReader());
        }
        catch (BackupRestoreException e)
        {
            // ignore
        }
View Full Code Here

        InstanceIdentity factory = injector.getInstance(InstanceIdentity.class);

        FifoQueue<AbstractBackupPath> queue = new FifoQueue<AbstractBackupPath>(10);
        for (int i = 10; i < 30; i++)
        {
            S3BackupPath path = new S3BackupPath(conf, factory);
            path.parseRemote("test_backup/"+FakeConfiguration.FAKE_REGION+"/fakecluster/123456/201108" + i + "0000" + "/SNAP/ks1/cf2/f1" + i + ".db");
            queue.adjustAndAdd(path);
        }

        for (int i = 10; i < 30; i++)
        {
            S3BackupPath path = new S3BackupPath(conf, factory);
            path.parseRemote("test_backup/"+FakeConfiguration.FAKE_REGION+"/fakecluster/123456/201108" + i + "0000" + "/SNAP/ks1/cf2/f2" + i + ".db");
            queue.adjustAndAdd(path);
        }

        for (int i = 10; i < 30; i++)
        {
            S3BackupPath path = new S3BackupPath(conf, factory);
            path.parseRemote("test_backup/"+FakeConfiguration.FAKE_REGION+"/fakecluster/123456/201108" + i + "0000" + "/SNAP/ks1/cf2/f3" + i + ".db");
            queue.adjustAndAdd(path);
        }

        S3BackupPath path = new S3BackupPath(conf, factory);
        path.parseRemote("test_backup/"+FakeConfiguration.FAKE_REGION+"/fakecluster/123456/201108290000" + "/SNAP/ks1/cf2/f129.db");
        Assert.assertTrue(queue.contains(path));
        path.parseRemote("test_backup/"+FakeConfiguration.FAKE_REGION+"/fakecluster/123456/201108290000" + "/SNAP/ks1/cf2/f229.db");
        Assert.assertTrue(queue.contains(path));
        path.parseRemote("test_backup/"+FakeConfiguration.FAKE_REGION+"/fakecluster/123456/201108290000" + "/SNAP/ks1/cf2/f329.db");
        Assert.assertTrue(queue.contains(path));

        path.parseRemote("test_backup/"+FakeConfiguration.FAKE_REGION+"/fakecluster/123456/201108260000/SNAP/ks1/cf2/f326.db To: cass/data/ks1/cf2/f326.db");
        Assert.assertEquals(path, queue.first());
    }
View Full Code Here

    {
        clearTest();
        flist = new ArrayList<AbstractBackupPath>();
        for (String file : files)
        {
            S3BackupPath path = pathProvider.get();
            path.parseRemote(file);
            flist.add(path);
        }
        downloadedFiles = new HashSet<String>();
        uploadedFiles = new HashSet<String>();
    }
View Full Code Here

            downloadedFiles.clear();
    }

    public void addFile(String file)
    {
        S3BackupPath path = pathProvider.get();
        path.parseRemote(file);
        flist.add(path);
    }
View Full Code Here

        final String oldToken = "1234";

        new Expectations() {
            @NonStrict InstanceIdentity identity;
            PriamInstance instance;
            AbstractBackupPath backupPath = new S3BackupPath(null, null);
 
            {
                pathProvider.get(); result = backupPath;
                backupPath.parseDate(dateRange.split(",")[0]); result = new DateTime(2011, 01, 01, 00, 00).toDate(); times = 1;
                backupPath.parseDate(dateRange.split(",")[1]); result = new DateTime(2011, 12, 31, 23, 59).toDate(); times = 1;

                config.getDC(); result = oldRegion;
                priamServer.getId(); result = identity; times = 2;
                identity.getInstance(); result = instance; times = 2;
                instance.getToken(); result = oldToken;
View Full Code Here

    @Test
    public void testBackupFileCreation() throws ParseException
    {
        // Test snapshot file
        String snapshotfile = "target/data/Keyspace1/Standard1/snapshots/201108082320/Keyspace1-Standard1-ia-5-Data.db";
        S3BackupPath backupfile = injector.getInstance(S3BackupPath.class);
        backupfile.parseLocal(new File(snapshotfile), BackupFileType.SNAP);
        Assert.assertEquals(BackupFileType.SNAP, backupfile.type);
        Assert.assertEquals("Keyspace1", backupfile.keyspace);
        Assert.assertEquals("Standard1", backupfile.columnFamily);
        Assert.assertEquals("1234567", backupfile.token);
        Assert.assertEquals("fake-app", backupfile.clusterName);
        Assert.assertEquals(FakeConfiguration.FAKE_REGION, backupfile.region);
        Assert.assertEquals("casstestbackup", backupfile.baseDir);
        Assert.assertEquals("casstestbackup/"+FakeConfiguration.FAKE_REGION+"/fake-app/1234567/201108082320/SNAP/Keyspace1/Standard1/Keyspace1-Standard1-ia-5-Data.db", backupfile.getRemotePath());
    }
View Full Code Here

    @Test
    public void testIncBackupFileCreation() throws ParseException
    {
        // Test incremental file       
        File bfile = new File("target/data/Keyspace1/Standard1/Keyspace1-Standard1-ia-5-Data.db");
        S3BackupPath backupfile = injector.getInstance(S3BackupPath.class);
        backupfile.parseLocal(bfile, BackupFileType.SST);
        Assert.assertEquals(BackupFileType.SST, backupfile.type);
        Assert.assertEquals("Keyspace1", backupfile.keyspace);
        Assert.assertEquals("Standard1", backupfile.columnFamily);
        Assert.assertEquals("1234567", backupfile.token);
        Assert.assertEquals("fake-app", backupfile.clusterName);
        Assert.assertEquals(FakeConfiguration.FAKE_REGION, backupfile.region);
        Assert.assertEquals("casstestbackup", backupfile.baseDir);
        String datestr = backupfile.formatDate(new Date(bfile.lastModified()));
        Assert.assertEquals("casstestbackup/"+FakeConfiguration.FAKE_REGION+"/fake-app/1234567/" + datestr + "/SST/Keyspace1/Standard1/Keyspace1-Standard1-ia-5-Data.db", backupfile.getRemotePath());
    }
View Full Code Here

    public void testMetaFileCreation() throws ParseException
    {
        // Test snapshot file
        String filestr = "cass/data/1234567.meta";
        File bfile = new File(filestr);
        S3BackupPath backupfile = injector.getInstance(S3BackupPath.class);
        backupfile.time = backupfile.parseDate("201108082320");
        backupfile.parseLocal(bfile, BackupFileType.META);
        Assert.assertEquals(BackupFileType.META, backupfile.type);
        Assert.assertEquals("1234567", backupfile.token);
        Assert.assertEquals("fake-app", backupfile.clusterName);
        Assert.assertEquals(FakeConfiguration.FAKE_REGION, backupfile.region);
        Assert.assertEquals("casstestbackup", backupfile.baseDir);
        Assert.assertEquals("casstestbackup/"+FakeConfiguration.FAKE_REGION+"/fake-app/1234567/201108082320/META/1234567.meta", backupfile.getRemotePath());
    }
View Full Code Here

TOP

Related Classes of com.netflix.priam.aws.S3BackupPath

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.