Package com.sforce.async

Examples of com.sforce.async.JobInfo


    when(context.getConfiguration()).thenReturn(conf);
   
    SFHandler mockSFHandler = mock(SFHandler.class);
    when(mockSFHandler.getBulkConnection(user, password)).thenReturn(null);
   
    JobInfo info = new JobInfo();
    String id = "id";
    info.setId(id);
    when(mockSFHandler.createJob(sObject, null)).thenReturn(info);
   
    ExportSalesforceMapper mapper = new ExportSalesforceMapper();
    mapper.setSfHandler(mockSFHandler);
    mapper.setup(context);
View Full Code Here


    String id = "id";
    batchInfo.setId(id);
    Text batchId = new Text();
    mapper.setBatchId(batchId);   
   
    JobInfo info = new JobInfo();
    String id1 = "id1";
    info.setId(id1);
    when(mockSFHandler.createBatch(any(FSDataInputStream.class), any(BulkConnection.class), any(JobInfo.class))).thenReturn(
        batchInfo);
    mapper.setSfHandler(mockSFHandler);
    mapper.setJob(info);
    mapper.setJobId(new Text(id1));
    mapper.map(new Text("abc"), mock(FSDataInputStream.class), context);
    assertEquals(id, batchId.toString());
    verify(context, times(1)).write(new Text(info.getId()), batchId);   
  }
View Full Code Here

   * @return The JobInfo for the new job.
   * @throws AsyncApiException
   */
  public JobInfo createJob(String sobjectType,
      BulkConnection connection) throws AsyncApiException {
    JobInfo job = new JobInfo();
    job.setObject(sobjectType);
    job.setOperation(OperationEnum.insert);
    job.setContentType(ContentType.CSV);
    job = connection.createJob(job);
    System.out.println(job);
    return job;
  }
View Full Code Here

    return job;
  }

  public void closeJob(BulkConnection connection, String jobId)
      throws AsyncApiException {
    JobInfo job = new JobInfo();
    job.setId(jobId);
    job.setState(JobStateEnum.Closed);
    connection.updateJob(job);
  }
View Full Code Here

    String getJobId() {
        return this.jobInfo.getId();
    }

    void createJob(Config cfg) throws AsyncApiException {
        JobInfo job = new JobInfo();
        final OperationEnum op = cfg.getOperationInfo().getOperationEnum();
        job.setOperation(op);
        if (op == OperationEnum.upsert) {
            job.setExternalIdFieldName(cfg.getString(Config.EXTERNAL_ID_FIELD));
        }
        job.setObject(cfg.getString(Config.ENTITY));
        job.setContentType(cfg.getBoolean(Config.BULK_API_ZIP_CONTENT) && op != OperationEnum.query ? ContentType.ZIP_CSV
                : ContentType.CSV);
        job.setConcurrencyMode(cfg.getBoolean(Config.BULK_API_SERIAL_MODE) ? ConcurrencyMode.Serial
                : ConcurrencyMode.Parallel);

        if (op == OperationEnum.update || op == OperationEnum.upsert || op == OperationEnum.insert) {
            final String assRule = cfg.getString(Config.ASSIGNMENT_RULE);
            if (assRule != null && (assRule.length() == 15 || assRule.length() == 18)) {
                job.setAssignmentRuleId(assRule);
            }
        }
        job = this.client.createJob(job);
        logger.info(Messages.getMessage(getClass(), "logJobCreated", job.getId()));
        this.jobInfo = job;
    }
View Full Code Here

TOP

Related Classes of com.sforce.async.JobInfo

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.