FixDelegator extends BaseDelegator implements IFixDelegator { @Override public List<IFix> fixJobs(final List<String> jobIds, final int changeListId, final String status, final boolean delete) throws ConnectionException, RequestException, AccessException { try { FixJobsOptions fixJobsOptions = new FixJobsOptions().setDelete(delete) .setStatus(status); return fixJobs(jobIds, changeListId, fixJobsOptions); } catch (final ConnectionException | AccessException | RequestException exc) { throw exc; } catch (P4JavaException exc) { throw new RequestException(exc.getMessage(), exc); } } FixDelegator(final IOptionsServer server); @Override List<IFix> fixJobs(final List<String> jobIds, final int changeListId,
            final String status, final boolean delete); @Override List<IFix> fixJobs(@Nonnull final List<String> jobIds, final int changeListId,
            final FixJobsOptions opts);  }
@Test(expected = AccessException.class) public void testFixJobsOptAccessException() throws P4JavaException { when(server.execMapCmdList(eq(FIX.toString()), argThat(FIX_MATCHER), eq(null))) .thenThrow(AccessException.AccessExceptionForTests.class); fixDelegator.fixJobs(JOB_LIST, Integer.valueOf(TEST_CHANGELIST), new FixJobsOptions()); }
@Test(expected = AccessException.class) public void testFixJobsAccessException() throws P4JavaException { when(server.execMapCmdList(eq(FIX.toString()), argThat(FIX_DELETE_MATCHER), eq(null))) .thenThrow(AccessException.AccessExceptionForTests.class); fixDelegator.fixJobs(JOB_LIST, Integer.valueOf(TEST_CHANGELIST), null, true); }
@Test public void testFixJobsOpt() throws P4JavaException { when(server.execMapCmdList(eq(FIX.toString()), argThat(FIX_MATCHER), eq((Map<String, Object>)null))) .thenReturn(buildValidResultMap()); List<IFix> fixes = fixDelegator.fixJobs(JOB_LIST, Integer.valueOf(TEST_CHANGELIST), new FixJobsOptions()); assertFixes(fixes); }
@Test public void testFixJobs() throws P4JavaException { when(server.execMapCmdList(eq(FIX.toString()), argThat(FIX_MATCHER), eq((Map<String, Object>)null))) .thenReturn(buildValidResultMap()); List<IFix> fixes = fixDelegator.fixJobs(JOB_LIST, Integer.valueOf(TEST_CHANGELIST), null, false); assertFixes(fixes); }
@Test(expected = ConnectionException.class) public void testFixJobsOptConnectionException() throws P4JavaException { when(server.execMapCmdList(eq(FIX.toString()), argThat(FIX_MATCHER), eq((Map<String, Object>)null))) .thenThrow(ConnectionException.class); fixDelegator.fixJobs(JOB_LIST, Integer.valueOf(TEST_CHANGELIST), new FixJobsOptions()); }
@Test(expected = ConnectionException.class) public void testFixJobsConnectionException() throws P4JavaException { when(server.execMapCmdList(eq(FIX.toString()), argThat(FIX_DELETE_MATCHER), eq((Map<String, Object>)null))) .thenThrow(ConnectionException.class); fixDelegator.fixJobs(JOB_LIST, Integer.valueOf(TEST_CHANGELIST), null, true); }
@Test(expected = AccessException.class) public void testFixJobsOptAccessException() throws P4JavaException { when(server.execMapCmdList(eq(FIX.toString()), argThat(FIX_MATCHER), eq((Map<String, Object>)null))) .thenThrow(AccessException.class); fixDelegator.fixJobs(JOB_LIST, Integer.valueOf(TEST_CHANGELIST), new FixJobsOptions()); }
@Test(expected = AccessException.class) public void testFixJobsAccessException() throws P4JavaException { when(server.execMapCmdList(eq(FIX.toString()), argThat(FIX_DELETE_MATCHER), eq((Map<String, Object>)null))) .thenThrow(AccessException.class); fixDelegator.fixJobs(JOB_LIST, Integer.valueOf(TEST_CHANGELIST), null, true); }
@Test(expected = RequestException.class) public void testFixJobsOptRequestException() throws P4JavaException { when(server.execMapCmdList(eq(FIX.toString()), argThat(FIX_MATCHER), eq((Map<String, Object>)null))) .thenThrow(RequestException.class); fixDelegator.fixJobs(JOB_LIST, Integer.valueOf(TEST_CHANGELIST), new FixJobsOptions()); }
@Test(expected = RequestException.class) public void testFixJobsRequestException() throws P4JavaException { when(server.execMapCmdList(eq(FIX.toString()), argThat(FIX_DELETE_MATCHER), eq((Map<String, Object>)null))) .thenThrow(RequestException.class); fixDelegator.fixJobs(JOB_LIST, Integer.valueOf(TEST_CHANGELIST), null, true); }
@Test(expected = P4JavaException.class) public void testFixJobsOptP4JavaException() throws P4JavaException { when(server.execMapCmdList(eq(FIX.toString()), argThat(FIX_MATCHER), eq((Map<String, Object>)null))) .thenThrow(P4JavaException.class); fixDelegator.fixJobs(JOB_LIST, Integer.valueOf(TEST_CHANGELIST), new FixJobsOptions()); }
@Test(expected = RequestException.class) public void testFixJobsP4JavaException() throws P4JavaException { when(server.execMapCmdList(eq(FIX.toString()), argThat(FIX_DELETE_MATCHER), eq((Map<String, Object>)null))) .thenThrow(P4JavaException.class); fixDelegator.fixJobs(JOB_LIST, Integer.valueOf(TEST_CHANGELIST), null, true); }
@Test public void testFixJobsOptNullResultMapFixToString() throws Exception { when(server.execMapCmdList(eq(FIX.toString()), argThat(FIX_MATCHER), eq((Map<String, Object>)null))) .thenReturn(null); List<IFix> fixes = fixDelegator.fixJobs(JOB_LIST, Integer.valueOf(TEST_CHANGELIST), new FixJobsOptions()); assertNotNull(fixes); assertEquals(0, fixes.size()); }
@Test public void testFixJobsOpt() throws P4JavaException { when(server.execMapCmdList(eq(FIX.toString()), argThat(FIX_MATCHER), eq(null))) .thenReturn(buildValidResultMap()); List<IFix> fixes = fixDelegator.fixJobs(JOB_LIST, Integer.valueOf(TEST_CHANGELIST), new FixJobsOptions()); assertFixes(fixes); }
@Test public void testFixJobs() throws P4JavaException { when(server.execMapCmdList(eq(FIX.toString()), argThat(FIX_MATCHER), eq(null))) .thenReturn(buildValidResultMap()); List<IFix> fixes = fixDelegator.fixJobs(JOB_LIST, Integer.valueOf(TEST_CHANGELIST), null, false); assertFixes(fixes); }
@Test(expected = ConnectionException.class) public void testFixJobsOptConnectionException() throws P4JavaException { when(server.execMapCmdList(eq(FIX.toString()), argThat(FIX_MATCHER), eq(null))) .thenThrow(ConnectionException.class); fixDelegator.fixJobs(JOB_LIST, Integer.valueOf(TEST_CHANGELIST), new FixJobsOptions()); }
@Test(expected = ConnectionException.class) public void testFixJobsConnectionException() throws P4JavaException { when(server.execMapCmdList(eq(FIX.toString()), argThat(FIX_DELETE_MATCHER), eq(null))) .thenThrow(ConnectionException.class); fixDelegator.fixJobs(JOB_LIST, Integer.valueOf(TEST_CHANGELIST), null, true); }
@Test(expected = AccessException.class) public void testFixJobsOptAccessException() throws P4JavaException { when(server.execMapCmdList(eq(FIX.toString()), argThat(FIX_MATCHER), eq(null))) .thenThrow(AccessException.class); fixDelegator.fixJobs(JOB_LIST, Integer.valueOf(TEST_CHANGELIST), new FixJobsOptions()); }
@Test(expected = AccessException.class) public void testFixJobsAccessException() throws P4JavaException { when(server.execMapCmdList(eq(FIX.toString()), argThat(FIX_DELETE_MATCHER), eq(null))) .thenThrow(AccessException.class); fixDelegator.fixJobs(JOB_LIST, Integer.valueOf(TEST_CHANGELIST), null, true); }
@Test(expected = RequestException.class) public void testFixJobsOptRequestException() throws P4JavaException { when(server.execMapCmdList(eq(FIX.toString()), argThat(FIX_MATCHER), eq(null))) .thenThrow(RequestException.class); fixDelegator.fixJobs(JOB_LIST, Integer.valueOf(TEST_CHANGELIST), new FixJobsOptions()); }
@Test(expected = RequestException.class) public void testFixJobsRequestException() throws P4JavaException { when(server.execMapCmdList(eq(FIX.toString()), argThat(FIX_DELETE_MATCHER), eq(null))) .thenThrow(RequestException.class); fixDelegator.fixJobs(JOB_LIST, Integer.valueOf(TEST_CHANGELIST), null, true); }
@Test(expected = P4JavaException.class) public void testFixJobsOptP4JavaException() throws P4JavaException { when(server.execMapCmdList(eq(FIX.toString()), argThat(FIX_MATCHER), eq(null))) .thenThrow(P4JavaException.class); fixDelegator.fixJobs(JOB_LIST, Integer.valueOf(TEST_CHANGELIST), new FixJobsOptions()); }
@Test(expected = RequestException.class) public void testFixJobsP4JavaException() throws P4JavaException { when(server.execMapCmdList(eq(FIX.toString()), argThat(FIX_DELETE_MATCHER), eq(null))) .thenThrow(P4JavaException.class); fixDelegator.fixJobs(JOB_LIST, Integer.valueOf(TEST_CHANGELIST), null, true); }
@Test public void testFixJobsOptNullResultMapFixToString() throws Exception { when(server.execMapCmdList(eq(FIX.toString()), argThat(FIX_MATCHER), eq(null))) .thenReturn(null); List<IFix> fixes = fixDelegator.fixJobs(JOB_LIST, Integer.valueOf(TEST_CHANGELIST), new FixJobsOptions()); assertNotNull(fixes); assertEquals(0, fixes.size()); }