diff options
author | Noel Grandin <noel@peralex.com> | 2016-01-12 15:27:41 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-03-14 13:44:39 +0200 |
commit | b9d63d49be66ed1bfc4a76924f1c52ec3630adc8 (patch) | |
tree | 3c1f0cb02452d23bed03cbbc908e580b285da55a /qadevOOo/runner | |
parent | 8353667d35bc511378c9b14261b6bb11b7bd56aa (diff) |
remove some unused Java code
found by UCDetector
Change-Id: Ic0295a24b26e206eb53eda2da540755477df86df
Diffstat (limited to 'qadevOOo/runner')
-rw-r--r-- | qadevOOo/runner/helper/BuildEnvTools.java | 182 | ||||
-rw-r--r-- | qadevOOo/runner/helper/ComplexDescGetter.java | 2 | ||||
-rw-r--r-- | qadevOOo/runner/helper/ParameterNotFoundException.java | 30 | ||||
-rw-r--r-- | qadevOOo/runner/helper/ProcessHandler.java | 79 | ||||
-rw-r--r-- | qadevOOo/runner/helper/WindowListener.java | 55 | ||||
-rw-r--r-- | qadevOOo/runner/lib/MultiPropertyTest.java | 4 | ||||
-rw-r--r-- | qadevOOo/runner/util/PropertyName.java | 18 |
7 files changed, 2 insertions, 368 deletions
diff --git a/qadevOOo/runner/helper/BuildEnvTools.java b/qadevOOo/runner/helper/BuildEnvTools.java deleted file mode 100644 index 60d328494f3e..000000000000 --- a/qadevOOo/runner/helper/BuildEnvTools.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you 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 . - */ -package helper; - -import java.io.File; -import java.io.PrintWriter; -import lib.TestParameters; -import share.LogWriter; -import util.*; - -/** - * This class support you to execute some shell commands in a build environment. At every call of commands - * a build environment was created and the commands will be executed. - * - */ -public class BuildEnvTools { - - private final TestParameters param; - private final LogWriter log; - private final boolean mDebug; - private final String mPlatform; - private final String mShell; - private final boolean mCygwin; - - /** - * This constructor creates an instance of BuildEncTools. It is verifying for all neccesarry - * parameters in <CODE>TestParameters</CODE> This must be: - * <ul> - * <li>OperatingSystem: Fill this parameter with an operating system like unxsols, unxsoli, unxlngi or wntmsci. - * </li> - * <li> Shell: Fill this parameter with a shell f.e '/bin/tcsh' - * or 'c:\\myShell\\myShell.exe' - * </li> - */ - public BuildEnvTools(TestParameters param, LogWriter log) throws ParameterNotFoundException { - this.param = param; - this.log = log; - mDebug = param.getBool(PropertyName.DEBUG_IS_ACTIVE); - - boolean error = false; - - String msg = "\nERROR: the following parameter must be set before executing the test:\n\n"; - - mPlatform = (String) param.get(PropertyName.OPERATING_SYSTEM); - if (mDebug) { - log.println("### " + mPlatform); - } - if (mPlatform == null){ - msg += PropertyName.OPERATING_SYSTEM + "\nFill this parameter with an operating system like unxsols," + - " unxsoli, unxlngi, unxmacxi or wntmsci. \n\n"; - } - if (mPlatform != null && - (!mPlatform.equalsIgnoreCase(PropertyName.UNXSOLS)) && - (!mPlatform.equalsIgnoreCase(PropertyName.UNXSOLI)) && - (!mPlatform.equalsIgnoreCase(PropertyName.UNXLNGI)) && - (!mPlatform.equalsIgnoreCase(PropertyName.UNXMACXI))&& - (!mPlatform.equalsIgnoreCase(PropertyName.WNTMSCI)) ){ - - msg += PropertyName.OPERATING_SYSTEM + ":" + mPlatform + "\nFill this parameter with an operating system like unxsols," + - " unxsoli, unxlngi, unxmacxi or wntmsci. \n\n"; - error = true; - } - - mShell = (String) param.get(PropertyName.SHELL); - if (mShell == null) { - msg += PropertyName.SHELL + "\nFill this parameter with a shell" + - "\n\t/bin/tcsh c:\\myShell\\myShell.exe\n\n"; - error = true; - } - - mCygwin = param.getBool(PropertyName.CYGWIN); - - if (error) { - throw new ParameterNotFoundException(msg); - } - } - - /** - * Executes the given commands in OOo-Environment shell. - * @return the processHandler of the commands - * @see helper.ProcessHandler - */ - public ProcessHandler runCommandsInEnvironmentShell(String[] commands, File workDir, int shortWait) { - - final String[] cmdLines = getCmdLinesWithCommand(commands); - final ProcessHandler pHdl = new ProcessHandler(cmdLines, (PrintWriter) log, workDir, shortWait, param); - pHdl.runCommand(); - return pHdl; - } - - public String getSrcRoot() { - - String sSrcRoot = (String) param.get(PropertyName.SRC_ROOT); - - if (sSrcRoot == null) { - String[] cmdLines = null; - if (mPlatform.equals(PropertyName.WNTMSCI) && ! mCygwin) { - cmdLines = new String[]{mShell, "/C", "echo SRC_ROOT=%SRC_ROOT"}; - } else { - cmdLines = new String[]{mShell, "--login ", "-c ", "echo \"SRC_ROOT=$SRC_ROOT\""}; - } - - final ProcessHandler procHdl = new ProcessHandler(cmdLines, (PrintWriter) log, null, 5000, param); - procHdl.runCommand(); - - if (mDebug) { - log.println("---> Output of command:"); - log.println(procHdl.getOutputText()); - log.println("<--- Output of command:"); - log.println("---> Error output of command"); - log.println(procHdl.getErrorText()); - log.println("<--- Error output of command"); - } - final String output = procHdl.getOutputText(); - final String[] outs = output.split("\n"); - - for (int i = 0; i < outs.length; i++) { - final String line = outs[i]; - if (line.startsWith("SRC_ROOT")) { - sSrcRoot = getEnvValue(line); - } - } - } - return sSrcRoot; - } - - private String[] getCmdLinesWithCommand(String[] commands) { - String[] cmdLines = null; - log.println("prepare command for platform " + mPlatform); - - String separator = ""; - if (mPlatform.equals(PropertyName.WNTMSCI)) { - separator = mCygwin ? ";" : "^"; - } else { - separator = ";"; - } - - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < commands.length; i++) { - if (i != 0) { - sb.append(separator); - } - sb.append(commands[i]); - } - - String command = sb.toString(); - - if (mPlatform.equals(PropertyName.WNTMSCI)){ - if (mCygwin){ - String srcRoot = (String) param.get(PropertyName.SRC_ROOT); - String envSet = "export cyg_src_root=`cygpath '" + srcRoot.replaceAll("\\\\", "\\\\\\\\")+ "'`; source $cyg_src_root/winenv.set.sh;"; - command = envSet + command; - cmdLines = new String[]{mShell, "--login", "-c", "\"" + command + "\""}; - } else { - cmdLines = new String[]{mShell, "/C", "\"" + command + "\""}; - } - } else { - cmdLines = new String[]{mShell, "-c", command}; - } - return cmdLines; - } - - private String getEnvValue(String line) { - final String[] split = line.split("="); - return split[1]; - } -} diff --git a/qadevOOo/runner/helper/ComplexDescGetter.java b/qadevOOo/runner/helper/ComplexDescGetter.java index 7a207a6c8980..444ff181bbbf 100644 --- a/qadevOOo/runner/helper/ComplexDescGetter.java +++ b/qadevOOo/runner/helper/ComplexDescGetter.java @@ -147,7 +147,7 @@ public class ComplexDescGetter extends DescGetter * @param testMethodNames list of all methods to test * @return filled description entry */ - public DescEntry createTestDesc(String testObjectName, String className, String[] testMethodNames, LogWriter log) + private DescEntry createTestDesc(String testObjectName, String className, String[] testMethodNames, LogWriter log) { DescEntry dEntry = new DescEntry(); diff --git a/qadevOOo/runner/helper/ParameterNotFoundException.java b/qadevOOo/runner/helper/ParameterNotFoundException.java deleted file mode 100644 index bb856a748f01..000000000000 --- a/qadevOOo/runner/helper/ParameterNotFoundException.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you 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 . - */ - -package helper; - -/** - * This exception is thrown when a parameter could not be found. - * - */ -public class ParameterNotFoundException extends Exception { - public ParameterNotFoundException(String message){ - super (message); - } - -} diff --git a/qadevOOo/runner/helper/ProcessHandler.java b/qadevOOo/runner/helper/ProcessHandler.java index 60b31b09b34e..cd4902158205 100644 --- a/qadevOOo/runner/helper/ProcessHandler.java +++ b/qadevOOo/runner/helper/ProcessHandler.java @@ -120,10 +120,8 @@ public class ProcessHandler private boolean isStarted = false; private long mTimeOut = 0; private Pump stdout = null; - private Pump stderr = null; private PrintStream stdIn = null; private Process m_aProcess = null; - private TestParameters param = null; private boolean debug = false; private boolean bUseOutput = true; @@ -212,7 +210,6 @@ public class ProcessHandler { this(null, log, workDir, null, 0); this.cmdLineArray = commands; - this.param = param; if (shortWait != 0) { this.mTimeOut = shortWait; @@ -226,62 +223,6 @@ public class ProcessHandler } /** - * This method do an asynchronous execution of the commands. To avoid a interruption on long running processes - * caused by <CODE>OfficeWatcher</CODE>, the OfficeWatcher get frequently a ping. - * @see helper.OfficeWatcher - */ - public void runCommand() - { - - boolean changedText = true; - String memText = ""; - - this.executeAsynchronously(); - - OfficeWatcher ow = null; - if (param != null) - { - ow = (OfficeWatcher) param.get(PropertyName.OFFICE_WATCHER); - } - if (ow != null) - { - ow.ping(); - } - - int hangcheck = 10; - while (!this.isFinished() && changedText) - { - waitFor(2000, false); // wait but don't kill - - if (ow != null) - { - ow.ping(); - } - // check for changes in the output stream. If there are no changes, the process maybe hangs - if (!this.isFinished()) - { - hangcheck--; - if (hangcheck < 0) - { - String sOutputText = getOutputText(); - if (sOutputText.length() == memText.length()) - { - changedText = false; - } - hangcheck = 10; - memText = this.getOutputText(); - } - } - } - - if (!this.isFinished()) - { - dbg("runCommand Process is not finished but there are no changes in output stream."); - this.kill(); - } - } - - /** * Executes the command and returns only when the process * exits. * @@ -417,7 +358,7 @@ public class ProcessHandler } dbg("execute: pump io-streams"); stdout = new Pump(m_aProcess.getInputStream(), log, "out > ", bUseOutput); - stderr = new Pump(m_aProcess.getErrorStream(), log, "err > ", bUseOutput); + new Pump(m_aProcess.getErrorStream(), log, "err > ", bUseOutput); stdIn = new PrintStream(m_aProcess.getOutputStream()); dbg("execute: flush io-streams"); @@ -549,24 +490,6 @@ public class ProcessHandler } /** - * Returns the text output by external command to stderr. - * @return the text output by external command to stderr - */ - public String getErrorText() - { - if (stderr == null) - { - return ""; - } - else - { - return stderr.getStringBuffer(); - } - } - - - - /** * Returns information about was the command started or * not. * diff --git a/qadevOOo/runner/helper/WindowListener.java b/qadevOOo/runner/helper/WindowListener.java deleted file mode 100644 index 710bda794f89..000000000000 --- a/qadevOOo/runner/helper/WindowListener.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you 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 . - */ -package helper; - -/** - * An own implementation of a XWindowListener - * - */ -public class WindowListener implements com.sun.star.awt.XWindowListener { - - /** - * The window hidden event - */ - public void windowHidden(com.sun.star.lang.EventObject eventObject) { - } - - /** - * The window move event - */ - public void windowMoved(com.sun.star.awt.WindowEvent windowEvent) { - } - - /** - * The window resize event - */ - public void windowResized(com.sun.star.awt.WindowEvent windowEvent) { - } - - /** - * The window show event - */ - public void windowShown(com.sun.star.lang.EventObject eventObject) { - } - - /** - * The dispose event - */ - public void disposing(com.sun.star.lang.EventObject eventObject) { - } -} diff --git a/qadevOOo/runner/lib/MultiPropertyTest.java b/qadevOOo/runner/lib/MultiPropertyTest.java index 673fdb3d3915..2d5e06729e7c 100644 --- a/qadevOOo/runner/lib/MultiPropertyTest.java +++ b/qadevOOo/runner/lib/MultiPropertyTest.java @@ -37,10 +37,6 @@ import util.ValueChanger; import util.ValueComparer; import util.utils; -import com.sun.star.uno.Any; -import com.sun.star.uno.AnyConverter; -import com.sun.star.uno.Type; - /** * MultiPropertyTest extends the functionality of MultiMethodTest to support * services testing. Since, in most cases, service tests has one method testing diff --git a/qadevOOo/runner/util/PropertyName.java b/qadevOOo/runner/util/PropertyName.java index 51d52a873750..83a0b7f4716f 100644 --- a/qadevOOo/runner/util/PropertyName.java +++ b/qadevOOo/runner/util/PropertyName.java @@ -120,26 +120,8 @@ public interface PropertyName { * path to the source root of OpenOffice.org */ String SRC_ROOT = "SRC_ROOT"; - /** - * parameter name: "Version"<p> - * the name of the version to test - */ - String VERSION = "Version"; /** - * parameter name "Shell"<p> - * Path to a shell. - * This shell is used to run some commands outside of Java - * example: /bin/tcsh c:\\myShell\\myShell.exe - */ - String SHELL = "Shell"; - /** - * parameter name "Cygwin"<p> - * If Cygwin is set to TRUE it indicates if the runner runs in a Cygwin - * environment - */ - String CYGWIN = "Cygwin"; - /** * internal only, no parameter */ String WNTMSCI = "wntmsci"; |