Examples of BatchInfo


Examples of org.apache.camel.component.salesforce.api.dto.bulk.BatchInfo

        // make the call and parse the result
        doHttpRequest(get, new ClientResponseCallback() {
            @Override
            public void onResponse(InputStream response, SalesforceException ex) {
                BatchInfo value = null;
                try {
                    value = unmarshalResponse(response, get, BatchInfo.class);
                } catch (SalesforceException e) {
                    ex = e;
                }
View Full Code Here

Examples of org.apache.camel.component.salesforce.api.dto.bulk.BatchInfo

        // make the call and parse the result
        doHttpRequest(post, new ClientResponseCallback() {
            @Override
            public void onResponse(InputStream response, SalesforceException ex) {
                BatchInfo value = null;
                try {
                    value = unmarshalResponse(response, post, BatchInfo.class);
                } catch (SalesforceException e) {
                    ex = e;
                }
View Full Code Here

Examples of org.apache.camel.component.salesforce.api.dto.bulk.BatchInfo

        });
    }

    private void processGetBatch(final Exchange exchange, final AsyncCallback callback) throws SalesforceException {
        String jobId;
        BatchInfo batchBody = exchange.getIn().getBody(BatchInfo.class);
        String batchId;
        if (batchBody != null) {
            jobId = batchBody.getJobId();
            batchId = batchBody.getId();
        } else {
            jobId = getParameter(JOB_ID, exchange, IGNORE_BODY, NOT_OPTIONAL);
            batchId = getParameter(BATCH_ID, exchange, USE_BODY, NOT_OPTIONAL);
        }
        bulkClient.getBatch(jobId, batchId, new BulkApiClient.BatchInfoResponseCallback() {
View Full Code Here

Examples of org.apache.camel.component.salesforce.api.dto.bulk.BatchInfo

        });
    }

    private void processGetRequest(final Exchange exchange, final AsyncCallback callback) throws SalesforceException {
        String jobId;
        BatchInfo batchBody;
        String batchId;
        batchBody = exchange.getIn().getBody(BatchInfo.class);
        if (batchBody != null) {
            jobId = batchBody.getJobId();
            batchId = batchBody.getId();
        } else {
            jobId = getParameter(JOB_ID, exchange, IGNORE_BODY, NOT_OPTIONAL);
            batchId = getParameter(BATCH_ID, exchange, USE_BODY, NOT_OPTIONAL);
        }
View Full Code Here

Examples of org.apache.camel.component.salesforce.api.dto.bulk.BatchInfo

        });
    }

    private void processGetResults(final Exchange exchange, final AsyncCallback callback) throws SalesforceException {
        String jobId;
        BatchInfo batchBody;
        String batchId;
        batchBody = exchange.getIn().getBody(BatchInfo.class);
        if (batchBody != null) {
            jobId = batchBody.getJobId();
            batchId = batchBody.getId();
        } else {
            jobId = getParameter(JOB_ID, exchange, IGNORE_BODY, NOT_OPTIONAL);
            batchId = getParameter(BATCH_ID, exchange, USE_BODY, NOT_OPTIONAL);
        }
        bulkClient.getResults(jobId, batchId, new BulkApiClient.StreamResponseCallback() {
View Full Code Here

Examples of org.apache.camel.component.salesforce.api.dto.bulk.BatchInfo

                });
    }

    private void processGetQueryResultIds(final Exchange exchange, final AsyncCallback callback) throws SalesforceException {
        String jobId;
        BatchInfo batchBody;
        String batchId;
        batchBody = exchange.getIn().getBody(BatchInfo.class);
        if (batchBody != null) {
            jobId = batchBody.getJobId();
            batchId = batchBody.getId();
        } else {
            jobId = getParameter(JOB_ID, exchange, IGNORE_BODY, NOT_OPTIONAL);
            batchId = getParameter(BATCH_ID, exchange, USE_BODY, NOT_OPTIONAL);
        }
        bulkClient.getQueryResultIds(jobId, batchId, new BulkApiClient.QueryResultIdsCallback() {
View Full Code Here

Examples of org.apache.camel.component.salesforce.api.dto.bulk.BatchInfo

        });
    }

    private void processGetQueryResult(final Exchange exchange, final AsyncCallback callback) throws SalesforceException {
        String jobId;
        BatchInfo batchBody;
        String batchId;
        batchBody = exchange.getIn().getBody(BatchInfo.class);
        String resultId;
        if (batchBody != null) {
            jobId = batchBody.getJobId();
            batchId = batchBody.getId();
            resultId = getParameter(RESULT_ID, exchange, IGNORE_BODY, NOT_OPTIONAL);
        } else {
            jobId = getParameter(JOB_ID, exchange, IGNORE_BODY, NOT_OPTIONAL);
            batchId = getParameter(BATCH_ID, exchange, IGNORE_BODY, NOT_OPTIONAL);
            resultId = getParameter(RESULT_ID, exchange, USE_BODY, NOT_OPTIONAL);
View Full Code Here

Examples of org.apache.camel.component.salesforce.api.dto.bulk.BatchInfo

        // test createBatch
        Map<String, Object> headers = new HashMap<String, Object>();
        headers.put(SalesforceEndpointConfig.JOB_ID, jobInfo.getId());
        headers.put(SalesforceEndpointConfig.CONTENT_TYPE, jobInfo.getContentType());
        BatchInfo batchInfo  = template().requestBodyAndHeaders("direct:createBatch",
            request.stream, headers, BatchInfo.class);
        assertNotNull("Null batch", batchInfo);
        assertNotNull("Null batch id", batchInfo.getId());

        // test getAllBatches
        @SuppressWarnings("unchecked")
        List<BatchInfo> batches = template().requestBody("direct:getAllBatches", jobInfo, List.class);
        assertNotNull("Null batches", batches);
        assertFalse("Empty batch list", batches.isEmpty());

        // test getBatch
        batchInfo = batches.get(0);
        batchInfo = getBatchInfo(batchInfo);

        // test getRequest
        InputStream requestStream  = template().requestBody("direct:getRequest", batchInfo, InputStream.class);
        assertNotNull("Null batch request", requestStream);

        // wait for batch to finish
        log.info("Waiting for batch to finish...");
        while (!batchProcessed(batchInfo)) {
            // sleep 5 seconds
            Thread.sleep(5000);
            // check again
            batchInfo = getBatchInfo(batchInfo);
        }
        log.info("Batch finished with state " + batchInfo.getState());
        assertEquals("Batch did not succeed", BatchStateEnum.COMPLETED, batchInfo.getState());

        // test getResults
        InputStream results  = template().requestBody("direct:getResults", batchInfo, InputStream.class);
        assertNotNull("Null batch results", results);
View Full Code Here

Examples of org.apache.camel.component.salesforce.api.dto.bulk.BatchInfo

        jobInfo.setContentType(contentType);
        jobInfo.setObject(Merchandise__c.class.getSimpleName());
        jobInfo = createJob(jobInfo);

        // test createQuery
        BatchInfo batchInfo = template().requestBody("direct:createBatchQuery", jobInfo, BatchInfo.class);
        assertNotNull("Null batch query", batchInfo);
        assertNotNull("Null batch query id", batchInfo.getId());

        // test getRequest
        InputStream requestStream = template().requestBody("direct:getRequest", batchInfo, InputStream.class);
        assertNotNull("Null batch request", requestStream);

        // wait for batch to finish
        log.info("Waiting for query batch to finish...");
        while (!batchProcessed(batchInfo)) {
            // sleep 5 seconds
            Thread.sleep(5000);
            // check again
            batchInfo = getBatchInfo(batchInfo);
        }
        log.info("Query finished with state " + batchInfo.getState());
        assertEquals("Query did not succeed", BatchStateEnum.COMPLETED, batchInfo.getState());

        // test getQueryResultList
        @SuppressWarnings("unchecked")
        List<String> resultIds = template().requestBody("direct:getQueryResultIds", batchInfo, List.class);
        assertNotNull("Null query result ids", resultIds);
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.