Package org.mule.module.db.internal.util

Examples of org.mule.module.db.internal.util.FileReader


    public void createsQueryFromFile() throws Exception
    {
        String fileName = "file";
        String fileContent = "select * from test";

        FileReader fileReader = mock(FileReader.class);
        when(fileReader.getResourceAsString(fileName)).thenReturn(fileContent);

        QueryFileFactoryBean factoryBean = new QueryFileFactoryBean(fileName, fileReader);

        String query = factoryBean.getObject();

View Full Code Here


    @Test(expected = IllegalStateException.class)
    public void failsToReadFile() throws Exception
    {
        String fileName = "file";

        FileReader fileReader = mock(FileReader.class);
        when(fileReader.getResourceAsString(fileName)).thenThrow(new IOException());

        QueryFileFactoryBean factoryBean = new QueryFileFactoryBean(fileName, fileReader);

        factoryBean.getObject();
    }
View Full Code Here

    private void doResolveBulkQueryTest(String bulkSqlQuery) throws IOException
    {
        String fileName = "fileName";

        QueryTemplateParser queryTemplateParser = createQueryTemplateParser();
        FileReader fileReader = mock(FileReader.class);
        when(fileReader.getResourceAsString(fileName)).thenReturn(bulkSqlQuery);

        BulkQueryResolver bulkQueryResolver = new FileBulkQueryResolver(fileName, queryTemplateParser, fileReader);

        BulkQuery resolvedBulkQuery = bulkQueryResolver.resolve(muleEvent);
View Full Code Here

    @Test(expected = QueryResolutionException.class)
    public void throwsErrorOnEmptyBulkQuery() throws Exception
    {
        String fileName = "fileName";

        FileReader fileReader = mock(FileReader.class);
        when(fileReader.getResourceAsString(fileName)).thenReturn("");

        FileBulkQueryResolver bulkQueryResolver = new FileBulkQueryResolver(fileName, null, fileReader);

        bulkQueryResolver.resolve(muleEvent);
    }
View Full Code Here

    @Test(expected = QueryResolutionException.class)
    public void throwsErrorOnFileReadError() throws Exception
    {
        String fileName = "fileName";

        FileReader fileReader = mock(FileReader.class);
        when(fileReader.getResourceAsString(fileName)).thenThrow(new IOException("Error"));

        FileBulkQueryResolver bulkQueryResolver = new FileBulkQueryResolver(fileName, null, fileReader);

        bulkQueryResolver.resolve(muleEvent);
    }
View Full Code Here

TOP

Related Classes of org.mule.module.db.internal.util.FileReader

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.