* Option for select device
* </p>
*/
- protected static final String OPT_DEVICE = "select device";
+ protected static final String OPT_DEVICE = "device";
/**
* <p>
* Option for target widget file
* </p>
*/
- protected static final String OPT_WIDGETFILE = "target widget file";
+ protected static final String OPT_WIDGETFILE = "widget";
/**
* <p>
* Option for target widget id
* </p>
*/
- protected static final String OPT_WIDGETID = "target widget id";
+ protected static final String OPT_WIDGETID = "id";
/**
* <p>
* Option for target widget file
* </p>
*/
- protected static final String OPT_WIDGETFILE = "target widget file";
+ protected static final String OPT_WIDGETFILE = "widget";
/**
* <p>
* Option for target widget file
* </p>
*/
- protected static final String OPT_WIDGETFILE = "target widget file";
+ protected static final String OPT_WIDGETFILE = "widget";
/**
* <p>
* Option for target widget id
* </p>
*/
- protected static final String OPT_WIDGETID = "target widget id";
+ protected static final String OPT_WIDGETID = "id";
/**
* <p>
* Option for target widget id
* </p>
*/
- protected static final String OPT_WIDGETID = "target widget id";
+ protected static final String OPT_WIDGETID = "id";
/**
* <p>
--- /dev/null
+/*
+* Web IDE - Command Line Interface
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* GyeongSeok Seo <gyeongseok.seo@samsung.com>
+* BonYong Lee <bonyong.lee@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.cli.exec;
+
+import static org.junit.Assert.*;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.PosixParser;
+import org.apache.commons.cli.UnrecognizedOptionException;
+import org.junit.Test;
+import org.tizen.common.core.command.Executor;
+
+/**
+ * WRTLauncherTest
+ *
+ * Test case for {@link WRTLauncher}
+ *
+ * @author GyeongSeok Seo{@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ *
+ * @see WRTLauncher
+ */
+public class
+WRTLauncherTest
+extends AbstractMainTest
+{
+ /**
+ * Test {@link WRTLauncher#getOptions()}
+ *
+ * @throws Exception in case of failure in test
+ *
+ * @see WRTLauncher#getOptions()
+ */
+ @Test
+ public void
+ test_getOptions()
+ throws Exception
+ {
+ WRTLauncher testClass = new WRTLauncher();
+ final Options opts = testClass.getOptions();
+ final PosixParser parser = new PosixParser();
+
+ parser.parse( opts, new String[] {
+ "-help", "-quiet", "-device", "deviceName"
+ } );
+
+ parser.parse( opts, new String[] {
+ "--help", "--quiet", "--device", "deviceName"
+ } );
+
+ parser.parse( opts, new String[] {
+ "-h", "-q", "-d", "deviceName"
+ } );
+
+ try {
+ parser.parse( opts, new String[] {
+ "-verbose", "-quiet"
+ } );
+ fail();
+ } catch ( final UnrecognizedOptionException e ) {
+ }
+
+ {
+ final CommandLine cmd = parser.parse( opts, new String[] { "--log=trace", "--device", "TestDevice" } );
+ final String[] args = cmd.getOptionValues( WRTLauncher.OPT_DEVICE );
+ assertEquals( 1, args.length );
+ assertEquals( "TestDevice", args[0] );
+ final String[] shortArgs = cmd.getOptionValues( "d" );
+ assertEquals( 1, shortArgs.length );
+ assertEquals( "TestDevice", shortArgs[0] );
+ }
+
+ {
+ final CommandLine cmd = parser.parse( opts, new String[] { "--log=debug", "-d", "TestDevice" } );
+ final String[] args = cmd.getOptionValues( WRTLauncher.OPT_DEVICE );
+ assertNotNull( args );
+ }
+ }
+
+ /**
+ * Test {@link WRTLauncher#run(String...)}
+ *
+ * @throws Exception in case of failure in test
+ *
+ * @see WRTLauncher#run(String...)
+ */
+ @Test
+ public
+ void
+ test_run()
+ throws Exception
+ {
+ final AtomicBoolean result = new AtomicBoolean( false );
+
+ final WRTLauncher testClass = new WRTLauncher()
+ {
+ protected Executor getExecutor() {
+ return WRTLauncherTest.this.executor;
+ }
+
+ protected void execute( final CommandLine cmdLine ) throws Exception {
+ result.set( true );
+ }
+ };
+
+ testClass.run( "-d", "TestDevice" );
+ assertTrue( result.get() );
+ }
+}
--- /dev/null
+/*
+* Web IDE - Command Line Interface
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* GyeongSeok Seo <gyeongseok.seo@samsung.com>
+* BonYong Lee <bonyong.lee@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.cli.exec.debug;
+
+import static org.junit.Assert.*;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.PosixParser;
+import org.apache.commons.cli.UnrecognizedOptionException;
+import org.junit.Test;
+import org.tizen.cli.exec.AbstractMainTest;
+import org.tizen.common.core.command.Executor;
+
+/**
+ * MainTest
+ *
+ * Test case for {@link Main}
+ *
+ * @author GyeongSeok Seo{@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ *
+ * @see Main
+ */
+public class
+MainTest
+extends AbstractMainTest
+{
+ /**
+ * Test {@link Main#getOptions()}
+ *
+ * @throws Exception in case of failure in test
+ *
+ * @see Main#getOptions()
+ */
+ @Test
+ public void
+ test_getOptions()
+ throws Exception
+ {
+ Main testClass = new Main();
+ final Options opts = testClass.getOptions();
+ final PosixParser parser = new PosixParser();
+
+ parser.parse( opts, new String[] {
+ "-help", "-quiet", "-device", "deviceName", "-widget", "test.wgt", "-id", "http://test.com"
+ } );
+
+ parser.parse( opts, new String[] {
+ "--help", "--quiet", "--device", "deviceName", "--widget", "test.wgt", "--id", "http://test.com"
+ } );
+
+ parser.parse( opts, new String[] {
+ "-h", "-q", "-d", "deviceName", "-w", "test.wgt", "-i", "http://test.com"
+ } );
+
+ try {
+ parser.parse( opts, new String[] {
+ "-verbose", "-quiet"
+ } );
+ fail();
+ } catch ( final UnrecognizedOptionException e ) {
+ }
+
+ {
+ final CommandLine cmd = parser.parse( opts, new String[] {
+ "--log=trace", "--device", "TestDevice", "--id", "http://test.com", "--widget", "test.wgt"
+ } );
+ final String[] args1 = cmd.getOptionValues( Main.OPT_WIDGETID );
+ assertEquals( 1, args1.length );
+ assertEquals( "http://test.com", args1[0] );
+ final String[] shortArgs1 = cmd.getOptionValues( "i" );
+ assertEquals( 1, shortArgs1.length );
+ assertEquals( "http://test.com", shortArgs1[0] );
+
+ final String[] args2 = cmd.getOptionValues( Main.OPT_WIDGETFILE );
+ assertEquals( 1, args2.length );
+ assertEquals( "test.wgt", args2[0] );
+ final String[] shortArgs2 = cmd.getOptionValues( "w" );
+ assertEquals( 1, shortArgs2.length );
+ assertEquals( "test.wgt", shortArgs2[0] );
+ }
+
+ {
+ final CommandLine cmd = parser.parse( opts, new String[] {
+ "--log=debug", "-i", "http://test.com", "-w", "test.wgt"
+ } );
+ final String[] args1 = cmd.getOptionValues( Main.OPT_WIDGETID );
+ assertNotNull( args1 );
+ final String[] args2 = cmd.getOptionValues( Main.OPT_WIDGETFILE );
+ assertNotNull( args2 );
+ }
+ }
+
+ /**
+ * Test {@link Main#run(String...)}
+ *
+ * @throws Exception in case of failure in test
+ *
+ * @see Main#run(String...)
+ */
+ @Test
+ public
+ void
+ test_run()
+ throws Exception
+ {
+ final AtomicBoolean result = new AtomicBoolean( false );
+
+ final Main testClass = new Main()
+ {
+ protected Executor getExecutor() {
+ return MainTest.this.executor;
+ }
+
+ protected void execute( final CommandLine cmdLine ) throws Exception {
+ result.set( true );
+ }
+ };
+
+ testClass.run( "-d", "TestDevice", "-i", "http://test.com", "-w", "test.wgt" );
+ assertTrue( result.get() );
+ }
+}
--- /dev/null
+/*
+* Web IDE - Command Line Interface
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* GyeongSeok Seo <gyeongseok.seo@samsung.com>
+* BonYong Lee <bonyong.lee@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.cli.exec.install;
+
+import static org.junit.Assert.*;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.PosixParser;
+import org.apache.commons.cli.UnrecognizedOptionException;
+import org.junit.Test;
+import org.tizen.cli.exec.AbstractMainTest;
+import org.tizen.common.core.command.Executor;
+
+/**
+ * MainTest
+ *
+ * Test case for {@link Main}
+ *
+ * @author GyeongSeok Seo{@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ *
+ * @see Main
+ */
+public class
+MainTest
+extends AbstractMainTest
+{
+ /**
+ * Test {@link Main#getOptions()}
+ *
+ * @throws Exception in case of failure in test
+ *
+ * @see Main#getOptions()
+ */
+ @Test
+ public void
+ test_getOptions()
+ throws Exception
+ {
+ Main testClass = new Main();
+ final Options opts = testClass.getOptions();
+ final PosixParser parser = new PosixParser();
+
+ parser.parse( opts, new String[] {
+ "-help", "-quiet", "-device", "deviceName", "-widget", "test.wgt"
+ } );
+
+ parser.parse( opts, new String[] {
+ "--help", "--quiet", "--device", "deviceName", "--widget", "test.wgt"
+ } );
+
+ parser.parse( opts, new String[] {
+ "-h", "-q", "-d", "deviceName", "-w", "test.wgt"
+ } );
+
+ try {
+ parser.parse( opts, new String[] {
+ "-verbose", "-quiet"
+ } );
+ fail();
+ } catch ( final UnrecognizedOptionException e ) {
+ }
+
+ {
+ final CommandLine cmd = parser.parse( opts, new String[] { "--log=trace", "--device", "TestDevice", "--widget", "test.wgt" } );
+ final String[] args = cmd.getOptionValues( Main.OPT_WIDGETFILE );
+ assertEquals( 1, args.length );
+ assertEquals( "test.wgt", args[0] );
+ final String[] shortArgs = cmd.getOptionValues( "w" );
+ assertEquals( 1, shortArgs.length );
+ assertEquals( "test.wgt", shortArgs[0] );
+ }
+
+ {
+ final CommandLine cmd = parser.parse( opts, new String[] { "--log=debug", "-w", "test.wgt" } );
+ final String[] args = cmd.getOptionValues( Main.OPT_WIDGETFILE );
+ assertNotNull( args );
+ }
+ }
+
+ /**
+ * Test {@link Main#run(String...)}
+ *
+ * @throws Exception in case of failure in test
+ *
+ * @see Main#run(String...)
+ */
+ @Test
+ public
+ void
+ test_run()
+ throws Exception
+ {
+ final AtomicBoolean result = new AtomicBoolean( false );
+
+ final Main testClass = new Main()
+ {
+ protected Executor getExecutor() {
+ return MainTest.this.executor;
+ }
+
+ protected void execute( final CommandLine cmdLine ) throws Exception {
+ result.set( true );
+ }
+ };
+
+ testClass.run( "-d", "TestDevice", "-w", "test.wgt" );
+ assertTrue( result.get() );
+ }
+}
--- /dev/null
+/*
+* Web IDE - Command Line Interface
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* GyeongSeok Seo <gyeongseok.seo@samsung.com>
+* BonYong Lee <bonyong.lee@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.cli.exec.query;
+
+import static org.junit.Assert.*;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.commons.cli.CommandLine;
+import org.junit.Test;
+import org.tizen.cli.exec.AbstractMainTest;
+import org.tizen.common.core.command.Executor;
+
+/**
+ * MainTest
+ *
+ * Test case for {@link Main}
+ *
+ * @author GyeongSeok Seo{@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ *
+ * @see Main
+ */
+public class
+MainTest
+extends AbstractMainTest
+{
+ /**
+ * Test {@link Main#run(String...)}
+ *
+ * @throws Exception in case of failure in test
+ *
+ * @see Main#run(String...)
+ */
+ @Test
+ public
+ void
+ test_run()
+ throws Exception
+ {
+ final AtomicBoolean result = new AtomicBoolean( false );
+
+ final Main testClass = new Main()
+ {
+ protected Executor getExecutor() {
+ return MainTest.this.executor;
+ }
+
+ protected void execute( final CommandLine cmdLine ) throws Exception {
+ result.set( true );
+ }
+ };
+
+ testClass.run( "-d", "TestDevice" );
+ assertTrue( result.get() );
+ }
+}
--- /dev/null
+/*
+* Web IDE - Command Line Interface
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* GyeongSeok Seo <gyeongseok.seo@samsung.com>
+* BonYong Lee <bonyong.lee@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.cli.exec.run;
+
+import static org.junit.Assert.*;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.PosixParser;
+import org.apache.commons.cli.UnrecognizedOptionException;
+import org.junit.Test;
+import org.tizen.cli.exec.AbstractMainTest;
+import org.tizen.common.core.command.Executor;
+
+/**
+ * MainTest
+ *
+ * Test case for {@link Main}
+ *
+ * @author GyeongSeok Seo{@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ *
+ * @see Main
+ */
+public class
+MainTest
+extends AbstractMainTest
+{
+ /**
+ * Test {@link Main#getOptions()}
+ *
+ * @throws Exception in case of failure in test
+ *
+ * @see Main#getOptions()
+ */
+ @Test
+ public void
+ test_getOptions()
+ throws Exception
+ {
+ Main testClass = new Main();
+ final Options opts = testClass.getOptions();
+ final PosixParser parser = new PosixParser();
+
+ parser.parse( opts, new String[] {
+ "-help", "-quiet", "-device", "deviceName", "-widget", "test.wgt", "-id", "http://test.com"
+ } );
+
+ parser.parse( opts, new String[] {
+ "--help", "--quiet", "--device", "deviceName", "--widget", "test.wgt", "--id", "http://test.com"
+ } );
+
+ parser.parse( opts, new String[] {
+ "-h", "-q", "-d", "deviceName", "-w", "test.wgt", "-i", "http://test.com"
+ } );
+
+ try {
+ parser.parse( opts, new String[] {
+ "-verbose", "-quiet"
+ } );
+ fail();
+ } catch ( final UnrecognizedOptionException e ) {
+ }
+
+ {
+ final CommandLine cmd = parser.parse( opts, new String[] {
+ "--log=trace", "--device", "TestDevice", "--id", "http://test.com", "--widget", "test.wgt"
+ } );
+ final String[] args1 = cmd.getOptionValues( Main.OPT_WIDGETID );
+ assertEquals( 1, args1.length );
+ assertEquals( "http://test.com", args1[0] );
+ final String[] shortArgs1 = cmd.getOptionValues( "i" );
+ assertEquals( 1, shortArgs1.length );
+ assertEquals( "http://test.com", shortArgs1[0] );
+
+ final String[] args2 = cmd.getOptionValues( Main.OPT_WIDGETFILE );
+ assertEquals( 1, args2.length );
+ assertEquals( "test.wgt", args2[0] );
+ final String[] shortArgs2 = cmd.getOptionValues( "w" );
+ assertEquals( 1, shortArgs2.length );
+ assertEquals( "test.wgt", shortArgs2[0] );
+ }
+
+ {
+ final CommandLine cmd = parser.parse( opts, new String[] {
+ "--log=debug", "-i", "http://test.com", "-w", "test.wgt"
+ } );
+ final String[] args1 = cmd.getOptionValues( Main.OPT_WIDGETID );
+ assertNotNull( args1 );
+ final String[] args2 = cmd.getOptionValues( Main.OPT_WIDGETFILE );
+ assertNotNull( args2 );
+ }
+ }
+
+ /**
+ * Test {@link Main#run(String...)}
+ *
+ * @throws Exception in case of failure in test
+ *
+ * @see Main#run(String...)
+ */
+ @Test
+ public
+ void
+ test_run()
+ throws Exception
+ {
+ final AtomicBoolean result = new AtomicBoolean( false );
+
+ final Main testClass = new Main()
+ {
+ protected Executor getExecutor() {
+ return MainTest.this.executor;
+ }
+
+ protected void execute( final CommandLine cmdLine ) throws Exception {
+ result.set( true );
+ }
+ };
+
+ testClass.run( "-d", "TestDevice", "-i", "http://test.com", "-w", "test.wgt" );
+ assertTrue( result.get() );
+ }
+}
--- /dev/null
+/*
+* Web IDE - Command Line Interface
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* GyeongSeok Seo <gyeongseok.seo@samsung.com>
+* BonYong Lee <bonyong.lee@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.cli.exec.uninstall;
+
+import static org.junit.Assert.*;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.PosixParser;
+import org.apache.commons.cli.UnrecognizedOptionException;
+import org.junit.Test;
+import org.tizen.cli.exec.AbstractMainTest;
+import org.tizen.common.core.command.Executor;
+
+/**
+ * MainTest
+ *
+ * Test case for {@link Main}
+ *
+ * @author GyeongSeok Seo{@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ *
+ * @see Main
+ */
+public class
+MainTest
+extends AbstractMainTest
+{
+ /**
+ * Test {@link Main#getOptions()}
+ *
+ * @throws Exception in case of failure in test
+ *
+ * @see Main#getOptions()
+ */
+ @Test
+ public void
+ test_getOptions()
+ throws Exception
+ {
+ Main testClass = new Main();
+ final Options opts = testClass.getOptions();
+ final PosixParser parser = new PosixParser();
+
+ parser.parse( opts, new String[] {
+ "-help", "-quiet", "-device", "deviceName", "-id", "http://test.com"
+ } );
+
+ parser.parse( opts, new String[] {
+ "--help", "--quiet", "--device", "deviceName", "--id", "http://test.com"
+ } );
+
+ parser.parse( opts, new String[] {
+ "-h", "-q", "-d", "deviceName", "-i", "http://test.com"
+ } );
+
+ try {
+ parser.parse( opts, new String[] {
+ "-verbose", "-quiet"
+ } );
+ fail();
+ } catch ( final UnrecognizedOptionException e ) {
+ }
+
+ {
+ final CommandLine cmd = parser.parse( opts, new String[] { "--log=trace", "--device", "TestDevice", "--id", "http://test.com" } );
+ final String[] args = cmd.getOptionValues( Main.OPT_WIDGETID );
+ assertEquals( 1, args.length );
+ assertEquals( "http://test.com", args[0] );
+ final String[] shortArgs = cmd.getOptionValues( "i" );
+ assertEquals( 1, shortArgs.length );
+ assertEquals( "http://test.com", shortArgs[0] );
+ }
+
+ {
+ final CommandLine cmd = parser.parse( opts, new String[] { "--log=debug", "-i", "http://test.com" } );
+ final String[] args = cmd.getOptionValues( Main.OPT_WIDGETID );
+ assertNotNull( args );
+ }
+ }
+
+ /**
+ * Test {@link Main#run(String...)}
+ *
+ * @throws Exception in case of failure in test
+ *
+ * @see Main#run(String...)
+ */
+ @Test
+ public
+ void
+ test_run()
+ throws Exception
+ {
+ final AtomicBoolean result = new AtomicBoolean( false );
+
+ final Main testClass = new Main()
+ {
+ protected Executor getExecutor() {
+ return MainTest.this.executor;
+ }
+
+ protected void execute( final CommandLine cmdLine ) throws Exception {
+ result.set( true );
+ }
+ };
+
+ testClass.run( "-d", "TestDevice", "-i", "http://test.com" );
+ assertTrue( result.get() );
+ }
+}