Package org.apache.sqoop.common

Examples of org.apache.sqoop.common.SqoopException


    doNothing().when(repoHandler).deleteJobInputs(anyLong(), any(Connection.class));
    doNothing().when(repoHandler).deleteConnectionInputs(anyLong(), any(Connection.class));
    doNothing().when(repoHandler).updateConnector(any(MConnector.class), any(Connection.class));
    doReturn(true).when(repoHandler).existsConnection(anyLong(), any(Connection.class));

    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
        "update connection error.");
    doThrow(exception).when(repoHandler).updateConnection(any(MConnection.class), any(Connection.class));

    try {
      repo.upgradeConnector(oldConnector, newConnector);
    } catch (SqoopException ex) {
      assertEquals(ex.getMessage(), exception.getMessage());
      verify(repoHandler, times(1)).findConnectionsForConnector(anyLong(), any(Connection.class));
      verify(repoHandler, times(1)).findJobsForConnector(anyLong(), any(Connection.class));
      verify(repoHandler, times(2)).deleteJobInputs(anyLong(), any(Connection.class));
      verify(repoHandler, times(2)).deleteConnectionInputs(anyLong(), any(Connection.class));
      verify(repoHandler, times(1)).updateConnector(any(MConnector.class), any(Connection.class));
      verify(repoHandler, times(1)).existsConnection(anyLong(), any(Connection.class));
      verify(repoHandler, times(1)).updateConnection(any(MConnection.class), any(Connection.class));
      verifyNoMoreInteractions(repoHandler);
      return ;
    }

    fail("Should throw out an exception with message: " + exception.getMessage());
  }
View Full Code Here


      }

      if (upgradeSuccessful) {
        tx.commit();
      } else {
        throw new SqoopException(RepositoryError.JDBCREPO_0027);
      }
    } catch (SqoopException ex) {
      if(tx != null) {
        tx.rollback();
      }
      throw ex;
    } catch (Exception ex) {
      if(tx != null) {
        tx.rollback();
      }
      throw new SqoopException(RepositoryError.JDBCREPO_0000, ex);
    } finally {
      if(tx != null) {
        tx.close();
      }
      LOG.info("Metadata upgrade finished for connector: " + oldConnector.getUniqueName());
View Full Code Here

    doNothing().when(repoHandler).updateConnector(any(MConnector.class), any(Connection.class));
    doNothing().when(repoHandler).updateConnection(any(MConnection.class), any(Connection.class));
    doReturn(true).when(repoHandler).existsConnection(anyLong(), any(Connection.class));
    doReturn(true).when(repoHandler).existsJob(anyLong(), any(Connection.class));

    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
        "update job error.");
    doThrow(exception).when(repoHandler).updateJob(any(MJob.class), any(Connection.class));

    try {
      repo.upgradeConnector(oldConnector, newConnector);
    } catch (SqoopException ex) {
      assertEquals(ex.getMessage(), exception.getMessage());
      verify(repoHandler, times(1)).findConnectionsForConnector(anyLong(), any(Connection.class));
      verify(repoHandler, times(1)).findJobsForConnector(anyLong(), any(Connection.class));
      verify(repoHandler, times(2)).deleteJobInputs(anyLong(), any(Connection.class));
      verify(repoHandler, times(2)).deleteConnectionInputs(anyLong(), any(Connection.class));
      verify(repoHandler, times(1)).updateConnector(any(MConnector.class), any(Connection.class));
      verify(repoHandler, times(2)).existsConnection(anyLong(), any(Connection.class));
      verify(repoHandler, times(2)).updateConnection(any(MConnection.class), any(Connection.class));
      verify(repoHandler, times(1)).existsJob(anyLong(), any(Connection.class));
      verify(repoHandler, times(1)).updateJob(any(MJob.class), any(Connection.class));
      verifyNoMoreInteractions(repoHandler);
      return ;
    }

    fail("Should throw out an exception with message: " + exception.getMessage());
  }
View Full Code Here

      }

      if (upgradeSuccessful) {
        tx.commit();
      } else {
        throw new SqoopException(RepositoryError.JDBCREPO_0027);
      }
    } catch (SqoopException ex) {
      if(tx != null) {
        tx.rollback();
      }
      throw ex;
    } catch (Exception ex) {
      if(tx != null) {
        tx.rollback();
      }
      throw new SqoopException(RepositoryError.JDBCREPO_0000, ex);
    } finally {
      if(tx != null) {
        tx.close();
      }
      LOG.info("Framework metadata upgrade finished");
View Full Code Here

    MFramework newFramework = framework();

    when(frameworkMgr.getValidator()).thenReturn(validator);
    when(frameworkMgr.getMetadataUpgrader()).thenReturn(upgrader);

    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
        "find connections error.");
    doThrow(exception).when(repoHandler).findConnections(any(Connection.class));

    try {
      repo.upgradeFramework(newFramework);
    } catch (SqoopException ex) {
      assertEquals(ex.getMessage(), exception.getMessage());
      verify(repoHandler, times(1)).findConnections(any(Connection.class));
      verifyNoMoreInteractions(repoHandler);
      return ;
    }

    fail("Should throw out an exception with message: " + exception.getMessage());
  }
View Full Code Here

    when(frameworkMgr.getMetadataUpgrader()).thenReturn(upgrader);

    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
    doReturn(connectionList).when(repoHandler).findConnections(any(Connection.class));

    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
        "find jobs error.");
    doThrow(exception).when(repoHandler).findJobs(any(Connection.class));

    try {
      repo.upgradeFramework(newFramework);
    } catch (SqoopException ex) {
      assertEquals(ex.getMessage(), exception.getMessage());
      verify(repoHandler, times(1)).findConnections(any(Connection.class));
      verify(repoHandler, times(1)).findJobs(any(Connection.class));
      verifyNoMoreInteractions(repoHandler);
      return ;
    }

    fail("Should throw out an exception with message: " + exception.getMessage());
  }
View Full Code Here

    List<MConnection> connectionList = connections(connection(1,1), connection(2,1));
    List<MJob> jobList = jobs(job(1,1,1), job(2,1,2));
    doReturn(connectionList).when(repoHandler).findConnections(any(Connection.class));
    doReturn(jobList).when(repoHandler).findJobs(any(Connection.class));

    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
        "delete job inputs error.");
    doThrow(exception).when(repoHandler).deleteJobInputs(anyLong(), any(Connection.class));

    try {
      repo.upgradeFramework(newFramework);
    } catch (SqoopException ex) {
      assertEquals(ex.getMessage(), exception.getMessage());
      verify(repoHandler, times(1)).findConnections(any(Connection.class));
      verify(repoHandler, times(1)).findJobs(any(Connection.class));
      verify(repoHandler, times(1)).deleteJobInputs(anyLong(), any(Connection.class));
      verifyNoMoreInteractions(repoHandler);
      return ;
    }

    fail("Should throw out an exception with message: " + exception.getMessage());
  }
View Full Code Here

    List<MJob> jobList = jobs(job(1,1,1), job(2,1,2));
    doReturn(connectionList).when(repoHandler).findConnections(any(Connection.class));
    doReturn(jobList).when(repoHandler).findJobs(any(Connection.class));
    doNothing().when(repoHandler).deleteJobInputs(anyLong(), any(Connection.class));

    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
        "delete connection inputs error.");
    doThrow(exception).when(repoHandler).deleteConnectionInputs(anyLong(), any(Connection.class));

    try {
      repo.upgradeFramework(newFramework);
    } catch (SqoopException ex) {
      assertEquals(ex.getMessage(), exception.getMessage());
      verify(repoHandler, times(1)).findConnections(any(Connection.class));
      verify(repoHandler, times(1)).findJobs(any(Connection.class));
      verify(repoHandler, times(2)).deleteJobInputs(anyLong(), any(Connection.class));
      verify(repoHandler, times(1)).deleteConnectionInputs(anyLong(), any(Connection.class));
      verifyNoMoreInteractions(repoHandler);
      return ;
    }

    fail("Should throw out an exception with message: " + exception.getMessage());
  }
View Full Code Here

    doReturn(connectionList).when(repoHandler).findConnections(any(Connection.class));
    doReturn(jobList).when(repoHandler).findJobs(any(Connection.class));
    doNothing().when(repoHandler).deleteJobInputs(anyLong(), any(Connection.class));
    doNothing().when(repoHandler).deleteConnectionInputs(anyLong(), any(Connection.class));

    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
        "update framework metadata error.");
    doThrow(exception).when(repoHandler).updateFramework(any(MFramework.class), any(Connection.class));

    try {
      repo.upgradeFramework(newFramework);
    } catch (SqoopException ex) {
      assertEquals(ex.getMessage(), exception.getMessage());
      verify(repoHandler, times(1)).findConnections(any(Connection.class));
      verify(repoHandler, times(1)).findJobs(any(Connection.class));
      verify(repoHandler, times(2)).deleteJobInputs(anyLong(), any(Connection.class));
      verify(repoHandler, times(2)).deleteConnectionInputs(anyLong(), any(Connection.class));
      verify(repoHandler, times(1)).updateFramework(any(MFramework.class), any(Connection.class));
      verifyNoMoreInteractions(repoHandler);
      return ;
    }

    fail("Should throw out an exception with message: " + exception.getMessage());
  }
View Full Code Here

    doNothing().when(repoHandler).deleteJobInputs(anyLong(), any(Connection.class));
    doNothing().when(repoHandler).deleteConnectionInputs(anyLong(), any(Connection.class));
    doNothing().when(repoHandler).updateFramework(any(MFramework.class), any(Connection.class));
    doReturn(true).when(repoHandler).existsConnection(anyLong(), any(Connection.class));

    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
        "update connection error.");
    doThrow(exception).when(repoHandler).updateConnection(any(MConnection.class), any(Connection.class));

    try {
      repo.upgradeFramework(newFramework);
    } catch (SqoopException ex) {
      assertEquals(ex.getMessage(), exception.getMessage());
      verify(repoHandler, times(1)).findConnections(any(Connection.class));
      verify(repoHandler, times(1)).findJobs(any(Connection.class));
      verify(repoHandler, times(2)).deleteJobInputs(anyLong(), any(Connection.class));
      verify(repoHandler, times(2)).deleteConnectionInputs(anyLong(), any(Connection.class));
      verify(repoHandler, times(1)).updateFramework(any(MFramework.class), any(Connection.class));
      verify(repoHandler, times(1)).existsConnection(anyLong(), any(Connection.class));
      verify(repoHandler, times(1)).updateConnection(any(MConnection.class), any(Connection.class));
      verifyNoMoreInteractions(repoHandler);
      return ;
    }

    fail("Should throw out an exception with message: " + exception.getMessage());
  }
View Full Code Here

TOP

Related Classes of org.apache.sqoop.common.SqoopException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.