Examples of Context


Examples of org.apache.hadoop.mapreduce.Mapper.Context

    LoadSplit split = getLoadSplit();

    MapContext<NullWritable, GridmixRecord, GridmixKey, GridmixRecord> mapContext = new MapContextImpl<NullWritable, GridmixRecord, GridmixKey, GridmixRecord>(
            conf, taskId, reader, writer, committer, reporter, split);
    // context
    Context ctx = new WrappedMapper<NullWritable, GridmixRecord, GridmixKey, GridmixRecord>()
            .getMapContext(mapContext);

    reader.initialize(split, ctx);
    ctx.getConfiguration().setBoolean(MRJobConfig.MAP_OUTPUT_COMPRESS, true);
    CompressionEmulationUtil.setCompressionEmulationEnabled(
            ctx.getConfiguration(), true);

    LoadJob.LoadMapper mapper = new LoadJob.LoadMapper();
    // setup, map, clean
    mapper.run(ctx);
View Full Code Here

Examples of org.apache.hadoop.yarn.server.nodemanager.Context

      dispatcher.register(ContainersMonitorEventType.class, monitorBus);
      dispatcher.register(AuxServicesEventType.class, auxBus);
      dispatcher.register(ApplicationEventType.class, appBus);
      dispatcher.register(LogHandlerEventType.class, LogBus);

      Context context = mock(Context.class);
      when(context.getApplications()).thenReturn(
          new ConcurrentHashMap<ApplicationId, Application>());
      launcher = new ContainersLauncher(context, dispatcher, null, null, null);
      // create a mock ExecutorService, which will not really launch
      // ContainerLaunch at all.
      launcher.containerLauncher = mock(ExecutorService.class);
View Full Code Here

Examples of org.apache.hive.ptest.execution.conf.Context

    context.put("branch", "trunk");
    context.put("repository", "repo");
    context.put("repositoryName", "repoName");
    context.put("antArgs", "-Dsome=thing");
    context.put("logsURL", "http://ec2-174-129-184-35.compute-1.amazonaws.com/logs");
    TestConfiguration configuration = new TestConfiguration(new Context(context), logger);
    configuration.setJiraName("HIVE-4892");
    JIRAService service = new JIRAService(logger, configuration, "test-123");
    List<String> messages = Lists.newArrayList("msg1", "msg2");
    SortedSet<String> failedTests = Sets.newTreeSet(Collections.singleton("failed"));
    service.postComment(false, 5, failedTests, messages);
View Full Code Here

Examples of org.apache.isis.extensions.html.context.Context

    public void sessionDestroyed(final HttpSessionEvent event) {
        final HttpSession session = event.getSession();
        SessionAccess.removeSession(session);

        final Context context = (Context) session.getAttribute(NOF_SESSION_ATTRIBUTE);
        final AuthenticationSession nofSession = context.getSession();
        if (nofSession != null) {
            SessionAccess.logoffUser(nofSession);
        }

    }
View Full Code Here

Examples of org.apache.isis.viewer.html.context.Context

        }

        // authenticated
        authenticationSessionStrategy.bind(request, response, authSession);

        final Context context = new Context(getHtmlComponentFactory());
        context.setSession(authSession);
        authSession.setAttribute(HtmlServletConstants.AUTHENTICATION_SESSION_CONTEXT_KEY, context);

        LOG.info("created session");
        redirectToStartPage(response, user);
    }
View Full Code Here

Examples of org.apache.karaf.shell.commands.Context

public class CompletionTest extends CompleterTestSupport {

    @Test
    public void testSubShellCompletion() throws Exception {
        Context context = new Context();
        context.set("SCOPE", "*");
        context.set(SessionProperties.COMPLETION_MODE, "subshell");
        CommandSessionHolder.setSession(context.getSession());

        context.addCommand("*", new SimpleSubShell("foo"), "foo");
        context.addCommand("*", new SimpleCommand(ExitAction.class), "exit");
        context.addCommand("foo", new SimpleCommand(MyAction.class), "my-action");
        context.addCommand("foo", new SimpleCommand(MyActionTwoArguments.class), "one-action");
        context.addCommand("bar", new SimpleCommand(MyAction.class), "one-action");
        context.addCommand("bar", new SimpleCommand(MyActionTwoArguments.class), "another");

        Completer comp = new CommandsCompleter(context.getSession());

        context.execute("foo");
        assertEquals(Arrays.asList("my-action "), complete(comp, "my"));
        assertEquals(Arrays.asList("exit ", "my-action ", "one-action "), complete(comp, ""));
        assertEquals(Arrays.asList(), complete(comp, "an"));
        assertEquals(Arrays.asList("--check", "--foo", "--help", "--integer", "--string"),
                     complete(comp, "my-action --"));
        assertEquals(Arrays.asList("--dummy", "--help"), complete(comp, "one-action --"));

        context.execute("exit");
        assertEquals(Arrays.asList(), complete(comp, "my"));
        assertEquals(Arrays.asList("exit ", "foo "), complete(comp, ""));
        assertEquals(Arrays.asList(), complete(comp, "an"));
    }
View Full Code Here

Examples of org.apache.karaf.shell.commands.basic.Context

public class CompletionTest extends CompleterTestSupport {

    @Test
    public void testSubShellCompletion() throws Exception {
        Context context = new Context();
        context.set("SCOPE", "*");
        context.set(SessionProperties.COMPLETION_MODE, "subshell");
        CommandSessionHolder.setSession(context.getSession());

        context.addCommand("*", new SimpleSubShell("foo"), "foo");
        context.addCommand("*", new SimpleCommand(ExitAction.class), "exit");
        context.addCommand("foo", new SimpleCommand(MyAction.class), "my-action");
        context.addCommand("foo", new SimpleCommand(MyActionTwoArguments.class), "one-action");
        context.addCommand("bar", new SimpleCommand(MyAction.class), "one-action");
        context.addCommand("bar", new SimpleCommand(MyActionTwoArguments.class), "another");

        Completer comp = new CommandsCompleter(context.getSession());

        context.execute("foo");
        assertEquals(Arrays.asList("my-action "), complete(comp, "my"));
        assertEquals(Arrays.asList("exit ", "my-action ", "one-action "), complete(comp, ""));
        assertEquals(Arrays.asList(), complete(comp, "an"));
        assertEquals(Arrays.asList("--check", "--foo", "--help", "--integer", "--string"),
                     complete(comp, "my-action --"));
        assertEquals(Arrays.asList("--dummy", "--help"), complete(comp, "one-action --"));

        context.execute("exit");
        assertEquals(Arrays.asList(), complete(comp, "my"));
        assertEquals(Arrays.asList("exit ", "foo "), complete(comp, ""));
        assertEquals(Arrays.asList(), complete(comp, "an"));
    }
View Full Code Here

Examples of org.apache.mina.codec.textline.TextLineDecoder.Context

public class AutoTextLineDecoderTest {

    @Test
    public void testThatEmptyBufferReturnsEmptyResult() {
        TextLineDecoder decoder = new TextLineDecoder();
        Context context = decoder.createDecoderState();
        String results = decoder.decode(ByteBuffer.allocate(0), context);
        assertNull(results);
    }
View Full Code Here

Examples of org.apache.oozie.action.hadoop.ActionExecutorTestCase.Context

        WorkflowJobBean wf = createBaseWorkflow(protoConf, "pig-action");
        WorkflowActionBean action = (WorkflowActionBean) wf.getActions().get(0);
        action.setType(ae.getType());

        Context context = new Context(wf, action);

        Configuration conf = ae.createBaseHadoopConf(context, actionXml);
        ae.setupActionConf(conf, context, actionXml, getFsTestCaseDir());
        assertEquals("SCRIPT", conf.get("oozie.pig.script"));
        assertEquals("2", conf.get("oozie.pig.params.size"));
View Full Code Here

Examples of org.apache.oozie.dependency.URIHandler.Context

            String user = ParamChecker
                    .notEmpty((String) eval.getVariable(OozieClient.USER_NAME), OozieClient.USER_NAME);
            String doneFlag = ds.getDoneFlag();
            URIHandlerService uriService = Services.get().get(URIHandlerService.class);
            URIHandler uriHandler = null;
            Context uriContext = null;
            try {
                while (instance >= checkedInstance && !currentThread.isInterrupted()) {
                    ELEvaluator uriEval = getUriEvaluator(nominalInstanceCal);
                    String uriPath = uriEval.evaluate(uriTemplate, String.class);
                    if (uriHandler == null) {
                        URI uri = new URI(uriPath);
                        uriHandler = uriService.getURIHandler(uri);
                        uriContext = uriHandler.getContext(uri, conf, user);
                    }
                    String uriWithDoneFlag = uriHandler.getURIWithDoneFlag(uriPath, doneFlag);
                    if (uriHandler.exists(new URI(uriWithDoneFlag), uriContext)) {
                        if (available == endOffset) {
                            LOG.debug("Matched future(" + available + "): " + uriWithDoneFlag);
                            resolved = true;
                            resolvedInstances.append(DateUtils.formatDateOozieTZ(nominalInstanceCal));
                            resolvedURIPaths.append(uriPath);
                            retVal = resolvedInstances.toString();
                            eval.setVariable("resolved_path", resolvedURIPaths.toString());
                            break;
                        }
                        else if (available >= startOffset) {
                            LOG.debug("Matched future(" + available + "): " + uriWithDoneFlag);
                            resolvedInstances.append(DateUtils.formatDateOozieTZ(nominalInstanceCal)).append(
                                    INSTANCE_SEPARATOR);
                            resolvedURIPaths.append(uriPath).append(INSTANCE_SEPARATOR);
                        }
                        available++;
                    }
                    // nominalInstanceCal.add(dsTimeUnit.getCalendarUnit(), datasetFrequency);
                    nominalInstanceCal = (Calendar) initInstance.clone();
                    instCount[0]++;
                    nominalInstanceCal.add(dsTimeUnit.getCalendarUnit(), instCount[0] * datasetFrequency);
                    checkedInstance++;
                    // DateUtils.moveToEnd(nominalInstanceCal, getDSEndOfFlag());
                }
            }
            finally {
                if (uriContext != null) {
                    uriContext.destroy();
                }
            }
            if (!resolved) {
                // return unchanged future function with variable 'is_resolved'
                // to 'false'
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.