Examples of URI


Examples of org.jwat.common.Uri

            e.printStackTrace();
            Assert.fail("Unexpected exception!");
        }

        String uriStr = "urn:uuid:a1bc4f20-d057-44bd-a299-bdf31f4dfa53";
        Uri uriObj = Uri.create(uriStr);

        /*
         * Non warc headers.
         */

        header = getTestHeader();
        headerLine = header.addHeader("X-Header1", dateObj, dateStr);
        Assert.assertNotNull(headerLine);
        Assert.assertEquals("X-Header1", headerLine.name);
        Assert.assertEquals(dateStr, headerLine.value);
        headerLine = header.addHeader("X-Header2", dateObj, dateStr);
        Assert.assertNotNull(headerLine);
        Assert.assertEquals("X-Header2", headerLine.name);
        Assert.assertEquals(dateStr, headerLine.value);

        /*
         * Duplicate date headers.
         */

        header = getTestHeader();
        headerLine = header.addHeader("WARC-Date", dateObj, dateStr);
        Assert.assertNotNull(headerLine);
        Assert.assertEquals("WARC-Date", headerLine.name);
        Assert.assertEquals(dateStr, headerLine.value);
        errors = header.diagnostics.getErrors();
        warnings = header.diagnostics.getWarnings();
        Assert.assertEquals(0, errors.size());
        Assert.assertEquals(0, warnings.size());
        headerLine = header.addHeader("WARC-Date", dateObj, dateStr);
        Assert.assertNotNull(headerLine);
        Assert.assertEquals("WARC-Date", headerLine.name);
        Assert.assertEquals(dateStr, headerLine.value);
        errors = header.diagnostics.getErrors();
        warnings = header.diagnostics.getWarnings();
        Assert.assertEquals(1, errors.size());
        Assert.assertEquals(0, warnings.size());
        diagnosis = errors.get(0);
        Assert.assertEquals(DiagnosisType.DUPLICATE, diagnosis.type);
        Assert.assertEquals("'WARC-Date' header", diagnosis.entity);
        Assert.assertEquals(1, diagnosis.information.length);

        /*
         * Integer add header.
         */

        cases = generate_invalid_datatype_cases(integerObj, integerStr, WarcConstants.FN_WARC_SEGMENT_NUMBER, WarcConstants.FN_WARC_RECORD_ID);
        test_headeradd_object_cases(cases, WarcConstants.FDT_INTEGER);

        /*
         * Long add header.
         */

        cases = generate_invalid_datatype_cases(longObj, longStr, WarcConstants.FN_CONTENT_LENGTH, WarcConstants.FN_CONTENT_TYPE);
        test_headeradd_object_cases(cases, WarcConstants.FDT_LONG);

        /*
         * Digest add header.
         */

        cases = generate_invalid_datatype_cases(digestObj, digestStr, WarcConstants.FN_WARC_BLOCK_DIGEST, WarcConstants.FN_WARC_SEGMENT_NUMBER);
        test_headeradd_object_cases(cases, WarcConstants.FDT_DIGEST);

        /*
         * ContentType add header.
         */

        cases = generate_invalid_datatype_cases(contentTypeObj, contentTypeStr, WarcConstants.FN_CONTENT_TYPE, WarcConstants.FN_WARC_BLOCK_DIGEST);
        test_headeradd_object_cases(cases, WarcConstants.FDT_CONTENTTYPE);

        /*
         * Date add header.
         */

        cases = generate_invalid_datatype_cases(dateObj, dateStr, WarcConstants.FN_WARC_DATE, WarcConstants.FN_CONTENT_TYPE);
        test_headeradd_object_cases(cases, WarcConstants.FDT_DATE);

        /*
         * InetAddress add header.
         */

        cases = generate_invalid_datatype_cases(inetAddressObj, inetAddressStr, WarcConstants.FN_WARC_IP_ADDRESS, WarcConstants.FN_WARC_DATE);
        test_headeradd_object_cases(cases, WarcConstants.FDT_INETADDRESS);

        /*
         * URI add header.
         */

        cases = generate_invalid_datatype_cases(uriObj, "<" + uriStr + ">", WarcConstants.FN_WARC_RECORD_ID, WarcConstants.FN_WARC_IP_ADDRESS);
        test_headeradd_object_cases(cases, WarcConstants.FDT_URI);

        /*
         * Test datatype for headers.
         */

        /*
        WarcConstants.FN_WARC_TYPE
        WarcConstants.FN_WARC_TRUNCATED
        WarcConstants.FN_WARC_FILENAME
        WarcConstants.FN_WARC_PROFILE
        */

        /*
         * Integer.
         */

        String segmentNrStr = "42";
        Integer segmentNrObj = Integer.parseInt(segmentNrStr);
        cases = generate_header_datatype_cases(segmentNrObj, segmentNrStr, WarcConstants.FN_WARC_SEGMENT_NUMBER, "warcSegmentNumberStr", "warcSegmentNumber");
        test_headeradd_object_cases(cases, WarcConstants.FDT_INTEGER);

        /*
         * Long.
         */

        String contentLengthStr = "1234567890123456";
        Long contentLengthObj = Long.parseLong(contentLengthStr);
        cases = generate_header_datatype_cases(contentLengthObj, contentLengthStr, WarcConstants.FN_CONTENT_LENGTH, "contentLengthStr", "contentLength");
        test_headeradd_object_cases(cases, WarcConstants.FDT_LONG);

        String segmentTotalLengthStr = "9876543210987654";
        Long segmentTotalLengthObj = Long.parseLong(segmentTotalLengthStr);
        cases = generate_header_datatype_cases(segmentTotalLengthObj, segmentTotalLengthStr, WarcConstants.FN_WARC_SEGMENT_TOTAL_LENGTH, "warcSegmentTotalLengthStr", "warcSegmentTotalLength");
        test_headeradd_object_cases(cases, WarcConstants.FDT_LONG);

        /*
         * Digest.
         */

        String blockDigestStr = "sha1:Y4N5SWNQBIBIGQ66IFXDMLGJW6FZFV6U";
        WarcDigest blockDigestObj = WarcDigest.parseWarcDigest(blockDigestStr);
        cases = generate_header_datatype_cases(blockDigestObj, blockDigestStr, WarcConstants.FN_WARC_BLOCK_DIGEST, "warcBlockDigestStr", "warcBlockDigest");
        test_headeradd_object_cases(cases, WarcConstants.FDT_DIGEST);

        String payloadDigestStr = "sha1:BCCYP7NW6QIIOSM523Y5XHQKE5KWLMBD";
        WarcDigest payloadDigestObj = WarcDigest.parseWarcDigest(payloadDigestStr);
        cases = generate_header_datatype_cases(payloadDigestObj, payloadDigestStr, WarcConstants.FN_WARC_PAYLOAD_DIGEST, "warcPayloadDigestStr", "warcPayloadDigest");
        test_headeradd_object_cases(cases, WarcConstants.FDT_DIGEST);

        /*
         * ContentType.
         */

        contentTypeStr = "application/http; msgtype=request";
        contentTypeObj = ContentType.parseContentType(contentTypeStr);
        cases = generate_header_datatype_cases(contentTypeObj, contentTypeStr, WarcConstants.FN_CONTENT_TYPE, "contentTypeStr", "contentType");
        test_headeradd_object_cases(cases, WarcConstants.FDT_CONTENTTYPE);

        String identifiedPayloadTypeStr = "application/http; msgtype=response";
        ContentType identifiedPayloadTypeObj = ContentType.parseContentType(identifiedPayloadTypeStr);
        cases = generate_header_datatype_cases(identifiedPayloadTypeObj, identifiedPayloadTypeStr, WarcConstants.FN_WARC_IDENTIFIED_PAYLOAD_TYPE, "warcIdentifiedPayloadTypeStr", "warcIdentifiedPayloadType");
        test_headeradd_object_cases(cases, WarcConstants.FDT_CONTENTTYPE);

        /*
         * Date.
         */

        dateStr = "2010-06-23T13:33:21Z";
        dateObj = WarcDateParser.getDate(dateStr);
        cases = generate_header_datatype_cases(dateObj, dateStr, WarcConstants.FN_WARC_DATE, "warcDateStr", "warcDate");
        test_headeradd_object_cases(cases, WarcConstants.FDT_DATE);

        String refersToDateStr = "2010-06-23T13:33:21Z";
        Date refersToDateObj = WarcDateParser.getDate(refersToDateStr);
        cases = generate_header_datatype_cases(refersToDateObj, refersToDateStr, WarcConstants.FN_WARC_REFERS_TO_DATE, "warcRefersToDateStr", "warcRefersToDate");
        test_headeradd_object_cases(cases, WarcConstants.FDT_DATE);

        /*
         * InetAddress.
         */

        inetAddressStr = "174.36.20.141";
        inetAddressObj = null;
        try {
            inetAddressObj = InetAddress.getByName(inetAddressStr);
        } catch (UnknownHostException e) {
            e.printStackTrace();
            Assert.fail("Unexpected exception!");
        }
        cases = generate_header_datatype_cases(inetAddressObj, inetAddressStr, WarcConstants.FN_WARC_IP_ADDRESS, "warcIpAddress", "warcInetAddress");
        test_headeradd_object_cases(cases, WarcConstants.FDT_INETADDRESS);

        /*
         * URI.
         */

        String recordIdStr = "urn:uuid:12eab1ec-8615-4f09-b6d2-976d96552073";
        Uri recordIdObj = Uri.create(recordIdStr);
        cases = generate_header_datatype_cases(recordIdObj, "<" + recordIdStr + ">", WarcConstants.FN_WARC_RECORD_ID, "warcRecordIdStr", "warcRecordIdUri");
        test_headeradd_object_cases(cases, WarcConstants.FDT_URI);

        String refersToStr = "urn:uuid:bfa9d26b-ff19-402a-8508-e7ff852d4ded";
        Uri refersToObj = Uri.create(refersToStr);
        cases = generate_header_datatype_cases(refersToObj, "<" + refersToStr + ">", WarcConstants.FN_WARC_REFERS_TO, "warcRefersToStr", "warcRefersToUri");
        test_headeradd_object_cases(cases, WarcConstants.FDT_URI);

        String targetUriStr = "urn:uuid:de715d47-9f36-4cdf-84db-eb3b47dcd0e3";
        Uri targetUriObj = Uri.create(targetUriStr);
        cases = generate_header_datatype_cases(targetUriObj, targetUriStr, WarcConstants.FN_WARC_TARGET_URI, "warcTargetUriStr", "warcTargetUriUri");
        test_headeradd_object_cases(cases, WarcConstants.FDT_URI);

        String warcinfoIdStr = "urn:uuid:1cb0e3be-d9e2-4058-bf00-9775c75a71a6";
        Uri warcinfoIdObj = Uri.create(warcinfoIdStr);
        cases = generate_header_datatype_cases(warcinfoIdObj, "<" + warcinfoIdStr + ">", WarcConstants.FN_WARC_WARCINFO_ID, "warcWarcinfoIdStr", "warcWarcinfoIdUri");
        test_headeradd_object_cases(cases, WarcConstants.FDT_URI);

        String segmentOriginIdStr = "urn:uuid:c4fc410a-4c7b-4bcc-a251-382b1d669f9a";
        Uri segmentOriginIdObj = Uri.create(segmentOriginIdStr);
        cases = generate_header_datatype_cases(segmentOriginIdObj, "<" + segmentOriginIdStr + ">", WarcConstants.FN_WARC_SEGMENT_ORIGIN_ID, "warcSegmentOriginIdStr", "warcSegmentOriginIdUrl");
        test_headeradd_object_cases(cases, WarcConstants.FDT_URI);

        Object[][] concurrentHeaders = new Object[][] {
                {Uri.create("urn:uuid:173a3db1-9ba4-496e-9eaf-6e550a62fd88"), "<urn:uuid:173a3db1-9ba4-496e-9eaf-6e550a62fd88>"},
                {Uri.create("urn:uuid:660b74e7-076e-4698-abba-4eeeb8e09bf1"), "<urn:uuid:660b74e7-076e-4698-abba-4eeeb8e09bf1>"},
                {Uri.create("urn:uuid:e6c0d888-b384-4ef4-a698-6166bc0875b8"), "<urn:uuid:e6c0d888-b384-4ef4-a698-6166bc0875b8>"}
        };
        cases = generate_multivalue_cases(concurrentHeaders, WarcConstants.FN_WARC_CONCURRENT_TO, "warcConcurrentToList");
        test_headeradd_multivalue_object_cases(cases, WarcConstants.FDT_URI);

        String warcProfileStr = WarcConstants.PROFILE_IDENTICAL_PAYLOAD_DIGEST;
        Uri warcProfileObj = Uri.create(warcProfileStr);
        cases = generate_header_datatype_cases(warcProfileObj, warcProfileStr, WarcConstants.FN_WARC_PROFILE, "warcProfileStr", "warcProfileUri");
        test_headeradd_object_cases(cases, WarcConstants.FDT_URI);

        warcProfileStr = "urn:uuid:de715d47-9f36-4cdf-84db-eb3b47dcd0e3";
        warcProfileObj = Uri.create(warcProfileStr);
        cases = generate_header_datatype_cases(warcProfileObj, warcProfileStr, WarcConstants.FN_WARC_PROFILE, "warcProfileStr", "warcProfileUri");
        test_headeradd_object_cases(cases, WarcConstants.FDT_URI);

        String warcRefersToTargetUriStr = "urn:uuid:de715d47-9f36-4cdf-84db-eb3b47dcd0e3";
        Uri warcRefersToTargetUriObj = Uri.create(warcRefersToTargetUriStr);
        cases = generate_header_datatype_cases(warcRefersToTargetUriObj, warcRefersToTargetUriStr, WarcConstants.FN_WARC_REFERS_TO_TARGET_URI, "warcRefersToTargetUriStr", "warcRefersToTargetUriUri");
        test_headeradd_object_cases(cases, WarcConstants.FDT_URI);

        /*
        public List<WarcConcurrentTo> warcConcurrentToList = new LinkedList<WarcConcurrentTo>();
View Full Code Here

Examples of org.librdf.redland.URI

 
  public URI getURI()
    {
      long uri_object=core.librdf_node_get_uri(this.object);
      return new URI(this.world, uri_object);
    }
View Full Code Here

Examples of org.mortbay.util.URI

        _tunnelTimeoutMs = ms;
    }

    /* ------------------------------------------------------------ */
    public void handle(String pathInContext, String pathParams, HttpRequest request, HttpResponse response) throws HttpException, IOException {
        URI uri = request.getURI();

        // Is this a CONNECT request?
        if (HttpRequest.__CONNECT.equalsIgnoreCase(request.getMethod())) {
            response.setField(HttpFields.__Connection, "close"); // TODO Needed for IE????
            handleConnect(pathInContext, pathParams, request, response);
View Full Code Here

Examples of org.ontoware.rdf2go.model.node.URI

    init();

    // creating URIs
    // persons
    URI max = model.createURI("http://xam.de/foaf.rdf.xml#i");
    URI konrad = model.createURI("http://example.com/persons#konrad");
    URI guido = model.createURI("http://example.com/persons#guido");
    URI james = model.createURI("http://example.com/persons#james");
    // relations
    URI hasName = model.createURI("http://xmlns.com/foaf/0.1/#term_name");
    URI hasAge = model.createURI("http://example.com/relations#age");
    hasTag = model.createURI("http://example.com/relations#hasTag");
    // tags
    PlainLiteral tagJava = model.createPlainLiteral("Java");
    PlainLiteral tagPython = model.createPlainLiteral("Python");
    PlainLiteral tagComputers = model.createPlainLiteral("Computers");
View Full Code Here

Examples of org.openqa.jetty.util.URI

        _tunnelTimeoutMs = ms;
    }

    /* ------------------------------------------------------------ */
    public void handle(String pathInContext, String pathParams, HttpRequest request, HttpResponse response) throws HttpException, IOException {
        URI uri = request.getURI();

        // Is this a CONNECT request?
        if (HttpRequest.__CONNECT.equalsIgnoreCase(request.getMethod())) {
            response.setField(HttpFields.__Connection, "close"); // TODO Needed for IE????
            handleConnect(pathInContext, pathParams, request, response);
View Full Code Here

Examples of org.openrdf.model.URI

  {
    MemoryStore store = new MemoryStore(dataDir);
    store.initialize();

    URIFactory factory = store.getURIFactory();
    URI foo = factory.createURI("http://www.foo.example/foo");
    URI bar = factory.createURI("http://www.foo.example/bar");

    SailConnection con = store.getConnection();
    con.addStatement(foo, RDF.TYPE, bar);

    TupleQueryModel query = QueryParserUtil.parseTupleQuery(QueryLanguage.SERQL,
View Full Code Here

Examples of org.openrdf.rio.rdfjson.RDFJSONUtility.URI

     */
    public static RDFNode parseRDFJSONNode(Map<String, String> nodeDef) {
        RDFNode object;

        if( nodeDef.get(TYPE).equals(URI) ) {
            object = new URI(nodeDef.get(VALUE));
        } else if( nodeDef.get(TYPE).equals(BNODE) ) {
            object = new BNode(nodeDef.get(VALUE));
        } else {
            if( nodeDef.get(LANG) != null ) {
                object = new Literal(nodeDef.get(VALUE),nodeDef.get(LANG));
            } else if( nodeDef.get(DATATYPE) != null) {
                object = new Literal(nodeDef.get(VALUE),new URI(nodeDef.get(DATATYPE)));
            } else {
                object = new Literal(nodeDef.get(VALUE));
            }
        }
        return object;
View Full Code Here

Examples of org.opensaml.artifact.URI

    /**
     * We ignore prefixes for SAML compliance.
     */
    public String getNewTicketId(final String prefix) {
        if (saml2compliant) {
            return new SAMLArtifactType0002(this.randomStringGenerator.getNewStringAsBytes(), new URI(this.sourceLocation)).encode();
        } else {
            return new SAMLArtifactType0001(this.sourceIdDigest, this.randomStringGenerator.getNewStringAsBytes()).encode();
        }
    }
View Full Code Here

Examples of org.wikier.trioo.jtrioo.annotations.URI

  private String separator;
 
  @SuppressWarnings("rawtypes")
  public MetaURI(Class cls) throws IllegalArgumentException {
    this.cls = cls;
    URI uri = ((AnnotatedElement)cls).getAnnotation(URI.class);
    if (uri != null) {
      this.base = uri.base();
      this.parts = uri.parts();
      this.separator = uri.separator();
      this.validate();
    } else {
      throw new IllegalArgumentException("Class not annotated with any URI");
    }
  }
View Full Code Here

Examples of org.wymiwyg.commons.util.URI

    FunctionallyGroundedNode existing = descriptionPathToFgNode.get(describingResource);
    if (existing != null) {
      return existing;
    }
    try {
      String relativePath = new URI(ReferencingNaturalizer.rootURL)
          .relativize(describingResource.getURIRef(), URI.SAMEDOCUMENT
              | URI.ABSOLUTE | URI.RELATIVE | URI.PARENT);
      PathNode pathNode = new ZipPathNode(zipFile, relativePath);
      //FunctionallyGroundedNode result =
      return getFgNodeFromPathNode(zipFile, pathNode, describingResource);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.