@Test public void testGetJob() { MJob testJob = job(123l, 456l); testJob.setEnabled(true); MJob mJobSpy = org.mockito.Mockito.spy(testJob); when(repositoryManagerMock.getRepository()).thenReturn(jdbcRepoMock); when(jdbcRepoMock.findJob(123l)).thenReturn(mJobSpy); assertEquals(jobManager.getJob(123l), mJobSpy); verify(repositoryManagerMock, times(1)).getRepository(); verify(jdbcRepoMock, times(1)).findJob(123l); }
MJob getJob(long jobId) { MJob job = RepositoryManager.getInstance().getRepository().findJob(jobId); if (job == null) { throw new SqoopException(DriverError.DRIVER_0004, "Unknown job id: " + jobId); } if (!job.getEnabled()) { throw new SqoopException(DriverError.DRIVER_0009, "Job id: " + job.getPersistenceId()); } return job; }
JobManager implements Reconfigurable { MJob getJob(long jobId) { MJob job = RepositoryManager.getInstance().getRepository().findJob(jobId); if (job == null) { throw new SqoopException(DriverError.DRIVER_0004, "Unknown job id: " + jobId); } if (!job.getEnabled()) { throw new SqoopException(DriverError.DRIVER_0009, "Job id: " + job.getPersistenceId()); } return job; } }
JobManager implements Reconfigurable { MJob getJob(long jobId) { MJob job = RepositoryManager.getInstance().getRepository().findJob(jobId); if (job == null) { throw new SqoopException(DriverError.DRIVER_0004, "Unknown job id: " + jobId); } if (!job.getEnabled()) { throw new SqoopException(DriverError.DRIVER_0009, "Job id: " + job.getPersistenceId()); } return job; }  }
JobManager implements Reconfigurable { MJob getJob(long jobId) { MJob job = RepositoryManager.getInstance().getRepository().findJob(jobId); if (job == null) { throw new SqoopException(DriverError.DRIVER_0004, "Unknown job id: " + jobId); } if (!job.getEnabled()) { throw new SqoopException(DriverError.DRIVER_0009, "Job id: " + job.getPersistenceId()); } return job; }  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 { MJob getJob(long jobId) { MJob job = RepositoryManager.getInstance().getRepository().findJob(jobId); if (job == null) { throw new SqoopException(DriverError.DRIVER_0004, "Unknown job id: " + jobId); } if (!job.getEnabled()) { throw new SqoopException(DriverError.DRIVER_0009, "Job id: " + job.getPersistenceId()); } return job; }  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();  }