Package com.asakusafw.testdriver

Examples of com.asakusafw.testdriver.TestDriverContext


     * Executes an Asakusa batch application.
     * @throws IOException if failed to prepare execution plan
     * @throws AssertionError if failed to execute each job
     */
    public void perform() throws IOException {
        TestDriverContext context = configuration.context;
        for (FlowScript flow : configuration.script.getAllFlows()) {
            context.setCurrentBatchId(configuration.script.getId());
            context.setCurrentFlowId(flow.getId());
            context.setCurrentExecutionId(getExecutionId(flow));

            TestExecutionPlan plan = toPlan(flow);
            executePlan(plan);
        }
    }
View Full Code Here


                    script.getId()), e);
        }
    }

    Map<String, String> getHadoopProperties() {
        TestDriverContext context = configuration.context;
        VariableTable resolver = new VariableTable(RedefineStrategy.ERROR);
        resolver.defineVariables(context.getBatchArgs());
        Map<String, String> dPropMap = Maps.create();
        dPropMap.put(StageConstants.PROP_USER, context.getOsUser());
        dPropMap.put(StageConstants.PROP_EXECUTION_ID, context.getExecutionId());
        dPropMap.put(StageConstants.PROP_ASAKUSA_BATCH_ARGS, resolver.toSerialString());
        dPropMap.putAll(context.getExtraConfigurations());
        return dPropMap;
    }
View Full Code Here

                flow.getId());
    }

    private void executePlan(TestExecutionPlan plan) throws IOException {
        assert plan != null;
        TestDriverContext context = configuration.context;
        JobExecutor executor = context.getJobExecutor();
        LOG.info("Executing plan: batchId={}, flowId={}, execId={}, args={}, executor={}", new Object[] {
                context.getCurrentBatchId(),
                context.getCurrentFlowId(),
                context.getExecutionId(),
                context.getBatchArgs(),
                executor.getClass().getName(),
        });
        try {
            runJobFlowCommands(executor, plan.getInitializers());
            runJobFlowCommands(executor, plan.getImporters());
View Full Code Here

     * @param batchId the target batch ID
     * @param batchArguments the batch arguments (nullable)
     * @return the exit code
     */
    public static int execute(String batchId, Map<String, String> batchArguments) {
        TestDriverContext context = createContext();
        if (batchArguments != null) {
            context.getBatchArgs().putAll(batchArguments);
        }
        Arguments arguments = new Arguments(context, batchId, generateExecutionId());
        return execute(arguments);
    }
View Full Code Here

        LOG.debug("Exec ID (prefix): {}", batchId);

        Properties arguments = cmd.getOptionProperties(OPT_ARGUMENT.getOpt());
        LOG.debug("Batch arguments: {}", arguments);

        TestDriverContext context = createContext();
        context.getBatchArgs().putAll(toMap(arguments));

        return new Arguments(context, batchId, executionIdPrefix);
    }
View Full Code Here

                script,
                args.executionIdPrefix);
    }

    private static TestDriverContext createContext() {
        TestDriverContext context = new TestDriverContext(BatchTestRunner.class);

        // NOTE: We must use the system "batchapps" path instead of a temporary location
        context.useSystemBatchApplicationsInstallationPath(true);
        return context;
    }
View Full Code Here

    /**
     * Trivial testing.
     */
    @Test
    public void trivial() {
        TestDriverContext context = new TestDriverContext(getClass());
        JobExecutorFactory factory = new InProcessJobExecutorFactory();
        assertThat(factory.newInstance(context), is(instanceOf(InProcessJobExecutor.class)));
    }
View Full Code Here

TOP

Related Classes of com.asakusafw.testdriver.TestDriverContext

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.