@Override @XmlTransient @UriGenerator public String getUri() { return URI_PREFIX + bin(path); }
@Test public void testArchive() { final File archive = new File("/tmp/ecs-sync-archive-test.zip"); if (archive.exists()) archive.delete(); archive.deleteOnExit(); ArchiveConfig archiveConfig = new ArchiveConfig(); archiveConfig.setPath(archive.getPath()); archiveConfig.setStoreMetadata(true); TestConfig testConfig = new TestConfig().withReadData(true).withDiscardData(false); testConfig.withObjectCount(LG_OBJ_COUNT).withMaxSize(LG_OBJ_MAX_SIZE); endToEndTest(archiveConfig, testConfig, null, false); }
@Test public void testTarGzip() throws Exception { File file = File.createTempFile("test", ".tar.gz"); file.deleteOnExit(); writeFile(file, TAR_GZ_CONTENT); ArchiveConfig archiveConfig = new ArchiveConfig(); archiveConfig.setPath(file.getPath()); TestConfig testConfig = new TestConfig().withReadData(true).withDiscardData(false); EcsSync sync = new EcsSync(); sync.setSyncConfig(new SyncConfig().withSource(archiveConfig).withTarget(testConfig)); sync.run(); Assert.assertEquals("Failures detected", 0, sync.getStats().getObjectsFailed()); Assert.assertEquals("Wrong number of files transferred", 3, sync.getStats().getObjectsComplete()); Assert.assertEquals("Wrong number of bytes transferred", 26, sync.getStats().getBytesComplete()); }
@Override public void configure(SyncStorage source, Iterator<SyncFilter> filters, SyncStorage target) { super.configure(source, filters, target); TFile tFile = new TFile(config.getPath()); if (source == this) { if (!tFile.isArchive() || !tFile.isDirectory()) throw new ConfigurationException("The source " + config.getPath() + " is not a valid archive. " + "Note: tar files must fit entirely into memory and you will get this error if they are too large"); } else { if (tFile.exists() && (!tFile.isArchive() || !tFile.isDirectory())) throw new ConfigurationException("The target " + config.getPath() + " exists and is not a valid archive. " + "Note: tar files must fit entirely into memory and you will get this error if they are too large"); } }