Package org.apache.sqoop.model

Examples of org.apache.sqoop.model.MFramework


    // Load framework into repository
    loadConnectorAndFramework();

    // Retrieve it
    MFramework framework = handler.findFramework(getDerbyConnection());
    assertNotNull(framework);

    // Get original structure
    MFramework original = getFramework();

    // And compare them
    assertEquals(original, framework);
  }
View Full Code Here


    // And compare them
    assertEquals(original, framework);
  }

  public void testRegisterConnector() throws Exception {
    MFramework framework = getFramework();

    handler.registerFramework(framework, getDerbyConnection());

    // Connector should get persistence ID
    assertEquals(1, framework.getPersistenceId());

    // Now check content in corresponding tables
    assertCountForTable("SQOOP.SQ_CONNECTOR", 0);
    assertCountForTable("SQOOP.SQ_FORM", 6);
    assertCountForTable("SQOOP.SQ_INPUT", 12);

    // Registered framework should be easily recovered back
    MFramework retrieved = handler.findFramework(getDerbyConnection());
    assertNotNull(retrieved);
    assertEquals(framework, retrieved);
    assertEquals(framework.getVersion(), retrieved.getVersion());
  }
View Full Code Here

    assertEquals(FrameworkManager.CURRENT_FRAMEWORK_VERSION, getFrameworkVersion());
    runQuery("UPDATE SQOOP.SQ_SYSTEM SET SQM_VALUE='" + lowerVersion +
      "' WHERE SQM_KEY = '" + DerbyRepoConstants.SYSKEY_FRAMEWORK_VERSION + "'");
    assertEquals(lowerVersion, getFrameworkVersion());

    MFramework framework = getFramework();
    handler.updateFramework(framework, getDerbyConnection());

    assertEquals(FrameworkManager.CURRENT_FRAMEWORK_VERSION, framework.getVersion());

    assertEquals(FrameworkManager.CURRENT_FRAMEWORK_VERSION, getFrameworkVersion());
  }
View Full Code Here

  /**
   * Test that serializing actual data is not an issue.
   */
  public void testDataSerialization() throws Exception {
    MConnector connector = getConnector();
    MFramework framework = getFramework();

    // Register metadata for everything and our new connector
    handler.registerConnector(connector, getDerbyConnection());
    handler.registerFramework(framework, getDerbyConnection());

    // Inserted values
    Map<String, String> map = new HashMap<String, String>();
    map.put("A", "B");

    // Connection object with all various values
    MConnection connection = new MConnection(connector.getPersistenceId(), connector.getConnectionForms(), framework.getConnectionForms());
    MConnectionForms forms = connection.getConnectorPart();
    forms.getStringInput("f.String").setValue("A");
    forms.getMapInput("f.Map").setValue(map);
    forms.getIntegerInput("f.Integer").setValue(1);
    forms.getBooleanInput("f.Boolean").setValue(true);
View Full Code Here

    return null;
  }

  private void showFramework() {
    MFramework framework = client.getFramework();
    ResourceBundle bundle = client.getFrameworkResourceBundle();

    printlnResource(Constants.RES_SHOW_PROMPT_FRAMEWORK_OPTS, framework.getPersistenceId());
    displayFormMetadataDetails(framework, bundle);
  }
View Full Code Here

  @Override
  public MFramework registerFramework(final MFramework mFramework, final boolean autoUpgrade) {
    return (MFramework) doWithConnection(new DoWithConnection() {
      @Override
      public Object doIt(Connection conn) {
        MFramework result = handler.findFramework(conn);
        if (result == null) {
          handler.registerFramework(mFramework, conn);
          return mFramework;
        } else {
          // We're currently not serializing framework version into repository
View Full Code Here

    return new MConnector("A", "org.apache.sqoop.test.A", "1.0-test",
      getConnectionForms(), getJobForms());
  }

  protected MFramework getFramework() {
    return new MFramework(getConnectionForms(), getJobForms(),
      FrameworkManager.CURRENT_FRAMEWORK_VERSION);
  }
View Full Code Here

  /**
   * Test the procedure when the framework auto upgrade option is enabled
   */
  @Test
  public void testFrameworkEnableAutoUpgrade() {
    MFramework newFramework = framework();
    MFramework oldFramework = anotherFramework();

    when(repoHandler.findFramework(any(Connection.class))).thenReturn(oldFramework);

    // make the upgradeFramework to throw an exception to prove that it has been called
    SqoopException exception = new SqoopException(RepositoryError.JDBCREPO_0000,
View Full Code Here

  /**
   * Test the procedure when the framework auto upgrade option is disabled
   */
  @Test
  public void testFrameworkDisableAutoUpgrade() {
    MFramework newFramework = framework();
    MFramework oldFramework = anotherFramework();

    when(repoHandler.findFramework(any(Connection.class))).thenReturn(oldFramework);

    try {
      repo.registerFramework(newFramework, false);
View Full Code Here

   * Test the framework upgrade procedure, when all the connections and
   * jobs using the old connector are still valid for the new connector
   */
  @Test
  public void testFrameworkUpgradeWithValidConnectionsAndJobs() {
    MFramework newFramework = framework();

    when(validator.validateConnection(any(MConnection.class))).thenReturn(valid);
    when(validator.validateJob(any(MJob.Type.class), any(MJob.class))).thenReturn(valid);
    when(frameworkMgr.getValidator()).thenReturn(validator);
    when(frameworkMgr.getMetadataUpgrader()).thenReturn(upgrader);
View Full Code Here

TOP

Related Classes of org.apache.sqoop.model.MFramework

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.