@Test public void testValidXmlSchema_Expression() throws Exception { String schemaUrl = PROPERTIES.getProperty(KEY_WILL_VALIDATE_SCHEMA); XmlSchemaValidator validator = new XmlSchemaValidator("%message{schema-key}") .withSchemaCache(new CacheConnection(new ExpiringMapCache().withMaxEntries(1))); AdaptrisMessage msg = MessageHelper.createMessage(PROPERTIES.getProperty(KEY_INPUT_FILE)); msg.addMetadata("schema-key", schemaUrl); XmlValidationService service = new XmlValidationService(validator); try { LifecycleHelper.initAndStart(service); service.doService(msg); service.doService(msg); } finally { LifecycleHelper.stopAndClose(service); } }
@Override public void doService(AdaptrisMessage msg) throws ServiceException { try { for (MessageValidator v : getValidators()) { v.validate(msg); } } catch (Exception e) { ExceptionHelper.rethrowServiceException(e); } }
XmlValidationService extends ServiceImp { @Override public void doService(AdaptrisMessage msg) throws ServiceException { try { for (MessageValidator v : getValidators()) { v.validate(msg); } } catch (Exception e) { ExceptionHelper.rethrowServiceException(e); } } }
XmlValidationService extends ServiceImp { @Override public void doService(AdaptrisMessage msg) throws ServiceException { try { for (MessageValidator v : getValidators()) { v.validate(msg); } } catch (Exception e) { ExceptionHelper.rethrowServiceException(e); } } XmlValidationService();  XmlValidationService(MessageValidator... validators); }
XmlValidationService extends ServiceImp { @Override public void doService(AdaptrisMessage msg) throws ServiceException { try { for (MessageValidator v : getValidators()) { v.validate(msg); } } catch (Exception e) { ExceptionHelper.rethrowServiceException(e); } } XmlValidationService();  XmlValidationService(MessageValidator... validators); @Override void start(); @Override void stop(); @Override void doService(AdaptrisMessage msg); @Override void prepare(); List<MessageValidator> getValidators(); void setValidators(List<MessageValidator> validators); }
XmlValidationService extends ServiceImp { @Override public void doService(AdaptrisMessage msg) throws ServiceException { try { for (MessageValidator v : getValidators()) { v.validate(msg); } } catch (Exception e) { ExceptionHelper.rethrowServiceException(e); } } XmlValidationService();  XmlValidationService(MessageValidator... validators); @Override void start(); @Override void stop(); @Override void doService(AdaptrisMessage msg); @Override void prepare(); List<MessageValidator> getValidators(); void setValidators(List<MessageValidator> validators);  }