Author: ashakirin Date: Wed Jan 30 16:10:20 2013 New Revision: 1440494 URL: http://svn.apache.org/viewvc?rev=1440494&view=rev Log: [SYNCOPE-231] Fixed and enabled Task.deal() test
Modified: syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/TaskServiceProxy.java syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java Modified: syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/TaskServiceProxy.java URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/TaskServiceProxy.java?rev=1440494&r1=1440493&r2=1440494&view=diff ============================================================================== --- syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/TaskServiceProxy.java (original) +++ syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/TaskServiceProxy.java Wed Jan 30 16:10:20 2013 @@ -26,6 +26,7 @@ import java.util.List; import java.util.Set; import javax.ws.rs.core.Response; +import javax.xml.ws.WebServiceException; import org.apache.syncope.common.services.TaskService; import org.apache.syncope.common.to.JobClassTO; @@ -40,6 +41,8 @@ import org.apache.syncope.common.types.P import org.apache.syncope.common.types.TaskType; import org.apache.syncope.common.util.CollectionWrapper; import org.springframework.http.HttpMethod; +import org.springframework.http.client.ClientHttpRequest; +import org.springframework.http.client.ClientHttpResponse; import org.springframework.web.client.RestTemplate; @SuppressWarnings("unchecked") @@ -70,12 +73,17 @@ public class TaskServiceProxy extends Sp @Override public void delete(final Long taskId) { + ClientHttpResponse response = null; try { - getRestTemplate().getRequestFactory() - .createRequest(URI.create(baseUrl + "task/delete/" + taskId), HttpMethod.GET).execute(); + ClientHttpRequest request = getRestTemplate().getRequestFactory().createRequest( + URI.create(baseUrl + "task/delete/" + taskId), HttpMethod.GET); + response = request.execute(); } catch (IOException e) { - // TODO log event - e.printStackTrace(); + throw new WebServiceException("Cannot send request to delete task " + taskId, e); + } finally { + if (response != null) { + response.close(); + } } } @@ -170,7 +178,7 @@ public class TaskServiceProxy extends Sp @Override public TaskExecTO readExecution(final Long executionId) { - return getRestTemplate().getForObject(baseUrl + "task/execution/read/{taskId}.json", TaskExecTO.class, + return getRestTemplate().getForObject(baseUrl + "task/execution/read/{executionId}.json", TaskExecTO.class, executionId); } Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java?rev=1440494&r1=1440493&r2=1440494&view=diff ============================================================================== --- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java (original) +++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java Wed Jan 30 16:10:20 2013 @@ -202,7 +202,6 @@ public class TaskTestITCase extends Abst } @Test - @Ignore public void deal() { try { taskService.delete(0L);