Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
gpang committed Dec 6, 2017
1 parent 65808c1 commit 1c4d72f
Showing 1 changed file with 11 additions and 8 deletions.
Expand Up @@ -44,6 +44,7 @@
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors;


/** /**
* Tests the loading of metadata and the available options. * Tests the loading of metadata and the available options.
Expand Down Expand Up @@ -235,25 +236,27 @@ public void unpersistedFileSync() throws Exception {
ListStatusOptions options = ListStatusOptions options =
ListStatusOptions.defaults().setLoadMetadataType(LoadMetadataType.Never) ListStatusOptions.defaults().setLoadMetadataType(LoadMetadataType.Never)
.setCommonOptions(SYNC_ALWAYS); .setCommonOptions(SYNC_ALWAYS);
List<URIStatus> initialStatusList = List<String> initialStatusList =
mFileSystem.listStatus(new AlluxioURI(alluxioPath(ROOT_DIR)), options); mFileSystem.listStatus(new AlluxioURI(alluxioPath(ROOT_DIR)), options).stream()
.map(URIStatus::getName).collect(Collectors.toList());


// write a MUST_CACHE file // write a MUST_CACHE file
writeMustCacheFile(alluxioPath(NEW_FILE), 1); writeMustCacheFile(alluxioPath(NEW_FILE), 1);


// List the status with force sync. // List the status with force sync.
List<URIStatus> syncStatusList = List<String> syncStatusList =
mFileSystem.listStatus(new AlluxioURI(alluxioPath(ROOT_DIR)), options); mFileSystem.listStatus(new AlluxioURI(alluxioPath(ROOT_DIR)), options).stream()
.map(URIStatus::getName).collect(Collectors.toList());


Set<URIStatus> initialSet = Sets.newHashSet(initialStatusList); Set<String> initialSet = Sets.newHashSet(initialStatusList);
Set<URIStatus> syncSet = Sets.newHashSet(syncStatusList); Set<String> syncSet = Sets.newHashSet(syncStatusList);
Assert.assertTrue(syncSet.size() > initialSet.size()); Assert.assertTrue(syncSet.size() > initialSet.size());
syncSet.removeAll(initialSet); syncSet.removeAll(initialSet);


// only the MUST_CACHE file should remain. // only the MUST_CACHE file should remain.
Assert.assertTrue(syncSet.size() == 1); Assert.assertTrue(syncSet.size() == 1);
URIStatus file = syncSet.iterator().next(); String file = syncSet.iterator().next();
Assert.assertTrue(file.getName().equals(new AlluxioURI(NEW_FILE).getName())); Assert.assertTrue(file.equals(new AlluxioURI(NEW_FILE).getName()));
} }


private String ufsPath(String path) { private String ufsPath(String path) {
Expand Down

0 comments on commit 1c4d72f

Please sign in to comment.