@Test public void testException() { final CougarException ex = new CougarServiceException(ServerFaultCode.FrameworkError, "service is down"); ExecutionObserver exceptionObserver = new ExecutionObserver() { @Override public void onResult(ExecutionResult executionResult) { assertTrue(executionResult.getResultType() == ExecutionResult.ResultType.Fault); assertEquals(executionResult.getFault(), ex); assertEquals(((ClientExecutionResult)executionResult).getResultSize(), 65); } }; InvocationResponseImpl impl = new InvocationResponseImpl(null, ex); impl.recreate(exceptionObserver, new ParameterType(String.class, null), 65); }
public void recreate(ExecutionObserver observer, ParameterType returnType, long size) { if (exception!=null) { observer.onResult(new ClientExecutionResult(exception, size)); } else { if (returnType.getImplementationClass().equals(EnumWrapper.class)) { observer.onResult(new ClientExecutionResult(new EnumWrapper(returnType.getComponentTypes()[0].getImplementationClass(), (String)result), size)); } else { observer.onResult(new ClientExecutionResult(result, size)); } } }
InvocationResponseImpl implements InvocationResponse { public void recreate(ExecutionObserver observer, ParameterType returnType, long size) { if (exception!=null) { observer.onResult(new ClientExecutionResult(exception, size)); } else { if (returnType.getImplementationClass().equals(EnumWrapper.class)) { observer.onResult(new ClientExecutionResult(new EnumWrapper(returnType.getComponentTypes()[0].getImplementationClass(), (String)result), size)); } else { observer.onResult(new ClientExecutionResult(result, size)); } } } }
InvocationResponseImpl implements InvocationResponse { public void recreate(ExecutionObserver observer, ParameterType returnType, long size) { if (exception!=null) { observer.onResult(new ClientExecutionResult(exception, size)); } else { if (returnType.getImplementationClass().equals(EnumWrapper.class)) { observer.onResult(new ClientExecutionResult(new EnumWrapper(returnType.getComponentTypes()[0].getImplementationClass(), (String)result), size)); } else { observer.onResult(new ClientExecutionResult(result, size)); } } } InvocationResponseImpl(final Object result);  InvocationResponseImpl(final Object result, final CougarException exception); }
InvocationResponseImpl implements InvocationResponse { public void recreate(ExecutionObserver observer, ParameterType returnType, long size) { if (exception!=null) { observer.onResult(new ClientExecutionResult(exception, size)); } else { if (returnType.getImplementationClass().equals(EnumWrapper.class)) { observer.onResult(new ClientExecutionResult(new EnumWrapper(returnType.getComponentTypes()[0].getImplementationClass(), (String)result), size)); } else { observer.onResult(new ClientExecutionResult(result, size)); } } } InvocationResponseImpl(final Object result);  InvocationResponseImpl(final Object result, final CougarException exception); void recreate(ExecutionObserver observer, ParameterType returnType, long size); boolean isSuccess(); Object getResult(); CougarException getException(); }
InvocationResponseImpl implements InvocationResponse { public void recreate(ExecutionObserver observer, ParameterType returnType, long size) { if (exception!=null) { observer.onResult(new ClientExecutionResult(exception, size)); } else { if (returnType.getImplementationClass().equals(EnumWrapper.class)) { observer.onResult(new ClientExecutionResult(new EnumWrapper(returnType.getComponentTypes()[0].getImplementationClass(), (String)result), size)); } else { observer.onResult(new ClientExecutionResult(result, size)); } } } InvocationResponseImpl(final Object result);  InvocationResponseImpl(final Object result, final CougarException exception); void recreate(ExecutionObserver observer, ParameterType returnType, long size); boolean isSuccess(); Object getResult(); CougarException getException();  }