GcsFileSystem extends FileSystem<GcsResourceId> { @VisibleForTesting List<MatchResult> matchNonGlobs(List<GcsPath> gcsPaths) throws IOException { List<StorageObjectOrIOException> results = options.getGcsUtil().getObjects(gcsPaths); ImmutableList.Builder<MatchResult> ret = ImmutableList.builder(); for (StorageObjectOrIOException result : results) { ret.add(toMatchResult(result)); } return ret.build(); } GcsFileSystem(GcsOptions options);   }
@Test public void testMatchNonGlobs() throws Exception { List<StorageObjectOrIOException> items = new ArrayList<>(); items.add( StorageObjectOrIOException.create( createStorageObject("gs: items.add( StorageObjectOrIOException.create( createStorageObject("gs: items.add(StorageObjectOrIOException.create(new FileNotFoundException())); items.add(StorageObjectOrIOException.create(new IOException())); items.add( StorageObjectOrIOException.create( createStorageObject("gs: List<GcsPath> gcsPaths = ImmutableList.of( GcsPath.fromUri("gs: GcsPath.fromUri("gs: GcsPath.fromUri("gs: GcsPath.fromUri("gs: GcsPath.fromUri("gs: when(mockGcsUtil.getObjects(eq(gcsPaths))).thenReturn(items); List<MatchResult> matchResults = gcsFileSystem.matchNonGlobs(gcsPaths); assertEquals(5, matchResults.size()); assertThat( ImmutableList.of("gs: contains(toFilenames(matchResults.get(0)).toArray())); assertThat( ImmutableList.of("gs: contains(toFilenames(matchResults.get(1)).toArray())); assertEquals(Status.NOT_FOUND, matchResults.get(2).status()); assertEquals(Status.ERROR, matchResults.get(3).status()); assertThat( ImmutableList.of("gs: contains(toFilenames(matchResults.get(4)).toArray())); }
@Test public void testMatchNonGlobs() throws Exception { List<StorageObjectOrIOException> items = new ArrayList<>(); items.add(StorageObjectOrIOException.create( createStorageObject("gs: items.add(StorageObjectOrIOException.create(new FileNotFoundException())); items.add(StorageObjectOrIOException.create(new IOException())); items.add(StorageObjectOrIOException.create( createStorageObject("gs: List<GcsPath> gcsPaths = ImmutableList.of( GcsPath.fromUri("gs: GcsPath.fromUri("gs: GcsPath.fromUri("gs: GcsPath.fromUri("gs: when(mockGcsUtil.getObjects(eq(gcsPaths))).thenReturn(items); List<MatchResult> matchResults = gcsFileSystem.matchNonGlobs(gcsPaths); assertEquals(4, matchResults.size()); assertThat( ImmutableList.of("gs: contains(toFilenames(matchResults.get(0)).toArray())); assertEquals(Status.NOT_FOUND, matchResults.get(1).status()); assertEquals(Status.ERROR, matchResults.get(2).status()); assertThat( ImmutableList.of("gs: contains(toFilenames(matchResults.get(3)).toArray())); }