// throws XRIResolutionException protected InputStream getDataFromURI(URI oURI, string query, ResolverFlags flags, ResolverState state) { // the path better be empty if ((oURI.getPath() != null) && (oURI.getPath().Length > 0)) return null; XRD oDesc = new XRD(); XRI oExternal = new XRI("xri://@foo"); oDesc.addRef(new Ref(oExternal.toString())); XRDS oDescs = new XRDS(); oDescs.add(oDesc); state.pushResolved(oURI.toString(), flags.toString(), oDesc.toString(), oURI); return new ByteArrayInputStream(oDescs.toString().getBytes()); }
public void testConstructURI() { Resolver resolver = new Resolver(); string qxri = "xri://@a*b*c/d/e?f=g"; try { URI sepURI = new URI("http://example.com/hello"); string result = resolver.constructURI(sepURI, "local", new XRI(qxri)); assertTrue("Invalid constructed URI for append=local '" + result + "'", result.Equals(sepURI.toString() + "/d/e?f=g")); result = resolver.constructURI(sepURI, "qxri", new XRI(qxri)); assertTrue("Invalid constructed URI for append=qxri '" + result + "'", result.Equals(sepURI.toString() + "@a*b*c/d/e?f=g")); Logger.Info("result = " + result); } catch (Exception oEx) { fail("Got wrong exception while trying to resolve IRI " + oEx); } }