Package org.culturegraph.resolver

Examples of org.culturegraph.resolver.ResolverResponse


  public void test() throws ResolverException {
    ResolverStubImpl resolver = new ResolverStubImpl();
    resolver.setRequestUrlPattern("http://nbn-resolving.de/$identifier");
    ResolverRequest resolverRequest = new ResolverRequest();
    resolverRequest.setIdentifier("urn:nbn:de:gbv:089-3321752945");
    ResolverResponse response = resolver
        .getResponse(resolverRequest);
    assertEquals(
        "http://edok01.tib.uni-hannover.de/edoks/e01dh01/332175294.pdf",
        response.getUrl());

    resolverRequest = new ResolverRequest();
    resolverRequest.setIdentifier("invalidUri");
    try {
      response = resolver.getResponse(resolverRequest);
      fail();
    } catch (ResolverException e) {
      assertEquals(ResolverExceptionCode.INVALID_IDENTIFIER, e
          .getExceptionCode());
    }
   
    ResolverStubImpl doiResolver = new ResolverStubImpl();
    doiResolver.setRequestUrlPattern("http://dx.doi.org/$identifier");
    resolverRequest = new ResolverRequest();
    resolverRequest.setIdentifier("doi:10.1000/182quatsch");
    response = doiResolver
        .getResponse(resolverRequest);
    assertEquals(
        "http://www.doi.org/hb.html",
        response.getUrl());
  }
View Full Code Here

TOP

Related Classes of org.culturegraph.resolver.ResolverResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.