Package com.asakusafw.windgate.core.process

Examples of com.asakusafw.windgate.core.process.ProcessProvider


        for (ProcessProfile processProfile : processes) {
            LOG.debug("Loading process provider \"{}\": {}",
                    processProfile.getName(),
                    processProfile.getProviderClass().getName());
            assert results.containsKey(processProfile.getName()) == false;
            ProcessProvider provider = processProfile.createProvider();
            results.put(processProfile.getName(), provider);
        }
        return results;
    }
View Full Code Here


    private void runGateProcesses(List<ResourceMirror> resources) throws IOException {
        assert resources != null;
        final DriverRepository drivers = new DriverRepository(resources);
        LinkedList<Future<?>> futures = new LinkedList<Future<?>>();
        for (final ProcessScript<?> process : script.getProcesses()) {
            final ProcessProvider processProvider = processProviders.get(process.getProcessType());
            assert processProvider != null;
            Future<?> future = executor.submit(new Callable<Void>() {
                @Override
                public Void call() throws IOException {
                    LOG.debug("Starting gate process: {}",
                            process.getName(),
                            sessionId);
                    try {
                        if (RuntimeContext.get().canExecute(processProvider)) {
                            processProvider.execute(drivers, process);
                        } else {
                            LOG.info("Skipped process execution (simulated)");
                        }
                    } catch (IOException e) {
                        WGLOG.error(e, "E00003",
View Full Code Here

        ProcessProfile componentProfile = new ProcessProfile(
                componentName,
                componentClass,
                profile.getContext(),
                componentConf);
        ProcessProvider component;
        try {
            component = componentProfile.createProvider();
        } catch (IOException e) {
            WGLOG.error(e, "E00001",
                    profile.getName(),
View Full Code Here

     * @throws Exception if failed
     */
    @Test
    public void execute_simple() throws Exception {
        ProcessProfile profile = profile(2, Action.SUCCESS);
        ProcessProvider provider = profile.createProvider();
        provider.execute(factory(), script());
    }
View Full Code Here

     * @throws Exception if failed
     */
    @Test
    public void execute_retry1() throws Exception {
        ProcessProfile profile = profile(2, Action.EXCEPTION, Action.SUCCESS);
        ProcessProvider provider = profile.createProvider();
        provider.execute(factory(), script());
    }
View Full Code Here

     * @throws Exception if failed
     */
    @Test
    public void execute_retry2() throws Exception {
        ProcessProfile profile = profile(2, Action.EXCEPTION, Action.EXCEPTION, Action.SUCCESS);
        ProcessProvider provider = profile.createProvider();
        provider.execute(factory(), script());
    }
View Full Code Here

     * @throws Exception if failed
     */
    @Test
    public void execute_retry_over() throws Exception {
        ProcessProfile profile = profile(2, Action.EXCEPTION, Action.EXCEPTION, Action.EXCEPTION, Action.SUCCESS);
        ProcessProvider provider = profile.createProvider();
        try {
            provider.execute(factory(), script());
            fail();
        } catch (IOException e) {
            // ok.
        }
    }
View Full Code Here

     * @throws Exception if failed
     */
    @Test
    public void execute_interrupted() throws Exception {
        ProcessProfile profile = profile(2, Action.INTERRUPT, Action.SUCCESS);
        ProcessProvider provider = profile.createProvider();
        try {
            provider.execute(factory(), script());
            fail();
        } catch (IOException e) {
            // ok.
        }
    }
View Full Code Here

     * @throws Exception if failed
     */
    @Test
    public void execute_retry_interval() throws Exception {
        ProcessProfile profile = profile(2, 1, Action.EXCEPTION, Action.EXCEPTION, Action.SUCCESS);
        ProcessProvider provider = profile.createProvider();

        long start = System.currentTimeMillis();
        provider.execute(factory(), script());
        long end = System.currentTimeMillis();

        assertThat(end - start, is(greaterThan(1200L)));
    }
View Full Code Here

    @Test
    public void execute_sim() throws Exception {
        RuntimeContext.set(RuntimeContext.DEFAULT.mode(ExecutionMode.SIMULATION));

        ProcessProfile profile = profile(2, Action.SUCCESS);
        ProcessProvider provider = profile.createProvider();
        assertThat(RuntimeContext.get().canExecute(provider), is(true));
    }
View Full Code Here

TOP

Related Classes of com.asakusafw.windgate.core.process.ProcessProvider

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.