@Test public void testCompoundKeys() throws IOException { HollowCombiner combiner = new HollowCombiner(input1, input2, input3); combiner.setPrimaryKeys(new PrimaryKey("TypeB", "key", "c.key")); combiner.combine(); HollowReadStateEngine output = StateEngineRoundTripper.roundTripSnapshot(combiner.getCombinedStateEngine()); assertObject(output, 1, 1, 1, 1, 1, 1); assertObject(output, 2, 1, 2, 1, 2, 1); assertObject(output, 3, 1, 3, 1, 3, 1); assertObject(output, 4, 2, 2, 2, 3, 2); assertObject(output, 5, 2, 4, 2, 4, 2); assertObject(output, 6, 2, 6, 2, 6, 2); assertObject(output, 7, 3, 2, 2, 3, 2); assertObject(output, 8, 3, 7, 3, 6, 3); assertObject(output, 9, 3, 8, 3, 8, 3); assertObject(output, 10,3, 4, 3, 10,3); }
@Test public void testCascadingKeys() throws IOException { HollowCombiner combiner = new HollowCombiner(input1, input2, input3); combiner.setPrimaryKeys(new PrimaryKey("TypeB", "key"), new PrimaryKey("TypeC", "key")); combiner.combine(); HollowReadStateEngine output = StateEngineRoundTripper.roundTripSnapshot(combiner.getCombinedStateEngine()); assertObject(output, 1, 1, 1, 1, 1, 1); assertObject(output, 2, 1, 2, 1, 2, 1); assertObject(output, 3, 1, 3, 1, 3, 1); assertObject(output, 4, 2, 2, 1, 2, 1); assertObject(output, 5, 2, 4, 2, 4, 2); assertObject(output, 6, 2, 6, 2, 6, 2); assertObject(output, 7, 3, 2, 1, 2, 1); assertObject(output, 8, 3, 7, 3, 6, 2); assertObject(output, 9, 3, 8, 3, 8, 3); assertObject(output, 10,3, 4, 2, 4, 2); }
@Test public void testCompoundCascadingKeys() throws IOException { HollowCombiner combiner = new HollowCombiner(input1, input2, input3); combiner.setPrimaryKeys(new PrimaryKey("TypeB", "key", "c.key"), new PrimaryKey("TypeC", "key")); combiner.combine(); HollowReadStateEngine output = StateEngineRoundTripper.roundTripSnapshot(combiner.getCombinedStateEngine()); assertObject(output, 1, 1, 1, 1, 1, 1); assertObject(output, 2, 1, 2, 1, 2, 1); assertObject(output, 3, 1, 3, 1, 3, 1); assertObject(output, 4, 2, 2, 2, 3, 1); assertObject(output, 5, 2, 4, 2, 4, 2); assertObject(output, 6, 2, 6, 2, 6, 2); assertObject(output, 7, 3, 2, 2, 3, 1); assertObject(output, 8, 3, 7, 3, 6, 2); assertObject(output, 9, 3, 8, 3, 8, 3); assertObject(output, 10,3, 4, 3, 10,3); }
@Test public void testExplicitlyExcludedAndRemappedKeys() throws IOException { HollowPrimaryKeyIndex cIdx1 = new HollowPrimaryKeyIndex(input1, "TypeC", "key"); HollowCombinerExcludePrimaryKeysCopyDirector director = new HollowCombinerExcludePrimaryKeysCopyDirector(); director.excludeKey(cIdx1, 3); HollowCombiner combiner = new HollowCombiner(director, input1, input2, input3); combiner.setPrimaryKeys(new PrimaryKey("TypeB", "key", "c.key"), new PrimaryKey("TypeC", "key")); combiner.combine(); HollowReadStateEngine output = StateEngineRoundTripper.roundTripSnapshot(combiner.getCombinedStateEngine()); assertObject(output, 1, 1, 1, 1, 1, 1); assertObject(output, 2, 1, 2, 1, 2, 1); assertObject(output, 3, 1, 3, 1, 3, 2); assertObject(output, 4, 2, 2, 2, 3, 2); assertObject(output, 5, 2, 4, 2, 4, 2); assertObject(output, 6, 2, 6, 2, 6, 2); assertObject(output, 7, 3, 2, 2, 3, 2); assertObject(output, 8, 3, 7, 3, 6, 2); assertObject(output, 9, 3, 8, 3, 8, 3); assertObject(output, 10,3, 4, 3, 10,3); }
@Test public void testExplicitlyExcludedButOtherwiseReferencedKeys() throws IOException { HollowPrimaryKeyIndex cIdx3 = new HollowPrimaryKeyIndex(input3, "TypeC", "key"); HollowCombinerExcludePrimaryKeysCopyDirector director = new HollowCombinerExcludePrimaryKeysCopyDirector(); director.excludeKey(cIdx3, 8); HollowCombiner combiner = new HollowCombiner(director, input1, input2, input3); combiner.setPrimaryKeys(new PrimaryKey("TypeB", "key", "c.key"), new PrimaryKey("TypeC", "key")); combiner.combine(); HollowReadStateEngine output = StateEngineRoundTripper.roundTripSnapshot(combiner.getCombinedStateEngine()); assertObject(output, 9, 3, 8, 3, 8, 3); }