MarkLogicRepositoryConnection extends RepositoryConnectionBase implements RepositoryConnection,MarkLogicRepositoryConnectionDependent { public MarkLogicRepositoryConnection(MarkLogicRepository repository, MarkLogicClient client, boolean quadMode) { super(repository); this.client = client; this.quadMode = true; this.defaultGraphPerms = client.emptyGraphPerms(); client.setValueFactory(repository.getValueFactory()); } MarkLogicRepositoryConnection(MarkLogicRepository repository, MarkLogicClient client, boolean quadMode); @Override ValueFactory getValueFactory(); void setValueFactory(ValueFactory f); @Override /** * Releases the connection to the database. Ensures that open transactions * are complete. Stops write cache Timer. */ void close(); @Override Query prepareQuery(String queryString); @Override Query prepareQuery(String queryString, String baseURI); @Override Query prepareQuery(QueryLanguage queryLanguage, String queryString); @Override MarkLogicQuery prepareQuery(QueryLanguage queryLanguage, String queryString, String baseURI); @Override MarkLogicTupleQuery prepareTupleQuery(String queryString); @Override MarkLogicTupleQuery prepareTupleQuery(String queryString,String baseURI); @Override MarkLogicTupleQuery prepareTupleQuery(QueryLanguage queryLanguage, String queryString); @Override MarkLogicTupleQuery prepareTupleQuery(QueryLanguage queryLanguage, String queryString, String baseURI); @Override MarkLogicGraphQuery prepareGraphQuery(String queryString); @Override MarkLogicGraphQuery prepareGraphQuery(String queryString,String baseURI); @Override MarkLogicGraphQuery prepareGraphQuery(QueryLanguage queryLanguage, String queryString); @Override MarkLogicGraphQuery prepareGraphQuery(QueryLanguage queryLanguage, String queryString, String baseURI); @Override MarkLogicBooleanQuery prepareBooleanQuery(String queryString); @Override MarkLogicBooleanQuery prepareBooleanQuery(String queryString,String baseURI); @Override MarkLogicBooleanQuery prepareBooleanQuery(QueryLanguage queryLanguage, String queryString); @Override MarkLogicBooleanQuery prepareBooleanQuery(QueryLanguage queryLanguage, String queryString, String baseURI); @Override MarkLogicUpdateQuery prepareUpdate(String queryString); @Override MarkLogicUpdateQuery prepareUpdate(String queryString,String baseURI); @Override MarkLogicUpdateQuery prepareUpdate(QueryLanguage queryLanguage, String queryString); @Override MarkLogicUpdateQuery prepareUpdate(QueryLanguage queryLanguage, String queryString, String baseURI); @Override RepositoryResult<Resource> getContextIDs(); RepositoryResult<Statement> getStatements(Resource subj, URI pred, Value obj, boolean includeInferred); @Override RepositoryResult<Statement> getStatements(Resource subj, URI pred, Value obj, boolean includeInferred, Resource... contexts); @Override boolean hasStatement(Statement st, boolean includeInferred, Resource... contexts); @Override boolean hasStatement(Resource subject, URI predicate, Value object, boolean includeInferred, Resource... contexts); @Override void export(RDFHandler handler, Resource... contexts); @Override void exportStatements(Resource subject, URI predicate, Value object, boolean includeInferred, RDFHandler handler, Resource... contexts); @Override long size(); @Override long size(Resource... contexts); @Override void clear(); @Override void clear(Resource... contexts); @Override boolean isEmpty(); @Override boolean isOpen(); @Override boolean isActive(); @Override IsolationLevel getIsolationLevel(); @Override void setIsolationLevel(IsolationLevel level); @Override void begin(); @Override void begin(IsolationLevel level); @Override void commit(); @Override void rollback(); @Override void add(InputStream in, String baseURI, RDFFormat dataFormat, Resource... contexts); @Override void add(File file, String baseURI, RDFFormat dataFormat, Resource... contexts); @Override void add(Reader reader, String baseURI, RDFFormat dataFormat, Resource... contexts); @Override void add(URL url, String baseURI, RDFFormat dataFormat, Resource... contexts); @Override void add(Resource subject, URI predicate, Value object, Resource... contexts); @Override void add(Statement st, Resource... contexts); @Override void add(Iterable<? extends Statement> statements, Resource... contexts); @Override void add(Iteration<? extends Statement, E> statements, Resource... contexts); @Override void remove(Resource subject, URI predicate, Value object, Resource... contexts); @Override void remove(Statement st, Resource... contexts); @Override void remove(Iterable<? extends Statement> statements); @Override void remove(Iterable<? extends Statement> statements, Resource... contexts); @Override void remove(Iteration<? extends Statement, E> statements); @Override void remove(Iteration<? extends Statement, E> statements, Resource... contexts); @Override RepositoryResult<Namespace> getNamespaces(); @Override String getNamespace(String prefix); @Override void setNamespace(String prefix, String name); @Override void removeNamespace(String prefix); @Override void clearNamespaces(); @Override void setDefaultGraphPerms(GraphPermissions graphPerms); @Override GraphPermissions getDefaultGraphPerms(); @Override void setDefaultConstrainingQueryDefinition(QueryDefinition queryDef); @Override QueryDefinition getDefaultConstrainingQueryDefinition(); @Override void setDefaultRulesets(SPARQLRuleset ... ruleset ); @Override SPARQLRuleset[] getDefaultRulesets(); @Override void sync(); @Override void configureWriteCache(long initDelay, long delayCache, long cacheSize);  }
@Test public void testMarkLogicRepositoryConnection() throws Exception { Assert.assertNotNull("Expected repository to exist.", rep); Assert.assertTrue("Expected repository to be initialized.", rep.isInitialized()); rep.shutDown(); Properties props = new Properties(); try { props.load(new FileInputStream("gradle.properties")); } catch (IOException e) { System.err.println("problem loading properties file."); System.exit(1); } String host = props.getProperty("mlHost"); int port = Integer.parseInt(props.getProperty("mlRestPort")); String user = props.getProperty("validUsername"); String pass = props.getProperty("validPassword"); rep = new MarkLogicRepository(host, port, user, pass, "DIGEST"); Assert.assertNotNull("Expected repository to exist.", rep); Assert.assertFalse("Expected repository to not be initialized.", rep.isInitialized()); rep.initialize(); conn = rep.getConnection(); Assert.assertTrue("Expected repository to be initialized.", rep.isInitialized()); rep.shutDown(); Assert.assertFalse("Expected repository to not be initialized.", rep.isInitialized()); rep.initialize(); conn = rep.getConnection(); Assert.assertNotNull("Expected repository to exist.", rep); }