Package com.sforce.async

Examples of com.sforce.async.BatchInfo


  @Test
  public final void testMapperForNullValues() throws IOException, InterruptedException, ConnectionException, AsyncApiException {
    Mapper.Context context = mock(Mapper.Context.class);
    SFHandler mockSFHandler = mock(SFHandler.class);
    when(mockSFHandler.getBulkConnection(anyString(), anyString())).thenReturn(null);
    BatchInfo batchInfo = new BatchInfo();
    String id = "id";
    batchInfo.setId(id);
    when(mockSFHandler.createBatch(any(FSDataInputStream.class), any(BulkConnection.class), any(JobInfo.class))).thenReturn(
        batchInfo);
    ExportSalesforceMapper mapper = new ExportSalesforceMapper();
    mapper.setSfHandler(mockSFHandler);
    Text batchId = new Text(id);
View Full Code Here


    SFHandler mockSFHandler = mock(SFHandler.class);
    mapper.setConnection(conn);
    mapper.setSfHandler(mockSFHandler);
   
    Mapper.Context context = mock(Mapper.Context.class);
    BatchInfo batchInfo = new BatchInfo();
    String id = "id";
    batchInfo.setId(id);
    Text batchId = new Text();
    mapper.setBatchId(batchId);   
   
    JobInfo info = new JobInfo();
    String id1 = "id1";
View Full Code Here

   */
  public BatchInfo createBatch(FSDataInputStream tmpInputStream,
      BulkConnection connection,
      JobInfo jobInfo) throws IOException, AsyncApiException {
    try {
      BatchInfo batchInfo = connection.createBatchFromStream(jobInfo,
          tmpInputStream);
      System.out.println(batchInfo);
      return batchInfo;
    } finally {
      tmpInputStream.close();
View Full Code Here

    @Override
    public void map(Text key, FSDataInputStream val, Context context)
        throws IOException, InterruptedException {
         try{  
        conn=getConnection();
        BatchInfo batch = sfHandler.createBatch(val, conn, job);
        batchId.set(batch.getId());
        context.write(jobId, batchId);
         }
         catch(Exception e) {
           e.printStackTrace();
           throw new IOException(e);
View Full Code Here

        this.attachments.put(name, new ByteArrayInputStream(fileContents));
        return "#" + name;
    }

    BatchInfo createBatch(InputStream batchContent) throws AsyncApiException {
        BatchInfo batch;
        if (this.jobInfo.getContentType() == ContentType.ZIP_CSV) {
            batch = this.client.createBatchWithInputStreamAttachments(this.jobInfo, batchContent, this.attachments);
        } else {
            batch = this.client.createBatchFromStream(this.jobInfo, batchContent);
        }
        logger.info(Messages.getMessage(getClass(), "logBatchLoaded", batch.getId()));
        return batch;
    }
View Full Code Here

    private void createBatch(ByteArrayOutputStream os, int numRecords) throws AsyncApiException {
        if (numRecords <= 0) return;
        final byte[] request = os.toByteArray();
        os.reset();
        BatchInfo bi = this.jobUtil.createBatch(new ByteArrayInputStream(request, 0, request.length));
        this.allBatchesInOrder.add(new BatchData(bi.getId(), numRecords));
    }
View Full Code Here

            jobUtil.createBatch(new ByteArrayInputStream(soql.getBytes(Config.BULK_API_ENCODING)));
        } catch (final UnsupportedEncodingException e) {
            throw new ExtractException(e);
        }
        jobUtil.closeJob();
        final BatchInfo b = jobUtil.getBatches().getBatchInfo()[0];
        if (b.getState() == BatchStateEnum.Failed) throw new ExtractException("Batch failed: " + b.getStateMessage());
        this.batch = b;
        return b.getNumberRecordsProcessed();
    }
View Full Code Here

TOP

Related Classes of com.sforce.async.BatchInfo

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.