MarkLogicRepository extends RepositoryBase implements Repository,MarkLogicClientDependent { @Override public MarkLogicRepositoryConnection getConnection() throws RepositoryException { if (!isInitialized()) { throw new RepositoryException("MarkLogicRepository not initialized."); } return new MarkLogicRepositoryConnection(this, getMarkLogicClient(), quadMode); } MarkLogicRepository(URL connectionString);  MarkLogicRepository(String host, int port, String user, String password, String auth);  MarkLogicRepository(DatabaseClient databaseClient); ValueFactory getValueFactory(); void setValueFactory(ValueFactory f); @Override File getDataDir(); @Override void setDataDir(File dataDir); @Override boolean isWritable(); @Override MarkLogicRepositoryConnection getConnection(); @Override synchronized MarkLogicClient getMarkLogicClient(); @Override synchronized void setMarkLogicClient(MarkLogicClient client); boolean isQuadMode(); void setQuadMode(boolean quadMode);  }
@Test public void negativeTestRepo2() throws Exception { Repository rep = new MarkLogicRepository(host, port, user, password, "DIGEST"); rep.initialize(); rep.shutDown(); exception.expect(RepositoryException.class); exception.expectMessage("MarkLogicRepository not initialized."); @SuppressWarnings("unused") RepositoryConnection conn = rep.getConnection(); }
@Test public void TestRepoWithJavaAPIClientDatabaseClient() throws Exception { DatabaseClient databaseClient = DatabaseClientFactory.newClient(host, port, user, password, DatabaseClientFactory.Authentication.valueOf("DIGEST")); Repository rep = new MarkLogicRepository(databaseClient); rep.initialize(); Assert.assertTrue(rep instanceof Repository); RepositoryConnection conn = rep.getConnection(); Assert.assertTrue(conn instanceof RepositoryConnection); conn.close(); rep.shutDown(); }
@Test public void testMultipleReposWithDifferentUsers() throws RepositoryException, MalformedQueryException, UpdateExecutionException { readerRep.initialize(); MarkLogicRepositoryConnection testReaderCon = readerRep.getConnection(); exception.expect(Exception.class); testReaderCon.prepareUpdate("CREATE GRAPH <abc>").execute(); writerRep.initialize(); MarkLogicRepositoryConnection testWriterCon = writerRep.getConnection(); testWriterCon.prepareUpdate("CREATE GRAPH <abcdef10>").execute(); writerRep.shutDown(); readerRep.shutDown(); }