use of com.adaptris.core.services.cache.CacheConnection in project interlok by adaptris.
the class GetAndCacheOauthTokenTest method testService_WithError.
@Test(expected = ServiceException.class)
public void testService_WithError() throws Exception {
ExpiringMapCache cache = new ExpiringMapCache().withExpiration(new TimeInterval(5L, TimeUnit.SECONDS));
AccessToken t = new AccessToken(getName());
GetAndCacheOauthToken service = new GetAndCacheOauthToken().withCacheKey("OauthToken").withConnection(new CacheConnection(cache)).withAccessTokenBuilder(new DummyAccessTokenBuilder(t, true));
AdaptrisMessage msg = new DefaultMessageFactory().newMessage(TEXT);
execute(service, msg);
}
use of com.adaptris.core.services.cache.CacheConnection in project interlok by adaptris.
the class ServiceFromCacheTest method createCache.
private CacheConnection createCache(String key) throws Exception {
ExpiringMapCache cacheInstance = new ExpiringMapCache();
CacheConnection conn = new CacheConnection();
conn.setCacheInstance(cacheInstance);
LifecycleHelper.initAndStart(conn);
conn.retrieveCache().put(key, DynamicServiceExecutorTest.createMessage(new ServiceList(new LogMessageService())).getContent());
return conn;
}
use of com.adaptris.core.services.cache.CacheConnection in project interlok by adaptris.
the class BasicSchemaValidationTest method testBasicSchemaValidator_Exception.
@Test(expected = ServiceException.class)
public void testBasicSchemaValidator_Exception() throws Exception {
String schemaUrl = PROPERTIES.getProperty(KEY_WILL_VALIDATE_SCHEMA);
BasicXmlSchemaValidator validator = new BasicXmlSchemaValidator().withSchema(schemaUrl).withSchemaCache(new CacheConnection().withCacheInstance(new ExpiringMapCache()));
XmlValidationService service = new XmlValidationService(validator);
try {
LifecycleHelper.initAndStart(service);
AdaptrisMessage m1 = new DefectiveMessageFactory(WhenToBreak.BOTH).newMessage();
service.doService(m1);
} finally {
LifecycleHelper.stopAndClose(service);
}
}
use of com.adaptris.core.services.cache.CacheConnection in project interlok by adaptris.
the class CacheServiceExample method retrieveObjectsForSampleConfig.
@Override
protected List retrieveObjectsForSampleConfig() {
List<Object> result = new ArrayList<Object>();
for (CacheExampleImplementation c : getExampleCacheImplementations()) {
for (CacheExampleServiceGenerator gen : getExampleGenerators()) {
Service service = gen.createExampleService();
navigateTo(service).setConnection(new CacheConnection(c.createCacheImplementation()));
result.add(service);
}
}
return result;
}
use of com.adaptris.core.services.cache.CacheConnection in project interlok by adaptris.
the class XmlSchemaValidatorImpl method prepare.
@Override
public void prepare() throws CoreException {
schemaCacheConnection = ObjectUtils.defaultIfNull(getSchemaCache(), new CacheConnection(new ExpiringMapCache().withExpiration(DEFAULT_CACHE_TTL).withMaxEntries(DEFAULT_CACHE_SIZE)));
LifecycleHelper.prepare(schemaCacheConnection);
}
Aggregations