SampleBlazegraphCustomFunctionRemote { public static void loadDataFromResource(final RemoteRepositoryManager repo, final String namespace, final String resource) throws Exception { final InputStream is = SampleBlazegraphCustomFunctionRemote.class .getResourceAsStream(resource); if (is == null) { throw new IOException("Could not locate resource: " + resource); } try { repo.getRepositoryForNamespace(namespace).add( new RemoteRepository.AddOp(is, RDFFormat.N3)); } finally { is.close(); } }  static void main(String[] args); static void loadDataFromResource(final RemoteRepositoryManager repo,
			final String namespace, final String resource); static final String serviceURL; static final String QUERY; }
@Test public void testCustomFunctionRemote() throws Exception{ final String namespace = "test"; final Properties journalProperties = new Properties(); { journalProperties.setProperty(Journal.Options.BUFFER_MODE, BufferMode.MemStore.name()); } Journal m_indexManager = new Journal(journalProperties); Server nss = NanoSparqlServer.newInstance(9999, "jettyMavenTest.xml", m_indexManager, null); final RemoteRepositoryManager m_repo = new RemoteRepositoryManager( SampleBlazegraphCustomFunctionRemote.serviceURL , false ); try { nss.start(); m_repo.createRepository(namespace, journalProperties); final String resource = "/data.n3"; SampleBlazegraphCustomFunctionRemote.loadDataFromResource(m_repo, namespace, resource); final TupleQueryResult result = m_repo.getRepositoryForNamespace(namespace) .prepareTupleQuery(SampleBlazegraphCustomFunctionRemote.QUERY) .evaluate(); int countResults = 0; String expected = "http: String actual = null; while(result.hasNext()){ BindingSet bs = result.next(); actual = bs.getBinding("doc").getValue().stringValue(); countResults++; } result.close(); Assert.assertEquals(1, countResults); Assert.assertEquals(expected, actual); } finally { nss.stop(); } }