Examples of RuntimeContext


Examples of cc.concurrent.mango.runtime.RuntimeContext

    }


    @Override
    public Object execute(Object[] methodArgs) {
        RuntimeContext context = buildRuntimeContext(methodArgs);
        if (isUseCache()) { // 先使用缓存,再使用db
            return executeFromCache(context);
        } else { // 直接使用db
            return executeFromDb(context, rowMapper);
        }
View Full Code Here

Examples of com.asakusafw.runtime.core.context.RuntimeContext

     * Test for passing runtime context.
     * @throws Exception if failed
     */
    @Test
    public void inherit_context() throws Exception {
        RuntimeContext context = RuntimeContext.DEFAULT
            .mode(ExecutionMode.SIMULATION)
            .batchId("testbatch")
            .buildId("testverify");

        RuntimeContext.set(context);

        putScript(target, "libexec/check-context.sh", SshProfile.COMMAND_GET);
        Map<String, String> results = new HashMap<String, String>();
        JschConnection conn = new JschConnection(profile, Arrays.asList(profile.getGetCommand()));
        try {
            InputStream output = conn.openStandardOutput();
            conn.connect();
            Scanner s = new Scanner(output, "UTF-8");
            while (s.hasNextLine()) {
                String[] pair = s.nextLine().split("=", 2);
                if (pair.length == 2) {
                    results.put(pair[0], pair[1]);
                }
            }
            s.close();
            int exit = conn.waitForExit(10000);
            assertThat(exit, is(0));
        } finally {
            conn.close();
        }

        RuntimeContext restored = RuntimeContext.DEFAULT.apply(results);
        assertThat(results.toString(), restored, is(context));
    }
View Full Code Here

Examples of com.asakusafw.runtime.core.context.RuntimeContext

        HadoopScriptHandler handler = handler(
                "env.ASAKUSA_HOME", getAsakusaHome().getAbsolutePath(),
                "env.handler", "HANDLER",
                "env.override", "HANDLER");

        RuntimeContext rc = RuntimeContext.DEFAULT
            .batchId("b")
            .mode(ExecutionMode.SIMULATION)
            .buildId("OK");
        ExecutionContext context = new ExecutionContext("b", "f", "e", ExecutionPhase.MAIN, map(), rc.unapply());
        execute(context, script, handler);

        Map<String, String> map = new HashMap<String, String>();
        for (String line : getOutput(shell)) {
            if (line.trim().isEmpty()) {
View Full Code Here

Examples of com.asakusafw.runtime.core.context.RuntimeContext

        MockJobClient c1 = new MockJobClient("testing", COMPLETED);
        JobClientProfile profile = new JobClientProfile("testing", list(c1), 1000, 10);
        QueueHadoopScriptHandler handler = create();
        handler.doConfigure(profile);

        RuntimeContext rc = RuntimeContext.DEFAULT
            .batchId("b")
            .mode(ExecutionMode.SIMULATION)
            .buildId("OK");
        ExecutionContext context = new ExecutionContext(
                "b", "f", "e", ExecutionPhase.MAIN,
                Collections.<String, String>emptyMap(),
                rc.unapply());

        HadoopScript script = script();
        handler.execute(ExecutionMonitor.NULL, context, script);

        JobScript js = c1.registered.get("testing");
View Full Code Here

Examples of com.asakusafw.runtime.core.context.RuntimeContext

            Map<String, String> copyDefinitions,
            BatchScript script) {
        assert result != null;
        assert copyDefinitions != null;
        assert script != null;
        RuntimeContext rc = RuntimeContext.get().batchId(script.getId()).buildId(script.getBuildId());

        Ternary dryRunResult = consumeBoolean(copyDefinitions, KEY_VERIFY_DRYRUN);
        if (dryRunResult == Ternary.TRUE) {
            rc = rc.mode(ExecutionMode.SIMULATION);
        } else if (dryRunResult == Ternary.FALSE) {
            rc = rc.mode(ExecutionMode.PRODUCTION);
        }

        Ternary verify = consumeBoolean(copyDefinitions, KEY_VERIFY_APPLICATION);
        if (verify == Ternary.FALSE) {
            rc = rc.buildId(null);
        }

        result.runtimeContext = rc;
        result.getEnv().putAll(rc.unapply());
    }
View Full Code Here

Examples of com.asakusafw.runtime.core.context.RuntimeContext

                Arrays.asList(shell.getAbsolutePath()),
                map("script", "SCRIPT", "override", "SCRIPT"));

        CommandScriptHandler handler = handler("env.handler", "HANDLER", "env.override", "HANDLER");

        RuntimeContext rc = RuntimeContext.DEFAULT
            .batchId("b")
            .mode(ExecutionMode.SIMULATION)
            .buildId("OK");
        ExecutionContext context = new ExecutionContext("b", "f", "e", ExecutionPhase.MAIN, map(), rc.unapply());
        execute(context, script, handler);

        Map<String, String> map = new HashMap<String, String>();
        for (String line : getOutput(shell)) {
            if (line.trim().isEmpty()) {
View Full Code Here

Examples of com.asakusafw.runtime.core.context.RuntimeContext

        HadoopScriptHandler handler = handler(
                "env.ASAKUSA_HOME", getAsakusaHome().getAbsolutePath(),
                "env.handler", "HANDLER",
                "env.override", "HANDLER");

        RuntimeContext rc = RuntimeContext.DEFAULT
            .batchId("b")
            .mode(ExecutionMode.SIMULATION)
            .buildId("OK");
        ExecutionContext context = new ExecutionContext("b", "f", "e", ExecutionPhase.MAIN, map(), rc.unapply());
        execute(context, script, handler);

        Map<String, String> map = new HashMap<String, String>();
        for (String line : getOutput(shell)) {
            if (line.trim().isEmpty()) {
View Full Code Here

Examples of com.asakusafw.runtime.core.context.RuntimeContext

                Arrays.asList(shell.getAbsolutePath()),
                map("script", "SCRIPT", "override", "SCRIPT"));

        CommandScriptHandler handler = handler("env.handler", "HANDLER", "env.override", "HANDLER");

        RuntimeContext rc = RuntimeContext.DEFAULT
            .batchId("b")
            .mode(ExecutionMode.SIMULATION)
            .buildId("OK");
        ExecutionContext context = new ExecutionContext(
                "b", "f", "e", ExecutionPhase.MAIN, map(), rc.unapply());
        execute(context, script, handler);

        Map<String, String> map = new HashMap<String, String>();
        for (String line : getOutput(shell)) {
            if (line.trim().isEmpty()) {
View Full Code Here

Examples of oasis.names.tc.wsrp.v1.types.RuntimeContext

    /**
     * Create the runtime context for the current request.
     */
    protected RuntimeContext getRuntimeContext(WSRPBaseRequest request) {
        RuntimeContext runtimeContext = new RuntimeContext();
        runtimeContext.setUserAuthentication(consumerEnv.getUserAuthentication());
        runtimeContext.setPortletInstanceKey(request.getPortletInstanceKey());

        URLTemplateComposer templateComposer = consumerEnv.getTemplateComposer();
        if (templateComposer != null) {
            runtimeContext.setNamespacePrefix(templateComposer.getNamespacePrefix());
        }

        Boolean doesUrlTemplateProcess = null;
        try {

            PortletDescription desc = producer.getPortletDescription(getPortlet().getParent());

            if (desc != null) {

                doesUrlTemplateProcess = desc.getDoesUrlTemplateProcessing();
            }

        } catch (WSRPException e) {

            // do nothing since exception has been logged already
            // continue with assumption that portlet does not support template processing
        }

        if (doesUrlTemplateProcess != null && templateComposer != null && doesUrlTemplateProcess.booleanValue()) {
            Templates templates = new Templates();
            templates.setBlockingActionTemplate(templateComposer.createBlockingActionTemplate(true, true, true, true));
            templates.setRenderTemplate(templateComposer.createRenderTemplate(true, true, true, true));
            templates.setDefaultTemplate(templateComposer.createDefaultTemplate(true, true, true, true));
            templates.setResourceTemplate(templateComposer.createResourceTemplate(true, true, true, true));
            templates.setSecureBlockingActionTemplate(
                templateComposer.createSecureBlockingActionTemplate(true, true, true, true));
            templates.setSecureRenderTemplate(templateComposer.createSecureRenderTemplate(true, true, true, true));
            templates.setSecureDefaultTemplate(templateComposer.createSecureDefaultTemplate(true, true, true, true));
            templates.setSecureResourceTemplate(templateComposer.createSecureResourceTemplate(true, true, true, true));
            runtimeContext.setTemplates(templates);
        }

        runtimeContext.setSessionID(request.getSessionID());
        runtimeContext.setExtensions(null);

        return runtimeContext;
    }
View Full Code Here

Examples of org.apache.flink.api.common.functions.RuntimeContext

      final MapFunction<String, Integer> parser = new RichMapFunction<String, Integer>() {
       
        @Override
        public void open(Configuration parameters) throws Exception {
          opened.set(true);
          RuntimeContext ctx = getRuntimeContext();
          assertEquals(0, ctx.getIndexOfThisSubtask());
          assertEquals(1, ctx.getNumberOfParallelSubtasks());
          assertEquals(taskName, ctx.getTaskName());
        }
       
        @Override
        public Integer map(String value) {
          return Integer.parseInt(value);
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.