Package com.netflix.exhibitor.core.s3

Examples of com.netflix.exhibitor.core.s3.PropertyBasedS3Credential


        checkMutuallyExclusive(cli, commandLine, S3_BACKUP, FILESYSTEMBACKUP);

        String                        s3Region = commandLine.getOptionValue(S3_REGION, null);
        PropertyBasedS3Credential     awsCredentials = null;
        PropertyBasedS3ClientConfig   awsClientConfig = null;
        if ( commandLine.hasOption(S3_CREDENTIALS) )
        {
            awsCredentials = new PropertyBasedS3Credential(new File(commandLine.getOptionValue(S3_CREDENTIALS)));
        }

        if ( commandLine.hasOption(S3_PROXY) )
        {
            awsClientConfig = new PropertyBasedS3ClientConfig(new File(commandLine.getOptionValue(S3_PROXY)));
        }

        BackupProvider backupProvider = null;
        if ( "true".equalsIgnoreCase(commandLine.getOptionValue(S3_BACKUP)) )
        {
View Full Code Here


                    new PutObjectRequest("bucket", "exhibitor-backup" + S3BackupProvider.SEPARATOR + "test" + S3BackupProvider.SEPARATOR + 1, in, null);

            MockS3Client        s3Client = new MockS3Client(null, null);
            s3Client.putObject(dummyRequest);

            S3BackupProvider    provider = new S3BackupProvider(new MockS3ClientFactory(s3Client), new PropertyBasedS3Credential(new Properties()), new PropertyBasedS3ClientConfig(new Properties()), null);
            out = new FileOutputStream(tempFile);
            provider.downloadBackup(null, new BackupMetaData("test", 1), out, Maps.<String, String>newHashMap());
           
            Assert.assertEquals(Files.toByteArray(sourceFile), Files.toByteArray(tempFile));
        }
View Full Code Here

                return list;
            }
        };

        MockS3Client            s3Client = new MockS3Client(null, listing);
        S3BackupProvider        provider = new S3BackupProvider(new MockS3ClientFactory(s3Client), new PropertyBasedS3Credential(new Properties()), new PropertyBasedS3ClientConfig(new Properties()), null);
        List<BackupMetaData>    backups = provider.getAvailableBackups(null, Maps.<String, String>newHashMap());
        List<String>            backupNames = Lists.transform
        (
            backups,
            new Function<BackupMetaData, String>()
View Full Code Here

    }

    private byte[] getUploadedBytes(File sourceFile) throws Exception
    {
        MockS3Client        s3Client = new MockS3Client();
        S3BackupProvider    provider = new S3BackupProvider(new MockS3ClientFactory(s3Client), new PropertyBasedS3Credential(new Properties()), new PropertyBasedS3ClientConfig(new Properties()), null);

        provider.uploadBackup(null, new BackupMetaData("test", 10), sourceFile, Maps.<String, String>newHashMap());

        ByteArrayOutputStream   out = new ByteArrayOutputStream();
        for ( byte[] bytes : s3Client.getUploadedBytes() )
View Full Code Here

        }

        checkMutuallyExclusive(cli, commandLine, S3_BACKUP, FILESYSTEMBACKUP);

        String                        s3Region = commandLine.getOptionValue(S3_REGION, null);
        PropertyBasedS3Credential     awsCredentials = null;
        PropertyBasedS3ClientConfig   awsClientConfig = null;
        if ( commandLine.hasOption(S3_CREDENTIALS) )
        {
            awsCredentials = new PropertyBasedS3Credential(new File(commandLine.getOptionValue(S3_CREDENTIALS)));
        }

        if ( commandLine.hasOption(S3_PROXY) )
        {
            awsClientConfig = new PropertyBasedS3ClientConfig(new File(commandLine.getOptionValue(S3_PROXY)));
View Full Code Here

                    new PutObjectRequest("bucket", "exhibitor-backup" + S3BackupProvider.SEPARATOR + "test" + S3BackupProvider.SEPARATOR + 1, in, null);

            MockS3Client        s3Client = new MockS3Client(null, null);
            s3Client.putObject(dummyRequest);

            S3BackupProvider    provider = new S3BackupProvider(new MockS3ClientFactory(s3Client), new PropertyBasedS3Credential(new Properties()), new PropertyBasedS3ClientConfig(new Properties()), null);
            out = new FileOutputStream(tempFile);
            provider.downloadBackup(null, new BackupMetaData("test", 1), out, Maps.<String, String>newHashMap());
           
            Assert.assertEquals(Files.toByteArray(sourceFile), Files.toByteArray(tempFile));
        }
View Full Code Here

                return list;
            }
        };

        MockS3Client            s3Client = new MockS3Client(null, listing);
        S3BackupProvider        provider = new S3BackupProvider(new MockS3ClientFactory(s3Client), new PropertyBasedS3Credential(new Properties()), new PropertyBasedS3ClientConfig(new Properties()), null);
        List<BackupMetaData>    backups = provider.getAvailableBackups(null, Maps.<String, String>newHashMap());
        List<String>            backupNames = Lists.transform
        (
            backups,
            new Function<BackupMetaData, String>()
View Full Code Here

    }

    private byte[] getUploadedBytes(File sourceFile) throws Exception
    {
        MockS3Client        s3Client = new MockS3Client();
        S3BackupProvider    provider = new S3BackupProvider(new MockS3ClientFactory(s3Client), new PropertyBasedS3Credential(new Properties()), new PropertyBasedS3ClientConfig(new Properties()), null);

        provider.uploadBackup(null, new BackupMetaData("test", 10), sourceFile, Maps.<String, String>newHashMap());

        ByteArrayOutputStream   out = new ByteArrayOutputStream();
        for ( byte[] bytes : s3Client.getUploadedBytes() )
View Full Code Here

    }

    private ConfigProvider getS3Provider(ExhibitorCLI cli, CommandLine commandLine, PropertyBasedS3Credential awsCredentials, PropertyBasedS3ClientConfig awsClientConfig, String hostname, Properties defaultProperties, String s3Region) throws Exception
    {
        String  prefix = cli.getOptions().hasOption(S3_CONFIG_PREFIX) ? commandLine.getOptionValue(S3_CONFIG_PREFIX) : DEFAULT_PREFIX;
        return new S3ConfigProvider(new S3ClientFactoryImpl(), awsCredentials, awsClientConfig, getS3Arguments(cli, commandLine.getOptionValue(S3_CONFIG), prefix), hostname, defaultProperties, s3Region);
    }
View Full Code Here

        }

        BackupProvider backupProvider = null;
        if ( "true".equalsIgnoreCase(commandLine.getOptionValue(S3_BACKUP)) )
        {
            backupProvider = new S3BackupProvider(new S3ClientFactoryImpl(), awsCredentials, awsClientConfig, s3Region);
        }
        else if ( "true".equalsIgnoreCase(commandLine.getOptionValue(FILESYSTEMBACKUP)) )
        {
            backupProvider = new FileSystemBackupProvider();
        }
View Full Code Here

TOP

Related Classes of com.netflix.exhibitor.core.s3.PropertyBasedS3Credential

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.