Package org.apache.commons.mail

Examples of org.apache.commons.mail.DataSourceResolver.resolve()


    public void testResolvingFilesLenient() throws Exception
    {
        DataSourceResolver dataSourceResolver = new DataSourceCompositeResolver(dataSourceResolvers, true);

        // resolve using HTTP
        assertTrue(toByteArray(dataSourceResolver.resolve("/images/feather-small.gif")).length > 0);

        // resolve using class path
        assertTrue(toByteArray(dataSourceResolver.resolve("/contentTypeTest.gif")).length > 0);
    }
View Full Code Here


        // resolve using HTTP
        assertTrue(toByteArray(dataSourceResolver.resolve("/images/feather-small.gif")).length > 0);

        // resolve using class path
        assertTrue(toByteArray(dataSourceResolver.resolve("/contentTypeTest.gif")).length > 0);
    }

    @Test(expected = IOException.class)
    public void testResolvingFilesNonLenient() throws Exception
    {
View Full Code Here

    @Test(expected = IOException.class)
    public void testResolvingFilesNonLenient() throws Exception
    {
        DataSourceResolver dataSourceResolver = new DataSourceCompositeResolver(dataSourceResolvers, false);

        dataSourceResolver.resolve("./image/does-not-exist.gif");
    }

    @Test
    public void testExternalModification() throws Exception
    {
View Full Code Here

    }

    public void testResolvingFileLenient() throws Exception
    {
        DataSourceResolver dataSourceResolver = new DataSourceFileResolver(new File("./src/test/resources"), true);
        assertTrue(toByteArray(dataSourceResolver.resolve("images/asf_logo_wide.gif")).length == IMG_SIZE);
        assertTrue(toByteArray(dataSourceResolver.resolve("./images/asf_logo_wide.gif")).length == IMG_SIZE);
        assertTrue(toByteArray(dataSourceResolver.resolve("../resources/images/asf_logo_wide.gif")).length == IMG_SIZE);
        assertNull(toByteArray(dataSourceResolver.resolve("/images/does-not-exist.gif")));
        assertNull(dataSourceResolver.resolve("./images/does-not-exist.gif"));
    }
View Full Code Here

    public void testResolvingFileLenient() throws Exception
    {
        DataSourceResolver dataSourceResolver = new DataSourceFileResolver(new File("./src/test/resources"), true);
        assertTrue(toByteArray(dataSourceResolver.resolve("images/asf_logo_wide.gif")).length == IMG_SIZE);
        assertTrue(toByteArray(dataSourceResolver.resolve("./images/asf_logo_wide.gif")).length == IMG_SIZE);
        assertTrue(toByteArray(dataSourceResolver.resolve("../resources/images/asf_logo_wide.gif")).length == IMG_SIZE);
        assertNull(toByteArray(dataSourceResolver.resolve("/images/does-not-exist.gif")));
        assertNull(dataSourceResolver.resolve("./images/does-not-exist.gif"));
    }
View Full Code Here

    public void testResolvingFileLenient() throws Exception
    {
        DataSourceResolver dataSourceResolver = new DataSourceFileResolver(new File("./src/test/resources"), true);
        assertTrue(toByteArray(dataSourceResolver.resolve("images/asf_logo_wide.gif")).length == IMG_SIZE);
        assertTrue(toByteArray(dataSourceResolver.resolve("./images/asf_logo_wide.gif")).length == IMG_SIZE);
        assertTrue(toByteArray(dataSourceResolver.resolve("../resources/images/asf_logo_wide.gif")).length == IMG_SIZE);
        assertNull(toByteArray(dataSourceResolver.resolve("/images/does-not-exist.gif")));
        assertNull(dataSourceResolver.resolve("./images/does-not-exist.gif"));
    }

    public void testResolvingFileNonLenient() throws Exception
View Full Code Here

    {
        DataSourceResolver dataSourceResolver = new DataSourceFileResolver(new File("./src/test/resources"), true);
        assertTrue(toByteArray(dataSourceResolver.resolve("images/asf_logo_wide.gif")).length == IMG_SIZE);
        assertTrue(toByteArray(dataSourceResolver.resolve("./images/asf_logo_wide.gif")).length == IMG_SIZE);
        assertTrue(toByteArray(dataSourceResolver.resolve("../resources/images/asf_logo_wide.gif")).length == IMG_SIZE);
        assertNull(toByteArray(dataSourceResolver.resolve("/images/does-not-exist.gif")));
        assertNull(dataSourceResolver.resolve("./images/does-not-exist.gif"));
    }

    public void testResolvingFileNonLenient() throws Exception
    {
View Full Code Here

        DataSourceResolver dataSourceResolver = new DataSourceFileResolver(new File("./src/test/resources"), true);
        assertTrue(toByteArray(dataSourceResolver.resolve("images/asf_logo_wide.gif")).length == IMG_SIZE);
        assertTrue(toByteArray(dataSourceResolver.resolve("./images/asf_logo_wide.gif")).length == IMG_SIZE);
        assertTrue(toByteArray(dataSourceResolver.resolve("../resources/images/asf_logo_wide.gif")).length == IMG_SIZE);
        assertNull(toByteArray(dataSourceResolver.resolve("/images/does-not-exist.gif")));
        assertNull(dataSourceResolver.resolve("./images/does-not-exist.gif"));
    }

    public void testResolvingFileNonLenient() throws Exception
    {
        DataSourceResolver dataSourceResolver = new DataSourceFileResolver(new File("."), false);
View Full Code Here

    }

    public void testResolvingFileNonLenient() throws Exception
    {
        DataSourceResolver dataSourceResolver = new DataSourceFileResolver(new File("."), false);
        assertNotNull(dataSourceResolver.resolve("./src/test/resources/images/asf_logo_wide.gif"));

        try
        {
            dataSourceResolver.resolve("asf_logo_wide.gif");
            fail("Expecting an IOException");
View Full Code Here

        DataSourceResolver dataSourceResolver = new DataSourceFileResolver(new File("."), false);
        assertNotNull(dataSourceResolver.resolve("./src/test/resources/images/asf_logo_wide.gif"));

        try
        {
            dataSourceResolver.resolve("asf_logo_wide.gif");
            fail("Expecting an IOException");
        }
        catch(IOException e)
        {
            return;
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.