|
18 | 18 | package org.apache.hadoop.hbase.regionserver;
|
19 | 19 |
|
20 | 20 | import static org.apache.hadoop.hbase.regionserver.storefiletracker.StoreFileTrackerFactory.TRACKER_IMPL;
|
| 21 | +import static org.hamcrest.MatcherAssert.assertThat; |
| 22 | +import static org.hamcrest.Matchers.containsString; |
| 23 | +import static org.hamcrest.Matchers.everyItem; |
| 24 | +import static org.hamcrest.Matchers.hasItem; |
| 25 | +import static org.hamcrest.Matchers.hasProperty; |
| 26 | +import static org.hamcrest.Matchers.not; |
21 | 27 | import static org.junit.Assert.assertTrue;
|
22 |
| -import static org.junit.Assert.fail; |
23 |
| - |
24 | 28 | import java.io.IOException;
|
25 | 29 | import java.util.ArrayList;
|
26 | 30 | import java.util.List;
|
27 | 31 | import java.util.UUID;
|
28 | 32 | import java.util.concurrent.TimeUnit;
|
29 |
| -import org.apache.commons.lang3.mutable.MutableBoolean; |
30 | 33 | import org.apache.hadoop.fs.FileStatus;
|
31 | 34 | import org.apache.hadoop.fs.FileSystem;
|
32 | 35 | import org.apache.hadoop.fs.FileUtil;
|
@@ -222,21 +225,12 @@ private Pair<StoreFileInfo,String> copyFileInTheStoreDir(HRegion region) throws
|
222 | 225 | return new Pair<>(fileInfo, copyName);
|
223 | 226 | }
|
224 | 227 |
|
225 |
| - private void validateDaughterRegionsFiles(HRegion region, String orignalFileName, |
| 228 | + private void validateDaughterRegionsFiles(HRegion region, String originalFileName, |
226 | 229 | String untrackedFile) throws IOException {
|
227 | 230 | //verify there's no link for the untracked, copied file in first region
|
228 | 231 | List<StoreFileInfo> infos = region.getRegionFileSystem().getStoreFiles("info");
|
229 |
| - final MutableBoolean foundLink = new MutableBoolean(false); |
230 |
| - infos.stream().forEach(i -> { |
231 |
| - assertTrue(i.getActiveFileName().contains(orignalFileName)); |
232 |
| - if(i.getActiveFileName().contains(untrackedFile)){ |
233 |
| - fail(); |
234 |
| - } |
235 |
| - if(i.getActiveFileName().contains(orignalFileName)){ |
236 |
| - foundLink.setTrue(); |
237 |
| - } |
238 |
| - }); |
239 |
| - assertTrue(foundLink.booleanValue()); |
| 232 | + assertThat(infos, everyItem(hasProperty("activeFileName", not(containsString(untrackedFile))))); |
| 233 | + assertThat(infos, hasItem(hasProperty("activeFileName", containsString(originalFileName)))); |
240 | 234 | }
|
241 | 235 |
|
242 | 236 | private void verifyFilesAreTracked(Path regionDir, FileSystem fs) throws Exception {
|
|
0 commit comments