Examples of MConnector


Examples of org.apache.sqoop.model.MConnector

   * Test the exception handling procedure when the database handler fails to
   * delete job inputs for a given connector
   */
  @Test
  public void testConnectorUpgradeHandlerDeleteJobInputsError() {
    MConnector newConnector = connector(1, "1.1");
    MConnector oldConnector = connector(1);

    SqoopConnector sqconnector = mock(SqoopConnector.class);
    when(sqconnector.getValidator()).thenReturn(validator);
    when(sqconnector.getMetadataUpgrader()).thenReturn(upgrader);
    when(connectorMgr.getConnector(anyString())).thenReturn(sqconnector);
View Full Code Here

Examples of org.apache.sqoop.model.MConnector

   * Test the exception handling procedure when the database handler fails to
   * delete connection inputs for a given connector
   */
  @Test
  public void testConnectorUpgradeHandlerDeleteConnectionInputsError() {
    MConnector newConnector = connector(1, "1.1");
    MConnector oldConnector = connector(1);

    SqoopConnector sqconnector = mock(SqoopConnector.class);
    when(sqconnector.getValidator()).thenReturn(validator);
    when(sqconnector.getMetadataUpgrader()).thenReturn(upgrader);
    when(connectorMgr.getConnector(anyString())).thenReturn(sqconnector);
View Full Code Here

Examples of org.apache.sqoop.model.MConnector

   * Test the exception handling procedure when the database handler fails to
   * update the connector metadata
   */
  @Test
  public void testConnectorUpgradeHandlerUpdateConnectorError() {
    MConnector newConnector = connector(1, "1.1");
    MConnector oldConnector = connector(1);

    SqoopConnector sqconnector = mock(SqoopConnector.class);
    when(sqconnector.getValidator()).thenReturn(validator);
    when(sqconnector.getMetadataUpgrader()).thenReturn(upgrader);
    when(connectorMgr.getConnector(anyString())).thenReturn(sqconnector);
View Full Code Here

Examples of org.apache.sqoop.model.MConnector

   * Test the exception handling procedure when the database handler fails to
   * update the connection metadata
   */
  @Test
  public void testConnectorUpgradeHandlerUpdateConnectionError() {
    MConnector newConnector = connector(1, "1.1");
    MConnector oldConnector = connector(1);

    SqoopConnector sqconnector = mock(SqoopConnector.class);
    when(validator.validateConnection(any(MConnection.class))).thenReturn(valid);
    when(validator.validateJob(any(MJob.Type.class), any(MJob.class))).thenReturn(valid);
    when(sqconnector.getValidator()).thenReturn(validator);
View Full Code Here

Examples of org.apache.sqoop.model.MConnector

   * Test the exception handling procedure when the database handler fails to
   * update the job metadata
   */
  @Test
  public void testConnectorUpgradeHandlerUpdateJobError() {
    MConnector newConnector = connector(1, "1.1");
    MConnector oldConnector = connector(1);

    SqoopConnector sqconnector = mock(SqoopConnector.class);
    when(validator.validateConnection(any(MConnection.class))).thenReturn(valid);
    when(validator.validateJob(any(MJob.Type.class), any(MJob.class))).thenReturn(valid);
    when(sqconnector.getValidator()).thenReturn(validator);
View Full Code Here

Examples of org.apache.sqoop.model.MConnector

  private MConnector connector(long id, String version) {
    List<MJobForms> jobForms = new LinkedList<MJobForms>();
    jobForms.add(new MJobForms(MJob.Type.IMPORT, FormUtils.toForms(ImportJobConfiguration.class)));

    MConnector connector = new MConnector("A" + id, "A" + id, version + id,
        new MConnectionForms(new LinkedList<MForm>()), jobForms);
    connector.setPersistenceId(id);
    return connector;
  }
View Full Code Here

Examples of org.apache.sqoop.model.MConnector

  @Override
  public MConnector findConnector(String shortName, Connection conn) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Looking up connector: " + shortName);
    }
    MConnector mc = null;
    PreparedStatement baseConnectorFetchStmt = null;
    PreparedStatement formFetchStmt = null;
    PreparedStatement inputFetchStmt = null;
    try {
      baseConnectorFetchStmt = conn.prepareStatement(STMT_FETCH_BASE_CONNECTOR);
      baseConnectorFetchStmt.setString(1, shortName);
      ResultSet rsetBaseConnector = baseConnectorFetchStmt.executeQuery();

      if (!rsetBaseConnector.next()) {
        LOG.debug("No connector found by name: " + shortName);
        return null;
      }

      long connectorId = rsetBaseConnector.getLong(1);
      String connectorName = rsetBaseConnector.getString(2);
      String connectorClassName = rsetBaseConnector.getString(3);
      String connectorVersion = rsetBaseConnector.getString(4);

      formFetchStmt = conn.prepareStatement(STMT_FETCH_FORM_CONNECTOR);
      formFetchStmt.setLong(1, connectorId);
      inputFetchStmt = conn.prepareStatement(STMT_FETCH_INPUT);

      List<MForm> connectionForms = new ArrayList<MForm>();
      Map<MJob.Type, List<MForm>> jobForms =
        new HashMap<MJob.Type, List<MForm>>();

      loadForms(connectionForms, jobForms, formFetchStmt, inputFetchStmt, 1);

      mc = new MConnector(connectorName, connectorClassName, connectorVersion,
        new MConnectionForms(connectionForms),
        convertToJobList(jobForms));
      mc.setPersistenceId(connectorId);

      if (rsetBaseConnector.next()) {
        throw new SqoopException(DerbyRepoError.DERBYREPO_0005, shortName);
      }
    } catch (SQLException ex) {
View Full Code Here

Examples of org.apache.sqoop.model.MConnector

   * not require additional HTTP request.
   */
  @Test
  public void testGetConnector() {
    when(requests.readConnector(1L)).thenReturn(connectorBean(connector(1)));
    MConnector connector = client.getConnector(1);
    assertEquals(1, connector.getPersistenceId());

    client.getResourceBundle(1L);

    verify(requests, times(1)).readConnector(1L);
  }
View Full Code Here

Examples of org.apache.sqoop.model.MConnector

  }

  @Test
  public void testGetConnectorByString() {
    when(requests.readConnector(null)).thenReturn(connectorBean(connector(1)));
    MConnector connector = client.getConnector("A1");
    assertEquals(1, connector.getPersistenceId());
    assertEquals("A1", connector.getUniqueName());

    client.getResourceBundle(1L);

    verify(requests, times(0)).readConnector(1L);
    verify(requests, times(1)).readConnector(null);
View Full Code Here

Examples of org.apache.sqoop.model.MConnector

  @Test
  public void testGetConnectorBundle() {
    when(requests.readConnector(1L)).thenReturn(connectorBean(connector(1)));
    client.getResourceBundle(1L);

    MConnector connector = client.getConnector(1);
    assertEquals(1, connector.getPersistenceId());

    verify(requests, times(1)).readConnector(1L);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.