Example usage for com.google.common.jimfs Jimfs newFileSystem

List of usage examples for com.google.common.jimfs Jimfs newFileSystem

Introduction

In this page you can find the example usage for com.google.common.jimfs Jimfs newFileSystem.

Prototype

public static FileSystem newFileSystem() 

Source Link

Document

Creates a new in-memory file system with a default configuration appropriate to the current operating system.

Usage

From source file:com.basistech.tc.SparkFsTc.java

public static void main(String[] args) {

    SparkConf conf = new SparkConf().setAppName("File System Test Case");
    JavaSparkContext sc = new JavaSparkContext(conf);

    JavaRDD<String> logData = sc.parallelize(Collections.singletonList("foo"));
    System.out.println(logData.getNumPartitions());
    logData.mapPartitions(itr -> {/*from   w w w .j  a va 2 s  . c o  m*/
        FileSystem fs = Jimfs.newFileSystem();
        Path path = fs.getPath("/root");
        URI uri = path.toUri();
        Paths.get(uri); // expect this to go splat.
        return null;
    }).collect();
}

From source file:com.google.copybara.testing.DummyOrigin.java

public DummyOrigin() {
    this.fs = Jimfs.newFileSystem();
    this.author = DEFAULT_AUTHOR;
}

From source file:com.github.jsdossier.testing.GuiceRule.java

public static Builder builder(Object target, Module... modules) {
    Builder builder = new AutoValue_GuiceRule.Builder();
    return builder.setTarget(target).setLanguageIn(CompilerOptions.LanguageMode.ECMASCRIPT5)
            .setModuleNamingConvention(ModuleNamingConvention.ES6).setNewTypeInference(false)
            .setGuiceModules(ImmutableList.copyOf(modules)).setInputFs(Jimfs.newFileSystem())
            .setModulePrefix(Optional.<Path>absent()).setSourcePrefix(Optional.<Path>absent())
            .setModuleExterns(ImmutableSet.<Path>of()).setModules(ImmutableSet.<Path>of())
            .setModulePathFilter(Predicates.<Path>alwaysFalse())
            .setTypeNameFilter(Predicates.<String>alwaysFalse()).setSourceUrlTemplate(Optional.<String>absent())
            .setOutputFs(Jimfs.newFileSystem()).setOutputDir(Optional.<Path>absent());
}