Package com.marklogic.xcc

Examples of com.marklogic.xcc.ResultSequence


                XName xname = new XName(name.getNamespaceURI(), name.getLocalName());
                XdmVariable myVariable = ValueFactory.newVariable (xname, value);
                request.setVariable (myVariable);
            }

            ResultSequence rs = session.submitRequest (request);

            while (rs.hasNext()) {
                ResultItem rsItem = rs.next();
                XdmItem item = rsItem.getItem();

                // FIXME: This needs work...
                if (item instanceof XdmDocument || item instanceof XdmElement) {
                    XdmNode xccXML = parseString(item.asString());
View Full Code Here


 
  public void testRelToAbs10() throws Exception {
    XdmValue[] params = new XdmValue[] {
        ValueFactory.newXSString("http://en.wikipedia.org/wiki/Star_Wars"),
        ValueFactory.newXSString("/wiki/File:Star_Wars_Logo.svg")};
    ResultSequence rs = executeLibraryModule(modulePath, moduleNamespace, "rel-to-abs", params);
    String s = (String)rs.itemAt(0).asString();
    assertEquals("http://en.wikipedia.org/wiki/File:Star_Wars_Logo.svg", s);         
  }
View Full Code Here

 
  public void testEmptyDatabase() throws Exception {
    executeLibraryModule(modulePath, moduleNamespace, "emptyDatabase");
    // Verify update by running a query
    String q = "fn:count(fn:doc())";
    ResultSequence rs = this.executeQuery(q, null, null);
    XSInteger qResult = (XSInteger)rs.itemAt(0);
    assertEquals(getName(), 0, qResult.asPrimitiveInt());
  }
View Full Code Here

 
  public void testInit() throws Exception {
    executeLibraryModule(modulePath, moduleNamespace, "init");
    // Verify update by running a query
    String q = "fn:doc('/config/tarantula.xml')" + "//tara:switch/text()";
    ResultSequence rs = this.executeQuery(q, null, null);
    String qStr = rs.asString();
    assertEquals("on", qStr);
 
  }
View Full Code Here

 
  public void testTurnOff() throws Exception {
    executeLibraryModule(modulePath, moduleNamespace, "turnOff");
    // Verify update by running a query
    String q = "fn:doc('/config/tarantula.xml')" + "//tara:switch/text()";
    ResultSequence rs = this.executeQuery(q, null, null);
    String qStr = rs.asString();
    assertEquals("off", qStr);
 
  }
View Full Code Here

 
  public void testTurnOn() throws Exception {
    executeLibraryModule(modulePath, moduleNamespace, "turnOn");
    // Verify update by running a query
    String q = "fn:doc('/config/tarantula.xml')" + "//tara:switch/text()";
    ResultSequence rs = this.executeQuery(q, null, null);
    String qStr = rs.asString();
    assertEquals("on", qStr);
 
  }
View Full Code Here

 
  public void testStartBreadthCrawler() throws Exception {
    XdmValue[] params = new XdmValue[] {
      ValueFactory.newXSString(sampleURL1),
      ValueFactory.newXSInteger(1) };
    ResultSequence rs = executeLibraryModule(modulePath, moduleNamespace, "x", null);
    //Verify update by running a query
    System.out.println(rs.asString());
 
    assertEquals(getName(), 0, 0);

  }
View Full Code Here

 
  public void testHTTPGetHTMLContent() throws Exception {
    //Initialize the variable
    XdmVariable[] variables = new XdmVariable[] {
        ValueFactory.newVariable(new XName("url"), ValueFactory.newXSString(sampleURL1))};
    ResultSequence rs = this.executeMainModule(modulePath, null, variables);
    String q = "fn:doc('" + sampleURL1 + "')//*:title/text()";
    ResultSequence rs2 = executeQuery(q, null, null);
    String qStr = rs2.asString();
    System.out.println(rs.asString());
    System.out.println(qStr);
    assertEquals("Star Wars - Wikipedia, the free encyclopedia", qStr);   
  }
View Full Code Here

 
  public void testGetLinkQueue() throws Exception {
    //Initialize the variable
    XdmVariable[] variables = new XdmVariable[] {
        ValueFactory.newVariable(new XName("url"), ValueFactory.newXSString(sampleURL1))};
    ResultSequence rs = this.executeMainModule(modulePath2, null, variables);
    String q = "fn:count(fn:doc('" + sampleURL1 + "')//*:link)";
    ResultSequence rs2 = executeQuery(q, null, null);
    String qStr = rs2.asString();
    try {
        // Create file
        FileWriter fstream = new FileWriter("link-queue.txt");
        BufferedWriter out = new BufferedWriter(fstream);
        out.write(rs.asString());
View Full Code Here

  public void testRelToAbs1() throws Exception {
    XdmValue[] params = new XdmValue[] {
        ValueFactory.newXSString(absURL),
        ValueFactory.newXSString("../lena.jpg")};
    ResultSequence rs = executeLibraryModule(modulePath, moduleNamespace, "rel-to-abs", params);
    String s = (String)rs.itemAt(0).asString();
    assertEquals(s, "http://www.example.com/a/lena.jpg");         
  }
View Full Code Here

TOP

Related Classes of com.marklogic.xcc.ResultSequence

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.