@Test(groups = {"fast-unit"}) public void _givenArchiverRootURIWithFileScheme_setsBackendNameAndArchivePath() throws IOException { createArchiverMbeanWithArchiverRootURI("file:/archiver_root"); assertEquals("local", archiverMBean.getBackendName()); assertEquals("/archiver_root", archiverMBean.getArchivePath()); }
private void runHdfsTestCase(File hdfsPropertiesFile) throws IOException { String host = "thehost"; String port = "9876"; String archiverRootURI = createHdfsArchiverRootUri(host, port); createArchiverMbeanWithArchiverRootURI(archiverRootURI); assertEquals("hdfs", archiverMBean.getBackendName()); assertEquals("/archiver_root", archiverMBean.getArchivePath()); Properties hdfsProperties = new Properties(); hdfsProperties.load(FileUtils.openInputStream(hdfsPropertiesFile)); assertEquals(host, hdfsProperties.getProperty("hadoop.host")); assertEquals(port, hdfsProperties.getProperty("hadoop.port")); }
private void set_Backend_archivePath_andAmazonProperties() throws IOException { String id = "theId"; String secret = "theSecret"; String bucket = "theBucket"; String archiverRootURI = "s3n://" + id + ":" + secret + "@" + bucket + "/archiver_root"; createArchiverMbeanWithArchiverRootURI(archiverRootURI); assertEquals("s3n", archiverMBean.getBackendName()); assertEquals("/archiver_root", archiverMBean.getArchivePath()); Properties amazonProperties = new Properties(); File amazonPropertiesFile = BackendConfigurationFiles.create().getByName(AWSCredentialsImpl.AMAZON_PROPERTIES_FILENAME); amazonProperties.load(FileUtils.openInputStream(amazonPropertiesFile)); assertEquals(id, amazonProperties.getProperty("aws.id")); assertEquals(secret, amazonProperties.getProperty("aws.secret")); assertEquals(bucket, amazonProperties.getProperty("s3.bucket")); }