dlmarion commented on PR #6153:
URL: https://github.com/apache/accumulo/pull/6153#issuecomment-3961371081
I looked at trying to write a test for this, but could not figure it out
quickly. Another option would be to fail at runtime on the server side, which
should be caught during testing. To do this, we could include the following
method in the ThriftProcessorTypes class, then call it for each interface
passed to the getManagerTProcessor method.
```
private void validateHAServerExceptions(Class<?> thriftInterface) {
String className = thriftInterface.getClass().getName();
Method[] methods = thriftInterface.getClass().getMethods();
for (Method m : methods) {
Class<?>[] exceptionClasses = m.getExceptionTypes();
if (exceptionClasses.length == 0) {
throw new IllegalStateException("Method " + m.getName() + " on " +
className + ""
+ " does not declare ThriftNotActiveServiceException to be
thrown");
}
boolean found = false;
for (Class<?> ec : exceptionClasses) {
if
(ThriftNotActiveServiceException.class.getName().equals(ec.getClass().getName()))
{
found = true;
break;
}
}
if (!found) {
throw new IllegalStateException("Method " + m.getName() + " on " +
className + ""
+ " does not declare ThriftNotActiveServiceException to be
thrown");
}
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]