JdbcRepository extends Repository { @SuppressWarnings("unchecked") @Override public List<MJob> findJobs() { return (List<MJob>) doWithConnection(new DoWithConnection() { @Override public Object doIt(Connection conn) { return handler.findJobs(conn); } }); } protected  JdbcRepository(JdbcRepositoryHandler handler,
      JdbcRepositoryContext repoContext); @Override JdbcRepositoryTransaction getTransaction(); @Override void createOrUpgradeRepository(); @Override boolean isRepositorySuitableForUse(); @Override MConnector registerConnector(final MConnector mConnector, final boolean autoUpgrade); @Override MConnector findConnector(final String shortName); @SuppressWarnings("unchecked") @Override List<MConnector> findConnectors(); @Override MDriver registerDriver(final MDriver mDriver, final boolean autoUpgrade); @Override MDriver findDriver(final String shortName); @Override void createLink(final MLink link); @Override void updateLink(final MLink link); @Override void updateLink(final MLink link, RepositoryTransaction tx); @Override void enableLink(final long linkId, final boolean enabled); @Override void deleteLink(final long linkId); @Override MLink findLink(final long id); @Override MLink findLink(final String name); @SuppressWarnings("unchecked") @Override List<MLink> findLinks(); @SuppressWarnings("unchecked") @Override List<MLink> findLinksForConnector(final long connectorId); @Override void createJob(final MJob job); @Override void updateJob(final MJob job); @Override void updateJob(final MJob job, RepositoryTransaction tx); @Override void enableJob(final long id, final boolean enabled); @Override void deleteJob(final long id); @Override MJob findJob(final long id); @Override MJob findJob(final String name); @SuppressWarnings("unchecked") @Override List<MJob> findJobs(); @SuppressWarnings("unchecked") @Override List<MJob> findJobsForConnector(final long connectorId); @Override void createSubmission(final MSubmission submission); @Override void updateSubmission(final MSubmission submission); @Override void purgeSubmissions(final Date threshold); @SuppressWarnings("unchecked") @Override List<MSubmission> findUnfinishedSubmissions(); @SuppressWarnings("unchecked") @Override List<MSubmission> findSubmissions(); @SuppressWarnings("unchecked") @Override List<MSubmission> findSubmissionsForJob(final long jobId); @Override MSubmission findLastSubmissionForJob(final long jobId); @Override MConfig findFromJobConfig(final long jobId, final String configName); @Override MConfig findToJobConfig(final long jobId, final String configName); @Override MConfig findDriverJobConfig(final long jobId, final String configName); @Override MConfig findLinkConfig(final long linkId, final String configName); @Override void updateJobConfig(final long jobId, final MConfig config, final MConfigUpdateEntityType type); @Override void updateJobConfig(final long jobId, final MConfig config, final MConfigUpdateEntityType type, RepositoryTransaction tx); @Override void updateLinkConfig(final long linkId, final MConfig config, final MConfigUpdateEntityType type); @Override void updateLinkConfig(final long linkId, final MConfig config, final MConfigUpdateEntityType type, RepositoryTransaction tx);  }
@Test public void testDriverConfigUpgradeHandlerWithFindJobsError() { MDriver newDriverConfig = driver(); when(driverMock.getConfigurableUpgrader()).thenReturn(driverUpgraderMock); SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000, "find jobs error."); doThrow(exception).when(repoHandlerMock).findJobs(any(Connection.class)); try { repoSpy.upgradeDriver(newDriverConfig); } catch (SqoopException ex) { assertEquals(ex.getMessage(), exception.getMessage()); verify(repoHandlerMock, times(1)).findJobs(any(Connection.class)); verifyNoMoreInteractions(repoHandlerMock); return ; } fail("Should throw out an exception with message: " + exception.getMessage()); }