Package com.asakusafw.compiler.batch.ResourceRepository

Examples of com.asakusafw.compiler.batch.ResourceRepository.Cursor


            ResourceRepository repo, JarOutputStream jar, Set<Location> saw,
            boolean allowFrameworkInfo) throws IOException {
        assert repo != null;
        assert jar != null;
        assert saw != null;
        Cursor cursor = repo.createCursor();
        try {
            while (cursor.next()) {
                Location location = cursor.getLocation();
                if (allowFrameworkInfo == false
                        && (FRAMEWORK_INFO.isPrefixOf(location) || MANIFEST_FILE.isPrefixOf(location))) {
                    LOG.debug("Skipped adding a framework info: {}", location);
                    continue;
                }
                if (saw.contains(location)) {
                    LOG.warn("{} is already added to JAR", location);
                    continue;
                }
                saw.add(location);
                addEntry(jar, cursor.openResource(), location);
            }
        } finally {
            cursor.close();
        }
    }
View Full Code Here


     * @throws Exception テスト中に例外が発生した場合
     */
    @Test
    public void single() throws Exception {
        FileRepository repository = new FileRepository(open("single.zip"));
        Cursor cur = repository.createCursor();
        Map<String, List<String>> entries = drain(cur);

        Map<String, List<String>> expected = Maps.create();
        expected.put("hello.txt", Arrays.asList("Hello, world!"));

View Full Code Here

     * @throws Exception テスト中に例外が発生した場合
     */
    @Test
    public void multiple() throws Exception {
        FileRepository repository = new FileRepository(open("multiple.zip"));
        Cursor cur = repository.createCursor();
        Map<String, List<String>> entries = drain(cur);

        Map<String, List<String>> expected = Maps.create();
        expected.put("a.txt", Arrays.asList("aaa"));
        expected.put("b.txt", Arrays.asList("bbb"));
View Full Code Here

     * @throws Exception テスト中に例外が発生した場合
     */
    @Test
    public void structured() throws Exception {
        FileRepository repository = new FileRepository(open("structured.zip"));
        Cursor cur = repository.createCursor();
        Map<String, List<String>> entries = drain(cur);

        Map<String, List<String>> expected = Maps.create();
        expected.put("a.txt", Arrays.asList("aaa"));
        expected.put("a/b.txt", Arrays.asList("bbb"));
View Full Code Here

     * @throws Exception テスト中に例外が発生した場合
     */
    @Test
    public void empty() throws Exception {
        FileRepository repository = new FileRepository(framework.getWork("empty"));
        Cursor cur = repository.createCursor();
        Map<String, List<String>> entries = drain(cur);

        Map<String, List<String>> expected = Maps.create();

        assertThat(entries, is(expected));
View Full Code Here

        Set<String> errorBatches = Sets.create();
        boolean succeeded = true;
        try {
            ResourceRepository scanner = getScanner(new File(scanPath));
            Cursor cursor = scanner.createCursor();
            try {
                while (cursor.next()) {
                    Location location = cursor.getLocation();
                    Class<? extends BatchDescription> batchDescription = getBatchDescription(location);
                    if (batchDescription == null) {
                        continue;
                    }
                    boolean singleSucceeded = BatchCompilerDriver.compile(
                            outputDirectory,
                            batchDescription,
                            packageName,
                            hadoopWorkLocation,
                            compilerWorkDirectory,
                            linkingResources,
                            pluginLocations);
                    succeeded &= singleSucceeded;
                    if (singleSucceeded == false) {
                        errorBatches.add(toClassName(location));
                        if (skipError == false) {
                            break;
                        }
                    }
                }
            } finally {
                cursor.close();
            }
        } catch (Exception e) {
            LOG.error(MessageFormat.format(
                    "バッチクラスの検索に失敗しました ({0})",
                    scanPath),
View Full Code Here

     * @throws Exception テスト中に例外が発生した場合
     */
    @Test
    public void single() throws Exception {
        ZipRepository repository = new ZipRepository(open("single.zip"));
        Cursor cur = repository.createCursor();
        Map<String, List<String>> entries = drain(cur);

        Map<String, List<String>> expected = Maps.create();
        expected.put("hello.txt", Arrays.asList("Hello, world!"));

View Full Code Here

     * @throws Exception テスト中に例外が発生した場合
     */
    @Test
    public void multiple() throws Exception {
        ZipRepository repository = new ZipRepository(open("multiple.zip"));
        Cursor cur = repository.createCursor();
        Map<String, List<String>> entries = drain(cur);

        Map<String, List<String>> expected = Maps.create();
        expected.put("a.txt", Arrays.asList("aaa"));
        expected.put("b.txt", Arrays.asList("bbb"));
View Full Code Here

     * @throws Exception テスト中に例外が発生した場合
     */
    @Test
    public void structured() throws Exception {
        ZipRepository repository = new ZipRepository(open("structured.zip"));
        Cursor cur = repository.createCursor();
        Map<String, List<String>> entries = drain(cur);

        Map<String, List<String>> expected = Maps.create();
        expected.put("a.txt", Arrays.asList("aaa"));
        expected.put("a/b.txt", Arrays.asList("bbb"));
View Full Code Here

     * @throws Exception テスト中に例外が発生した場合
     */
    @Test(expected = IOException.class)
    public void notarchive() throws Exception {
        ZipRepository repository = new ZipRepository(open("notarchive.zip"));
        Cursor cur = repository.createCursor();
        drain(cur);
    }
View Full Code Here

TOP

Related Classes of com.asakusafw.compiler.batch.ResourceRepository.Cursor

Copyright © 2018 www.massapicom. 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.