mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALF-4842 (Transfer Service):
- Fixed issue in rehydrating exception received from target repo. Added appropriate test case. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22618 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -238,6 +238,34 @@ public class HttpClientTransmitterImplTest extends TestCase
|
||||
assertTrue(Arrays.deepEquals(expectedException.getMsgParams(), receivedException.getMsgParams()));
|
||||
}
|
||||
|
||||
public void testBeginFailure() throws Exception
|
||||
{
|
||||
final ExceptionJsonSerializer errorSerializer = new ExceptionJsonSerializer();
|
||||
final TransferException expectedException = new TransferException("my message id", new Object[] {"param1", "param2"});
|
||||
when(mockedHttpClient.executeMethod(any(HostConfiguration.class), any(HttpMethod.class),
|
||||
any(HttpState.class))).thenReturn(500);
|
||||
doAnswer(new Answer<String>() {
|
||||
@Override
|
||||
public String answer(InvocationOnMock invocation) throws Throwable
|
||||
{
|
||||
JSONObject errorObject = errorSerializer.serialize(expectedException);
|
||||
return errorObject.toString();
|
||||
}
|
||||
}).when(mockedHttpMethodFactory.latestPostMethod).getResponseBodyAsString();
|
||||
|
||||
try
|
||||
{
|
||||
transmitter.begin(target);
|
||||
fail();
|
||||
}
|
||||
catch(TransferException ex)
|
||||
{
|
||||
assertEquals(expectedException.getClass(), ex.getClass());
|
||||
assertEquals(expectedException.getMsgId(), ex.getMsgId());
|
||||
assertTrue(Arrays.deepEquals(expectedException.getMsgParams(), ex.getMsgParams()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class CustomSocketFactory implements SecureProtocolSocketFactory
|
||||
{
|
||||
|
||||
|
Reference in New Issue
Block a user