@Test(expectedExceptions = DescriptorValidationFailedException.class) public void testParseNodeWhenNoInterceptorClassShouldThrowException() { given(requestInterceptorInitializer.getExternalClassObject(CLASS)).willReturn(null); given(responseInterceptorInitializer.getExternalClassObject(CLASS)).willReturn(null); underTest.parseNode(interceptorNode, document); }
@Override public InterceptorDescriptor parseNode(final Node interceptorNode, final Document document) { InterceptorDescriptor interceptorDescriptor = null; if (interceptorNode != null) { Element el = (Element) interceptorNode; String name = el.getAttribute("name"); String clazz = el.getAttribute("class"); if (clazz == null) { throw new DescriptorValidationFailedException("Validation of stub descriptor failed - Class name is missing."); } if (clazz.toLowerCase().endsWith(".class")) { throw new DescriptorValidationFailedException("Validation of stub descriptor failed - Class name '" + clazz + "' should not contain 'class' at its end."); } ParameterList params = parseInterceptorParameters(el.getElementsByTagName("param")); RequestInterceptor requestInterceptor = null; ResponseInterceptor responseInterceptor = null; try { requestInterceptor = requestInterceptorInitializer.getExternalClassObject(clazz); } catch (InterfaceValidationFailedException e) { LOGGER.debug("No Request interceptor in class:" + clazz, e); } try { responseInterceptor = responseInterceptorInitializer.getExternalClassObject(clazz); } catch (InterfaceValidationFailedException e) { LOGGER.debug("No Response interceptor in class:" + clazz, e); } if (requestInterceptor == null && responseInterceptor == null) { throw new DescriptorValidationFailedException("Validation of stub descriptor failed - Class '" + clazz + "' does not implement any of the necessary interfaces."); } interceptorDescriptor = new InterceptorDescriptor(name, requestInterceptor, responseInterceptor, params); } return interceptorDescriptor; }
InterceptorDescriptorParser implements NodeParser<InterceptorDescriptor> { @Override public InterceptorDescriptor parseNode(final Node interceptorNode, final Document document) { InterceptorDescriptor interceptorDescriptor = null; if (interceptorNode != null) { Element el = (Element) interceptorNode; String name = el.getAttribute("name"); String clazz = el.getAttribute("class"); if (clazz == null) { throw new DescriptorValidationFailedException("Validation of stub descriptor failed - Class name is missing."); } if (clazz.toLowerCase().endsWith(".class")) { throw new DescriptorValidationFailedException("Validation of stub descriptor failed - Class name '" + clazz + "' should not contain 'class' at its end."); } ParameterList params = parseInterceptorParameters(el.getElementsByTagName("param")); RequestInterceptor requestInterceptor = null; ResponseInterceptor responseInterceptor = null; try { requestInterceptor = requestInterceptorInitializer.getExternalClassObject(clazz); } catch (InterfaceValidationFailedException e) { LOGGER.debug("No Request interceptor in class:" + clazz, e); } try { responseInterceptor = responseInterceptorInitializer.getExternalClassObject(clazz); } catch (InterfaceValidationFailedException e) { LOGGER.debug("No Response interceptor in class:" + clazz, e); } if (requestInterceptor == null && responseInterceptor == null) { throw new DescriptorValidationFailedException("Validation of stub descriptor failed - Class '" + clazz + "' does not implement any of the necessary interfaces."); } interceptorDescriptor = new InterceptorDescriptor(name, requestInterceptor, responseInterceptor, params); } return interceptorDescriptor; } }
InterceptorDescriptorParser implements NodeParser<InterceptorDescriptor> { @Override public InterceptorDescriptor parseNode(final Node interceptorNode, final Document document) { InterceptorDescriptor interceptorDescriptor = null; if (interceptorNode != null) { Element el = (Element) interceptorNode; String name = el.getAttribute("name"); String clazz = el.getAttribute("class"); if (clazz == null) { throw new DescriptorValidationFailedException("Validation of stub descriptor failed - Class name is missing."); } if (clazz.toLowerCase().endsWith(".class")) { throw new DescriptorValidationFailedException("Validation of stub descriptor failed - Class name '" + clazz + "' should not contain 'class' at its end."); } ParameterList params = parseInterceptorParameters(el.getElementsByTagName("param")); RequestInterceptor requestInterceptor = null; ResponseInterceptor responseInterceptor = null; try { requestInterceptor = requestInterceptorInitializer.getExternalClassObject(clazz); } catch (InterfaceValidationFailedException e) { LOGGER.debug("No Request interceptor in class:" + clazz, e); } try { responseInterceptor = responseInterceptorInitializer.getExternalClassObject(clazz); } catch (InterfaceValidationFailedException e) { LOGGER.debug("No Response interceptor in class:" + clazz, e); } if (requestInterceptor == null && responseInterceptor == null) { throw new DescriptorValidationFailedException("Validation of stub descriptor failed - Class '" + clazz + "' does not implement any of the necessary interfaces."); } interceptorDescriptor = new InterceptorDescriptor(name, requestInterceptor, responseInterceptor, params); } return interceptorDescriptor; }  }
InterceptorDescriptorParser implements NodeParser<InterceptorDescriptor> { @Override public InterceptorDescriptor parseNode(final Node interceptorNode, final Document document) { InterceptorDescriptor interceptorDescriptor = null; if (interceptorNode != null) { Element el = (Element) interceptorNode; String name = el.getAttribute("name"); String clazz = el.getAttribute("class"); if (clazz == null) { throw new DescriptorValidationFailedException("Validation of stub descriptor failed - Class name is missing."); } if (clazz.toLowerCase().endsWith(".class")) { throw new DescriptorValidationFailedException("Validation of stub descriptor failed - Class name '" + clazz + "' should not contain 'class' at its end."); } ParameterList params = parseInterceptorParameters(el.getElementsByTagName("param")); RequestInterceptor requestInterceptor = null; ResponseInterceptor responseInterceptor = null; try { requestInterceptor = requestInterceptorInitializer.getExternalClassObject(clazz); } catch (InterfaceValidationFailedException e) { LOGGER.debug("No Request interceptor in class:" + clazz, e); } try { responseInterceptor = responseInterceptorInitializer.getExternalClassObject(clazz); } catch (InterfaceValidationFailedException e) { LOGGER.debug("No Response interceptor in class:" + clazz, e); } if (requestInterceptor == null && responseInterceptor == null) { throw new DescriptorValidationFailedException("Validation of stub descriptor failed - Class '" + clazz + "' does not implement any of the necessary interfaces."); } interceptorDescriptor = new InterceptorDescriptor(name, requestInterceptor, responseInterceptor, params); } return interceptorDescriptor; }  @Override InterceptorDescriptor parseNode(final Node interceptorNode, final Document document); }
InterceptorDescriptorParser implements NodeParser<InterceptorDescriptor> { @Override public InterceptorDescriptor parseNode(final Node interceptorNode, final Document document) { InterceptorDescriptor interceptorDescriptor = null; if (interceptorNode != null) { Element el = (Element) interceptorNode; String name = el.getAttribute("name"); String clazz = el.getAttribute("class"); if (clazz == null) { throw new DescriptorValidationFailedException("Validation of stub descriptor failed - Class name is missing."); } if (clazz.toLowerCase().endsWith(".class")) { throw new DescriptorValidationFailedException("Validation of stub descriptor failed - Class name '" + clazz + "' should not contain 'class' at its end."); } ParameterList params = parseInterceptorParameters(el.getElementsByTagName("param")); RequestInterceptor requestInterceptor = null; ResponseInterceptor responseInterceptor = null; try { requestInterceptor = requestInterceptorInitializer.getExternalClassObject(clazz); } catch (InterfaceValidationFailedException e) { LOGGER.debug("No Request interceptor in class:" + clazz, e); } try { responseInterceptor = responseInterceptorInitializer.getExternalClassObject(clazz); } catch (InterfaceValidationFailedException e) { LOGGER.debug("No Response interceptor in class:" + clazz, e); } if (requestInterceptor == null && responseInterceptor == null) { throw new DescriptorValidationFailedException("Validation of stub descriptor failed - Class '" + clazz + "' does not implement any of the necessary interfaces."); } interceptorDescriptor = new InterceptorDescriptor(name, requestInterceptor, responseInterceptor, params); } return interceptorDescriptor; }  @Override InterceptorDescriptor parseNode(final Node interceptorNode, final Document document);  }