}
}
public void testCacheFactory() throws Exception
{
InitParams params = new InitParams();
ObjectParameter param = new ObjectParameter();
param.setName("NoImpl");
ExoCacheConfig config = new ExoCacheConfig();
config.setName(param.getName());
param.setObject(config);
params.addParameter(param);
param = new ObjectParameter();
param.setName("KnownImpl");
config = new ExoCacheConfig();
config.setName(param.getName());
config.setImplementation("org.exoplatform.services.cache.concurrent.ConcurrentFIFOExoCache");
param.setObject(config);
params.addParameter(param);
param = new ObjectParameter();
param.setName("UnKnownImpl");
config = new ExoCacheConfig();
config.setName(param.getName());
config.setImplementation("fakeImpl");
param.setObject(config);
params.addParameter(param);
param = new ObjectParameter();
param.setName("UnKnownImplButCorrectFQN");
config = new ExoCacheConfig();
config.setName(param.getName());
config.setImplementation("java.lang.String");
param.setObject(config);
params.addParameter(param);
param = new ObjectParameter();
param.setName("NoImpl-MyExoCacheConfig");
config = new MyExoCacheConfig();
config.setName(param.getName());
param.setObject(config);
params.addParameter(param);
param = new ObjectParameter();
param.setName("KnownImpl-MyExoCacheConfig");
config = new MyExoCacheConfig();
config.setName(param.getName());
config.setImplementation("org.exoplatform.services.cache.FIFOExoCache");
param.setObject(config);
params.addParameter(param);
param = new ObjectParameter();
param.setName("UnKnownImpl-MyExoCacheConfig");
config = new MyExoCacheConfig();
config.setName(param.getName());
config.setImplementation("fakeImpl");
param.setObject(config);
params.addParameter(param);
param = new ObjectParameter();
param.setName("UnKnownImplButCorrectFQN-MyExoCacheConfig");
config = new MyExoCacheConfig();
config.setName(param.getName());
config.setImplementation("java.lang.String");
param.setObject(config);
params.addParameter(param);
CacheService cs = new CacheServiceImpl(params, new MyExoCacheFactory());
assertTrue("Expected type MyExoCache found " + cs.getCacheInstance("NoImpl").getClass(),
cs.getCacheInstance("NoImpl") instanceof MyExoCache);
assertTrue("Expected type ConcurrentFIFOExoCache found " + cs.getCacheInstance("KnownImpl").getClass(),