Пример #1
0
 /** no block information. */
 @Test
 public void no_info() {
   BlockBuilder builder = new BlockBuilder();
   builder.seek(1000);
   List<DirectInputFragment> results = builder.compute(50, 100, true, true);
   assertThat(results.size(), is(10));
 }
Пример #2
0
 /** 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"));
 }
Пример #3
0
 /** 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));
 }
Пример #4
0
 /** 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")));
 }
Пример #5
0
 /** 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"));
 }
Пример #6
0
 /** per prefered size. */
 @Test
 public void pref_size() {
   BlockBuilder builder = new BlockBuilder();
   builder.add(400, "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"));
 }
Пример #7
0
 /** empty file. */
 @Test
 public void empty() {
   BlockBuilder builder = new BlockBuilder();
   List<DirectInputFragment> results = builder.compute(50, 100, true, true);
   assertThat(results.size(), is(1));
 }