/** * Prepares the global out parameter <code>Map</code>. * @param outParameters the global out parameter <code>Map</code> */ public void prepareGlobalOutParameter(MockParameterMap outParameters) { globalOutParameter = new MockParameterMap(outParameters); }
public void addBatch() throws SQLException { batchParameters.add(new MockParameterMap(paramObjects)); }
/** * Returns the if the specified SQL string returns multiple result sets. * Please note that you can modify the match parameters with {@link #setCaseSensitive}, * {@link #setExactMatch} and {@link #setUseRegularExpressions}. * @param sql the SQL string * @return <code>true</code> if the query returns multiple result sets, * <code>false</code> otherwise */ public boolean hasMultipleResultSets(String sql) { return hasMultipleResultSets(sql, new MockParameterMap(), true); }
/** * Prepare the update count for execute update calls for a specified SQL string * with an empty parameter map. * @param sql the SQL string * @param updateCount the update count */ @Override public void prepareUpdateCount(String sql, int updateCount) { prepareUpdateCount(sql, updateCount, new MockParameterMap()); }
/** * Returns the if the specified SQL string returns multiple update counts. * Please note that you can modify the match parameters with {@link #setCaseSensitive}, * {@link #setExactMatch} and {@link #setUseRegularExpressions}. * @param sql the SQL string * @return <code>true</code> if the SQL string returns multiple update counts, * <code>false</code> otherwise */ public boolean hasMultipleUpdateCounts(String sql) { return hasMultipleUpdateCounts(sql, new MockParameterMap(), true); }
/** * Prepare the generated keys <code>ResultSet</code> * for a specified SQL string. Please note that you can modify * the match parameters with {@link #setCaseSensitive}, * {@link #setExactMatch} and {@link #setUseRegularExpressions}. * @param sql the SQL string * @param generatedKeysResult the generated keys {@link MockResultSet} */ public void prepareGeneratedKeys(String sql, MockResultSet generatedKeysResult) { prepareGeneratedKeys(sql, generatedKeysResult, new MockParameterMap()); }
/** * Prepare a <code>ResultSet</code> for a specified SQL string and * an empty parameter map. * @param sql the SQL string * @param resultSet the corresponding {@link MockResultSet} */ @Override public void prepareResultSet(String sql, MockResultSet resultSet) { prepareResultSet(sql, resultSet, new MockParameterMap()); }
/** * Prepare an array of <code>ResultSet</code> objects for a specified SQL string and * an empty parameter map. * @param sql the SQL string * @param resultSets the corresponding <code>MockResultSet[]</code> */ @Override public void prepareResultSets(String sql, MockResultSet[] resultSets) { prepareResultSets(sql, resultSets, new MockParameterMap()); }
/** * Prepare that the specified SQL string with empty parameters * should raise an exception. * This can be used to simulate database exceptions. * This method creates an <code>SQLException</code> and will throw this * exception. * @param sql the SQL string * @param exc the <code>SQLException</code> that should be thrown */ @Override public void prepareThrowsSQLException(String sql, SQLException exc) { prepareThrowsSQLException(sql, new MockParameterMap()); }
/** * Prepare the update counts for execute update calls for a specified SQL string * with an empty parameter map. * @param sql the SQL string * @param updateCounts the update counts */ @Override public void prepareUpdateCounts(String sql, Integer[] updateCounts) { prepareUpdateCounts(sql, updateCounts, new MockParameterMap()); }
/** * Given a SQL string, remove the associated entry from the resultSetsForStatement TreeMap * @param sql The SQL string associated with the resultset */ public void removeResultSet(String sql) { removeResultSet(sql, new MockParameterMap(), false); }
/** * Remove the throws mock for the specified SQL string. * @param sql The SQL string which identifies the conditions under which to throw a SQLException */ public void removeThrowsSqlException(String sql) { removeThrowsSqlException(sql, new MockParameterMap(), false); }
protected void prepareThrowsSQLException(String sql, SQLException exc, MockParameterMap parameters) { List<ParameterWrapper<SQLException>> list = getListFromMapForSQLStatement(sql, throwsSQLException); list.add(new ParameterWrapper<SQLException>(exc, new MockParameterMap(parameters))); throwsSQLExceptionCompiled.put(patternMatcherFactory.create(sql), list); } /**
protected void prepareUpdateCount(String sql, int updateCount, MockParameterMap parameters) { List<ParameterWrapper<Integer[]>> list = getListFromMapForSQLStatement(sql, updateCountForStatement); list.add(new ParameterWrapper<Integer[]>(new Integer[]{updateCount}, new MockParameterMap(parameters))); updateCountForStatementCompiled.put(patternMatcherFactory.create(sql), list); }
protected void prepareGeneratedKeys(String sql, MockResultSet generatedKeysResult, MockParameterMap parameters) { List<ParameterWrapper<MockResultSet>> list = getListFromMapForSQLStatement(sql, generatedKeysForStatement); list.add(new ParameterWrapper<MockResultSet>(generatedKeysResult, new MockParameterMap(parameters))); generatedKeysForStatementCompiled.put(patternMatcherFactory.create(sql), list); }
protected void prepareResultSet(String sql, MockResultSet resultSet, MockParameterMap parameters) { List<ParameterWrapper<MockResultSet[]>> list = getListFromMapForSQLStatement(sql, resultSetsForStatement); list.add(new ParameterWrapper<MockResultSet[]>(new MockResultSet[]{resultSet}, new MockParameterMap(parameters))); resultSetsForStatementCompiled.put(patternMatcherFactory.create(sql), list); }
public void prepareUpdateCounts(String sql, Integer[] updateCounts, MockParameterMap parameters) { List<ParameterWrapper<Integer[]>> list = getListFromMapForSQLStatement(sql, updateCountForStatement); list.add(new ParameterWrapper<Integer[]>(updateCounts.clone(), new MockParameterMap(parameters))); updateCountForStatementCompiled.put(patternMatcherFactory.create(sql), list); }
protected void prepareResultSets(String sql, MockResultSet[] resultSets, MockParameterMap parameters) { List<ParameterWrapper<MockResultSet[]>> list = getListFromMapForSQLStatement(sql, resultSetsForStatement); list.add(new ParameterWrapper<MockResultSet[]>(resultSets.clone(), new MockParameterMap(parameters))); resultSetsForStatementCompiled.put(patternMatcherFactory.create(sql), list); }
public MockParameterMap getIndexedParameterMap() { MockParameterMap indexedParameters = new MockParameterMap(); for(ParameterReference parameterReference : paramObjects.keySet()){ if(parameterReference instanceof ParameterIndex){ indexedParameters.put(parameterReference, paramObjects.get(parameterReference)); } } return new MockUnmodifiableParameterMap(indexedParameters); }
public MockParameterMap getNamedParameterMap() { MockParameterMap namedParameters = new MockParameterMap(); for(ParameterReference parameterReference : paramObjects.keySet()){ if(parameterReference instanceof ParameterName){ namedParameters.put(parameterReference, paramObjects.get(parameterReference)); } } return new MockUnmodifiableParameterMap(namedParameters); }