Build fix: Relax tests now that Integer.MAX_VALUE is allowed for the row limit

- ALF-7167 (RINF 11) - CQ


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28750 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2011-07-01 10:51:36 +00:00
parent f18746b781
commit f54c5e8bf5
3 changed files with 18 additions and 25 deletions

View File

@@ -72,7 +72,8 @@ public interface CannedQueryDAO
* @param queryName the name of the query e.g. <b>select_userCount</b>
* @param parameterObj the values to drive the selection (may be <tt>null</tt> if not required)
* @param offset the number of results to skip
* @param limit the maximum number of results to retrieve
* @param limit the maximum number of results to retrieve or <code>Integer.MAX_VALUE</code>
* for no limit
* @return the list of results
*/
<R> List<R> executeQuery(
@@ -87,7 +88,8 @@ public interface CannedQueryDAO
* @param queryName the name of the query e.g. <b>select_userCount</b>
* @param parameterObj the values to drive the selection (may be <tt>null</tt> if not required)
* @param offset the number of results to skip
* @param limit the maximum number of results to retrieve
* @param limit the maximum number of results to retrieve or <code>Integer.MAX_VALUE</code>
* for no limit
* @return the list of results
*/
<R> void executeQuery(

View File

@@ -233,15 +233,16 @@ public class CannedQueryDAOTest extends TestCase
{
// Expected
}
try
{
cannedQueryDAO.executeQuery(QUERY_NS, QUERY_SELECT_MIMETYPES, null, 0, Integer.MAX_VALUE);
fail("Illegal parameter not detected");
}
catch (IllegalArgumentException e)
{
// Expected
}
// TODO MyBatis workaround - temporarily support unlimited for nested result maps (see also below)
// try
// {
// cannedQueryDAO.executeQuery(QUERY_NS, QUERY_SELECT_MIMETYPES, null, 0, Integer.MAX_VALUE);
// fail("Illegal parameter not detected");
// }
// catch (IllegalArgumentException e)
// {
// // Expected
// }
}
public void testExecute_ListMimetypes() throws Throwable

View File

@@ -131,21 +131,16 @@ public class CannedQueryDAOImpl extends AbstractCannedQueryDAOImpl
throw new IllegalArgumentException("Query result offset must be zero or greater.");
}
// TODO MyBatis workaround - temporarily support unlimited for nested result maps (see also below)
/*
if (limit <= 0 || limit == Integer.MAX_VALUE)
if (limit <= 0)
{
throw new IllegalArgumentException("Query results must be constrained by a limit.");
throw new IllegalArgumentException("Query results limit must be greater than zero.");
}
*/
String query = makeQueryName(sqlNamespace, queryName);
try
{
if ((offset == 0) && (limit == Integer.MAX_VALUE))
{
// TODO MyBatis workaround - temporarily support unlimited for nested result maps (see also above)
// http://code.google.com/p/mybatis/issues/detail?id=129
return (List<R>) template.selectList(query, parameterObj);
}
else
@@ -182,13 +177,10 @@ public class CannedQueryDAOImpl extends AbstractCannedQueryDAOImpl
throw new IllegalArgumentException("Query result offset must be zero or greater.");
}
// TODO MyBatis workaround - temporarily support unlimited for nested result maps (see also below)
/*
if (limit <= 0 || limit == Integer.MAX_VALUE)
if (limit <= 0)
{
throw new IllegalArgumentException("Query results must be constrained by a limit.");
throw new IllegalArgumentException("Query results limit must be greater than zero.");
}
*/
String query = makeQueryName(sqlNamespace, queryName);
ResultHandlerTranslator<R> resultHandler = new ResultHandlerTranslator<R>(handler);
@@ -200,8 +192,6 @@ public class CannedQueryDAOImpl extends AbstractCannedQueryDAOImpl
if ((offset == 0) && (limit == Integer.MAX_VALUE))
{
// TODO MyBatis workaround - temporarily support unlimited for nested result maps (see also above)
// http://code.google.com/p/mybatis/issues/detail?id=129
template.select(query, parameterObj, resultHandler);
}
else