Example usage for org.springframework.integration.jdbc StoredProcExecutor setReturningResultSetRowMappers

List of usage examples for org.springframework.integration.jdbc StoredProcExecutor setReturningResultSetRowMappers

Introduction

In this page you can find the example usage for org.springframework.integration.jdbc StoredProcExecutor setReturningResultSetRowMappers.

Prototype

public void setReturningResultSetRowMappers(Map<String, RowMapper<?>> returningResultSetRowMappers) 

Source Link

Document

If the Stored Procedure returns ResultSets you may provide a map of RowMapper to convert the java.sql.ResultSet to meaningful objects.

Usage

From source file:org.springframework.integration.jdbc.StoredProcExecutorTests.java

@Test
public void testSetReturningResultSetRowMappersWithNullMap() {

    DataSource datasource = mock(DataSource.class);
    StoredProcExecutor storedProcExecutor = new StoredProcExecutor(datasource);

    try {//from w w w. ja  va2  s . c o  m
        storedProcExecutor.setReturningResultSetRowMappers(null);
    } catch (IllegalArgumentException e) {
        assertEquals("returningResultSetRowMappers must not be null.", e.getMessage());
        return;
    }

    fail("Exception expected.");

}

From source file:org.springframework.integration.jdbc.StoredProcExecutorTests.java

@Test
public void testSetReturningResultSetRowMappersWithMapContainingNullValues() {

    DataSource datasource = mock(DataSource.class);
    StoredProcExecutor storedProcExecutor = new StoredProcExecutor(datasource);

    Map<String, RowMapper<?>> rowmappers = new HashMap<String, RowMapper<?>>();
    rowmappers.put("results", null);

    try {//from w ww  .ja  v  a2 s .  c  o m
        storedProcExecutor.setReturningResultSetRowMappers(rowmappers);
    } catch (IllegalArgumentException e) {
        assertEquals("The provided map cannot contain null values.", e.getMessage());
        return;
    }

    fail("Exception expected.");

}

From source file:org.springframework.integration.jdbc.StoredProcExecutorTests.java

@Test
public void testSetReturningResultSetRowMappersWithEmptyMap() {

    DataSource datasource = mock(DataSource.class);
    StoredProcExecutor storedProcExecutor = new StoredProcExecutor(datasource);

    Map<String, RowMapper<?>> rowmappers = new HashMap<String, RowMapper<?>>();

    storedProcExecutor.setReturningResultSetRowMappers(rowmappers);

    //Should Successfully finish

}