Commit 7a574f32 authored by Joe Osborn's avatar Joe Osborn
Browse files

Made some global TDP per Daniel's suggestion


Signed-off-by: Joe Osborn's avatarJoe Osborn <osbornjd@ornl.gov>
parent 5aadfd41
......@@ -55,28 +55,28 @@ public class CommandFactoryTest {
* The hostname for which the job should run on. Default to local host name for
* now
*/
String hostname = getLocalHostname();
private String hostname = getLocalHostname();
/**
* Create a command factory to use for getting the commands.
*/
CommandFactory factory = new CommandFactory();
/**
* A string containing the working directory for the executable to run in
*/
String workingDirectory;
private CommandFactory factory = new CommandFactory();
/**
* Get the present working directory to run things in
*/
String pwd = System.getProperty("user.dir") + "/src/test/java/org/eclipse/ice/tests/commands/";
private String pwd = System.getProperty("user.dir") + "/src/test/java/org/eclipse/ice/tests/commands/";
/**
* A connection configuration with which to test
*/
ConnectionConfiguration connectionConfig = new ConnectionConfiguration();
private ConnectionConfiguration connectionConfig = new ConnectionConfiguration();
/**
* A TDP for collecting configuration files to run tests
*/
private TestDataPath dataPath = new TestDataPath();
/**
* Default constructor
*/
......@@ -182,8 +182,7 @@ public class CommandFactoryTest {
// Request a ConnectionAuthorization of type text file which contains the
// credentials
TestDataPath keyDataPath = new TestDataPath();
String keyPath = keyDataPath.resolve("commands/somekey").toString();
String keyPath = dataPath.resolve("commands/somekey").toString();
ConnectionAuthorizationHandler auth = authFactory.getConnectionAuthorizationHandler("keypath",
keyPath);
......@@ -201,9 +200,8 @@ public class CommandFactoryTest {
ConnectionConfiguration secondConn = new ConnectionConfiguration();
TestDataPath dataPath = new TestDataPath();
String credFile = dataPath.resolve("commands/ice-remote-creds.txt").toString();
ConnectionAuthorizationHandler intermAuth = authFactory.getConnectionAuthorizationHandler("text",credFile);
secondConn.setAuthorization(intermAuth);
secondConn.setName("executeConnection");
......@@ -693,10 +691,10 @@ public class CommandFactoryTest {
ConnectionConfiguration cfg = new ConnectionConfiguration();
// Make the connection configuration
// Get a factory which determines the type of authorization
ConnectionAuthorizationHandlerFactory authFactory = new ConnectionAuthorizationHandlerFactory();
// Request a ConnectionAuthorization of type text file which contains the
// credentials
TestDataPath dataPath = new TestDataPath();
String credFile = dataPath.resolve("commands/ice-remote-creds.txt").toString();
ConnectionAuthorizationHandler auth = authFactory.getConnectionAuthorizationHandler("text", credFile);
......
......@@ -38,6 +38,11 @@ import org.junit.Test;
*/
public class CommandFactoryUpdaterTest {
/**
* A TDP for collecting config files
*/
private TestDataPath dataPath = new TestDataPath();
/**
* This function tests a command with an HTTPUpdater
*/
......@@ -148,7 +153,7 @@ public class CommandFactoryUpdaterTest {
*/
private EmailUpdateHandler setupEmailUpdateHandler() {
// Get a text file with credentials
TestDataPath dataPath = new TestDataPath();
String credFile = dataPath.resolve("commands/ice-email-creds.txt").toString();
TxtFileConnectionAuthorizationHandler auth = new TxtFileConnectionAuthorizationHandler();
......
......@@ -47,8 +47,13 @@ public class CommandTest {
* Get the present working directory Add the following directories where the
* tests live
*/
String pwd = System.getProperty("user.dir") + "/src/test/java/org/eclipse/ice/tests/commands/";
private String pwd = System.getProperty("user.dir") + "/src/test/java/org/eclipse/ice/tests/commands/";
/**
* A TDP for collecting config files
*/
private TestDataPath dataPath = new TestDataPath();
/**
* Remove output files after tests finish running
*
......@@ -133,7 +138,6 @@ public class CommandTest {
// Request a ConnectionAuthorization of type text file which contains the
// credentials
TestDataPath dataPath = new TestDataPath();
String credFile = dataPath.resolve("commands/ice-remote-creds.txt").toString();
ConnectionAuthorizationHandler auth = authFactory.getConnectionAuthorizationHandler("text", credFile);
......@@ -241,7 +245,6 @@ public class CommandTest {
// Request a ConnectionAuthorization of type text file which contains the
// credentials
TestDataPath dataPath = new TestDataPath();
String credFile = dataPath.resolve("commands/ice-remote-creds.txt").toString();
ConnectionAuthorizationHandler auth = authFactory.getConnectionAuthorizationHandler("text", credFile);
......@@ -309,7 +312,6 @@ public class CommandTest {
// Request a ConnectionAuthorization of type text file which contains the
// credentials
TestDataPath dataPath = new TestDataPath();
String credFile = dataPath.resolve("commands/ice-remote-creds.txt").toString();
ConnectionAuthorizationHandler auth = authFactory.getConnectionAuthorizationHandler("text", credFile);
......
......@@ -37,8 +37,16 @@ import org.junit.Test;
*/
public class ConnectionAuthorizationHandlerFactoryTest {
/**
* A factory for generating the authorizations
*/
private ConnectionAuthorizationHandlerFactory factory = new ConnectionAuthorizationHandlerFactory();
/**
* A TDP for collecting config files
*/
private TestDataPath dataPath = new TestDataPath();
/**
* Tests local authorization of
* {@link org.eclipse.ice.commands.ConnectionAuthorizationHandlerFactory#getConnectionAuthorizationHandler(String)}
......@@ -68,7 +76,7 @@ public class ConnectionAuthorizationHandlerFactoryTest {
*/
@Test
public void testTextAuthorization() throws IOException {
TestDataPath dataPath = new TestDataPath();
String credFile = dataPath.resolve("commands/ice-remote-creds.txt").toString();
// Get a text file authorization handler
......@@ -114,7 +122,6 @@ public class ConnectionAuthorizationHandlerFactoryTest {
// Create a text file credential path to get the same username/hostname
// as the key, in the event someone is using a host that is not the dummy
// server
TestDataPath dataPath = new TestDataPath();
String credFile = dataPath.resolve("commands/ice-remote-creds.txt").toString();
// Get a text file authorization handler
......
......@@ -60,6 +60,11 @@ public class ConnectionManagerTest {
*/
static ConnectionConfiguration configuration = new ConnectionConfiguration();
/**
* A TDP for collecting config files
*/
static TestDataPath dataPath = new TestDataPath();
/**
* This function makes a test connection with which to play with
*
......@@ -71,10 +76,10 @@ public class ConnectionManagerTest {
// Set up the configuration with the necessary credentials
// Get a factory which determines the type of authorization
ConnectionAuthorizationHandlerFactory authFactory = new ConnectionAuthorizationHandlerFactory();
// Request a ConnectionAuthorization of type text file which contains the
// credentials
ConnectionAuthorizationHandler auth = null;
TestDataPath dataPath = new TestDataPath();
String credFile = dataPath.resolve("commands/ice-remote-creds.txt").toString();
auth = authFactory.getConnectionAuthorizationHandler("text", credFile);
......@@ -218,7 +223,6 @@ public class ConnectionManagerTest {
ConnectionManager manager = ConnectionManagerFactory.getConnectionManager();
// Read in a dummy configuration file that contains credentials
TestDataPath dataPath = new TestDataPath();
String credFile = dataPath.resolve("commands/ice-remote-creds.txt").toString();
// Set the credentials since they were deleted after closing the previous
......@@ -321,7 +325,6 @@ public class ConnectionManagerTest {
ConnectionManager manager = ConnectionManagerFactory.getConnectionManager();
// Read in a dummy configuration file that contains credentials
TestDataPath dataPath = new TestDataPath();
String credFile = dataPath.resolve("commands/ice-remote-creds.txt").toString();
ConnectionAuthorizationHandlerFactory authFactory = new ConnectionAuthorizationHandlerFactory();
......
......@@ -67,6 +67,7 @@ public class EmailHandlerTest {
*/
@Test
public void testEmailNotificationPostUpdateBadCreds() {
// Just make up some dummy file that doesn't actually exist
String credFile = "/tmp/dumFile.txt";
if (System.getProperty("os.name").toLowerCase().contains("win"))
credFile = "C:\\Users\\Administrator\\dumFile.txt";
......
......@@ -50,10 +50,17 @@ public class RemoteCommandTest {
*/
static ConnectionConfiguration connectConfig = new ConnectionConfiguration();
// Get the present working directory and add the extra directories to get the
// directory where the executable lives
/**
* Get the present working directory and add the extra directories to get the
* directory where the executable lives
*/
static String pwd = System.getProperty("user.dir") + "/src/test/java/org/eclipse/ice/tests/commands/";
/**
* A TDP for collecting config files
*/
static TestDataPath dataPath = new TestDataPath();
@After
public void tearDown() throws Exception {
ConnectionManagerFactory.getConnectionManager().listAllConnections();
......@@ -97,7 +104,6 @@ public class RemoteCommandTest {
// Request a ConnectionAuthorization of type text file which contains the
// credentials
TestDataPath dataPath = new TestDataPath();
String credFile = dataPath.resolve("commands/ice-remote-creds.txt").toString();
ConnectionAuthorizationHandler auth = authFactory.getConnectionAuthorizationHandler("text", credFile);
......@@ -224,7 +230,7 @@ public class RemoteCommandTest {
badConfig.setOS(System.getProperty("os.name"));
ConnectionAuthorizationHandlerFactory authFactory = new ConnectionAuthorizationHandlerFactory();
TestDataPath dataPath = new TestDataPath();
String credFile = dataPath.resolve("commands/ice-remote-creds.txt").toString();
ConnectionAuthorizationHandler auth = authFactory.getConnectionAuthorizationHandler("text", credFile);
......
......@@ -59,8 +59,13 @@ public class RemoteFileBrowserTest {
* A remote file handler test to take advantage of the file creation/deletion
* code and remote connection establishment code already developed there.
*/
RemoteFileHandlerTest fileCreator = new RemoteFileHandlerTest();
private RemoteFileHandlerTest fileCreator = new RemoteFileHandlerTest();
/**
* A TDP for collecting config files
*/
static TestDataPath dataPath = new TestDataPath();
/**
* @throws java.lang.Exception
*/
......@@ -315,7 +320,6 @@ public class RemoteFileBrowserTest {
// Request a ConnectionAuthorization of type text file which contains the
// credentials
TestDataPath dataPath = new TestDataPath();
String credFile = dataPath.resolve("commands/ice-remote-creds.txt").toString();
ConnectionAuthorizationHandler auth = authFactory.getConnectionAuthorizationHandler("text", credFile);
......
......@@ -67,6 +67,12 @@ public class RemoteFileHandlerTest {
*/
static Connection fileTransferConn = new Connection();
/**
* A TDP for collecting config files
*/
static TestDataPath dataPath = new TestDataPath();
/**
* Setup the dummy connection so that the file transfer tests can access an ssh
* connection
......@@ -302,7 +308,6 @@ public class RemoteFileHandlerTest {
// Request a ConnectionAuthorization of type text file which contains the
// credentials
TestDataPath dataPath = new TestDataPath();
String credFile = dataPath.resolve("commands/ice-remote-creds.txt").toString();
ConnectionAuthorizationHandler auth = authFactory.getConnectionAuthorizationHandler("text", credFile);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment