本文整理汇总了Java中com.marklogic.xcc.ResultSequence.hasNext方法的典型用法代码示例。如果您正苦于以下问题:Java ResultSequence.hasNext方法的具体用法?Java ResultSequence.hasNext怎么用?Java ResultSequence.hasNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.marklogic.xcc.ResultSequence
的用法示例。
在下文中一共展示了ResultSequence.hasNext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testImportDelimitedTextUTF16LEZip
import com.marklogic.xcc.ResultSequence; //导入方法依赖的package包/类
@Test
public void testImportDelimitedTextUTF16LEZip() throws Exception {
String cmd = "IMPORT -host localhost -username admin -password admin"
+ " -input_file_path " + Constants.TEST_PATH.toUri()
+ "/encoding/samplecsv.utf16le.zip -content_encoding utf-16le"
+ " -delimited_uri_id first -input_compressed"
+ " -output_uri_replace " + Constants.MLCP_HOME + ",'/space/workspace/xcc/mlcp'"
+ " -input_file_type delimited_text"
+ " -port " + Constants.port + " -database " + Constants.testDb;
String[] args = cmd.split(" ");
assertFalse(args.length == 0);
Utils.clearDB(Utils.getTestDbXccUri(), Constants.testDb);
String[] expandedArgs = null;
expandedArgs = OptionsFileUtil.expandArguments(args);
ContentPump.runCommand(expandedArgs);
ResultSequence result = Utils.runQuery(
Utils.getTestDbXccUri(), "fn:count(fn:collection())");
assertTrue(result.hasNext());
assertEquals("3", result.next().asString());
Utils.closeSession();
result = Utils.getNonEmptyDocsURIs(Utils.getTestDbXccUri());
StringBuilder sb = new StringBuilder();
while(result.hasNext()) {
String s = result.next().asString();
sb.append(s);
}
Utils.closeSession();
String key = Utils.readSmallFile(Constants.TEST_PATH.toUri().getPath()
+ "/keys/TestImportDelimitedText#testImportDelimitedTextUTF16LEZip.txt");
assertTrue(sb.toString().equals(key));
}
示例2: getForestSplits
import com.marklogic.xcc.ResultSequence; //导入方法依赖的package包/类
protected void getForestSplits(JobContext jobContext,
ResultSequence result,
List<ForestSplit> forestSplits,
List<String> ruleUris,
String[] inputHosts) throws IOException {
Configuration jobConf = jobContext.getConfiguration();
super.getForestSplits(jobContext, result, forestSplits, ruleUris, inputHosts);
// Third while loop: audit settings
while (result.hasNext()) {
ResultItem item = result.next();
if (ItemType.XS_STRING != item.getItemType()) {
throw new IOException("Unexpected item type " + item.getItemType().toString());
}
String itemStr = ((XSString)item.getItem()).asString();
if ("AUDIT".equals(itemStr)) {
continue;
} else if (ConfigConstants.AUDIT_MLCPSTART_EVENT.
equalsIgnoreCase(itemStr)) {
mlcpStartEventEnabled = true;
} else if (ConfigConstants.AUDIT_MLCPFINISH_EVENT.
equalsIgnoreCase(itemStr)) {
mlcpFinishEventEnabled = true;
} else {
throw new IOException("Unrecognized audit event " + itemStr);
}
}
if (ruleUris != null && ruleUris.size() > 0) {
AuditUtil.prepareAuditMlcpFinish(jobConf, ruleUris.size());
if (LOG.isDebugEnabled()) {
// TODO: Use this version if only JAVA 8 is supported
// String logMessage = String.join(", ", ruleUris);
LOG.debug("Redaction rules applied: " + StringUtils.join(ruleUris, ", "));
}
}
if (mlcpStartEventEnabled) {
AuditUtil.auditMlcpStart(jobConf, jobContext.getJobName());
}
jobConf.setBoolean(ConfigConstants.CONF_AUDIT_MLCPFINISH_ENABLED, mlcpFinishEventEnabled);
}
示例3: testImportDelimitedText
import com.marklogic.xcc.ResultSequence; //导入方法依赖的package包/类
@Test
public void testImportDelimitedText() throws Exception {
String cmd =
"IMPORT -host localhost -username admin -password admin"
+ " -input_file_path " + Constants.TEST_PATH.toUri() + "/csv"
+ " -hadoop_conf_dir " + Constants.HADOOP_CONF_DIR
+ " -delimited_uri_id first"
+ " -input_file_type delimited_text -input_file_pattern .*\\.csv"
+ " -port " + Constants.port + " -database " + Constants.testDb;
String[] args = cmd.split(" ");
assertFalse(args.length == 0);
Utils.clearDB(Utils.getTestDbXccUri(), Constants.testDb);
String[] expandedArgs = null;
expandedArgs = OptionsFileUtil.expandArguments(args);
ContentPump.runCommand(expandedArgs);
ResultSequence result = Utils.runQuery(
Utils.getTestDbXccUri(), "fn:count(fn:collection())");
assertTrue(result.hasNext());
assertEquals("7", result.next().asString());
Utils.closeSession();
result = Utils.getNonEmptyDocsURIs(Utils.getTestDbXccUri());
StringBuilder sb = new StringBuilder();
while(result.hasNext()) {
String s = result.next().asString();
sb.append(s);
}
Utils.closeSession();
String key = Utils.readSmallFile(Constants.TEST_PATH.toUri().getPath()
+ "/keys/TestImportDelimitedText#testImportDelimitedText.txt");
assertTrue(sb.toString().equals(key));
}
示例4: testImportDelimitedJSONZip
import com.marklogic.xcc.ResultSequence; //导入方法依赖的package包/类
@Test
public void testImportDelimitedJSONZip() throws Exception {
String cmd = "IMPORT -host localhost -username admin -password admin"
+ " -input_file_path " + Constants.TEST_PATH.toUri() + "/delimitedJson/zip/sample.zip"
+ " -uri_id name -generate_uri false -input_compressed true -input_compression_codec zip"
+ " -input_file_type delimited_json"
+ " -port " + Constants.port + " -database " + Constants.testDb;
String[] args = cmd.split(" ");
Utils.clearDB(Utils.getTestDbXccUri(), Constants.testDb);
String[] expandedArgs = null;
expandedArgs = OptionsFileUtil.expandArguments(args);
ContentPump.runCommand(expandedArgs);
ResultSequence result = Utils.runQuery(Utils.getTestDbXccUri(),
"fn:count(fn:doc())");
assertTrue(result.hasNext());
assertEquals("5", result.next().asString());
Utils.closeSession();
result = Utils.assertDocsFormat(Utils.getTestDbXccUri(),"JSON");
assertTrue(result.hasNext());
assertTrue(result.next().asString().equals("true"));
Utils.closeSession();
result = Utils.getAllDocs(Utils.getTestDbXccUri());
StringBuilder sb = new StringBuilder();
while (result.hasNext()) {
String s = result.next().asString();
sb.append(s);
}
String key = Utils
.readSmallFile(Constants.TEST_PATH.toUri().getPath()
+ "/keys/TestImportDelimitedJson#testImportDelimitedJsonDir.txt");
assertTrue(sb.toString().equals(key));
}
示例5: testImportDelimitedJSONZipDir
import com.marklogic.xcc.ResultSequence; //导入方法依赖的package包/类
@Test
public void testImportDelimitedJSONZipDir() throws Exception {
String cmd = "IMPORT -host localhost -username admin -password admin"
+ " -input_file_path " + Constants.TEST_PATH.toUri() + "/delimitedJson/zip"
+ " -uri_id name -generate_uri false -input_compressed true -input_compression_codec zip"
+ " -input_file_type delimited_json"
+ " -port " + Constants.port + " -database " + Constants.testDb;
String[] args = cmd.split(" ");
Utils.clearDB(Utils.getTestDbXccUri(), Constants.testDb);
String[] expandedArgs = null;
expandedArgs = OptionsFileUtil.expandArguments(args);
ContentPump.runCommand(expandedArgs);
ResultSequence result = Utils.runQuery(Utils.getTestDbXccUri(),
"fn:count(fn:doc())");
assertTrue(result.hasNext());
assertEquals("6", result.next().asString());
Utils.closeSession();
result = Utils.assertDocsFormat(Utils.getTestDbXccUri(),"JSON");
assertTrue(result.hasNext());
assertTrue(result.next().asString().equals("true"));
Utils.closeSession();
result = Utils.getAllDocs(Utils.getTestDbXccUri());
StringBuilder sb = new StringBuilder();
while (result.hasNext()) {
String s = result.next().asString();
sb.append(s);
}
String key = Utils
.readSmallFile(Constants.TEST_PATH.toUri().getPath()
+ "/keys/TestImportDelimitedJson#testImportDelimitedJSONZipDir.txt");
assertTrue(sb.toString().equals(key));
}
示例6: testImportDelimitedJSONGzip
import com.marklogic.xcc.ResultSequence; //导入方法依赖的package包/类
@Test
public void testImportDelimitedJSONGzip() throws Exception {
String cmd = "IMPORT -host localhost -username admin -password admin"
+ " -input_file_path " + Constants.TEST_PATH.toUri() + "/delimitedJson/gzip/sample.gz"
+ " -uri_id name -generate_uri false -input_compressed true -input_compression_codec gzip"
+ " -input_file_type delimited_json"
+ " -port " + Constants.port + " -database " + Constants.testDb;
String[] args = cmd.split(" ");
Utils.clearDB(Utils.getTestDbXccUri(), Constants.testDb);
String[] expandedArgs = null;
expandedArgs = OptionsFileUtil.expandArguments(args);
ContentPump.runCommand(expandedArgs);
ResultSequence result = Utils.runQuery(Utils.getTestDbXccUri(),
"fn:count(fn:doc())");
assertTrue(result.hasNext());
assertEquals("5", result.next().asString());
Utils.closeSession();
result = Utils.assertDocsFormat(Utils.getTestDbXccUri(),"JSON");
assertTrue(result.hasNext());
assertTrue(result.next().asString().equals("true"));
Utils.closeSession();
result = Utils.getAllDocs(Utils.getTestDbXccUri());
StringBuilder sb = new StringBuilder();
while (result.hasNext()) {
String s = result.next().asString();
sb.append(s);
}
String key = Utils
.readSmallFile(Constants.TEST_PATH.toUri().getPath()
+ "/keys/TestImportDelimitedJson#testImportDelimitedJsonDir.txt");
assertTrue(sb.toString().equals(key));
}
示例7: testImportDelimitedJSONGzipDir
import com.marklogic.xcc.ResultSequence; //导入方法依赖的package包/类
@Test
public void testImportDelimitedJSONGzipDir() throws Exception {
String cmd = "IMPORT -host localhost -username admin -password admin"
+ " -input_file_path " + Constants.TEST_PATH.toUri() + "/delimitedJson/gzip"
+ " -uri_id name -generate_uri false -input_compressed true -input_compression_codec gzip"
+ " -input_file_type delimited_json"
+ " -port " + Constants.port + " -database " + Constants.testDb;
String[] args = cmd.split(" ");
Utils.clearDB(Utils.getTestDbXccUri(), Constants.testDb);
String[] expandedArgs = null;
expandedArgs = OptionsFileUtil.expandArguments(args);
ContentPump.runCommand(expandedArgs);
ResultSequence result = Utils.runQuery(Utils.getTestDbXccUri(),
"fn:count(fn:doc())");
assertTrue(result.hasNext());
assertEquals("6", result.next().asString());
Utils.closeSession();
result = Utils.assertDocsFormat(Utils.getTestDbXccUri(),"JSON");
assertTrue(result.hasNext());
assertTrue(result.next().asString().equals("true"));
Utils.closeSession();
result = Utils.getAllDocs(Utils.getTestDbXccUri());
StringBuilder sb = new StringBuilder();
while (result.hasNext()) {
String s = result.next().asString();
sb.append(s);
}
String key = Utils
.readSmallFile(Constants.TEST_PATH.toUri().getPath()
+ "/keys/TestImportDelimitedJson#testImportDelimitedJSONZipDir.txt");
assertTrue(sb.toString().equals(key));
}
示例8: testImportDelimitedTextSplit
import com.marklogic.xcc.ResultSequence; //导入方法依赖的package包/类
@Test
public void testImportDelimitedTextSplit() throws Exception {
String cmd =
"IMPORT -host localhost -username admin -password admin"
+ " -input_file_path " + Constants.TEST_PATH.toUri() + "/csv"
+ " -delimited_uri_id first"
+ " -split_input -max_split_size 50"
+ " -input_file_type delimited_text"
+ " -input_file_pattern .*\\.csv"
+ " -port " + Constants.port + " -database " + Constants.testDb;
String[] args = cmd.split(" ");
assertFalse(args.length == 0);
Utils.clearDB(Utils.getTestDbXccUri(), Constants.testDb);
String[] expandedArgs = null;
expandedArgs = OptionsFileUtil.expandArguments(args);
ContentPump.runCommand(expandedArgs);
ResultSequence result = Utils.runQuery(
Utils.getTestDbXccUri(), "fn:count(fn:collection())");
assertTrue(result.hasNext());
assertEquals("7", result.next().asString());
Utils.closeSession();
result = Utils.getNonEmptyDocsURIs(Utils.getTestDbXccUri());
StringBuilder sb = new StringBuilder();
while(result.hasNext()) {
String s = result.next().asString();
sb.append(s);
}
Utils.closeSession();
String key = Utils.readSmallFile(Constants.TEST_PATH.toUri().getPath()
+ "/keys/TestImportDelimitedText#testImportDelimitedText.txt");
assertTrue(sb.toString().equals(key));
}
示例9: testImportDelimitedJSONArray
import com.marklogic.xcc.ResultSequence; //导入方法依赖的package包/类
@Test
public void testImportDelimitedJSONArray() throws Exception {
String cmd = "IMPORT -host localhost -username admin -password admin"
+ " -input_file_path " + Constants.TEST_PATH.toUri() + "/delimitedJson/testUri2"
+ " -uri_id val -generate_uri false"
+ " -input_file_type delimited_json"
+ " -port " + Constants.port + " -database " + Constants.testDb;
String[] args = cmd.split(" ");
Utils.clearDB(Utils.getTestDbXccUri(), Constants.testDb);
String[] expandedArgs = null;
expandedArgs = OptionsFileUtil.expandArguments(args);
ContentPump.runCommand(expandedArgs);
ResultSequence result = Utils.runQuery(Utils.getTestDbXccUri(),
"fn:count(fn:doc())");
assertTrue(result.hasNext());
assertEquals("4", result.next().asString());
Utils.closeSession();
result = Utils.getAllDocs(Utils.getTestDbXccUri());
StringBuilder sb = new StringBuilder();
while (result.hasNext()) {
String s = result.next().asString();
sb.append(s);
}
String key = Utils
.readSmallFile(Constants.TEST_PATH.toUri().getPath()
+ "/keys/TestImportDelimitedJson#testImportDelimitedJSONArray.txt");
assertTrue(sb.toString().equals(key));
}
示例10: testImportMixedDocs
import com.marklogic.xcc.ResultSequence; //导入方法依赖的package包/类
@Test
public void testImportMixedDocs() throws Exception {
String cmd = "IMPORT -password admin -username admin -host localhost"
+ " -input_file_path " + Constants.TEST_PATH.toUri() + "/wiki"
+ " -output_uri_prefix test/"
+ " -output_collections test,ML"
+ " -fastload false"
+ " -output_uri_replace wiki,'wiki1'"
+ " -port " + Constants.port + " -database " + Constants.testDb;
String[] args = cmd.split(" +");
assertFalse(args.length == 0);
Utils.clearDB(Utils.getTestDbXccUri(), Constants.testDb);
String[] expandedArgs = null;
expandedArgs = OptionsFileUtil.expandArguments(args);
ContentPump.runCommand(expandedArgs);
ResultSequence result = Utils.runQuery(
Utils.getTestDbXccUri(),
"fn:count(fn:collection(\"ML\"))");
assertTrue(result.hasNext());
assertEquals("93", result.next().asString());
Utils.closeSession();
result = Utils.runQuery(Utils.getTestDbXccUri(),
"xdmp:directory(\"test/\", \"infinity\")");
int count = 0;
while (result.hasNext()) {
ResultItem item = result.next();
String uri = item.getDocumentURI();
assertTrue(uri.contains("wiki1"));
count++;
}
assertTrue(count == 93);
Utils.closeSession();
}
示例11: testImportDelimitedTextGenerateId
import com.marklogic.xcc.ResultSequence; //导入方法依赖的package包/类
@Test
public void testImportDelimitedTextGenerateId() throws Exception {
String cmd = "IMPORT -host localhost -username admin -password admin"
+ " -input_file_path " + Constants.TEST_PATH.toUri() + "/csv"
+ " -generate_uri"
+ " -output_uri_replace " + Constants.MLCP_HOME + ",'/space/workspace/xcc/mlcp'"
+ " -input_file_type delimited_text -input_file_pattern .*\\.csv"
+ " -port " + Constants.port + " -database " + Constants.testDb;
String[] args = cmd.split(" ");
assertFalse(args.length == 0);
Utils.clearDB(Utils.getTestDbXccUri(), Constants.testDb);
String[] expandedArgs = null;
expandedArgs = OptionsFileUtil.expandArguments(args);
ContentPump.runCommand(expandedArgs);
ResultSequence result = Utils.runQuery(
Utils.getTestDbXccUri(), "fn:count(fn:collection())");
assertTrue(result.hasNext());
assertEquals("7", result.next().asString());
Utils.closeSession();
result = Utils.getNonEmptyDocsURIs(Utils.getTestDbXccUri());
StringBuilder sb = new StringBuilder();
while(result.hasNext()) {
String s = result.next().asString();
sb.append(s);
}
Utils.closeSession();
String key = Utils.readSmallFile(Constants.TEST_PATH.toUri().getPath()
+ "/keys/TestImportDelimitedText#testImportDelimitedGenerateId.txt");
System.out.println("DUMP:" + cmd);
System.out.println("DUMP:" + sb.length() +"@" + sb.toString());
assertTrue(sb.toString().equals(key));
}
示例12: testImportDelimitedTextHardZip
import com.marklogic.xcc.ResultSequence; //导入方法依赖的package包/类
@Test
public void testImportDelimitedTextHardZip() throws Exception {
String cmd = "IMPORT -host localhost -username admin -password admin"
+ " -input_file_path " + Constants.TEST_PATH.toUri() + "/csv/sample3.csv.hard.zip"
+ " -delimited_uri_id first -input_compressed"
+ " -input_file_type delimited_text"
+ " -port " + Constants.port + " -database " + Constants.testDb;
String[] args = cmd.split(" ");
assertFalse(args.length == 0);
Utils.clearDB(Utils.getTestDbXccUri(), Constants.testDb);
String[] expandedArgs = null;
expandedArgs = OptionsFileUtil.expandArguments(args);
ContentPump.runCommand(expandedArgs);
ResultSequence result = Utils.runQuery(
Utils.getTestDbXccUri(), "fn:count(fn:collection())");
assertTrue(result.hasNext());
assertEquals("3", result.next().asString());
Utils.closeSession();
result = Utils.getAllDocs(Utils.getTestDbXccUri());
StringBuilder sb = new StringBuilder();
while(result.hasNext()) {
String s = result.next().asString();
sb.append(s);
}
Utils.closeSession();
String key = Utils.readSmallFile(Constants.TEST_PATH.toUri().getPath()
+ "/keys/TestImportDelimitedText#testImportDelimitedTextHardZip.txt");
assertTrue(sb.toString().equals(key));
}
示例13: testImportDelimitedTextJSONDataType
import com.marklogic.xcc.ResultSequence; //导入方法依赖的package包/类
@Test
public void testImportDelimitedTextJSONDataType() throws Exception {
String cmd = "IMPORT -host localhost -username admin -password admin"
+ " -input_file_path "
+ Constants.TEST_PATH.toUri()
+ "/csv/sample4.txt"
+ " -input_file_type delimited_text -data_type zipcode,String,score,number"
+ " -document_type json"
+ " -port " + Constants.port + " -database " + Constants.testDb;
String[] args = cmd.split(" ");
assertFalse(args.length == 0);
Utils.clearDB(Utils.getTestDbXccUri(), Constants.testDb);
String[] expandedArgs = null;
expandedArgs = OptionsFileUtil.expandArguments(args);
ContentPump.runCommand(expandedArgs);
ResultSequence result = Utils.runQuery(Utils.getTestDbXccUri(),
"fn:count(fn:doc())");
assertTrue(result.hasNext());
assertEquals("2", result.next().asString());
Utils.closeSession();
result = Utils.getAllDocs(Utils.getTestDbXccUri());
StringBuilder sb = new StringBuilder();
while (result.hasNext()) {
String s = result.next().asString();
sb.append(s);
}
String key = Utils
.readSmallFile(Constants.TEST_PATH.toUri().getPath()
+ "/keys/TestImportDelimitedText#testImportDelimitedTextJSONDataType.txt");
assertTrue(sb.toString().equals(key));
}
示例14: testImportDelimitedTextElemNamesSplit
import com.marklogic.xcc.ResultSequence; //导入方法依赖的package包/类
@Test
public void testImportDelimitedTextElemNamesSplit() throws Exception {
String cmd = "IMPORT -host localhost -username admin -password admin"
+ " -input_file_path " + Constants.TEST_PATH.toUri() + "/csv/sample3.csv.ename"
+ " -split_input -max_split_size 50"
+ " -input_file_type delimited_text"
+ " -port " + Constants.port + " -database " + Constants.testDb;
String[] args = cmd.split(" ");
assertFalse(args.length == 0);
Utils.clearDB(Utils.getTestDbXccUri(), Constants.testDb);
String[] expandedArgs = null;
expandedArgs = OptionsFileUtil.expandArguments(args);
ContentPump.runCommand(expandedArgs);
ResultSequence result = Utils.runQuery(
Utils.getTestDbXccUri(), "fn:count(fn:collection())");
assertTrue(result.hasNext());
assertEquals("3", result.next().asString());
Utils.closeSession();
result = Utils.getAllDocs(Utils.getTestDbXccUri());
StringBuilder sb = new StringBuilder();
while(result.hasNext()) {
String s = result.next().asString();
sb.append(s);
}
Utils.closeSession();
String key = Utils.readSmallFile(Constants.TEST_PATH.toUri().getPath()
+ "/keys/TestImportDelimitedText#testImportDelimitedTextElemNamesSplit.txt");
assertTrue(sb.toString().equals(key));
}
示例15: testImportAggZip
import com.marklogic.xcc.ResultSequence; //导入方法依赖的package包/类
@Test
public void testImportAggZip() throws Exception {
String cmd = "IMPORT -host localhost" +
" -username admin" + " -password admin" +
" -input_file_path " + Constants.TEST_PATH.toUri() + "/agg.zip" +
" -aggregate_record_element p -aggregate_uri_id id" +
" -input_file_type aggregates -input_compressed true" +
" -input_compression_codec zip" +
" -namespace http://marklogic.com/foo"
+ " -port " + Constants.port + " -database " + Constants.testDb;
String[] args = cmd.split(" ");
assertFalse(args.length == 0);
Utils.clearDB(Utils.getTestDbXccUri(), Constants.testDb);
String[] expandedArgs = null;
expandedArgs = OptionsFileUtil.expandArguments(args);
ContentPump.runCommand(expandedArgs);
ResultSequence result = Utils.runQuery(
Utils.getTestDbXccUri(), "fn:count(fn:collection())");
assertTrue(result.hasNext());
assertEquals("4", result.next().asString());
Utils.closeSession();
result = Utils.getNonEmptyDocsURIs(Utils.getTestDbXccUri());
StringBuilder sb = new StringBuilder();
while(result.hasNext()) {
String s = result.next().asString();
sb.append(s);
}
Utils.closeSession();
String key = Utils.readSmallFile(Constants.TEST_PATH.toUri().getPath() + "/keys/TestImportAggregate#testImportAggZip.txt");
assertTrue(sb.toString().equals(key));
}