Package org.apache.tools.ant.types.resources

Examples of org.apache.tools.ant.types.resources.StringResource$StringResourceFilterOutputStream


        super.tearDown();
        fakeServer.stop();
    }

    public void testIgnoreUnsupportedResource() throws Exception {
        final Resource unsupportedResource = new StringResource() {
            public InputStream getInputStream() {
                throw new UnsupportedOperationException();
            }
        };
        stubResourceCollection.add(unsupportedResource);
View Full Code Here


    /**
     * Get the resources to concatenate.
     */
    private ResourceCollection getResources() {
        if (rc == null) {
            return new StringResource(getProject(), textBuffer.toString());
        }
        if (dest != null) {
            Intersect checkDestNotInSources = new Intersect();
            checkDestNotInSources.setProject(getProject());
            checkDestNotInSources.add(rc);
View Full Code Here

     */
    public void execute() throws BuildException {
        final String msg = "".equals(message) ? StringUtils.LINE_SEP : message;
        try {
            ResourceUtils
                    .copyResource(new StringResource(msg), output == null ? new LogOutputResource(
                            this, logLevel) : output, null, null, false, false, append, null, ""
                            .equals(encoding) ? null : encoding, getProject());
        } catch (IOException ioe) {
            throw new BuildException(ioe, getLocation());
        }
View Full Code Here

            be.setMessage(String.valueOf(i), 0);
            c.messageLogged(be);
        }

        LogContent content = new LogContent(p, LogLevel.ERR, false);
        StringResource s = new StringResource();
        ResourceUtils.copyResource(content, s);

        Assert.assertEquals(s.getValue(),
                            "0" + StringUtils.LINE_SEP
                            + "1" + StringUtils.LINE_SEP);
    }
View Full Code Here

            be.setMessage(String.valueOf(i), 0);
            c.messageLogged(be);
        }

        LogContent content = new LogContent(p, LogLevel.ERR, true);
        StringResource s = new StringResource();
        ResourceUtils.copyResource(content, s);

        Assert.assertEquals(s.getValue(), "01");
    }
View Full Code Here

            c.messageLogged(be);
        }

        LogContent content = new LogContent();
        content.setProject(p);
        StringResource s = new StringResource();
        ResourceUtils.copyResource(content, s);

        Assert.assertEquals(s.getValue(), "01");
    }
View Full Code Here

        Assert.assertEquals(s.getValue(), "01");
    }

    private static void assertMessages(LogContent content, String[] messages,
                                       int upTo) throws IOException {
        StringResource s = new StringResource();
        ResourceUtils.copyResource(content, s);
        String actual = s.getValue();
        for (int i = 0; i <= upTo && i < messages.length; i++) {
            Assert.assertTrue("checking for " + messages[i] + " in " + actual,
                              actual.indexOf(messages[i]) > -1);
        }
        for (int i = upTo + 1; i < messages.length; i++) {
View Full Code Here

    /**
     * Get the resources to concatenate.
     */
    private ResourceCollection getResources() {
        if (rc == null) {
            return new StringResource(getProject(), textBuffer.toString());
        }
        if (dest != null) {
            Intersect checkDestNotInSources = new Intersect();
            checkDestNotInSources.setProject(getProject());
            checkDestNotInSources.add(rc);
View Full Code Here

                log(destinationFile + " is up-to-date.", Project.MSG_VERBOSE);
                return null; // no need to do anything
            }
            return existRc;
        } else {
            StringResource s = new StringResource();
            s.setProject(getProject());
            s.setValue(textBuffer.toString());
            return s;
        }
    }
View Full Code Here

        helper = repo.getProjectHelperForBuildFile(r);
        assertTrue(helper instanceof SomeHelper);
        helper = repo.getProjectHelperForAntlib(r);
        assertTrue(helper instanceof SomeHelper);

        r = new StringResource("test.myext");
        helper = repo.getProjectHelperForBuildFile(r);
        assertTrue(helper instanceof ProjectHelper2);
        helper = repo.getProjectHelperForAntlib(r);
        assertTrue(helper instanceof ProjectHelper2);

        r = new StringResource("test.other");
        helper = repo.getProjectHelperForBuildFile(r);
        assertTrue(helper instanceof ProjectHelper2);
        helper = repo.getProjectHelperForAntlib(r);
        assertTrue(helper instanceof ProjectHelper2);
    }
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.types.resources.StringResource$StringResourceFilterOutputStream

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.