@Test public void testDoService_WithError() throws Exception { AdaptrisMessage msg = new DefectiveMessageFactory(EnumSet.of(WhenToBreak.METADATA_GET)).newMessage("Hello World"); msg.addMetadata("metadataKey", "value"); Cache cache = createCacheInstanceForTests(); RemoveKeyFromCache service = new RemoveKeyFromCache().withKey("%message{metadataKey}").withConnection(new CacheConnection().withCacheInstance(cache)); try { start(service); service.doService(msg); fail(); } catch (ServiceException expected) { } finally { stop(service); } }
@Override public void doService(AdaptrisMessage msg) throws ServiceException { try { Cache cache = retrieveCache(); cache.remove(msg.resolve(getKey())); } catch (Exception e) { throw ExceptionHelper.wrapServiceException(e); } }
RemoveKeyFromCache extends SingleKeyCacheService { @Override public void doService(AdaptrisMessage msg) throws ServiceException { try { Cache cache = retrieveCache(); cache.remove(msg.resolve(getKey())); } catch (Exception e) { throw ExceptionHelper.wrapServiceException(e); } } }
RemoveKeyFromCache extends SingleKeyCacheService { @Override public void doService(AdaptrisMessage msg) throws ServiceException { try { Cache cache = retrieveCache(); cache.remove(msg.resolve(getKey())); } catch (Exception e) { throw ExceptionHelper.wrapServiceException(e); } }  }
RemoveKeyFromCache extends SingleKeyCacheService { @Override public void doService(AdaptrisMessage msg) throws ServiceException { try { Cache cache = retrieveCache(); cache.remove(msg.resolve(getKey())); } catch (Exception e) { throw ExceptionHelper.wrapServiceException(e); } }  @Override void doService(AdaptrisMessage msg); }
RemoveKeyFromCache extends SingleKeyCacheService { @Override public void doService(AdaptrisMessage msg) throws ServiceException { try { Cache cache = retrieveCache(); cache.remove(msg.resolve(getKey())); } catch (Exception e) { throw ExceptionHelper.wrapServiceException(e); } }  @Override void doService(AdaptrisMessage msg);  }