Examples of BatchInfo


Examples of com.asakusafw.compiler.testing.BatchInfo

        }

        File compilerOutputDir = new File(compileWorkDir, "output");
        File compilerLocalWorkingDir = new File(compileWorkDir, "build");

        BatchInfo batchInfo = DirectBatchCompiler.compile(
                batchDescriptionClass,
                "test.batch",
                Location.fromPath(driverContext.getClusterWorkDir(), '/'),
                compilerOutputDir,
                compilerLocalWorkingDir,
                Arrays.asList(new File[] {
                        DirectFlowCompiler.toLibraryPath(batchDescriptionClass)
                }),
                batchDescriptionClass.getClassLoader(),
                driverContext.getOptions());

        // ジョブフロー名の検査
        for (String flowId : jobFlowMap.keySet()) {
            if (batchInfo.findJobflow(flowId) == null) {
                throw new IllegalStateException(MessageFormat.format(
                        "ジョブフロー{1}はバッチ{0}に定義されていません",
                        driverContext.getCallerClass().getName(),
                        flowId));
            }
        }

        // 環境の検証
        driverContext.validateExecutionEnvironment();

        LOG.info("テスト環境を初期化しています: {}", driverContext.getCallerClass().getName());
        JobflowExecutor executor = new JobflowExecutor(driverContext);
        executor.cleanWorkingDirectory();
        for (JobflowInfo jobflowInfo : batchInfo.getJobflows()) {
            driverContext.prepareCurrentJobflow(jobflowInfo);
            executor.cleanInputOutput(jobflowInfo);
        }

        for (JobflowInfo jobflowInfo : batchInfo.getJobflows()) {
            driverContext.prepareCurrentJobflow(jobflowInfo);
            String flowId = jobflowInfo.getJobflow().getFlowId();
            JobFlowTester tester = jobFlowMap.get(flowId);
            if (tester != null) {
                LOG.debug("ジョブフローの入出力を初期化しています: {}#{}",
View Full Code Here

Examples of com.asakusafw.compiler.testing.BatchInfo

            }

            File compilerOutputDir = new File(compileWorkDir, "output");
            File compilerLocalWorkingDir = new File(compileWorkDir, "build");

            BatchInfo batchInfo = DirectBatchCompiler.compile(
                    batchDescriptionClass,
                    "test.batch",
                    Location.fromPath(driverContext.getClusterWorkDir(), '/'),
                    compilerOutputDir,
                    compilerLocalWorkingDir,
                    Arrays.asList(new File[] {
                            DirectFlowCompiler.toLibraryPath(batchDescriptionClass)
                    }),
                    batchDescriptionClass.getClassLoader(),
                    driverContext.getOptions());

            for (JobflowInfo jobflowInfo : batchInfo.getJobflows()) {
                driverContext.prepareCurrentJobflow(jobflowInfo);
                executor.runJobflow(jobflowInfo);
            }

            // テスト結果検証ツールを実行し、Excel上の期待値とDB上の実際値を比較する。
View Full Code Here

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

Examples of com.sforce.async.BatchInfo

    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

Examples of com.sforce.async.BatchInfo

   */
  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

Examples of com.sforce.async.BatchInfo

    @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

Examples of com.sforce.async.BatchInfo

        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

Examples of com.sforce.async.BatchInfo

    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

Examples of com.sforce.async.BatchInfo

            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

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
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.