Package com.asakusafw.runtime.util.cache

Examples of com.asakusafw.runtime.util.cache.HadoopFileCacheRepository.resolve()


        LockProvider<Path> locks = new LocalFileLockProvider<Path>(folder.newFolder());
        RetryStrategy retrier = new ConstantRetryStrategy();
        HadoopFileCacheRepository cache = new HadoopFileCacheRepository(configuration, path(cacheRepo), locks, retrier);

        File source = put(folder.newFile(), "Hello, world!");
        Path resolved = cache.resolve(path(source));

        assertThat(get(file(resolved)), is("Hello, world!"));
        assertThat(resolved, is(not(path(source))));
        assertThat(containsFile(cacheRepo, file(resolved)), is(true));
    }
View Full Code Here


        LockProvider<Path> locks = new LocalFileLockProvider<Path>(folder.newFolder());
        RetryStrategy retrier = new ConstantRetryStrategy();
        HadoopFileCacheRepository cache = new HadoopFileCacheRepository(configuration, path(cacheRepo), locks, retrier);

        File source = put(folder.newFile(), "Hello, world!");
        Path first = cache.resolve(path(source));

        put(source, "UPDATED");
        Path retry = cache.resolve(path(source));

        assertThat(retry, is(first));
View Full Code Here

        File source = put(folder.newFile(), "Hello, world!");
        Path first = cache.resolve(path(source));

        put(source, "UPDATED");
        Path retry = cache.resolve(path(source));

        assertThat(retry, is(first));
        assertThat(get(file(retry)), is("UPDATED"));
    }
View Full Code Here

        LockProvider<Path> locks = new LocalFileLockProvider<Path>(folder.newFolder());
        RetryStrategy retrier = new ConstantRetryStrategy();
        HadoopFileCacheRepository cache = new HadoopFileCacheRepository(configuration, path(cacheRepo), locks, retrier);

        File source = put(folder.newFile(), "Hello, world!");
        Path first = cache.resolve(path(source));
        long timestamp = file(first).lastModified();
        Assume.assumeThat(timestamp, is(greaterThan(0L)));

        for (int i = 0; i < 10; i++) {
            if (System.currentTimeMillis() != timestamp) {
View Full Code Here

            Thread.sleep(10);
        }
        Assume.assumeThat(System.currentTimeMillis(), is(not(timestamp)));

        // may not changed
        Path retry = cache.resolve(path(source));
        assertThat(file(retry).lastModified(), is(timestamp));
    }

    /**
     * Conflict cache creation.
View Full Code Here

                        latch.countDown();
                        if (latch.await(5, TimeUnit.SECONDS) == false) {
                            throw new TimeoutException();
                        }
                        LOG.info("Start: resolve @" + label);
                        Path result = cache.resolve(path);

                        LOG.info("Finish: resolve @" + label);
                        return result;
                    }
                }));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.