@Test public final void testGetRepository() throws RDF4JException, IOException { Model graph = Rio.parse(this.getClass().getResourceAsStream("/proxy.ttl"), RepositoryConfigSchema.NAMESPACE, RDFFormat.TURTLE); RepositoryConfig config = RepositoryConfig.create(graph, Models.subject(graph.filter(null, RDF.TYPE, RepositoryConfigSchema.REPOSITORY)) .orElseThrow(() -> new RepositoryConfigException("missing Repository instance in config"))); config.validate(); assertThat(config.getID()).isEqualTo("proxy"); assertThat(config.getTitle()).isEqualTo("Test Proxy for 'memory'"); RepositoryImplConfig implConfig = config.getRepositoryImplConfig(); assertThat(implConfig.getType()).isEqualTo("openrdf:ProxyRepository"); assertThat(implConfig).isInstanceOf(ProxyRepositoryConfig.class); assertThat(((ProxyRepositoryConfig) implConfig).getProxiedRepositoryID()).isEqualTo("memory"); ProxyRepository repository = (ProxyRepository) factory.getRepository(implConfig); repository.setRepositoryResolver(mock(RepositoryResolver.class)); assertThat(repository).isInstanceOf(ProxyRepository.class); }
@Override public Repository getRepository(RepositoryImplConfig config) throws RepositoryConfigException { ProxyRepository result = null; if (config instanceof ProxyRepositoryConfig) { result = new ProxyRepository(((ProxyRepositoryConfig) config).getProxiedRepositoryID()); } else { throw new RepositoryConfigException("Invalid configuration class: " + config.getClass()); } return result; }
ProxyRepositoryFactory implements RepositoryFactory { @Override public Repository getRepository(RepositoryImplConfig config) throws RepositoryConfigException { ProxyRepository result = null; if (config instanceof ProxyRepositoryConfig) { result = new ProxyRepository(((ProxyRepositoryConfig) config).getProxiedRepositoryID()); } else { throw new RepositoryConfigException("Invalid configuration class: " + config.getClass()); } return result; } }
ProxyRepositoryFactory implements RepositoryFactory { @Override public Repository getRepository(RepositoryImplConfig config) throws RepositoryConfigException { ProxyRepository result = null; if (config instanceof ProxyRepositoryConfig) { result = new ProxyRepository(((ProxyRepositoryConfig) config).getProxiedRepositoryID()); } else { throw new RepositoryConfigException("Invalid configuration class: " + config.getClass()); } return result; }  }
ProxyRepositoryFactory implements RepositoryFactory { @Override public Repository getRepository(RepositoryImplConfig config) throws RepositoryConfigException { ProxyRepository result = null; if (config instanceof ProxyRepositoryConfig) { result = new ProxyRepository(((ProxyRepositoryConfig) config).getProxiedRepositoryID()); } else { throw new RepositoryConfigException("Invalid configuration class: " + config.getClass()); } return result; }  @Override String getRepositoryType(); @Override RepositoryImplConfig getConfig(); @Override Repository getRepository(RepositoryImplConfig config); }
ProxyRepositoryFactory implements RepositoryFactory { @Override public Repository getRepository(RepositoryImplConfig config) throws RepositoryConfigException { ProxyRepository result = null; if (config instanceof ProxyRepositoryConfig) { result = new ProxyRepository(((ProxyRepositoryConfig) config).getProxiedRepositoryID()); } else { throw new RepositoryConfigException("Invalid configuration class: " + config.getClass()); } return result; }  @Override String getRepositoryType(); @Override RepositoryImplConfig getConfig(); @Override Repository getRepository(RepositoryImplConfig config); static final String REPOSITORY_TYPE; }