use of org.apache.jackrabbit.oak.index.indexer.document.NodeStateEntry in project jackrabbit-oak by apache.
the class NodeStateEntryWriterTest method childOrderNotWritten.
@Test
public void childOrderNotWritten() {
NodeStateEntryWriter nw = new NodeStateEntryWriter(blobStore);
NodeBuilder b1 = EMPTY_NODE.builder();
b1.setProperty("foo", "bar");
b1.setProperty(":childOrder", "bar");
b1.setProperty(":hidden", "bar");
NodeStateEntry e1 = new NodeStateEntry(b1.getNodeState(), "/a");
String line = nw.toString(e1);
NodeStateEntryReader nr = new NodeStateEntryReader(blobStore);
NodeStateEntry r1 = nr.read(line);
assertTrue(r1.getNodeState().hasProperty(":hidden"));
assertFalse(r1.getNodeState().hasProperty(":childOrder"));
}
use of org.apache.jackrabbit.oak.index.indexer.document.NodeStateEntry in project jackrabbit-oak by apache.
the class NodeStateEntryWriterTest method multipleEntries.
@Test
public void multipleEntries() {
NodeStateEntryWriter nw = new NodeStateEntryWriter(blobStore);
NodeBuilder b1 = EMPTY_NODE.builder();
b1.setProperty("foo", "bar");
NodeBuilder b2 = EMPTY_NODE.builder();
b2.setProperty("foo2", "bar2");
NodeStateEntry e1 = new NodeStateEntry(b1.getNodeState(), "/a");
NodeStateEntry e2 = new NodeStateEntry(b2.getNodeState(), "/a");
String line1 = nw.toString(e1);
String line2 = nw.toString(e2);
NodeStateEntryReader nr = new NodeStateEntryReader(blobStore);
assertEquals(e1, nr.read(line1));
assertEquals(e2, nr.read(line2));
}
use of org.apache.jackrabbit.oak.index.indexer.document.NodeStateEntry in project jackrabbit-oak by apache.
the class NodeStateEntryWriterTest method pathElements_root.
@Test
public void pathElements_root() {
NodeStateEntryWriter nw = new NodeStateEntryWriter(blobStore);
NodeBuilder b1 = EMPTY_NODE.builder();
b1.setProperty("foo", "bar");
NodeStateEntry e1 = new NodeStateEntry(b1.getNodeState(), "/");
String json = nw.asJson(e1.getNodeState());
List<String> pathElements = copyOf(elements(e1.getPath()));
String line = nw.toString(pathElements, json);
NodeStateEntryReader nr = new NodeStateEntryReader(blobStore);
NodeStateEntry r1 = nr.read(line);
assertTrue(r1.getNodeState().hasProperty("foo"));
assertEquals("/", r1.getPath());
}
use of org.apache.jackrabbit.oak.index.indexer.document.NodeStateEntry in project jackrabbit-oak by apache.
the class NodeStateEntryWriterTest method pathElements.
@Test
public void pathElements() {
NodeStateEntryWriter nw = new NodeStateEntryWriter(blobStore);
NodeBuilder b1 = EMPTY_NODE.builder();
b1.setProperty("foo", "bar");
NodeStateEntry e1 = new NodeStateEntry(b1.getNodeState(), "/a/b/c/d");
String json = nw.asJson(e1.getNodeState());
List<String> pathElements = copyOf(elements(e1.getPath()));
String line = nw.toString(pathElements, json);
NodeStateEntryReader nr = new NodeStateEntryReader(blobStore);
NodeStateEntry r1 = nr.read(line);
assertTrue(r1.getNodeState().hasProperty("foo"));
assertEquals("/a/b/c/d", r1.getPath());
}
use of org.apache.jackrabbit.oak.index.indexer.document.NodeStateEntry in project jackrabbit-oak by apache.
the class StoreAndSortStrategy method writeToStore.
private File writeToStore(File dir, String fileName) throws IOException {
entryCount = 0;
File file = new File(dir, fileName);
Stopwatch sw = Stopwatch.createStarted();
try (BufferedWriter w = FlatFileStoreUtils.createWriter(file, compressionEnabled)) {
for (NodeStateEntry e : nodeStates) {
String line = entryWriter.toString(e);
w.append(line);
w.newLine();
textSize += line.length() + LINE_SEP_LENGTH;
entryCount++;
}
}
String sizeStr = compressionEnabled ? String.format("compressed/%s actual size", humanReadableByteCount(textSize)) : "";
log.info("Dumped {} nodestates in json format in {} ({} {})", entryCount, sw, humanReadableByteCount(file.length()), sizeStr);
return file;
}
Aggregations