Package org.apache.felix.service.command

Examples of org.apache.felix.service.command.CommandSession


    }

    @Override
    @SuppressWarnings("rawtypes")
    public int complete(String buffer, int cursor, List candidates) {
        CommandSession session = CommandSessionHolder.getSession();
        ArgumentCompleter.ArgumentList list = (ArgumentCompleter.ArgumentList)session.get(ArgumentCompleter.ARGUMENTS_LIST);
        String[] arguments = list.getArguments();
        int index = list.getCursorArgumentIndex();
        int paramCount = 0;
        for (String arg : arguments) {
            if (arg.startsWith("-")) {
View Full Code Here


    protected String executeCommand(final String command, final Long timeout, final Boolean silent) {
        String response;
        final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        final PrintStream printStream = new PrintStream(byteArrayOutputStream);
        final CommandProcessor commandProcessor = getOsgiService(CommandProcessor.class);
        final CommandSession commandSession = commandProcessor.createSession(System.in, printStream, System.err);
        FutureTask<String> commandFuture = new FutureTask<String>(
                new Callable<String>() {
                    public String call() {
                        try {
                            if (!silent) {
                                System.err.println(command);
                            }
                            commandSession.execute(command);
                        } catch (Exception e) {
                            e.printStackTrace(System.err);
                        }
                        printStream.flush();
                        return byteArrayOutputStream.toString();
View Full Code Here

            }
        };
        command.setId(TEST_PROVISIONR_ID);
        command.setKey(TEST_BUSINESS_KEY);

        CommandSession session = mock(CommandSession.class);
        String output = (String) command.execute(session);

        verify(service).startPoolManagementProcess(TEST_BUSINESS_KEY, pool);
        assertThat(output).isEqualTo("Pool management process started (id: null)");
    }
View Full Code Here

    public void testProvisioningServiceNotFound() throws Exception {
        CreatePoolCommand command = new CreatePoolCommand(Collections.<Provisionr>emptyList(),
            Collections.<PoolTemplate>emptyList(), PATH_TO_PUBLIC_KEY, PATH_TO_PRIVATE_KEY);
        command.setId("dummy");

        CommandSession session = mock(CommandSession.class);
        command.execute(session);
    }
View Full Code Here

        ProcessEngine processEngine = mockProcessEngine(PROCESS_INSTANCE_ID, TEST_BUSINESS_KEY, TEST_PROVISIONR_ID);

        DestroyPoolCommand command = new DestroyPoolCommand(ImmutableList.of(service), processEngine);
        command.setBusinessKey(TEST_BUSINESS_KEY);

        CommandSession session = mock(CommandSession.class);
        command.execute(session);

        verify(service).destroyPool(TEST_BUSINESS_KEY);
    }
View Full Code Here

    public void testFailsWithAnEmptyServiceList() throws Exception {
        ProcessEngine processEngine = mockProcessEngine(PROCESS_INSTANCE_ID, TEST_BUSINESS_KEY, TEST_PROVISIONR_ID);

        DestroyPoolCommand command = new DestroyPoolCommand(ImmutableList.<Provisionr>of(), processEngine);

        CommandSession session = mock(CommandSession.class);
        command.setBusinessKey(TEST_BUSINESS_KEY);
        command.execute(session);
    }
View Full Code Here

        final ProcessEngine processEngine = newProcessEngineMock(Collections.<ProcessInstance>emptyList());

        ListPoolsCommand command = new ListPoolsCommand(processEngine);
        command.setOut(out);

        CommandSession session = mock(CommandSession.class);
        command.execute(session);
        out.flush();

        assertThat(outputStream.toString()).containsIgnoringCase("no active pools found");
        outputStream.reset();
View Full Code Here

        ListPoolsCommand command = new ListPoolsCommand(processEngine);
        command.setOut(out);

        /* list all active pools */
        CommandSession session = mock(CommandSession.class);
        command.execute(session);
        out.flush();

        assertThat(outputStream.toString())
            .contains("Pool Description")
View Full Code Here

        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        PrintStream out = new PrintStream(outputStream);
        command.setOut(out);

        CommandSession session = mock(CommandSession.class);
        command.execute(session);
        out.close();

        for (Provisionr service : services) {
            verify(service).getId();
View Full Code Here

    @Test
    public void testResumeCommandNeedsBusinessKey() throws Exception {
        final ResetRetriesCommand command = new ResetRetriesCommand(newMockProcessEngine());
        command.setOut(out);

        CommandSession commandSession = mock(CommandSession.class);
        command.execute(commandSession);
        out.flush();
        assertThat(outputStream.toString()).containsIgnoringCase("please supply a business key");
    }
View Full Code Here

TOP

Related Classes of org.apache.felix.service.command.CommandSession

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.