Example #1
0
        public static Resolver setupResolver()
        {
            // instantiate a Resolver obj
              Resolver resolver = new Resolver();

              // configure roots
              XRD eqRoot = createAuthRoot("http://equal.xri.net/");
              eqRoot.setCanonicalID(new CanonicalID("="));
              Status eqRootStatus = new Status(Status.SUCCESS);
              eqRootStatus.setCID(Status.CID_VERIFIED);
              eqRoot.setStatus(eqRootStatus);
              resolver.setAuthority("=", eqRoot);

              XRD atRoot = createAuthRoot("http://at.xri.net/");
              atRoot.setCanonicalID(new CanonicalID("@"));
              Status atRootStatus = new Status(Status.SUCCESS);
              atRootStatus.setCID(Status.CID_VERIFIED);
              atRoot.setStatus(atRootStatus);
              resolver.setAuthority("@", atRoot);

              return resolver;
        }
Example #2
0
        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);
            }
        }