Package org.apache.sqoop.common

Examples of org.apache.sqoop.common.SqoopException


    doNothing().when(repoHandler).updateFramework(any(MFramework.class), any(Connection.class));
    doReturn(true).when(repoHandler).existsConnection(anyLong(), any(Connection.class));
    doReturn(true).when(repoHandler).existsJob(anyLong(), any(Connection.class));
    doNothing().when(repoHandler).updateConnection(any(MConnection.class), 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.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(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(formName.equals(form.getName())) {
        return form;
      }
    }

    throw new SqoopException(ModelError.MODEL_010, "Form name: " + formName);
  }
View Full Code Here

  }

  public MInput getInput(String name) {
    String []parts = name.split("\\.");
    if(parts.length != 2) {
      throw new SqoopException(ModelError.MODEL_009, name);
    }

    return getForm(parts[0]).getInput(name);
  }
View Full Code Here

          String responseText = resp.getEntity(String.class);
          JSONObject json = (JSONObject) JSONValue.parse(responseText);
          ex.restore(json);

          throw new SqoopException(ClientError.CLIENT_0001, ex.getThrowable());
        }
      }

      return resp;
    }
View Full Code Here

    }

    try {
      cloneJob(getLong(line, Constants.OPT_JID));
    } catch (IOException ex) {
      throw new SqoopException(ShellError.SHELL_0005, ex);
    }

    return null;
  }
View Full Code Here

    try {
      JSONObject json =
        (JSONObject) JSONValue.parse(ctx.getRequest().getReader());
      bean.restore(json);
    } catch (IOException e) {
      throw new SqoopException(ServerError.SERVER_0003,
        "Can't read request content", e);
    }

    // Get job object
    List<MJob> jobs = bean.getJobs();

    if(jobs.size() != 1) {
      throw new SqoopException(ServerError.SERVER_0003,
        "Expected one job metadata but got " + jobs.size());
    }

    // Job object
    MJob job = jobs.get(0);

    // Verify that user is not trying to spoof us
    MJobForms connectorForms
      = ConnectorManager.getInstance().getConnectorMetadata(job.getConnectorId())
      .getJobForms(job.getType());
    MJobForms frameworkForms = FrameworkManager.getInstance().getFramework()
      .getJobForms(job.getType());

    if(!connectorForms.equals(job.getConnectorPart())
      || !frameworkForms.equals(job.getFrameworkPart())) {
      throw new SqoopException(ServerError.SERVER_0003,
        "Detected incorrect form structure");
    }

    // Responsible connector for this session
    SqoopConnector connector =
View Full Code Here

      Constants.PRE_CREATE, Constants.SUF_INFO);
  }

  public Object executeCommand(List args) {
    if(!isInteractive()) {
      throw new SqoopException(ShellError.SHELL_0007, "create");
    }

    if (args.size() == 0) {
      printlnResource(Constants.RES_CREATE_USAGE, getUsage());
      return null;
View Full Code Here

      Constants.PRE_UPDATE, Constants.SUF_INFO);
  }

  public Object executeCommand(List args) {
    if(!isInteractive()) {
      throw new SqoopException(ShellError.SHELL_0007, "update");
    }

    if (args.size() == 0) {
      printlnResource(Constants.RES_UPDATE_USAGE, getUsage());
      return null;
View Full Code Here

   * @param column Column that should be added to the schema at the end.
   * @return
   */
  public Schema addColumn(Column column) {
    if(column.getName() == null) {
      throw new SqoopException(SchemaError.SCHEMA_0001, "Column: " + column);
    }

    if(columNames.contains(column.getName())) {
      throw new SqoopException(SchemaError.SCHEMA_0002, "Column: " + column);
    }

    columNames.add(column.getName());

    columns.add(column);
View Full Code Here

    }

    try {
      cloneConnection(getLong(line, Constants.OPT_XID));
    } catch (IOException ex) {
      throw new SqoopException(ShellError.SHELL_0005, ex);
    }

    return null;
  }
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.