/** file is too small. */ @Test public void too_small() { BlockBuilder builder = new BlockBuilder(); builder.add(10, "a"); builder.add(10, "b"); builder.add(10, "c"); List<DirectInputFragment> results = builder.compute(100, 200, true, true); assertThat(results.size(), is(1)); }
/** tail blocks are too small. */ @Test public void ignore_little_locality() { BlockBuilder builder = new BlockBuilder(); builder.add(100, "a"); builder.add(1, "b", "c", "d"); List<DirectInputFragment> results = builder.compute(50, 200, true, true); assertThat(results.size(), is(1)); assertThat(results.get(0).getOwnerNodeNames(), hasItem("a")); assertThat(results.get(0).getOwnerNodeNames(), not(hasItem("b"))); }
/** head blocks are too small. */ @Test public void head_too_small() { BlockBuilder builder = new BlockBuilder(); builder.add(10, "b"); builder.add(10, "c"); builder.add(10, "d"); builder.add(100, "a"); List<DirectInputFragment> results = builder.compute(50, 200, true, true); assertThat(results.size(), is(1)); assertThat(results.get(0).getOwnerNodeNames(), hasItem("a")); }
/** per prefered size with block join. */ @Test public void pref_size_with_join() { BlockBuilder builder = new BlockBuilder(); builder.add(100, "a"); builder.add(100, "a"); builder.add(100, "a"); builder.add(100, "a"); List<DirectInputFragment> results = builder.compute(10, 80, true, true); assertThat(results.size(), is(5)); assertThat(results.get(0).getOwnerNodeNames(), hasItem("a")); assertThat(results.get(1).getOwnerNodeNames(), hasItem("a")); assertThat(results.get(2).getOwnerNodeNames(), hasItem("a")); assertThat(results.get(3).getOwnerNodeNames(), hasItem("a")); assertThat(results.get(4).getOwnerNodeNames(), hasItem("a")); }
/** simple testing. */ @Test public void simple() { BlockBuilder builder = new BlockBuilder(); builder.add(100, "a"); List<DirectInputFragment> results = builder.compute(50, 100, true, true); assertThat(results.size(), is(1)); assertThat(find(results, 0).getOwnerNodeNames(), hasItem("a")); }