summaryrefslogtreecommitdiff
path: root/qadevOOo/runner/helper
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-12-11 16:25:29 +0200
committerNoel Grandin <noelgrandin@gmail.com>2014-12-12 08:16:17 +0000
commit117a82cd090ddd8efbc500350dc6082730f04720 (patch)
tree50c07684d43c06fd54d17532caca6a3afafd6967 /qadevOOo/runner/helper
parent04b183a9bc792a53a9f081353a79486faa4f3872 (diff)
java: remove dead code in qadevOOo
found by running UCDetector over the code many times, like peeling an onion Change-Id: I54d5147eb1b5c921ad236331bc4c1f765b13ca83 Reviewed-on: https://gerrit.libreoffice.org/13445 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'qadevOOo/runner/helper')
-rw-r--r--qadevOOo/runner/helper/ConfigurationRead.java16
-rw-r--r--qadevOOo/runner/helper/InetTools.java79
-rw-r--r--qadevOOo/runner/helper/OSHelper.java5
-rw-r--r--qadevOOo/runner/helper/ObjectInspectorModelImpl.java133
-rw-r--r--qadevOOo/runner/helper/ProcessHandler.java134
-rw-r--r--qadevOOo/runner/helper/PropertyHelper.java45
-rw-r--r--qadevOOo/runner/helper/SimpleMailSender.java162
7 files changed, 0 insertions, 574 deletions
diff --git a/qadevOOo/runner/helper/ConfigurationRead.java b/qadevOOo/runner/helper/ConfigurationRead.java
index e698d47104f3..72346a2e7dad 100644
--- a/qadevOOo/runner/helper/ConfigurationRead.java
+++ b/qadevOOo/runner/helper/ConfigurationRead.java
@@ -19,7 +19,6 @@ package helper;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.container.XHierarchicalNameAccess;
-import com.sun.star.container.XNameAccess;
import com.sun.star.container.NoSuchElementException;
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.PropertyState;
@@ -71,21 +70,6 @@ public class ConfigurationRead {
this(xMSF, "org.openoffice.Setup");
}
-
-
-
- /**
- * Get the elements of the root node.
- * @return All elements of the root node.
- */
- public String[] getRootNodeNames() {
- XNameAccess xName = UnoRuntime.queryInterface(XNameAccess.class, root);
- String[]names = xName.getElementNames();
- return names;
- }
-
-
-
/**
* Get contents of a node by its hierarchical name.
* @param name The hierarchical name of the node.
diff --git a/qadevOOo/runner/helper/InetTools.java b/qadevOOo/runner/helper/InetTools.java
deleted file mode 100644
index 1ab8a2fe68a9..000000000000
--- a/qadevOOo/runner/helper/InetTools.java
+++ /dev/null
@@ -1,79 +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 com.sun.star.beans.PropertyValue;
-import com.sun.star.beans.XPropertySet;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.uno.UnoRuntime;
-
-// access the implementations via names
-import com.sun.star.util.XChangesBatch;
-
-import lib.TestParameters;
-
-
-public class InetTools {
- /**
- * Helper method: sets the HTTP-Proxy to values from
- * <code>lib.TestParameters</code>
- */
- public static boolean setHTTPProxy(TestParameters param){
- XMultiServiceFactory xMSF = param.getMSF();
- PropertyValue[] ProvArgs = new PropertyValue[1];
- PropertyValue Arg = new PropertyValue();
- Arg.Name = "nodepath";
- Arg.Value = "/org.openoffice.Inet/Settings";
- ProvArgs[0] = Arg;
-
- try {
- Object oProvider = xMSF.createInstance(
- "com.sun.star.configuration.ConfigurationProvider");
-
- XMultiServiceFactory oProviderMSF = UnoRuntime.queryInterface(
- XMultiServiceFactory.class,
- oProvider);
-
- Object oInet = oProviderMSF.createInstanceWithArguments(
- "com.sun.star.configuration.ConfigurationUpdateAccess",
- ProvArgs);
-
- XPropertySet oInetProps = UnoRuntime.queryInterface(
- XPropertySet.class, oInet);
-
- String HTTPProxyName = (String)param.get("HTTPProxyName");
- String HTTPProxyPort = (String)param.get("HTTPProxyPort");
-
- if ((HTTPProxyName == null) || (HTTPProxyPort == null)) {
- return false;
- }
-
- oInetProps.setPropertyValue("ooInetHTTPProxyName", HTTPProxyName);
- oInetProps.setPropertyValue("ooInetHTTPProxyPort", HTTPProxyPort);
- oInetProps.setPropertyValue("ooInetProxyType", Long.valueOf(2));
-
- XChangesBatch oSecureChange = UnoRuntime.queryInterface(
- XChangesBatch.class, oInet);
- oSecureChange.commitChanges();
- }
- catch(com.sun.star.uno.Exception e) {
- e.printStackTrace();
- }
- return true;
- }
-}
diff --git a/qadevOOo/runner/helper/OSHelper.java b/qadevOOo/runner/helper/OSHelper.java
index 212a01b1655c..242647153a50 100644
--- a/qadevOOo/runner/helper/OSHelper.java
+++ b/qadevOOo/runner/helper/OSHelper.java
@@ -47,9 +47,4 @@ public class OSHelper
System.getProperty("os.arch").equals("i386");
}
- public static boolean isUnix()
- {
- return isLinuxIntel() || isSolarisIntel() || isSolarisSparc();
- }
-
}
diff --git a/qadevOOo/runner/helper/ObjectInspectorModelImpl.java b/qadevOOo/runner/helper/ObjectInspectorModelImpl.java
deleted file mode 100644
index b0135cd84fe5..000000000000
--- a/qadevOOo/runner/helper/ObjectInspectorModelImpl.java
+++ /dev/null
@@ -1,133 +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 com.sun.star.inspection.PropertyCategoryDescriptor;
-import com.sun.star.inspection.XObjectInspectorModel;
-
-/**
- * This is an implementation of <CODE>ObjectInspectorModel</CODE>.
- * @see com.sun.star.inspection.XObjectInspectorModel
- */
-public class ObjectInspectorModelImpl implements XObjectInspectorModel{
-
- /**
- * class variable which contains the implementations of
- * <CODE>PropertyCategoryDescriptor</CODE>
- * @see com.sun.star.inspection.PropertyCategoryDescriptor
- */
- PropertyCategoryDescriptor[] m_Categories;
-
- /**
- * class variable which contains the count of implementations of
- * <CODE>PropertyCategoryDescriptor</CODE>
- */
- int m_count;
-
- /**
- * Creates a new instance of ObjectInspectorModelImpl
- * For every count given in parameter <CODE>count</CODE> an
- * <CODE>PropertyCategoryDescriptor</CODE> was created an filled with valuable content.
- * @param count count of <CODE>PropertyCategoryDescriptor</CODE> to create
- */
- public ObjectInspectorModelImpl(int count) {
- m_count = count;
- m_Categories = new PropertyCategoryDescriptor[m_count];
- int CategoryMem = 0;
- int inCat = 0;
- for (int n=0; n < m_count; n++ ){
-
- m_Categories[n] = new PropertyCategoryDescriptor();
-
- int category = n / 2;
- inCat =(CategoryMem == category)? ++inCat: 1;
- CategoryMem = category;
-
- m_Categories[n].ProgrammaticName = "Category" + category;
- m_Categories[n].UIName = "Category" + category + "Number" + inCat;
- m_Categories[n].HelpURL = "h:" + n;
- }
- }
-
- /**
- * returns the catrgories
- * @return returns the catrgories
- */
- public PropertyCategoryDescriptor[] describeCategories() {
- return m_Categories;
- }
-
- /**
- * returns currently nothing
- * @return nothing
- */
- public Object[] getHandlerFactories() {
- return null;
- }
-
- /** determines whether the object inspector should have a help section
- @return false
- */
- public boolean getHasHelpSection() {
- return false;
- }
-
- /** returns minimum number of lines in the help text section.
- @return 3
- */
- public int getMinHelpTextLines() {
- return 3;
- }
-
- /** returns maximum number of lines in the help text section.
- @return 8
- */
- public int getMaxHelpTextLines() {
- return 8;
- }
-
- /** returns whether or not the inspector's UI should be read-only
- */
- public boolean getIsReadOnly() {
- return false;
- }
-
- /** sets the inspector's read-only state
- */
- public void setIsReadOnly( boolean _IsReadOnly ) {
- // not supported, and not used so far in our test cases
- }
-
- /**
- * retrieves an index in a global property ordering, for a given property name
- * @param UIName the property whose global order index should be retrieved
- * @return the global order index of PropertyName
- */
- public int getPropertyOrderIndex(String UIName) {
- int index = 0;
- for (int n=0; n < m_Categories.length; n++){
- if (m_Categories[n].UIName.equals(UIName)){
- index = n;
- break;
- }
- }
- return index;
- }
-
- }
diff --git a/qadevOOo/runner/helper/ProcessHandler.java b/qadevOOo/runner/helper/ProcessHandler.java
index 9e0b352e55eb..9105a86b673b 100644
--- a/qadevOOo/runner/helper/ProcessHandler.java
+++ b/qadevOOo/runner/helper/ProcessHandler.java
@@ -119,7 +119,6 @@ public class ProcessHandler
private int exitValue = -1;
private boolean isFinished = false;
private boolean isStarted = false;
- private boolean mbTimedOut = false;
private long mTimeOut = 0;
private String stdInBuff = "";
private Pump stdout = null;
@@ -145,57 +144,6 @@ public class ProcessHandler
}
/**
- * Creates instance with specified external command
- * including parameters as an array.
- * Debug info and output
- * of external command is printed to stdout.
- */
- public ProcessHandler(String[] cmdLines)
- {
- this(null, null, null, null, 0);
- cmdLineArray = cmdLines;
- }
-
- /**
- * Creates instance with specified external command
- * including parameters as an array, with environment
- * variables.
- * Debug info and output
- * of external command is printed to stdout.
- * @see java.lang.Runtime exec(String[], String[])
- */
- public ProcessHandler(String[] cmdLines, String[] envVars)
- {
- this(null, null, null, envVars, 0);
- cmdLineArray = cmdLines;
- }
-
- /**
- * Creates instance with specified external command
- * including parameters as an array, with environment
- * variables. The command will be started in workDir.
- * Debug info and output
- * of external command is printed to stdout.
- */
- public ProcessHandler(String[] cmdLines, File workDir)
- {
- this(null, null, workDir, null, 0);
- cmdLineArray = cmdLines;
-
- }
-
- /**
- * Creates instance with specified external command and
- * log stream where debug info and output
- * of external command is printed out. The command will be started in workDir.
- */
- public ProcessHandler(String[] cmdLines, PrintWriter log, File workDir)
- {
- this(null, log, workDir, null, 0);
- cmdLineArray = cmdLines;
- }
-
- /**
* Creates instance with specified external command and
* log stream where debug info and output
* of external command is printed out.
@@ -215,40 +163,6 @@ public class ProcessHandler
/**
* Creates instance with specified external command which
- * will be executed in the some work directory.
- * Debug info and output
- * of external commandis printed to stdout.
- */
- public ProcessHandler(String cmdLine, File workDir)
- {
- this(cmdLine, null, workDir, null, 0);
- }
-
- /**
- * Creates instance with specified external command which
- * will be executed in the some work directory.
- * Debug info and output printed in log stream.
- */
- public ProcessHandler(String cmdLine, PrintWriter log, File workDir)
- {
- this(cmdLine, log, workDir, null, 0);
- }
-
- /**
- * Creates instance with specified external command which
- * will be executed in the some work directory and
- * log stream where debug info and output
- * of external command is printed .
- * The specified environment variables are set for the new process.
- * If log stream is null, logging is printed to stdout.
- */
- public ProcessHandler(String cmdLine, PrintWriter log, File workDir, String[] envVars)
- {
- this(cmdLine, log, workDir, envVars, 0);
- }
-
- /**
- * Creates instance with specified external command which
* will be executed in the some work directory and
*
* @param cmdLine the command to be executed
@@ -323,22 +237,6 @@ public class ProcessHandler
}
/**
- * If not equal 0, the time to maximal wait.
- */
- public void setProcessTimeout(int _n)
- {
- m_nProcessTimeout = _n;
- }
-
- /**
- * This command will call after ProcessTimeout is arrived.
- */
- public void setProcessKiller(String _s)
- {
- m_sProcessKiller = _s;
- }
-
- /**
* 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
@@ -394,16 +292,6 @@ public class ProcessHandler
}
}
- public boolean isTimedOut()
- {
- return mbTimedOut;
- }
-
- private void setTimedOut(boolean bTimedOut)
- {
- mbTimedOut = bTimedOut;
- }
-
/**
* Executes the command and returns only when the process
* exits.
@@ -476,26 +364,6 @@ public class ProcessHandler
isStarted = false;
}
- /**
- * Returns the time in seconds since 1st January 1970
- */
- private static long getSystemTime()
- {
- final long nTime = System.currentTimeMillis();
- return nTime;
- }
- private long m_nExactStartTimeInMillisec;
-
- private void initialExactStartTime()
- {
- m_nExactStartTimeInMillisec = getSystemTime();
- }
-
- public long getProcessStartTime()
- {
- return m_nExactStartTimeInMillisec;
- }
-
private void showEnvVars()
{
if (envVars != null)
@@ -530,7 +398,6 @@ public class ProcessHandler
}
showEnvVars();
log.println("");
- initialExactStartTime();
initializeProcessKiller();
m_aProcess = runtime.exec(cmdLineArray, envVars);
}
@@ -650,7 +517,6 @@ public class ProcessHandler
}
if (timeout < 0)
{
- setTimedOut(true);
log.println("The process has timed out!");
}
}
diff --git a/qadevOOo/runner/helper/PropertyHelper.java b/qadevOOo/runner/helper/PropertyHelper.java
deleted file mode 100644
index b5391cd40823..000000000000
--- a/qadevOOo/runner/helper/PropertyHelper.java
+++ /dev/null
@@ -1,45 +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.util.ArrayList;
-
-import com.sun.star.beans.PropertyValue;
-
-public class PropertyHelper
-{
- /**
- Create a PropertyValue[] from a ArrayList
- */
- public static PropertyValue[] createPropertyValueArrayFormArrayList(ArrayList<PropertyValue> _aPropertyList)
- {
- // copy the whole PropertyValue List to an PropertyValue Array
- PropertyValue[] aSaveProperties;
-
- if (_aPropertyList == null)
- {
- aSaveProperties = new PropertyValue[0];
- }
- else
- {
- aSaveProperties = _aPropertyList.toArray(new PropertyValue[_aPropertyList.size()]);
- }
- return aSaveProperties;
- }
-}
diff --git a/qadevOOo/runner/helper/SimpleMailSender.java b/qadevOOo/runner/helper/SimpleMailSender.java
deleted file mode 100644
index ecdcf214a0a7..000000000000
--- a/qadevOOo/runner/helper/SimpleMailSender.java
+++ /dev/null
@@ -1,162 +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.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-
-import java.net.InetAddress;
-import java.net.Socket;
-import java.net.UnknownHostException;
-
-
-public class SimpleMailSender {
- private String m_MailServer = "unknown";
- private String m_Sender = "unknown";
- private String m_Recipient = "unknown";
- private String m_Subject = "unknown";
- private String m_Message = "unknown";
-
-
- public String getMailServer() {
- return m_MailServer;
- }
-
- public void setMailServer(String server) {
- m_MailServer = server;
- }
-
- public String getSender() {
- return m_Sender;
- }
-
- public void setSender(String sender) {
- m_Sender = sender;
- }
-
- public String getRecipient() {
- return m_Recipient;
- }
-
- public void setRecipient(String recipient) {
- m_Recipient = recipient;
- }
-
- public String getSubject() {
- return m_Subject;
- }
-
- public void setSubject(String subject) {
- m_Subject = subject;
- }
-
- public String getMessage() {
- return m_Message;
- }
-
- public void setMessage(String msg) {
- m_Message = msg;
- }
-
- public void sendMail() {
- if (m_MailServer.equals ("unknown")) {
- System.out.println("No Mailserver given ... exiting");
- return;
- }
- if (m_Recipient.equals ("unknown")) {
- System.out.println("No Recipient given ... exiting");
- return;
- }
- sendMail(m_MailServer,m_Sender,m_Recipient,m_Subject,m_Message);
- }
-
- public void sendMail(String server, String sender,
- String recipient, String subject, String msg) {
- //setting member variables for reuse
- m_MailServer = server;
- m_Sender = sender;
- m_Recipient = recipient;
- m_Subject = subject;
- m_Message = msg;
-
- try {
- Socket socket = new Socket(m_MailServer, 25);
- BufferedReader input =
- new BufferedReader(new InputStreamReader(
- socket.getInputStream(), "8859_1"));
- BufferedWriter output =
- new BufferedWriter(new OutputStreamWriter(
- socket.getOutputStream(), "8859_1"));
-
- sendline(input, output, "HELO " + getHostName());
- sendline(input, output, "MAIL FROM: " + m_Sender);
- sendline(input, output, "RCPT TO: <" + m_Recipient + ">");
- sendline(input, output, "DATA");
- sendline(output, "MIME-Version: 1.0");
- sendline(output, "Subject: " + m_Subject);
- sendline(output, "From: " + m_Sender);
- sendline(output, "To: " + m_Recipient);
- sendline(output,
- "Content-Type: text/html; charset=\"us-ascii\"\r\n");
-
- // Send the body
- sendline(output, m_Message);
-
- sendline(input, output, ".");
- sendline(input, output, "QUIT");
- socket.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private void sendline(BufferedReader input,
- BufferedWriter output, String line) {
- try {
- output.write(line + "\r\n");
- output.flush();
- line = input.readLine();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private void sendline(BufferedWriter output, String line) {
- try {
- output.write(line + "\r\n");
- output.flush();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private String getHostName() {
- String hostname = "";
-
- try {
- InetAddress addr = InetAddress.getLocalHost();
-
- hostname = addr.getHostName();
- } catch (UnknownHostException e) {
- }
-
- return hostname;
- }
-}