Examples of MConnector


Examples of org.apache.sqoop.model.MConnector

   * Getting all connectors at once should avoid any other HTTP request to
   * specific connectors.
   */
  @Test
  public void testGetConnectors() {
    MConnector connector;

    when(requests.readConnector(null)).thenReturn(connectorBean(connector(1), connector(2)));
    Collection<MConnector> connectors = client.getConnectors();
    assertEquals(2, connectors.size());

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

    connector = client.getConnector(2);
    client.getResourceBundle(2);
    assertEquals(2, connector.getPersistenceId());

    connectors = client.getConnectors();
    assertEquals(2, connectors.size());

    connector = client.getConnector("A1");
    assertEquals(1, connector.getPersistenceId());
    assertEquals("A1", connector.getUniqueName());

    connector = client.getConnector("A2");
    assertEquals(2, connector.getPersistenceId());
    assertEquals("A2", connector.getUniqueName());

    connector = client.getConnector("A3");
    assertNull(connector);

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

Examples of org.apache.sqoop.model.MConnector

  private FrameworkBean frameworkBean(MFramework framework) {
    return new FrameworkBean(framework, new MapResourceBundle(null));
  }

  private MConnector connector(long id) {
    MConnector connector = new MConnector("A" + id, "A" + id, "1.0" + id, new MConnectionForms(null), new LinkedList<MJobForms>());
    connector.setPersistenceId(id);
    return connector;
  }
View Full Code Here

Examples of org.apache.sqoop.model.MConnector

    try {
      rtx = repository.getTransaction();
      rtx.begin();
      for (String name : handlerMap.keySet()) {
        ConnectorHandler handler = handlerMap.get(name);
        MConnector connectorMetadata = handler.getMetadata();
        MConnector registeredMetadata =
            repository.registerConnector(connectorMetadata, autoUpgrade);

        // Set registered metadata instead of connector metadata as they will
        // have filled persistent ids. We should be confident at this point that
        // there are no differences between those two structures.
View Full Code Here

Examples of org.apache.sqoop.model.MConnector

   * @param connectorName Connector name
   * @return Connector model or NULL if the connector do not exists.
   */
  public MConnector getConnector(String connectorName) {
    // Firstly try if we have this connector already in cache
    MConnector connector = getConnectorFromCache(connectorName);
    if(connector != null) return connector;

    // If the connector wasn't in cache and we have all connectors,
    // it simply do not exists.
    if(allConnectors) return null;
View Full Code Here

Examples of org.apache.sqoop.model.MConnector

   *
   * @param connectorName Connector name
   * @return
   */
  public MConnection newConnection(String connectorName) {
    MConnector connector = getConnector(connectorName);
    if(connector == null) {
      throw new SqoopException(ClientError.CLIENT_0003, connectorName);
    }

    return newConnection(connector.getPersistenceId());
  }
View Full Code Here

Examples of org.apache.sqoop.model.MConnector

      displayConnector(connector);
    }
  }

  private void showConnector(Long cid) {
    MConnector connector = client.getConnector(cid);

    printlnResource(Constants.RES_SHOW_PROMPT_CONNECTORS_TO_SHOW, 1);

    displayConnector(connector);
  }
View Full Code Here

Examples of org.apache.sqoop.model.MConnector

/**
*
*/
public class TestUtil {
  public static MConnector getConnector(String name) {
    return new MConnector(name, name + ".class", "1.0-test",
      getConnectionForms(), getAllJobForms());
  }
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

/**
*
*/
public class TestUtil {
  public static MConnector getConnector(String name) {
    return new MConnector(name, name + ".class", "1.0-test",
      getConnectionForms(), getAllJobForms());
  }
View Full Code Here

Examples of org.apache.sqoop.model.MConnector

    try {
      rtx = repository.getTransaction();
      rtx.begin();
      for (String name : handlerMap.keySet()) {
        ConnectorHandler handler = handlerMap.get(name);
        MConnector connectorMetadata = handler.getMetadata();
        MConnector registeredMetadata =
            repository.registerConnector(connectorMetadata);

        // Set registered metadata instead of connector metadata as they will
        // have filled persistent ids. We should be confident at this point that
        // there are no differences between those two structures.
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.