Package org.apache.ace.processlauncher

Examples of org.apache.ace.processlauncher.LaunchConfiguration


     */
    public void testCreateLaunchConfigurationBasedOnPropertiesFileOk() throws Exception {
        Properties props = TestUtil.getProperties("launch.properties");
        assertNotNull(props);

        LaunchConfiguration config = LaunchConfigurationFactory.create(props);
        assertNotNull(config);

        assertEquals(2, config.getInstanceCount());
        assertEquals("/bin/sh", config.getExecutableName());
        assertArrayEquals(new String[] { "-c", "'sleep 1 && exit'", "-c", "'echo \"foo bar!\n\"'" },
            config.getExecutableArgs());
        assertNull(config.getProcessStreamListener());
    }
View Full Code Here


        props.put(LaunchConfigurationFactory.EXECUTABLE_ARGS, "");
        props.put(LaunchConfigurationFactory.PROCESS_STREAM_LISTENER_FILTER, "(foo=bar)");
        props.put(LaunchConfigurationFactory.RESPAWN_AUTOMATICALLY, "false");
        props.put(LaunchConfigurationFactory.NORMAL_EXIT_VALUE, "2");

        LaunchConfiguration config = LaunchConfigurationFactory.create(props);
        assertNotNull(config);

        assertEquals(1, config.getInstanceCount());
        assertEquals("/path/to/foo", config.getExecutableName());
        assertArrayEquals(new String[0], config.getExecutableArgs());
        assertEquals(2, config.getNormalExitValue());
        assertNotNull(config.getProcessStreamListener());
        assertFalse(config.isRespawnAutomatically());
    }
View Full Code Here

    /**
     * Test that creating a valid {@link LaunchConfigurationImpl} works.
     */
    public void testCreateLaunchConfigurationOk() {
        LaunchConfiguration launchConfig = new LaunchConfigurationImpl(1, "/path/to/foo", new String[0], null, false);
        assertNotNull(launchConfig);
    }
View Full Code Here

    /**
     * Test that the {@link LaunchConfigurationImpl#getCommandLine()} method works properly when one
     * executable arguments are given.
     */
    public void testGetCommandLineWithOneArgumentsOk() {
        LaunchConfiguration launchConfig =
            new LaunchConfigurationImpl(1, "/path/to/foo", new String[] { "-bar" }, null, false);

        String[] commandLine = launchConfig.getCommandLine();
        assertNotNull(commandLine);
        assertEquals(2, commandLine.length);

        assertEquals("/path/to/foo", commandLine[0]);
        assertEquals("-bar", commandLine[1]);
View Full Code Here

    /**
     * Test that the {@link LaunchConfigurationImpl#getCommandLine()} method works properly when no
     * executable arguments are given.
     */
    public void testGetCommandLineWithoutArgumentsOk() {
        LaunchConfiguration launchConfig =
            new LaunchConfigurationImpl(1, "cwd", "/path/to/foo", new String[0], 0, "(foo=bar)", "(qux=quu)", false);

        String[] commandLine = launchConfig.getCommandLine();
        assertNotNull(commandLine);
        assertEquals(1, commandLine.length);

        assertEquals("/path/to/foo", commandLine[0]);
        assertEquals("cwd", launchConfig.getWorkingDirectory().getName());
        assertNotNull(launchConfig.getProcessStreamListener());
        assertFalse(launchConfig.isRespawnAutomatically());
    }
View Full Code Here

    /**
     * Test that the {@link LaunchConfigurationImpl#getCommandLine()} method works properly when two
     * executable arguments are given.
     */
    public void testGetCommandLineWithTwoArgumentsOk() {
        LaunchConfiguration launchConfig =
            new LaunchConfigurationImpl(1, "/path/to/foo", new String[] { "-qux", "-bar" }, null, true);

        String[] commandLine = launchConfig.getCommandLine();
        assertNotNull(commandLine);
        assertEquals(3, commandLine.length);

        assertEquals("/path/to/foo", commandLine[0]);
        assertEquals("-qux", commandLine[1]);
        assertEquals("-bar", commandLine[2]);
        assertNull(launchConfig.getProcessStreamListener());
        assertTrue(launchConfig.isRespawnAutomatically());
    }
View Full Code Here

     *
     * @param pid the service PID that is to be deleted, never <code>null</code>.
     * @see org.osgi.service.cm.ManagedServiceFactory#deleted(java.lang.String)
     */
    public final void deleted(final String pid) {
        LaunchConfiguration oldLaunchConfig = null;

        synchronized (m_launchConfigurations) {
            oldLaunchConfig = m_launchConfigurations.remove(pid);
        }

View Full Code Here

     * @see org.osgi.service.cm.ManagedServiceFactory#updated(java.lang.String,
     *      java.util.Dictionary)
     */
    @SuppressWarnings({ "rawtypes" })
    public final void updated(final String pid, final Dictionary config) throws ConfigurationException {
        LaunchConfiguration oldLaunchConfig = null;
        LaunchConfiguration newLaunchConfig = null;

        if (config != null) {
            newLaunchConfig = createLaunchConfiguration(config);
        }

View Full Code Here

TOP

Related Classes of org.apache.ace.processlauncher.LaunchConfiguration

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.