Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Tiede2012-02-08 14:08:32 +0000
committerMarkus Tiede2012-02-08 14:08:32 +0000
commit8cf24c6924ccb16ef9595b801d1af86ff675964c (patch)
tree508a522c3272e65d9a65b7c82b989684716ae4a2 /org.eclipse.jubula.app.autrun
parent2e16347ae12bd79b2ce885db000553f47b09abed (diff)
downloadorg.eclipse.jubula.core-8cf24c6924ccb16ef9595b801d1af86ff675964c.tar.gz
org.eclipse.jubula.core-8cf24c6924ccb16ef9595b801d1af86ff675964c.tar.xz
org.eclipse.jubula.core-8cf24c6924ccb16ef9595b801d1af86ff675964c.zip
Enhancement patch for 362875 reviewed and applied.
Diffstat (limited to 'org.eclipse.jubula.app.autrun')
-rw-r--r--org.eclipse.jubula.app.autrun/.checkstyle17
-rw-r--r--org.eclipse.jubula.app.autrun/src/org/eclipse/jubula/app/autrun/Activator.java7
-rw-r--r--org.eclipse.jubula.app.autrun/src/org/eclipse/jubula/app/autrun/AutRunApplication.java122
-rw-r--r--org.eclipse.jubula.app.autrun/src/org/eclipse/jubula/app/autrun/AutRunner.java16
-rw-r--r--org.eclipse.jubula.app.autrun/src/org/eclipse/jubula/app/autrun/i18n/Messages.java39
-rw-r--r--org.eclipse.jubula.app.autrun/src/org/eclipse/jubula/app/autrun/i18n/messages.properties21
6 files changed, 159 insertions, 63 deletions
diff --git a/org.eclipse.jubula.app.autrun/.checkstyle b/org.eclipse.jubula.app.autrun/.checkstyle
index 0afff8669..e0e718e07 100644
--- a/org.eclipse.jubula.app.autrun/.checkstyle
+++ b/org.eclipse.jubula.app.autrun/.checkstyle
@@ -1,7 +1,10 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
- <fileset name="all" enabled="true" check-config-name="Jubula" local="false">
- <file-match-pattern match-pattern="." include-pattern="true"/>
- </fileset>
-</fileset-config>
+<?xml version="1.0" encoding="UTF-8"?>
+
+<fileset-config file-format-version="1.2.0" simple-config="true">
+ <fileset name="all" enabled="true" check-config-name="Jubula" local="false">
+ <file-match-pattern match-pattern="." include-pattern="true"/>
+ </fileset>
+ <filter name="FilesFromPackage" enabled="true">
+ <filter-data value="src/org/eclipse/jubula/app/autrun/i18n"/>
+ </filter>
+</fileset-config>
diff --git a/org.eclipse.jubula.app.autrun/src/org/eclipse/jubula/app/autrun/Activator.java b/org.eclipse.jubula.app.autrun/src/org/eclipse/jubula/app/autrun/Activator.java
index 6535f08d5..dd54cefe5 100644
--- a/org.eclipse.jubula.app.autrun/src/org/eclipse/jubula/app/autrun/Activator.java
+++ b/org.eclipse.jubula.app.autrun/src/org/eclipse/jubula/app/autrun/Activator.java
@@ -26,7 +26,10 @@ import ch.qos.logback.core.joran.spi.JoranException;
* @created Sept 07, 2011
*/
public class Activator implements BundleActivator {
-
+ /**
+ * logback configuration file
+ */
+ private static final String LOGBACK_CONFIG_XML = "logback.xml"; //$NON-NLS-1$
/** the bundle context */
private static BundleContext context;
@@ -53,7 +56,7 @@ public class Activator implements BundleActivator {
// configuration
// rules
lc.reset();
- InputStream is = context.getBundle().getResource("logback.xml") //$NON-NLS-1$
+ InputStream is = context.getBundle().getResource(LOGBACK_CONFIG_XML)
.openStream();
configurator.doConfigure(is);
} catch (JoranException je) {
diff --git a/org.eclipse.jubula.app.autrun/src/org/eclipse/jubula/app/autrun/AutRunApplication.java b/org.eclipse.jubula.app.autrun/src/org/eclipse/jubula/app/autrun/AutRunApplication.java
index 99406c81c..6c9e53ccc 100644
--- a/org.eclipse.jubula.app.autrun/src/org/eclipse/jubula/app/autrun/AutRunApplication.java
+++ b/org.eclipse.jubula.app.autrun/src/org/eclipse/jubula/app/autrun/AutRunApplication.java
@@ -28,10 +28,11 @@ import org.apache.commons.cli.Parser;
import org.apache.commons.lang.ArrayUtils;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
+import org.eclipse.jubula.app.autrun.i18n.Messages;
import org.eclipse.jubula.tools.constants.AutConfigConstants;
import org.eclipse.jubula.tools.constants.StringConstants;
-import org.eclipse.jubula.tools.i18n.I18n;
import org.eclipse.jubula.tools.registration.AutIdentifier;
+import org.eclipse.osgi.util.NLS;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -128,6 +129,36 @@ public class AutRunApplication implements IApplication {
/** executable file used to start the AUT */
private static final String OPT_EXECUTABLE_LONG = "exec"; //$NON-NLS-1$
+
+ /** AUT agent hostname */
+ private static final String HOSTNAME = "hostname"; //$NON-NLS-1$
+
+ /** AUT agent port */
+ private static final String PORT = "port"; //$NON-NLS-1$
+
+ /** AUT id */
+ private static final String ID = "id"; //$NON-NLS-1$
+
+ /** technical components */
+ private static final String TRUE_FALSE = "true / false"; //$NON-NLS-1$
+
+ /** AUT keyboard layout */
+ private static final String LOCALE = "locale"; //$NON-NLS-1$
+
+ /** AUT working directory */
+ private static final String DIRECTORY = "directory"; //$NON-NLS-1$
+
+ /** AUT options */
+ private static final String COMMAND = "command"; //$NON-NLS-1$
+
+ /** swing class prefix */
+ private static final String SWING_AUT_TOOLKIT_CLASS_PREFIX = "Swing"; //$NON-NLS-1$
+
+ /** swt class prefix */
+ private static final String SWT_AUT_TOOLKIT_CLASS_PREFIX = "Swt"; //$NON-NLS-1$
+
+ /** rcp class prefix */
+ private static final String RCP_AUT_TOOLKIT_CLASS_PREFIX = "Rcp"; //$NON-NLS-1$
// - Command line options - End //
/**
@@ -195,75 +226,66 @@ public class AutRunApplication implements IApplication {
/**
* @return the command line options available when invoking the main method.
*/
- @SuppressWarnings("nls")
private static Options createCmdLineOptions() {
Options options = new Options();
- Option autAgentHostOption =
- new Option(OPT_AUT_AGENT_HOST, true,
- "AUT Agent Host"
- + " (default \"" + DEFAULT_AUT_AGENT_HOST + "\")");
+ Option autAgentHostOption = new Option(OPT_AUT_AGENT_HOST, true,
+ NLS.bind(Messages.infoAutAgentHost, DEFAULT_AUT_AGENT_HOST));
autAgentHostOption.setLongOpt(OPT_AUT_AGENT_HOST_LONG);
- autAgentHostOption.setArgName("hostname");
+ autAgentHostOption.setArgName(HOSTNAME);
options.addOption(autAgentHostOption);
- Option autAgentPortOption =
- new Option(OPT_AUT_AGENT_PORT, true,
- "AUT Agent Port between 1024 and 65536"
- + " (default \"" + DEFAULT_AUT_AGENT_PORT + "\")");
+ Option autAgentPortOption = new Option(OPT_AUT_AGENT_PORT, true,
+ NLS.bind(Messages.infoAutAgentPort, DEFAULT_AUT_AGENT_PORT));
autAgentPortOption.setLongOpt(OPT_AUT_AGENT_PORT_LONG);
- autAgentPortOption.setArgName("port");
+ autAgentPortOption.setArgName(PORT);
options.addOption(autAgentPortOption);
OptionGroup autToolkitOptionGroup = new OptionGroup();
- autToolkitOptionGroup.addOption(
- new Option(TK_SWING, "AUT uses Swing toolkit"));
- autToolkitOptionGroup.addOption(
- new Option(TK_SWT, "AUT uses SWT toolkit"));
- autToolkitOptionGroup.addOption(
- new Option(TK_RCP, "AUT uses RCP toolkit"));
+ autToolkitOptionGroup.addOption(new Option(TK_SWING,
+ Messages.infoSwingToolkit));
+ autToolkitOptionGroup.addOption(new Option(TK_SWT,
+ Messages.infoSwtToolkit));
+ autToolkitOptionGroup.addOption(new Option(TK_RCP,
+ Messages.infoRcpToolkit));
autToolkitOptionGroup.setRequired(true);
options.addOptionGroup(autToolkitOptionGroup);
-
- Option autIdOption =
- new Option(OPT_AUT_ID, true, "AUT ID");
+
+ Option autIdOption = new Option(OPT_AUT_ID, true, Messages.infoAutId);
autIdOption.setLongOpt(OPT_AUT_ID_LONG);
- autIdOption.setArgName("id");
+ autIdOption.setArgName(ID);
autIdOption.setRequired(true);
options.addOption(autIdOption);
-
- Option nameTechnicalComponentsOption =
- new Option(OPT_NAME_TECHNICAL_COMPONENTS,
- true, "Generate Names for Technical Components (true / false)");
+
+ Option nameTechnicalComponentsOption = new Option(
+ OPT_NAME_TECHNICAL_COMPONENTS, true,
+ Messages.infoGenerateTechnicalComponentNames);
nameTechnicalComponentsOption
- .setLongOpt(OPT_NAME_TECHNICAL_COMPONENTS_LONG);
- nameTechnicalComponentsOption.setArgName("true / false");
+ .setLongOpt(OPT_NAME_TECHNICAL_COMPONENTS_LONG);
+ nameTechnicalComponentsOption.setArgName(TRUE_FALSE);
options.addOption(nameTechnicalComponentsOption);
-
- Option keyboardLayoutOption =
- new Option(OPT_KEYBOARD_LAYOUT,
- true, "Keyboard Layout");
- keyboardLayoutOption
- .setLongOpt(OPT_KEYBOARD_LAYOUT_LONG);
- keyboardLayoutOption.setArgName("locale");
+
+ Option keyboardLayoutOption = new Option(OPT_KEYBOARD_LAYOUT, true,
+ Messages.infoKbLayout);
+ keyboardLayoutOption.setLongOpt(OPT_KEYBOARD_LAYOUT_LONG);
+ keyboardLayoutOption.setArgName(LOCALE);
options.addOption(keyboardLayoutOption);
-
- Option workingDirOption = new Option(OPT_WORKING_DIR,
- true, "AUT Working Directory");
+
+ Option workingDirOption = new Option(OPT_WORKING_DIR, true,
+ Messages.infoAutWorkingDirectory);
workingDirOption.setLongOpt(OPT_WORKING_DIR_LONG);
- workingDirOption.setArgName("directory");
+ workingDirOption.setArgName(DIRECTORY);
options.addOption(workingDirOption);
-
- Option helpOption = new Option(OPT_HELP,
- false, "Displays this help");
+
+ Option helpOption = new Option(OPT_HELP, false, Messages.infoHelp);
helpOption.setLongOpt(OPT_HELP_LONG);
options.addOption(helpOption);
OptionBuilder.hasArgs();
Option autExecutableFileOption = OptionBuilder.create(OPT_EXECUTABLE);
- autExecutableFileOption.setDescription("AUT Executable File");
+ autExecutableFileOption.setDescription(Messages.infoExecutableFile);
autExecutableFileOption.setLongOpt(OPT_EXECUTABLE_LONG);
autExecutableFileOption.setRequired(true);
- autExecutableFileOption.setArgName("command");
+ autExecutableFileOption.setArgName(COMMAND);
options.addOption(autExecutableFileOption);
return options;
@@ -312,13 +334,13 @@ public class AutRunApplication implements IApplication {
if (cmdLine != null && !cmdLine.hasOption(OPT_HELP)) {
String toolkit = StringConstants.EMPTY;
if (cmdLine.hasOption(TK_SWING)) {
- toolkit = "Swing"; //$NON-NLS-1$
+ toolkit = SWING_AUT_TOOLKIT_CLASS_PREFIX;
} else if (cmdLine.hasOption(TK_SWT)) {
- toolkit = "Swt"; //$NON-NLS-1$
+ toolkit = SWT_AUT_TOOLKIT_CLASS_PREFIX;
} else if (cmdLine.hasOption(TK_RCP)) {
- toolkit = "Rcp"; //$NON-NLS-1$
+ toolkit = RCP_AUT_TOOLKIT_CLASS_PREFIX;
}
-
+
int autAgentPort = DEFAULT_AUT_AGENT_PORT;
if (cmdLine.hasOption(OPT_AUT_AGENT_PORT)) {
try {
@@ -345,8 +367,8 @@ public class AutRunApplication implements IApplication {
try {
runner.run();
} catch (ConnectException ce) {
- LOG.info("Could not connect to AUT Agent.", ce); //$NON-NLS-1$
- System.err.println(I18n.getString("InfoDetail.connGuiDancerServerFailed")); //$NON-NLS-1$
+ LOG.info(Messages.infoConnectionToAutAgentFailed, ce);
+ System.err.println(Messages.infoNonAutAgentConnectionInfo);
}
} else {
printHelp(null);
diff --git a/org.eclipse.jubula.app.autrun/src/org/eclipse/jubula/app/autrun/AutRunner.java b/org.eclipse.jubula.app.autrun/src/org/eclipse/jubula/app/autrun/AutRunner.java
index fbce6beda..37ddc8a8c 100644
--- a/org.eclipse.jubula.app.autrun/src/org/eclipse/jubula/app/autrun/AutRunner.java
+++ b/org.eclipse.jubula.app.autrun/src/org/eclipse/jubula/app/autrun/AutRunner.java
@@ -20,6 +20,7 @@ import java.net.Socket;
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.jubula.app.autrun.i18n.Messages;
import org.eclipse.jubula.autagent.commands.IStartAut;
import org.eclipse.jubula.communication.connection.ConnectionState;
import org.eclipse.jubula.communication.connection.RestartAutProtocol;
@@ -35,6 +36,12 @@ import org.slf4j.LoggerFactory;
*/
public class AutRunner {
+ /** response OK when thread was started */
+ private static final String RESPONSE_OK = "Response.OK"; //$NON-NLS-1$
+
+ /** the thread name */
+ private static final String AGENT_CONNECTION_THREAD_NAME = "AUT Agent Connection"; //$NON-NLS-1$
+
/** the logger */
private static final Logger LOG =
LoggerFactory.getLogger(AutRunner.class);
@@ -106,7 +113,8 @@ public class AutRunner {
writer.println(
m_autConfiguration.get(AutConfigConstants.AUT_NAME));
- Thread agentConnectionThread = new Thread("AUT Agent Connection") { //$NON-NLS-1$
+ Thread agentConnectionThread = new Thread
+ (AGENT_CONNECTION_THREAD_NAME) {
public void run() {
try {
String line = reader.readLine();
@@ -118,7 +126,7 @@ public class AutRunner {
// the JVM won't shut down during AUT restart
Thread restartThread = new Thread() {
public void run() {
- writer.println("Response.OK"); //$NON-NLS-1$
+ writer.println(RESPONSE_OK);
try {
String restartReq = reader.readLine();
@@ -128,7 +136,7 @@ public class AutRunner {
AutRunner.this.run();
}
} catch (IOException e) {
- LOG.error("Error occured while restarting AUT.", e); //$NON-NLS-1$
+ LOG.error(Messages.restartAutFailed, e);
} finally {
try {
agentSocket.close();
@@ -144,7 +152,7 @@ public class AutRunner {
}
}
} catch (IOException e) {
- LOG.error("Error occured while restarting AUT.", e); //$NON-NLS-1$
+ LOG.error(Messages.restartAutFailed, e);
}
}
};
diff --git a/org.eclipse.jubula.app.autrun/src/org/eclipse/jubula/app/autrun/i18n/Messages.java b/org.eclipse.jubula.app.autrun/src/org/eclipse/jubula/app/autrun/i18n/Messages.java
new file mode 100644
index 000000000..31b60eb6d
--- /dev/null
+++ b/org.eclipse.jubula.app.autrun/src/org/eclipse/jubula/app/autrun/i18n/Messages.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2012 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.jubula.app.autrun.i18n;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.jubula.app.autrun.i18n.messages"; //$NON-NLS-1$
+
+ public static String infoAutAgentHost;
+ public static String infoAutAgentPort;
+ public static String infoSwingToolkit;
+ public static String infoSwtToolkit;
+ public static String infoRcpToolkit;
+ public static String infoAutId;
+ public static String infoGenerateTechnicalComponentNames;
+ public static String infoKbLayout;
+ public static String infoAutWorkingDirectory;
+ public static String infoHelp;
+ public static String infoExecutableFile;
+ public static String infoConnectionToAutAgentFailed;
+ public static String infoNonAutAgentConnectionInfo;
+ public static String restartAutFailed;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+ /** Constructor */
+ private Messages () {
+ }
+}
diff --git a/org.eclipse.jubula.app.autrun/src/org/eclipse/jubula/app/autrun/i18n/messages.properties b/org.eclipse.jubula.app.autrun/src/org/eclipse/jubula/app/autrun/i18n/messages.properties
new file mode 100644
index 000000000..593d12e4e
--- /dev/null
+++ b/org.eclipse.jubula.app.autrun/src/org/eclipse/jubula/app/autrun/i18n/messages.properties
@@ -0,0 +1,21 @@
+###############################################################################
+# Copyright (c) 2004, 2012 BREDEX GmbH.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+infoAutAgentHost = AUT Agent Host (default "{0}")
+infoAutAgentPort = AUT Agent Port between 1024 and 65536 (default "{0}")
+infoSwingToolkit = AUT uses Swing toolkit
+infoSwtToolkit = AUT uses SWT toolkit
+infoRcpToolkit = AUT uses RCP toolkit
+infoAutId = AUT ID
+infoGenerateTechnicalComponentNames = Generate Names for Technical Components (true / false)
+infoKbLayout = Keyboard Layout
+infoAutWorkingDirectory = AUT Working Directory
+infoHelp = Displays this help
+infoExecutableFile = AUT Executable File
+infoConnectionToAutAgentFailed = Could not connect to AUT Agent.
+infoNonAutAgentConnectionInfo = The connection to the AUT Agent could not be made. \n\nPlease check that you have started the AUT Agent, and \nthat your connection settings (hostname, port number) are correct.
+restartAutFailed = Error occured while restarting AUT.

Back to the top