//Reader reader;
Reader reader = new InputStreamReader( getClass().getResourceAsStream( "../QueryData_TasksOwned.mvel" ) );
List<Task> tasks = (List<Task>) eval( reader,
vars );
for ( Task task : tasks ) {
BlockingAddTaskResponseHandler responseHandler = new BlockingAddTaskResponseHandler();
client.addTask( task, null, responseHandler );
}
// Test UK I18N
reader = new InputStreamReader( getClass().getResourceAsStream( "../QueryResults_TasksOwnedInEnglish.mvel" ) );
Map<String, List<TaskSummary>> expected = (Map<String, List<TaskSummary>>) eval( reader,
vars );
BlockingAllOpenTasksForUseResponseHandler responseHandler = new BlockingAllOpenTasksForUseResponseHandler();
client.getTasksOwned( users.get( "peter" ).getId(),
"en-UK",
responseHandler );
List<TaskSummary> actual = responseHandler.getResults();
assertEquals( 3,
actual.size() );
assertTrue( CollectionUtils.equals( expected.get( "peter" ),
actual ) );
responseHandler = new BlockingAllOpenTasksForUseResponseHandler();
client.getTasksOwned( users.get( "steve" ).getId(),
"en-UK",
responseHandler );
actual = responseHandler.getResults();
assertEquals( 2,
actual.size() );
assertTrue( CollectionUtils.equals( expected.get( "steve" ),
actual ) );
responseHandler = new BlockingAllOpenTasksForUseResponseHandler();
client.getTasksOwned( users.get( "darth" ).getId(),
"en-UK",
responseHandler );
actual = responseHandler.getResults();
assertEquals( 1,
actual.size() );
assertTrue( CollectionUtils.equals( expected.get( "darth" ),
actual ) );
// Test DK I18N
reader = new InputStreamReader( getClass().getResourceAsStream( "../QueryResults_TasksOwnedInGerman.mvel" ) );
expected = (Map<String, List<TaskSummary>>) eval( reader,
vars );
responseHandler = new BlockingAllOpenTasksForUseResponseHandler();
client.getTasksOwned( users.get( "peter" ).getId(),
"en-DK",
responseHandler );
actual = responseHandler.getResults();
assertEquals( 3,
actual.size() );
assertTrue( CollectionUtils.equals( expected.get( "peter" ),
actual ) );
responseHandler = new BlockingAllOpenTasksForUseResponseHandler();
client.getTasksOwned( users.get( "steve" ).getId(),
"en-DK",
responseHandler );
actual = responseHandler.getResults();
assertEquals( 2,
actual.size() );
assertTrue( CollectionUtils.equals( expected.get( "steve" ),
actual ) );
responseHandler = new BlockingAllOpenTasksForUseResponseHandler();
client.getTasksOwned( users.get( "darth" ).getId(),
"en-DK",
responseHandler );
actual = responseHandler.getResults();
assertEquals( 1,
actual.size() );
assertTrue( CollectionUtils.equals( expected.get( "darth" ),
actual ) );
}