FstatDelegator extends BaseDelegator implements IFstatDelegator { @Override public List<IExtendedFileSpec> getExtendedFiles(final List<IFileSpec> fileSpecs, final int maxFiles, final int sinceChangelist, final int affectedByChangelist, final FileStatOutputOptions outputOptions, final FileStatAncilliaryOptions ancilliaryOptions) throws ConnectionException, AccessException { try { GetExtendedFilesOptions extendedFilesOptions = new GetExtendedFilesOptions() .setAncilliaryOptions(ancilliaryOptions).setMaxResults(maxFiles) .setOutputOptions(outputOptions).setSinceChangelist(sinceChangelist) .setAffectedByChangelist(affectedByChangelist); return getExtendedFiles(fileSpecs, extendedFilesOptions); } catch (final ConnectionException | AccessException exc) { throw exc; } catch (P4JavaException exc) { Log.warn("Unexpected exception in IServer.getExtendedFiles: %s", exc); return Collections.emptyList(); } } FstatDelegator(final IOptionsServer server); @Override List<IExtendedFileSpec> getExtendedFiles(final List<IFileSpec> fileSpecs,
            final int maxFiles, final int sinceChangelist, final int affectedByChangelist,
            final FileStatOutputOptions outputOptions,
            final FileStatAncilliaryOptions ancilliaryOptions); @Override List<IExtendedFileSpec> getExtendedFiles(final List<IFileSpec> fileSpecs,
            final GetExtendedFilesOptions opts);  }
@Test(expected = AccessException.class) public void testFstatJobsOptAccessException() throws P4JavaException { when(server.execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_MATCHER), eq(null))) .thenThrow(AccessException.AccessExceptionForTests.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(CLIENT_FILE); fstatDelegator.getExtendedFiles(specs, new GetExtendedFilesOptions()); }
@Test(expected = AccessException.class) public void testFstatJobsAccessException() throws P4JavaException { when(server.execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_PARAM_MATCHER), eq(null))) .thenThrow(AccessException.AccessExceptionForTests.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(CLIENT_FILE); fstatDelegator.getExtendedFiles(specs, 1, 1, 0, null, null); }
@Test(expected = ConnectionException.class) public void testFstatJobsOptConnectionException() throws P4JavaException { when(server.execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_MATCHER), eq((Map<String, Object>)null))) .thenThrow(ConnectionException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(CLIENT_FILE); fstatDelegator.getExtendedFiles(specs, new GetExtendedFilesOptions()); }
@Test(expected = ConnectionException.class) public void testFstatJobsConnectionException() throws P4JavaException { when(server.execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_PARAM_MATCHER), eq((Map<String, Object>)null))) .thenThrow(ConnectionException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(CLIENT_FILE); fstatDelegator.getExtendedFiles(specs, 1, 1, 0, null, null); }
@Test(expected = AccessException.class) public void testFstatJobsOptAccessException() throws P4JavaException { when(server.execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_MATCHER), eq((Map<String, Object>)null))) .thenThrow(AccessException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(CLIENT_FILE); fstatDelegator.getExtendedFiles(specs, new GetExtendedFilesOptions()); }
@Test(expected = AccessException.class) public void testFstatJobsAccessException() throws P4JavaException { when(server.execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_PARAM_MATCHER), eq((Map<String, Object>)null))) .thenThrow(AccessException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(CLIENT_FILE); fstatDelegator.getExtendedFiles(specs, 1, 1, 0, null, null); }
@Test(expected = RequestException.class) public void testFstatJobsOptRequestException() throws P4JavaException { when(server.execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_MATCHER), eq((Map<String, Object>)null))) .thenThrow(RequestException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(CLIENT_FILE); fstatDelegator.getExtendedFiles(specs, new GetExtendedFilesOptions()); }
@Test public void testFstatJobsRequestException() throws P4JavaException { when(server.execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_PARAM_MATCHER), eq((Map<String, Object>)null))) .thenThrow(RequestException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(CLIENT_FILE); List<IExtendedFileSpec> exSpecs = fstatDelegator.getExtendedFiles(specs, 1, 1, 0, null, null); assertNotNull(exSpecs); assertEquals(0, exSpecs.size()); }
@Test(expected = P4JavaException.class) public void testFstatJobsOptP4JavaException() throws P4JavaException { when(server.execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_MATCHER), eq((Map<String, Object>)null))) .thenThrow(P4JavaException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(CLIENT_FILE); List<IExtendedFileSpec> exSpecs = fstatDelegator.getExtendedFiles(specs, new GetExtendedFilesOptions()); assertNotNull(exSpecs); assertEquals(0, exSpecs.size()); }
@Test public void testFstatJobsP4JavaException() throws P4JavaException { when(server.execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_PARAM_MATCHER), eq((Map<String, Object>)null))) .thenThrow(P4JavaException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(CLIENT_FILE); List<IExtendedFileSpec> exSpecs = fstatDelegator.getExtendedFiles(specs, 1, 1, 0, null, null); assertNotNull(exSpecs); assertEquals(0, exSpecs.size()); }
@Test public void testFstatJobsOpt() throws P4JavaException { when(server.execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_MATCHER), eq((Map<String, Object>)null))) .thenReturn(buildValidResultMap()); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(CLIENT_FILE); List<IExtendedFileSpec> exSpecs = fstatDelegator.getExtendedFiles(specs, new GetExtendedFilesOptions()); verify(server).execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_MATCHER), eq((Map<String, Object>)null)); assertFileSpecs(exSpecs); }
@Test public void testFstatJobs() throws P4JavaException { when(server.execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_PARAM_MATCHER), eq((Map<String, Object>)null))) .thenReturn(buildValidResultMap()); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(CLIENT_FILE); List<IExtendedFileSpec> exSpecs = fstatDelegator.getExtendedFiles(specs, 1, 1, 0, null, null); verify(server).execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_PARAM_MATCHER), eq((Map<String, Object>)null)); assertFileSpecs(exSpecs); }
@Test public void testFstatJobsOptSpecific() throws P4JavaException { when(server.execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_OPT_SPEC_MATCHER), eq((Map<String, Object>)null))).thenReturn(buildValidResultMap()); GetExtendedFilesOptions options = new GetExtendedFilesOptions(); options.setMaxResults(1); options.setSinceChangelist(1); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(CLIENT_FILE); List<IExtendedFileSpec> exSpecs = fstatDelegator.getExtendedFiles(specs, options); verify(server).execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_OPT_SPEC_MATCHER), eq((Map<String, Object>)null)); assertFileSpecs(exSpecs); }
@Test(expected = ConnectionException.class) public void testFstatJobsOptConnectionException() throws P4JavaException { when(server.execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_MATCHER), eq(null))) .thenThrow(ConnectionException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(CLIENT_FILE); fstatDelegator.getExtendedFiles(specs, new GetExtendedFilesOptions()); }
@Test(expected = ConnectionException.class) public void testFstatJobsConnectionException() throws P4JavaException { when(server.execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_PARAM_MATCHER), eq(null))) .thenThrow(ConnectionException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(CLIENT_FILE); fstatDelegator.getExtendedFiles(specs, 1, 1, 0, null, null); }
@Test(expected = AccessException.class) public void testFstatJobsOptAccessException() throws P4JavaException { when(server.execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_MATCHER), eq(null))) .thenThrow(AccessException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(CLIENT_FILE); fstatDelegator.getExtendedFiles(specs, new GetExtendedFilesOptions()); }
@Test(expected = AccessException.class) public void testFstatJobsAccessException() throws P4JavaException { when(server.execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_PARAM_MATCHER), eq(null))) .thenThrow(AccessException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(CLIENT_FILE); fstatDelegator.getExtendedFiles(specs, 1, 1, 0, null, null); }
@Test(expected = RequestException.class) public void testFstatJobsOptRequestException() throws P4JavaException { when(server.execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_MATCHER), eq(null))) .thenThrow(RequestException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(CLIENT_FILE); fstatDelegator.getExtendedFiles(specs, new GetExtendedFilesOptions()); }
@Test public void testFstatJobsRequestException() throws P4JavaException { when(server.execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_PARAM_MATCHER), eq(null))) .thenThrow(RequestException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(CLIENT_FILE); List<IExtendedFileSpec> exSpecs = fstatDelegator.getExtendedFiles(specs, 1, 1, 0, null, null); assertNotNull(exSpecs); assertEquals(0, exSpecs.size()); }
@Test(expected = P4JavaException.class) public void testFstatJobsOptP4JavaException() throws P4JavaException { when(server.execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_MATCHER), eq(null))) .thenThrow(P4JavaException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(CLIENT_FILE); List<IExtendedFileSpec> exSpecs = fstatDelegator.getExtendedFiles(specs, new GetExtendedFilesOptions()); assertNotNull(exSpecs); assertEquals(0, exSpecs.size()); }
@Test public void testFstatJobsP4JavaException() throws P4JavaException { when(server.execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_PARAM_MATCHER), eq(null))) .thenThrow(P4JavaException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(CLIENT_FILE); List<IExtendedFileSpec> exSpecs = fstatDelegator.getExtendedFiles(specs, 1, 1, 0, null, null); assertNotNull(exSpecs); assertEquals(0, exSpecs.size()); }
@Test public void testFstatJobsOpt() throws P4JavaException { when(server.execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_MATCHER), eq(null))) .thenReturn(buildValidResultMap()); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(CLIENT_FILE); List<IExtendedFileSpec> exSpecs = fstatDelegator.getExtendedFiles(specs, new GetExtendedFilesOptions()); verify(server).execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_MATCHER), eq(null)); assertFileSpecs(exSpecs); }
@Test public void testFstatJobs() throws P4JavaException { when(server.execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_PARAM_MATCHER), eq(null))) .thenReturn(buildValidResultMap()); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(CLIENT_FILE); List<IExtendedFileSpec> exSpecs = fstatDelegator.getExtendedFiles(specs, 1, 1, 0, null, null); verify(server).execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_PARAM_MATCHER), eq(null)); assertFileSpecs(exSpecs); }
@Test public void testFstatJobsOptSpecific() throws P4JavaException { when(server.execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_OPT_SPEC_MATCHER), eq(null))).thenReturn(buildValidResultMap()); GetExtendedFilesOptions options = new GetExtendedFilesOptions(); options.setMaxResults(1); options.setSinceChangelist(1); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(CLIENT_FILE); List<IExtendedFileSpec> exSpecs = fstatDelegator.getExtendedFiles(specs, options); verify(server).execMapCmdList(eq(FSTAT.toString()), argThat(FIX_FS_OPT_SPEC_MATCHER), eq(null)); assertFileSpecs(exSpecs); }