Tabnine Logo
FilesystemConfig.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
com.emc.ecs.sync.config.storage.FilesystemConfig
constructor

Best Java code snippets using com.emc.ecs.sync.config.storage.FilesystemConfig.<init> (Showing top 15 results out of 315)

origin: EMCECS/ecs-sync

@Override
public void configure(SyncStorage source, Iterator<SyncFilter> filters, SyncStorage target) {
  super.configure(source, filters, target);
  if (config.getLocalCacheRoot() == null)
    throw new ConfigurationException("must specify a cache root");
  File cacheRoot = new File(config.getLocalCacheRoot());
  if (!cacheRoot.exists() || !cacheRoot.isDirectory() || !cacheRoot.canWrite() || cacheRoot.list().length != 0)
    throw new ConfigurationException(cacheRoot + " is not a writable empty directory");
  // split plugin chain for each side of the cache (source -> cache and cache -> target)
  List<SyncFilter> filtersBeforeCache = new ArrayList<>();
  List<SyncFilter> filtersAfterCache = new ArrayList<>();
  boolean beforeCache = true;
  while (filters.hasNext()) {
    SyncFilter filter = filters.next();
    if (filter == this) beforeCache = false;
    else if (beforeCache) filtersBeforeCache.add(filter);
    else filtersAfterCache.add(filter);
  }
  FilesystemConfig cacheConfig = new FilesystemConfig();
  cacheConfig.setPath(config.getLocalCacheRoot());
  cacheTarget = new FilesystemStorage();
  cacheTarget.setConfig(cacheConfig);
  cacheTarget.setOptions(options);
  cacheTarget.configure(source, filtersBeforeCache.iterator(), cacheTarget);
  cacheSource = new FilesystemStorage();
  cacheSource.setConfig(cacheConfig);
  cacheSource.setOptions(options);
  cacheSource.configure(cacheSource, filtersAfterCache.iterator(), target);
}
origin: EMCECS/ecs-sync

@Test
public void testFilesystem() {
  final File tempDir = new File("/tmp/ecs-sync-filesystem-test"); // File.createTempFile("ecs-sync-filesystem-test", "dir");
  tempDir.mkdir();
  tempDir.deleteOnExit();
  if (!tempDir.exists() || !tempDir.isDirectory())
    throw new RuntimeException("unable to make temp dir");
  FilesystemConfig filesystemConfig = new FilesystemConfig();
  filesystemConfig.setPath(tempDir.getPath());
  filesystemConfig.setStoreMetadata(true);
  multiEndToEndTest(filesystemConfig, new TestConfig(), false);
  new File(tempDir, ObjectMetadata.METADATA_DIR).delete(); // delete this so the temp dir can go away
}
origin: EMCECS/ecs-sync

  @Test
  public void testSingleFile() throws Exception {
    String name = "single-file-test";
    File sFile = new File(sourceDir, name);
    File tFile = new File(targetDir, name);
    int size = 100 * 1024;
    StreamUtil.copy(new RandomInputStream(size), new FileOutputStream(sFile), size);

    FilesystemConfig sConfig = new FilesystemConfig();
    sConfig.setPath(sFile.getAbsolutePath());

    FilesystemConfig tConfig = new FilesystemConfig();
    tConfig.setPath(tFile.getAbsolutePath());

    SyncConfig syncConfig = new SyncConfig().withSource(sConfig).withTarget(tConfig);

    EcsSync sync = new EcsSync();
    sync.setSyncConfig(syncConfig);

    sync.run();

    Assert.assertArrayEquals(Files.readAllBytes(sFile.toPath()), Files.readAllBytes(tFile.toPath()));
  }
}
origin: EMCECS/ecs-sync

FilesystemConfig sourceConfig = new FilesystemConfig();
sourceConfig.setPath(tempPath.toString());
TestConfig testConfig = new TestConfig();
origin: EMCECS/ecs-sync

FilesystemConfig fsConfig = new FilesystemConfig();
fsConfig.setPath(sourceDir.getPath());
TestConfig testConfig = new TestConfig().withReadData(true).withDiscardData(false);
origin: EMCECS/ecs-sync

@Test
public void testExcludeFilter() throws Exception {
  Path file = Paths.get(".");
  FilesystemConfig fsConfig = new FilesystemConfig();
  fsConfig.setPath(file.toString());
  fsConfig.setExcludedPaths(new String[]{"(.*/)?\\.[^/]*", "(.*/)?[^/]*foo[^/]*", "(.*/)?[^/]*\\.bin"});
  FilesystemStorage storage = new FilesystemStorage();
  storage.setConfig(fsConfig);
  storage.configure(storage, null, null);
  DirectoryStream.Filter<Path> filter = storage.getFilter();
  String[] positiveTests = new String[]{"bar.txt", "a.out", "this has spaces", "n.o.t.h.i.n.g"};
  for (String test : positiveTests) {
    Assert.assertTrue("filter should have accepted " + test, filter.accept(file.resolve(test)));
  }
  String[] negativeTests = new String[]{".svn", ".snapshots", ".f.o.o", "foo.txt", "ffoobar", "mywarez.bin",
      "in.the.round.bin"};
  for (String test : negativeTests) {
    Assert.assertFalse("filter should have rejected " + test, filter.accept(file.resolve(test)));
  }
}
origin: EMCECS/ecs-sync

@Test
public void testSingleFileToFilesystem() throws Exception {
  NfsConfig sourceConfig = getNfsConfig(nfs);
  sourceConfig.setSubPath(sourceDirectoryName + NfsFile.separator + testFileName);
  FilesystemConfig targetConfig = new FilesystemConfig();
  targetConfig.setPath(filesystemTargetFile.getAbsolutePath());
  SyncConfig syncConfig = new SyncConfig().withSource(sourceConfig).withTarget(targetConfig);
  EcsSync sync = new EcsSync();
  sync.setSyncConfig(syncConfig);
  sync.run();
  byte[] sourceBytes = readBytes(sourceFile);
  byte[] targetBytes = Files.readAllBytes(filesystemTargetFile.toPath());
  Assert.assertArrayEquals(sourceBytes, targetBytes);
}
origin: EMCECS/ecs-sync

@Test
public void testSingleFileFromFilesystem() throws Exception {
  FilesystemConfig sourceConfig = new FilesystemConfig();
  sourceConfig.setPath(filesystemSourceFile.getAbsolutePath());
  NfsConfig targetConfig = getNfsConfig(nfs);
  targetConfig.setSubPath(targetDirectoryName + NfsFile.separator + testFileName);
  SyncConfig syncConfig = new SyncConfig().withSource(sourceConfig).withTarget(targetConfig);
  EcsSync sync = new EcsSync();
  sync.setSyncConfig(syncConfig);
  sync.run();
  byte[] sourceBytes = Files.readAllBytes(filesystemSourceFile.toPath());
  byte[] targetBytes = readBytes(targetFile);
  Assert.assertArrayEquals(sourceBytes, targetBytes);
}
origin: EMCECS/ecs-sync

FilesystemConfig fsConfig = new FilesystemConfig();
fsConfig.setPath(tempDir.getPath());
origin: EMCECS/ecs-sync

mimeMap.put("foo", "x-bar");
mimeMap.put("aaa", "application/octet-stream");
FilesystemConfig object = new FilesystemConfig();
object.setPath("/foo/bar");
object.setUseAbsolutePath(true);
origin: EMCECS/ecs-sync

FilesystemConfig fsConfig = new FilesystemConfig();
fsConfig.setPath(sourceDir.getPath());
origin: EMCECS/ecs-sync

FilesystemConfig fsConfig = new FilesystemConfig();
fsConfig.setPath(sourceDir.getPath());
origin: EMCECS/ecs-sync

FilesystemConfig fsConfig = new FilesystemConfig();
fsConfig.setPath(sourceDir.getPath());
fsConfig.setStoreMetadata(true);
origin: EMCECS/ecs-sync

  @Test
  public void testFilesystemUriParsing() {
    FilesystemConfig fsConfig = new FilesystemConfig();

    String uri = "file:///foo/bar", path = "/foo/bar", newUri = "file:/foo/bar";
    ConfigUtil.parseUri(fsConfig, uri);
    Assert.assertEquals(path, fsConfig.getPath());
    Assert.assertEquals(newUri, ConfigUtil.generateUri(fsConfig));

    uri = "file://foo/bar";
    path = "foo/bar";
    newUri = "file:foo/bar";
    ConfigUtil.parseUri(fsConfig, uri);
    Assert.assertEquals(path, fsConfig.getPath());
    Assert.assertEquals(newUri, ConfigUtil.generateUri(fsConfig));
  }
}
origin: EMCECS/ecs-sync

    .withDiscardData(false);
FilesystemConfig tmpConfig = new FilesystemConfig();
tmpConfig.setPath(tempDir.getPath());
tmpConfig.setStoreMetadata(true);
com.emc.ecs.sync.config.storageFilesystemConfig<init>

Popular methods of FilesystemConfig

  • getPath
  • isUseAbsolutePath
  • setPath
  • getDeleteCheckScript
  • getDeleteOlderThan
  • getExcludedPaths
  • getModifiedSince
  • isFollowLinks
  • isIncludeBaseDir
  • setExcludedPaths
  • setModifiedSince
    Date/time should be provided in ISO-8601 UTC format (i.e. 2015-01-01T04:30:00Z)
  • setStoreMetadata
  • setModifiedSince,
  • setStoreMetadata,
  • isStoreMetadata,
  • setDeleteCheckScript,
  • setDeleteOlderThan,
  • setFollowLinks,
  • setUseAbsolutePath

Popular in Java

  • Reading from database using SQL prepared statement
  • addToBackStack (FragmentTransaction)
  • putExtra (Intent)
  • getResourceAsStream (ClassLoader)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now