@Test public void testGetInputStream() throws Exception { CacheConnection conn = createCache("actualCacheKey"); ServiceFromCache extractor = new ServiceFromCache().withKey("%message{myKey}").withConnection(conn); AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(); msg.addMetadata("myKey", "actualCacheKey"); try { LifecycleHelper.initAndStart(extractor); try (InputStream in = extractor.getInputStream(msg)) { assertNotNull(in); assertEquals(ServiceList.class, DefaultMarshaller.getDefaultMarshaller().unmarshal(in).getClass()); } } finally { LifecycleHelper.stopAndClose(extractor); } }
@Override public InputStream getInputStream(AdaptrisMessage msg) throws Exception { Args.notBlank(getKey(), "key"); Cache cache = getConnection().retrieveConnection(CacheConnection.class).retrieveCache(); String service = (String) cache.get(msg.resolve(getKey())); return IOUtils.toInputStream(service, msg.getContentEncoding()); }
ServiceFromCache extends ExtractorWithConnection { @Override public InputStream getInputStream(AdaptrisMessage msg) throws Exception { Args.notBlank(getKey(), "key"); Cache cache = getConnection().retrieveConnection(CacheConnection.class).retrieveCache(); String service = (String) cache.get(msg.resolve(getKey())); return IOUtils.toInputStream(service, msg.getContentEncoding()); } }
ServiceFromCache extends ExtractorWithConnection { @Override public InputStream getInputStream(AdaptrisMessage msg) throws Exception { Args.notBlank(getKey(), "key"); Cache cache = getConnection().retrieveConnection(CacheConnection.class).retrieveCache(); String service = (String) cache.get(msg.resolve(getKey())); return IOUtils.toInputStream(service, msg.getContentEncoding()); } ServiceFromCache(); }
ServiceFromCache extends ExtractorWithConnection { @Override public InputStream getInputStream(AdaptrisMessage msg) throws Exception { Args.notBlank(getKey(), "key"); Cache cache = getConnection().retrieveConnection(CacheConnection.class).retrieveCache(); String service = (String) cache.get(msg.resolve(getKey())); return IOUtils.toInputStream(service, msg.getContentEncoding()); } ServiceFromCache(); @Override InputStream getInputStream(AdaptrisMessage msg); String getKey(); void setKey(String query); ServiceFromCache withKey(String q); }
ServiceFromCache extends ExtractorWithConnection { @Override public InputStream getInputStream(AdaptrisMessage msg) throws Exception { Args.notBlank(getKey(), "key"); Cache cache = getConnection().retrieveConnection(CacheConnection.class).retrieveCache(); String service = (String) cache.get(msg.resolve(getKey())); return IOUtils.toInputStream(service, msg.getContentEncoding()); } ServiceFromCache(); @Override InputStream getInputStream(AdaptrisMessage msg); String getKey(); void setKey(String query); ServiceFromCache withKey(String q);  }