JobsDelegator extends BaseDelegator implements IJobsDelegator { @Override public List<IJob> getJobs(final List<IFileSpec> fileSpecs, final int maxJobs, final boolean longDescriptions, final boolean reverseOrder, final boolean includeIntegrated, final String jobView) throws ConnectionException, RequestException, AccessException { try { GetJobsOptions getJobsOptions = new GetJobsOptions() .setIncludeIntegrated(includeIntegrated).setLongDescriptions(longDescriptions) .setMaxJobs(maxJobs).setReverseOrder(reverseOrder).setJobView(jobView); return getJobs(fileSpecs, getJobsOptions); } catch (final ConnectionException | AccessException | RequestException exc) { throw exc; } catch (P4JavaException exc) { throw new RequestException(exc.getMessage(), exc); } } JobsDelegator(final IOptionsServer server); @Override List<IJob> getJobs(final List<IFileSpec> fileSpecs, final int maxJobs,
            final boolean longDescriptions, final boolean reverseOrder,
            final boolean includeIntegrated, final String jobView); @Override List<IJob> getJobs(final List<IFileSpec> fileSpecs, final GetJobsOptions opts);  }
@Test(expected = AccessException.class) public void testJobsOptAccessException() throws P4JavaException { when(server.execMapCmdList(eq(JOBS.toString()), argThat(SIMPLE_MATCHER), eq(null))) .thenThrow(AccessException.AccessExceptionForTests.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(FILE_SPEC); jobsDelegator.getJobs(specs, new GetJobsOptions()); }
@Test(expected = AccessException.class) public void testJobsAccessException() throws P4JavaException { when(server.execMapCmdList(eq(JOBS.toString()), argThat(PARAM_MATCHER), eq(null))) .thenThrow(AccessException.AccessExceptionForTests.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(FILE_SPEC); jobsDelegator.getJobs(specs, 1, true, true, true, null); }
@Test(expected = ConnectionException.class) public void testJobsOptConnectionException() throws P4JavaException { when(server.execMapCmdList(eq(JOBS.toString()), argThat(SIMPLE_MATCHER), eq((Map<String, Object>)null))) .thenThrow(ConnectionException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(FILE_SPEC); jobsDelegator.getJobs(specs, new GetJobsOptions()); }
@Test(expected = AccessException.class) public void testJobsOptAccessException() throws P4JavaException { when(server.execMapCmdList(eq(JOBS.toString()), argThat(SIMPLE_MATCHER), eq((Map<String, Object>)null))) .thenThrow(AccessException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(FILE_SPEC); jobsDelegator.getJobs(specs, new GetJobsOptions()); }
@Test(expected = RequestException.class) public void testJobsOptRequestException() throws P4JavaException { when(server.execMapCmdList(eq(JOBS.toString()), argThat(SIMPLE_MATCHER), eq((Map<String, Object>)null))) .thenThrow(RequestException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(FILE_SPEC); jobsDelegator.getJobs(specs, new GetJobsOptions()); }
@Test(expected = P4JavaException.class) public void testJobsOptP4JavaException() throws P4JavaException { when(server.execMapCmdList(eq(JOBS.toString()), argThat(SIMPLE_MATCHER), eq((Map<String, Object>)null))) .thenThrow(P4JavaException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(FILE_SPEC); jobsDelegator.getJobs(specs, new GetJobsOptions()); }
@Test(expected = ConnectionException.class) public void testJobsConnectionException() throws P4JavaException { when(server.execMapCmdList(eq(JOBS.toString()), argThat(PARAM_MATCHER), eq((Map<String, Object>)null))) .thenThrow(ConnectionException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(FILE_SPEC); jobsDelegator.getJobs(specs, 1, true, true, true, null); }
@Test(expected = AccessException.class) public void testJobsAccessException() throws P4JavaException { when(server.execMapCmdList(eq(JOBS.toString()), argThat(PARAM_MATCHER), eq((Map<String, Object>)null))) .thenThrow(AccessException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(FILE_SPEC); jobsDelegator.getJobs(specs, 1, true, true, true, null); }
@Test(expected = RequestException.class) public void testJobsRequestException() throws P4JavaException { when(server.execMapCmdList(eq(JOBS.toString()), argThat(PARAM_MATCHER), eq((Map<String, Object>)null))) .thenThrow(RequestException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(FILE_SPEC); jobsDelegator.getJobs(specs, 1, true, true, true, null); }
@Test(expected = P4JavaException.class) public void testJobsP4JavaException() throws P4JavaException { when(server.execMapCmdList(eq(JOBS.toString()), argThat(PARAM_MATCHER), eq((Map<String, Object>)null))) .thenThrow(P4JavaException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(FILE_SPEC); jobsDelegator.getJobs(specs, 1, true, true, true, null); }
@Test public void testJobsOpt() throws P4JavaException { when(server.execMapCmdList(eq(JOBS.toString()), argThat(SIMPLE_MATCHER), eq((Map<String, Object>)null))) .thenReturn(buildValidGetResultMap()); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(FILE_SPEC); List<IJob> jobs = jobsDelegator.getJobs(specs, new GetJobsOptions()); verify(server).execMapCmdList(eq(JOBS.toString()), argThat(SIMPLE_MATCHER), eq((Map<String, Object>)null)); assertJobs(jobs); }
@Test public void testJobsSpecifiedOpt() throws P4JavaException { when(server.execMapCmdList(eq(JOBS.toString()), argThat(PARAM_MATCHER), eq((Map<String, Object>)null))) .thenReturn(buildValidGetResultMap()); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(FILE_SPEC); GetJobsOptions options = new GetJobsOptions(); options.setMaxJobs(1).setLongDescriptions(true).setReverseOrder(true) .setIncludeIntegrated(true); List<IJob> jobs = jobsDelegator.getJobs(specs, options); verify(server).execMapCmdList(eq(JOBS.toString()), argThat(PARAM_MATCHER), eq((Map<String, Object>)null)); assertJobs(jobs); }
@Test public void testJobs() throws P4JavaException { when(server.execMapCmdList(eq(JOBS.toString()), argThat(PARAM_MATCHER), eq((Map<String, Object>)null))) .thenReturn(buildValidGetResultMap()); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(FILE_SPEC); List<IJob> jobs = jobsDelegator.getJobs(specs, 1, true, true, true, null); verify(server).execMapCmdList(eq(JOBS.toString()), argThat(PARAM_MATCHER), eq((Map<String, Object>)null)); assertJobs(jobs); }
@Test(expected = ConnectionException.class) public void testJobsOptConnectionException() throws P4JavaException { when(server.execMapCmdList(eq(JOBS.toString()), argThat(SIMPLE_MATCHER), eq(null))) .thenThrow(ConnectionException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(FILE_SPEC); jobsDelegator.getJobs(specs, new GetJobsOptions()); }
@Test(expected = AccessException.class) public void testJobsOptAccessException() throws P4JavaException { when(server.execMapCmdList(eq(JOBS.toString()), argThat(SIMPLE_MATCHER), eq(null))) .thenThrow(AccessException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(FILE_SPEC); jobsDelegator.getJobs(specs, new GetJobsOptions()); }
@Test(expected = RequestException.class) public void testJobsOptRequestException() throws P4JavaException { when(server.execMapCmdList(eq(JOBS.toString()), argThat(SIMPLE_MATCHER), eq(null))) .thenThrow(RequestException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(FILE_SPEC); jobsDelegator.getJobs(specs, new GetJobsOptions()); }
@Test(expected = P4JavaException.class) public void testJobsOptP4JavaException() throws P4JavaException { when(server.execMapCmdList(eq(JOBS.toString()), argThat(SIMPLE_MATCHER), eq(null))) .thenThrow(P4JavaException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(FILE_SPEC); jobsDelegator.getJobs(specs, new GetJobsOptions()); }
@Test(expected = ConnectionException.class) public void testJobsConnectionException() throws P4JavaException { when(server.execMapCmdList(eq(JOBS.toString()), argThat(PARAM_MATCHER), eq(null))) .thenThrow(ConnectionException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(FILE_SPEC); jobsDelegator.getJobs(specs, 1, true, true, true, null); }
@Test(expected = AccessException.class) public void testJobsAccessException() throws P4JavaException { when(server.execMapCmdList(eq(JOBS.toString()), argThat(PARAM_MATCHER), eq(null))) .thenThrow(AccessException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(FILE_SPEC); jobsDelegator.getJobs(specs, 1, true, true, true, null); }
@Test(expected = RequestException.class) public void testJobsRequestException() throws P4JavaException { when(server.execMapCmdList(eq(JOBS.toString()), argThat(PARAM_MATCHER), eq(null))) .thenThrow(RequestException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(FILE_SPEC); jobsDelegator.getJobs(specs, 1, true, true, true, null); }
@Test(expected = P4JavaException.class) public void testJobsP4JavaException() throws P4JavaException { when(server.execMapCmdList(eq(JOBS.toString()), argThat(PARAM_MATCHER), eq(null))) .thenThrow(P4JavaException.class); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(FILE_SPEC); jobsDelegator.getJobs(specs, 1, true, true, true, null); }
@Test public void testJobsOpt() throws P4JavaException { when(server.execMapCmdList(eq(JOBS.toString()), argThat(SIMPLE_MATCHER), eq(null))) .thenReturn(buildValidGetResultMap()); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(FILE_SPEC); List<IJob> jobs = jobsDelegator.getJobs(specs, new GetJobsOptions()); verify(server).execMapCmdList(eq(JOBS.toString()), argThat(SIMPLE_MATCHER), eq(null)); assertJobs(jobs); }
@Test public void testJobsSpecifiedOpt() throws P4JavaException { when(server.execMapCmdList(eq(JOBS.toString()), argThat(PARAM_MATCHER), eq(null))) .thenReturn(buildValidGetResultMap()); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(FILE_SPEC); GetJobsOptions options = new GetJobsOptions(); options.setMaxJobs(1).setLongDescriptions(true).setReverseOrder(true) .setIncludeIntegrated(true); List<IJob> jobs = jobsDelegator.getJobs(specs, options); verify(server).execMapCmdList(eq(JOBS.toString()), argThat(PARAM_MATCHER), eq(null)); assertJobs(jobs); }
@Test public void testJobs() throws P4JavaException { when(server.execMapCmdList(eq(JOBS.toString()), argThat(PARAM_MATCHER), eq(null))) .thenReturn(buildValidGetResultMap()); List<IFileSpec> specs = FileSpecBuilder.makeFileSpecList(FILE_SPEC); List<IJob> jobs = jobsDelegator.getJobs(specs, 1, true, true, true, null); verify(server).execMapCmdList(eq(JOBS.toString()), argThat(PARAM_MATCHER), eq(null)); assertJobs(jobs); }