RemoteRepositoryManager extends RepositoryManager { @Override public RepositoryConfig getRepositoryConfig(String id) throws RepositoryException { Model model = getModelFactory().createEmptyModel(); try (RDF4JProtocolSession protocolSession = getSharedHttpClientSessionManager() .createRDF4JProtocolSession(serverURL)) { protocolSession.setUsernameAndPassword(username, password); int serverProtocolVersion = Integer.parseInt(protocolSession.getServerProtocol()); if (serverProtocolVersion < 10) { protocolSession.setRepository(Protocol.getRepositoryLocation(serverURL, SystemRepository.ID)); protocolSession.getStatements(null, null, null, true, new StatementCollector(model)); } else { protocolSession.setRepository(Protocol.getRepositoryLocation(serverURL, id)); protocolSession.getRepositoryConfig(new StatementCollector(model)); } } catch (IOException | QueryEvaluationException | UnauthorizedException ue) { throw new RepositoryException(ue); } return RepositoryConfigUtil.getRepositoryConfig(model, id); } RemoteRepositoryManager(String serverURL); static RemoteRepositoryManager getInstance(String serverURL); static RemoteRepositoryManager getInstance(String serverURL, String username, String password); @Override HttpClient getHttpClient(); @Override void setHttpClient(HttpClient protocolSession); @Override void shutDown(); void setUsernameAndPassword(String username, String password); @Override URL getLocation(); String getServerURL(); @Override RepositoryConfig getRepositoryConfig(String id); @Override Collection<RepositoryInfo> getAllRepositoryInfos(boolean skipSystemRepo); @Override void addRepositoryConfig(RepositoryConfig config); @Override boolean removeRepository(String repositoryID);  }
@Test public void testGetRepositoryConfig() throws Exception { wireMockRule.stubFor(get(urlEqualTo("/rdf4j-server/protocol")) .willReturn(aResponse().withStatus(200).withBody(Protocol.VERSION))); wireMockRule .stubFor(get(urlEqualTo("/rdf4j-server/repositories/test/config")) .willReturn(aResponse().withStatus(200) .withHeader("Content-type", RDFFormat.NTRIPLES.getDefaultMIMEType()) .withBody("_:node1 <" + RepositoryConfigSchema.REPOSITORYID + "> \"test\" . "))); subject.getRepositoryConfig("test"); wireMockRule.verify(getRequestedFor(urlEqualTo("/rdf4j-server/repositories/test/config"))); }