本文整理汇总了Java中org.apache.gora.query.Result.close方法的典型用法代码示例。如果您正苦于以下问题:Java Result.close方法的具体用法?Java Result.close怎么用?Java Result.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.gora.query.Result
的用法示例。
在下文中一共展示了Result.close方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assertNumResults
import org.apache.gora.query.Result; //导入方法依赖的package包/类
public static<K,T extends Persistent> void assertNumResults(Query<K, T>query
, long numResults) throws Exception {
Result<K, T> result = query.execute();
int actualNumResults = 0;
while(result.next()) {
actualNumResults++;
}
result.close();
assertEquals(numResults, actualNumResults);
}
示例2: assertProgress
import org.apache.gora.query.Result; //导入方法依赖的package包/类
private void assertProgress(Query<String, WebPage> q, float... progress) throws Exception {
Result<String, WebPage> r = webPageStore.execute(q);
int i = 0;
do {
assertEquals(progress[i++], r.getProgress(), 0.01f);
} while (r.next());
r.close();
}
示例3: assertNumResults
import org.apache.gora.query.Result; //导入方法依赖的package包/类
public static<K,T extends Persistent> void assertNumResults(Query<K, T>query
, long numResults) throws IOException, Exception {
Result<K, T> result = query.execute();
int actualNumResults = 0;
while(result.next()) {
actualNumResults++;
}
result.close();
Assert.assertEquals(numResults, actualNumResults);
}
示例4: assertNumResults
import org.apache.gora.query.Result; //导入方法依赖的package包/类
public static<K,T extends Persistent> void assertNumResults(Query<K, T>query
, long numResults) throws IOException, Exception {
Result<K, T> result = query.execute();
int actualNumResults = 0;
while(result.next()) {
actualNumResults++;
}
result.close();
assertEquals(numResults, actualNumResults);
}
示例5: assertPartitions
import org.apache.gora.query.Result; //导入方法依赖的package包/类
public static void assertPartitions(DataStore<String, WebPage> store,
Query<String, WebPage> query, List<PartitionQuery<String,WebPage>> partitions)
throws Exception {
int count = 0, partitionsCount = 0;
Map<String, Integer> results = new HashMap<>();
Map<String, Integer> partitionResults = new HashMap<>();
//execute query and count results
Result<String, WebPage> result = store.execute(query);
assertNotNull(result);
while(result.next()) {
assertNotNull(result.getKey());
assertNotNull(result.get());
results.put(result.getKey(), result.get().hashCode()); //keys are not reused, so this is safe
count++;
}
result.close();
assertTrue(count > 0); //assert that results is not empty
assertEquals(count, results.size()); //assert that keys are unique
for(PartitionQuery<String, WebPage> partition:partitions) {
assertNotNull(partition);
result = store.execute(partition);
assertNotNull(result);
while(result.next()) {
assertNotNull(result.getKey());
assertNotNull(result.get());
partitionResults.put(result.getKey(), result.get().hashCode());
partitionsCount++;
}
result.close();
assertEquals(partitionsCount, partitionResults.size()); //assert that keys are unique
}
assertTrue(partitionsCount > 0);
assertEquals(count, partitionsCount);
for(Map.Entry<String, Integer> r : results.entrySet()) {
Integer p = partitionResults.get(r.getKey());
assertNotNull(p);
assertEquals(r.getValue(), p);
}
}
示例6: assertPartitions
import org.apache.gora.query.Result; //导入方法依赖的package包/类
public static void assertPartitions(DataStore<String, WebPage> store,
Query<String, WebPage> query, List<PartitionQuery<String,WebPage>> partitions)
throws IOException, Exception {
int count = 0, partitionsCount = 0;
Map<String, Integer> results = new HashMap<String, Integer>();
Map<String, Integer> partitionResults = new HashMap<String, Integer>();
//execute query and count results
Result<String, WebPage> result = store.execute(query);
Assert.assertNotNull(result);
while(result.next()) {
Assert.assertNotNull(result.getKey());
Assert.assertNotNull(result.get());
results.put(result.getKey(), result.get().hashCode()); //keys are not reused, so this is safe
count++;
}
result.close();
Assert.assertTrue(count > 0); //assert that results is not empty
Assert.assertEquals(count, results.size()); //assert that keys are unique
for(PartitionQuery<String, WebPage> partition:partitions) {
Assert.assertNotNull(partition);
result = store.execute(partition);
Assert.assertNotNull(result);
while(result.next()) {
Assert.assertNotNull(result.getKey());
Assert.assertNotNull(result.get());
partitionResults.put(result.getKey(), result.get().hashCode());
partitionsCount++;
}
result.close();
Assert.assertEquals(partitionsCount, partitionResults.size()); //assert that keys are unique
}
Assert.assertTrue(partitionsCount > 0);
Assert.assertEquals(count, partitionsCount);
for(Map.Entry<String, Integer> r : results.entrySet()) {
Integer p = partitionResults.get(r.getKey());
Assert.assertNotNull(p);
Assert.assertEquals(r.getValue(), p);
}
}
示例7: assertPartitions
import org.apache.gora.query.Result; //导入方法依赖的package包/类
public static void assertPartitions(DataStore<String, WebPage> store,
Query<String, WebPage> query, List<PartitionQuery<String,WebPage>> partitions)
throws IOException, Exception {
int count = 0, partitionsCount = 0;
Map<String, Integer> results = new HashMap<String, Integer>();
Map<String, Integer> partitionResults = new HashMap<String, Integer>();
//execute query and count results
Result<String, WebPage> result = store.execute(query);
assertNotNull(result);
while(result.next()) {
assertNotNull(result.getKey());
assertNotNull(result.get());
results.put(result.getKey(), result.get().hashCode()); //keys are not reused, so this is safe
count++;
}
result.close();
assertTrue(count > 0); //assert that results is not empty
assertEquals(count, results.size()); //assert that keys are unique
for(PartitionQuery<String, WebPage> partition:partitions) {
assertNotNull(partition);
result = store.execute(partition);
assertNotNull(result);
while(result.next()) {
assertNotNull(result.getKey());
assertNotNull(result.get());
partitionResults.put(result.getKey(), result.get().hashCode());
partitionsCount++;
}
result.close();
assertEquals(partitionsCount, partitionResults.size()); //assert that keys are unique
}
assertTrue(partitionsCount > 0);
assertEquals(count, partitionsCount);
for(Map.Entry<String, Integer> r : results.entrySet()) {
Integer p = partitionResults.get(r.getKey());
assertNotNull(p);
assertEquals(r.getValue(), p);
}
}