@Test public void testDisabledLink() { MLink testConnection = new MLink(123l, null); testConnection.setPersistenceId(1234); testConnection.setEnabled(false); SqoopException exception = new SqoopException(DriverError.DRIVER_0010, "Connection id: " + testConnection.getPersistenceId()); MLink mConnectionSpy = org.mockito.Mockito.spy(testConnection); when(repositoryManagerMock.getRepository()).thenReturn(jdbcRepoMock); when(jdbcRepoMock.findLink(123l)).thenReturn(mConnectionSpy); try { jobManager.getLink(123l); } catch (SqoopException ex) { assertEquals(ex.getMessage(), exception.getMessage()); verify(repositoryManagerMock, times(1)).getRepository(); verify(jdbcRepoMock, times(1)).findLink(123l); } }
MLink getLink(long linkId) { MLink link = RepositoryManager.getInstance().getRepository() .findLink(linkId); if (!link.getEnabled()) { throw new SqoopException(DriverError.DRIVER_0010, "Connection id: " + link.getPersistenceId()); } return link; }
JobManager implements Reconfigurable { MLink getLink(long linkId) { MLink link = RepositoryManager.getInstance().getRepository() .findLink(linkId); if (!link.getEnabled()) { throw new SqoopException(DriverError.DRIVER_0010, "Connection id: " + link.getPersistenceId()); } return link; } }
JobManager implements Reconfigurable { MLink getLink(long linkId) { MLink link = RepositoryManager.getInstance().getRepository() .findLink(linkId); if (!link.getEnabled()) { throw new SqoopException(DriverError.DRIVER_0010, "Connection id: " + link.getPersistenceId()); } return link; }  }
JobManager implements Reconfigurable { MLink getLink(long linkId) { MLink link = RepositoryManager.getInstance().getRepository() .findLink(linkId); if (!link.getEnabled()) { throw new SqoopException(DriverError.DRIVER_0010, "Connection id: " + link.getPersistenceId()); } return link; }  static JobManager getInstance(); static void setInstance(JobManager newInstance); void setNotificationBaseUrl(String url); String getNotificationBaseUrl(); synchronized void destroy(); synchronized void initialize(); MSubmission start(long jobId, HttpEventContext ctx); JobRequest createJobRequest(long jobId, MSubmission submission); MSubmission createJobSubmission(HttpEventContext ctx, long jobId); void prepareJob(JobRequest request); MSubmission stop(long jobId, HttpEventContext ctx); MSubmission status(long jobId); void updateSubmission(MSubmission submission); @Override synchronized void configurationChanged(); }
JobManager implements Reconfigurable { MLink getLink(long linkId) { MLink link = RepositoryManager.getInstance().getRepository() .findLink(linkId); if (!link.getEnabled()) { throw new SqoopException(DriverError.DRIVER_0010, "Connection id: " + link.getPersistenceId()); } return link; }  static JobManager getInstance(); static void setInstance(JobManager newInstance); void setNotificationBaseUrl(String url); String getNotificationBaseUrl(); synchronized void destroy(); synchronized void initialize(); MSubmission start(long jobId, HttpEventContext ctx); JobRequest createJobRequest(long jobId, MSubmission submission); MSubmission createJobSubmission(HttpEventContext ctx, long jobId); void prepareJob(JobRequest request); MSubmission stop(long jobId, HttpEventContext ctx); MSubmission status(long jobId); void updateSubmission(MSubmission submission); @Override synchronized void configurationChanged();  }