summaryrefslogtreecommitdiffstats
path: root/idrop-swing
diff options
context:
space:
mode:
Diffstat (limited to 'idrop-swing')
-rw-r--r--idrop-swing/pom.xml2
-rw-r--r--idrop-swing/release_notes.txt123
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/StartupSequencer.java275
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropConfigurationService.java10
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropConfigurationServiceImpl.java12
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropPreDatabaseBootstrapperService.java45
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropPreDatabaseBootstrapperServiceImpl.java196
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/utils/IdropPropertiesHelper.java4
-rw-r--r--idrop-swing/src/main/resources/idrop.properties9
-rw-r--r--idrop-swing/src/test/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropConfigurationServiceTest.java13
-rw-r--r--idrop-swing/src/test/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropPreDatabaseBootstrapperServiceImplTest.java81
-rw-r--r--idrop-swing/src/test/java/org/irods/jargon/idrop/desktop/unittest/AllTests.java10
-rw-r--r--idrop-swing/src/test/resources/testing.properties2
13 files changed, 542 insertions, 240 deletions
diff --git a/idrop-swing/pom.xml b/idrop-swing/pom.xml
index ada1dd5..8521c34 100644
--- a/idrop-swing/pom.xml
+++ b/idrop-swing/pom.xml
@@ -30,7 +30,7 @@
<dependency>
<groupId>org.irods.jargon</groupId>
<artifactId>jargon-test</artifactId>
- <scope>compile</scope>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
diff --git a/idrop-swing/release_notes.txt b/idrop-swing/release_notes.txt
index 59e7e41..4a56678 100644
--- a/idrop-swing/release_notes.txt
+++ b/idrop-swing/release_notes.txt
@@ -24,84 +24,57 @@ Note that the following bug and feature requests are logged in GForge with relat
==Bug Fixes==
-iRODS iDrop > 15GB streaming has issue in field (rules specify no parallel txfrs) 2011-08-12 07:26:57
-iRODS iDrop > gui position for login dialog from prefs/switch grids 2011-08-15 16:43:39
-iRODS iDrop > get transfer not updating intra-file progress 2011-08-19 10:43:03
-iRODS iDrop > Misc gui glitches and cleanup for 1.0.0 RC1 testing 2011-08-19 12:57:31
-iRODS iDrop > z fighting errors password change dialog 2011-08-25 15:10:24
-iRODS iDrop > weird error acl add 2011-09-29 16:34:38
-iRODS iDrop > show/hide menu button functionality break? 2011-10-06 09:32:09
-iRODS iDrop > fix login preset accidentally committed 2011-10-25 13:03:04
-iRODS iDrop > http upload 0 length file fails 2011-11-09 16:19:54
-iRODS iDrop > error generating thumbs from large TIFF 2011-12-19 10:13:50
-iRODS iDrop > error rename function in context menu 2011-12-30 08:54:36
-iRODS iDrop > error adding tag, no description from idrop web 2011-12-30 15:25:03
-iRODS iDrop > fix format of login screen 2011-12-31 09:00:34
-iRODS iDrop > unified message scheme for web interface 2011-12-31 11:20:00
-iRODS iDrop > minor formatting changes from initial functional testing 2012-01-01 09:53:41
-iRODS iDrop > New folder tree refresh cleanup 2012-01-02 09:53:19
-iRODS iDrop > remove PDF previews 2012-01-02 14:59:26
-iRODS iDrop > new folder message is for rename 2012-01-02 18:02:27
-iRODS iDrop > look at info rendering of html files 2012-01-04 10:42:04
-iRODS iDrop > occ'l broken images in gallery view 2012-01-06 10:33:04
-iRODS iDrop > error retrieving shopping cart idrop lite 2012-01-10 12:59:42
-iRODS iDrop > put operation fails with parallel threads 2012-01-11 12:56:53
-iRODS iDrop > stack traces initial load mode '2' 2012-01-11 14:49:39
-iRODS iDrop > Idrop-swing hangs while logging in as other user then rods - msAccessPolicy set to strict 2012-01-17 05:04:34
-iRODS iDrop > mutli-file irods delete not working 2011-06-02 11:42:24
-iRODS iDrop > refresh of irodsFileTree does not scroll down to selected item 2011-06-05 15:33:17
-iRODS iDrop > windows error on irods move WinXP 2011-06-06 12:24:34
-iRODS iDrop > Unable to build details for transfer type in queue manager dialog when copy 2011-06-06 12:26:14
-iRODS iDrop > -321000 error on copy in idrop 2011-06-06 12:35:59
-iRODS iDrop > info not synchronizing on tree select 2011-06-30 09:51:56
-iRODS iDrop > delete nodes in ll, refresh issue? 2011-06-30 16:41:36
-iRODS iDrop > drag/select feedback missing on some platforms 2011-07-01 08:35:17
-iRODS iDrop > potential grails build error clean on fedora linux 2011-07-21 11:21:32
-iRODS iDrop > fedora linux error when selecting node for info 2011-08-09 08:41:15
-iRODS iDrop > Txfr iRODS to local on WinXP, refresh collapses 2011-08-09 11:10:56
-iRODS iDrop > on txfr from local irods, did not update tree 2011-08-10 16:04:54
-iRODS iDrop > node delete issue seen on mac and win 2011-08-10 16:09:37
-iRODS iDrop > after refresh info panel selections skewed 2011-08-12 10:47:08
-iRODS iDrop > hit cancel button on switch grid or change password shouldn't exit 2011-08-15 16:22:54
-iRODS iDrop > drag from local to top level dir in LL causes warning 2011-08-29 09:43:10
-iRODS iDrop > add to cart seems to not be working on data object from info display 2011-11-24 09:44:29
-iRODS iDrop > tag/comment not working/giving feedback on iren 2011-12-06 11:13:47
-iRODS iDrop > new folder via context menu of tree not working 2011-12-17 11:53:39
-iRODS iDrop > rename error on win 2012-01-02 14:56:09
-iRODS iDrop > delete needs a 'busy' modal dialog until completion 2012-01-13 16:22:26
-iRODS iDrop > idrop-swing does not get irods file list 2011-04-18 13:21:37
-iRODS iDrop > -511017 on copy 2011-06-07 14:13:57
-iRODS iDrop > confirmation dialogs are not consistent 2011-07-08 11:06:35
-iRODS iDrop > comment field not persisting in info box 2011-07-21 11:57:03
-iRODS iDrop > multi select local file delete error 2011-08-17 15:39:12
-iRODS iDrop > local-irods synch path scheme implemented 2011-08-17 16:09:23
-iRODS iDrop > access error on copy 2011-08-22 07:48:03
-iRODS iDrop > cannot delete a synchronization 2011-09-28 20:36:33
-iRODS iDrop > idrop startup error with numberformatexception 2011-10-31 12:19:47
-iRODS iDrop > Upload errors from win 2012-01-02 14:51:26
-iRODS iDrop > for strict acl mode show home dir as root in tree 2012-01-11 11:23:50
-iRODS iDrop > sizing of browse table in various browsers - no scrolls 2012-01-17 15:24:38
-
+*15GB streaming has issue in field (rules specify no parallel txfrs) 2011-08-12 07:26:57
+*gui position for login dialog from prefs/switch grids 2011-08-15 16:43:39
+*get transfer not updating intra-file progress 2011-08-19 10:43:03
+*Misc gui glitches and cleanup for 1.0.0 RC1 testing 2011-08-19 12:57:31
+*z fighting errors password change dialog 2011-08-25 15:10:24
+*error rename function in context menu 2011-12-30 08:54:36
+*put operation fails with parallel threads 2012-01-11 12:56:53
+*Idrop-swing hangs while logging in as other user then rods - msAccessPolicy set to strict 2012-01-17 05:04:34
+*mutli-file irods delete not working 2011-06-02 11:42:24
+*refresh of irodsFileTree does not scroll down to selected item 2011-06-05 15:33:17
+*Unable to build details for transfer type in queue manager dialog when copy 2011-06-06 12:26:14
+*-321000 error on copy in idrop 2011-06-06 12:35:59
+*info not synchronizing on tree select 2011-06-30 09:51:56
+*delete nodes in ll, refresh issue? 2011-06-30 16:41:36
+*drag/select feedback missing on some platforms 2011-07-01 08:35:17
+*fedora linux error when selecting node for info 2011-08-09 08:41:15
+*Txfr iRODS to local on WinXP, refresh collapses 2011-08-09 11:10:56
+*on txfr from local irods, did not update tree 2011-08-10 16:04:54
+*node delete issue seen on mac and win 2011-08-10 16:09:37
+*after refresh info panel selections skewed 2011-08-12 10:47:08
+*hit cancel button on switch grid or change password shouldn't exit 2011-08-15 16:22:54
+*drag from local to top level dir in LL causes warning 2011-08-29 09:43:10
+*new folder via context menu of tree not working 2011-12-17 11:53:39
+*rename error on win 2012-01-02 14:56:09
+*delete needs a 'busy' modal dialog until completion 2012-01-13 16:22:26
+*idrop-swing does not get irods file list 2011-04-18 13:21:37
+*511017 on copy 2011-06-07 14:13:57
+*confirmation dialogs are not consistent 2011-07-08 11:06:35
+*multi select local file delete error 2011-08-17 15:39:12
+*local-irods synch path scheme implemented 2011-08-17 16:09:23
+*access error on copy 2011-08-22 07:48:03
+*cannot delete a synchronization 2011-09-28 20:36:33
+*drop startup error with numberformatexception 2011-10-31 12:19:47
+*for strict acl mode show home dir as root in tree 2012-01-11 11:23:50
==Features==
-iRODS iDrop > info view for local file system 2011-10-10 13:26:07
-iRODS iDrop > upload/download in info views and on menu 2011-11-28 11:01:14
-iRODS iDrop > make web view options sticky 2011-12-30 08:49:32
-iRODS iDrop > login preset capability 2012-01-30 13:05:16
-iRODS iDrop > LL - sync management preferences for single device 2011-05-27 12:32:58
-iRODS iDrop > add within-file progress bar 2011-08-15 13:49:50
-iRODS iDrop > AVU Crud in idrop-swing 2011-10-10 13:21:35
-iRODS iDrop > Metadata CRUD in idrop swing 2011-10-10 13:23:08
-iRODS iDrop > DnD and tree cleanup 2011-11-16 15:41:58
-iRODS iDrop > Consolidate buttons into drop-down menu 2011-12-09 11:02:16
-iRODS iDrop > Add progress bar to bottom of iDrop and links to view queue from idrop menu 2011-02-10 10:55:07
-iRODS iDrop > copy irods function 2011-02-10 11:02:02
-iRODS iDrop > LL - headless auto-backup 2011-02-10 11:25:14
-iRODS iDrop > LL - first-run setup wizard for sync folders 2011-05-27 12:28:32
-iRODS iDrop > drag and drop, desktop to irods file should use irods parent as target 2011-06-03 13:44:23
-iRODS iDrop > password change update synchs and transfers with new 2011-08-01 16:52:14
-iRODS iDrop > Fix search results screen to show info, including toolbar 2011-11-23 15:14:02
+*info view for local file system 2011-10-10 13:26:07
+*upload/download in info views and on menu 2011-11-28 11:01:14
+*make web view options sticky 2011-12-30 08:49:32
+*login preset capability 2012-01-30 13:05:16
+*LL - sync management preferences for single device 2011-05-27 12:32:58
+*add within-file progress bar 2011-08-15 13:49:50
+*DnD and tree cleanup 2011-11-16 15:41:58
+*Add progress bar to bottom of iDrop and links to view queue from idrop menu 2011-02-10 10:55:07
+*copy irods function 2011-02-10 11:02:02
+*headless auto-backup 2011-02-10 11:25:14
+*drag and drop, desktop to irods file should use irods parent as target 2011-06-03 13:44:23
+*password change update synchs and transfers with new 2011-08-01 16:52:14
+*Fix search results screen to show info, including toolbar 2011-11-23 15:14:02
+* [#691] revamp startup sequence
==Outstanding Issues==
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/StartupSequencer.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/StartupSequencer.java
index 11dada3..5589ef1 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/StartupSequencer.java
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/StartupSequencer.java
@@ -1,44 +1,38 @@
package org.irods.jargon.idrop.desktop.systraygui;
import java.awt.Component;
-import java.awt.Dimension;
import java.awt.Toolkit;
import java.util.List;
import java.util.Properties;
import java.util.Timer;
import java.util.logging.Level;
import java.util.logging.Logger;
-
import javax.swing.JOptionPane;
-
import org.irods.jargon.core.exception.JargonException;
-import org.irods.jargon.core.packinstr.TransferOptions;
import org.irods.jargon.core.pub.IRODSFileSystem;
-import org.irods.jargon.idrop.desktop.systraygui.services.IconManager;
-import org.irods.jargon.idrop.desktop.systraygui.services.IdropConfigurationService;
-import org.irods.jargon.idrop.desktop.systraygui.services.IdropConfigurationServiceImpl;
-import org.irods.jargon.idrop.desktop.systraygui.services.QueueSchedulerTimerTask;
+import org.irods.jargon.idrop.desktop.systraygui.services.*;
import org.irods.jargon.idrop.desktop.systraygui.utils.IdropConfig;
+import org.irods.jargon.idrop.desktop.systraygui.utils.IdropPropertiesHelper;
import org.irods.jargon.idrop.desktop.systraygui.utils.LookAndFeelManager;
-import org.irods.jargon.idrop.desktop.systraygui.viscomponents.SetupWizard;
import org.irods.jargon.idrop.exceptions.IdropAlreadyRunningException;
import org.irods.jargon.idrop.exceptions.IdropException;
import org.irods.jargon.idrop.exceptions.IdropRuntimeException;
import org.irods.jargon.transfer.dao.domain.LocalIRODSTransfer;
-import org.irods.jargon.transfer.engine.TransferEngineConfigurationProperties;
import org.irods.jargon.transfer.engine.TransferManagerImpl;
import org.irods.jargon.transfer.synch.SynchPeriodicScheduler;
-import org.openide.util.Exceptions;
import org.slf4j.LoggerFactory;
/**
- * Bootstrapping class for iDrop, load config, create necessary services, and
- * start the appropriate GUI components
- *
+ * Bootstrapping class for iDrop, load config, create necessary services, and start the appropriate
+ * GUI components
+ *
* @author Mike Conway - DICE (www.irods.org)
*/
public class StartupSequencer {
+ /**
+ * NOTE this class is in transition!!!!!!
+ */
private iDrop idrop;
private IDROPCore idropCore;
private static final org.slf4j.Logger log = LoggerFactory.getLogger(StartupSequencer.class);
@@ -69,47 +63,69 @@ public class StartupSequencer {
idrop = new iDrop(idropCore);
IDROPSplashWindow idropSplashWindow = new IDROPSplashWindow(idrop);
-
- try {
- Thread.sleep(STARTUP_SEQUENCE_PAUSE_INTERVAL);
- } catch (InterruptedException e) {
- throw new IdropRuntimeException(e);
- }
+ sleepABit();
idropSplashWindow.setStatus("Initializing...", ++count);
idropCore.setIconManager(new IconManager(idrop));
+ sleepABit();
- try {
- Thread.sleep(STARTUP_SEQUENCE_PAUSE_INTERVAL);
- } catch (InterruptedException e) {
- throw new IdropRuntimeException(e);
- }
+ String derivedConfigHomeDirectory = deriveConfigHomeDirectory();
- log.info("determine config root directory");
- String userHomeDirectory = System.getProperty("user.home");
- StringBuilder sb = new StringBuilder();
- sb.append(userHomeDirectory);
- sb.append("/.idrop");
- String derivedConfigHomeDirectory = sb.toString();
- log.info("set config home directory as: {}", derivedConfigHomeDirectory);
+ /*
+ * Is this newer version that what the database and data represent? Look for a version file
+ * and trigger any migration needed. This is the first step where the database has not been
+ * started yet. There may be additinal steps added later to do migrations of data after the
+ * database has started. This will happen later....
+ */
+
+ doAnyPreDatabaseLoadMigrationProcessing(derivedConfigHomeDirectory);
/*
- * Here is where I first try and start the database to get the
- * configuration. A database error indicates that iDrop is already
- * running
+ * Try and load the database, look at database info and prefer over any configuration in the
+ * deployed package. Merge the pre-configured data with any existing database info,
+ * preferring what is in the database
*/
idropSplashWindow.setStatus("Looking for configuration information...",
++count);
- Properties derivedProperties = null;
+ Properties derivedProperties;
+ IdropConfigurationService idropConfigurationService;
+
try {
- IdropConfigurationService idropConfigurationService = new IdropConfigurationServiceImpl(
- derivedConfigHomeDirectory, idropCore);
- idropCore.setIdropConfigurationService(idropConfigurationService);
- derivedProperties = idropConfigurationService.bootstrapConfiguration();
-
+
+ /*
+ * Here is where I first try and start the database to get the configuration. A database
+ * error indicates that iDrop is already running
+ */
+ log.info("statup will now start up the existing database, a new one may be created....");
+ idropConfigurationService = startUpTheDatabaseAndSetConfigurationServiceInIdropCore(derivedConfigHomeDirectory);
+
+ log.info("checking for any necessary migrations, this may back up database data and return a value that indicates that iDrop will need to restart");
+
+ /**
+ * Code stub here. Think of using a backup dir/file to detect whether the pre migration
+ * service needs to run. boolean restart =
+ * idropDatabaseMigrationService.backupExistingDataForAnyMigration(previousVersion,
+ * currentVersion, blah) if (restart) { display restart dialog exit } // now
+ * idropDatabaseMigrationService.migrateBackedUpDataToNewDatabase();
+ *
+ */
+ /*
+ * Based on existing data in the database, and incoming data from the classpath
+ * properties, come up with a merged set of properties
+ */
+ derivedProperties = idropConfigurationService.bootstrapConfigurationAndMergePropertiesFromLocalAndClasspath();
+ sleepABit();
+
+ idropSplashWindow.setStatus(
+ "Configuration information gathered, logging in...", ++count);
+
+ log.info("config properties derived...");
+ idropCore.setIdropConfig(new IdropConfig(derivedProperties));
+ idropCore.getIdropConfig().setUpLogging();
+
} catch (IdropAlreadyRunningException are) {
log.error("idrop is already running, shutting down");
JOptionPane.showMessageDialog((Component) null,
@@ -122,19 +138,6 @@ public class StartupSequencer {
throw new IdropRuntimeException(ex);
}
- try {
- Thread.sleep(STARTUP_SEQUENCE_PAUSE_INTERVAL);
- } catch (InterruptedException e) {
- throw new IdropRuntimeException(e);
- }
-
- idropSplashWindow.setStatus(
- "Configuration information gathered, logging in...", ++count);
-
- log.info("config properties derived...");
- idropCore.setIdropConfig(new IdropConfig(derivedProperties));
- idropCore.getIdropConfig().setUpLogging();
-
log.info("setting jargon properties based on configurations in iDrop");
try {
idropCore.getIdropConfigurationService().pushIDROPConfigToJargonAndTransfer();
@@ -166,18 +169,13 @@ public class StartupSequencer {
}
idropSplashWindow.toFront();
-
- try {
- Thread.sleep(STARTUP_SEQUENCE_PAUSE_INTERVAL);
- } catch (InterruptedException e) {
- throw new IdropRuntimeException(e);
- }
+ sleepABit();
idropSplashWindow.setStatus("Building transfer engine...", ++count);
log.info("building transfer manager...");
-
- try {
+
+ try {
idropCore.setTransferManager(new TransferManagerImpl(idropCore.getIrodsFileSystem(), idrop));
idropCore.getIdropConfigurationService().updateTransferOptions();
} catch (JargonException ex) {
@@ -207,21 +205,10 @@ public class StartupSequencer {
throw new IdropRuntimeException("error evaluating current queue",
ex);
}
+ sleepABit();
- try {
- Thread.sleep(STARTUP_SEQUENCE_PAUSE_INTERVAL);
- } catch (InterruptedException e) {
- throw new IdropRuntimeException(e);
- }
-
-
log.info("logged in, now checking for first run...");
-
- try {
- Thread.sleep(STARTUP_SEQUENCE_PAUSE_INTERVAL);
- } catch (InterruptedException e) {
- throw new IdropRuntimeException(e);
- }
+ sleepABit();
idropSplashWindow.setStatus(
"Checking if this is the first time run to set up synch...",
@@ -229,42 +216,37 @@ public class StartupSequencer {
String synchDeviceName = idropCore.getIdropConfig().getSynchDeviceName();
idrop.signalIdropCoreReadyAndSplashComplete();
- if (synchDeviceName == null && idropCore.getIdropConfig().isShowStartupWizard()) {
- log.info("first time running idrop, starting configuration wizard");
- log.info("showing gui first time run");
- doFirstTimeConfigurationWizard();
+
+ // see if I show the gui at startup or show a message
+ if (idropCore.getIdropConfig().isShowGuiAtStartup()) {
idrop.showIdropGui();
} else {
- // see if I show the gui at startup or show a message
- if (idropCore.getIdropConfig().isShowGuiAtStartup()) {
- idrop.showIdropGui();
- } else {
- Object[] options = {"Do not show GUI at startup",
- "Show GUI at startup"};
-
- int n = JOptionPane.showOptionDialog(idrop,
- "iDrop has started.\nCheck your system tray to access the iDrop user interface. ",
- "iDrop - Startup Complete",
- JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE,
- null,
- options,
- options[0]);
- log.info("response was:{}", n);
- if (n == 1) {
- log.info("switching to show GUI at startup");
- try {
- idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.SHOW_GUI, "true");
- idrop.showIdropGui();
- } catch (IdropException ex) {
- log.error("error setting show GUI at startup", ex);
- throw new IdropRuntimeException(ex);
- }
+ Object[] options = {"Do not show GUI at startup",
+ "Show GUI at startup"};
+
+ int n = JOptionPane.showOptionDialog(idrop,
+ "iDrop has started.\nCheck your system tray to access the iDrop user interface. ",
+ "iDrop - Startup Complete",
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.QUESTION_MESSAGE,
+ null,
+ options,
+ options[0]);
+ log.info("response was:{}", n);
+ if (n == 1) {
+ log.info("switching to show GUI at startup");
+ try {
+ idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.SHOW_GUI, "true");
+ idrop.showIdropGui();
+ } catch (IdropException ex) {
+ log.error("error setting show GUI at startup", ex);
+ throw new IdropRuntimeException(ex);
}
}
}
-
- idropSplashWindow.setStatus("Starting work queue...", ++count);
+
+
+ idropSplashWindow.setStatus("Starting work queue...", ++count);
try {
QueueSchedulerTimerTask queueSchedulerTimerTask = new QueueSchedulerTimerTask(
idropCore.getTransferManager(), idrop);
@@ -298,12 +280,61 @@ public class StartupSequencer {
}
+ private IdropConfigurationService startUpTheDatabaseAndSetConfigurationServiceInIdropCore(String derivedConfigHomeDirectory) throws IdropException {
+ IdropConfigurationService idropConfigurationService;
+ idropConfigurationService = new IdropConfigurationServiceImpl(
+ derivedConfigHomeDirectory, idropCore);
+ idropCore.setIdropConfigurationService(idropConfigurationService);
+ return idropConfigurationService;
+ }
+
+ private void sleepABit() throws IdropRuntimeException {
+ try {
+ Thread.sleep(STARTUP_SEQUENCE_PAUSE_INTERVAL);
+ } catch (InterruptedException e) {
+ throw new IdropRuntimeException(e);
+ }
+ }
+
+ private void doAnyPreDatabaseLoadMigrationProcessing(String derivedConfigHomeDirectory) throws IdropRuntimeException {
+ Properties propertiesLoadedFromIdropApplicationClasspath;
+ try {
+
+ IdropPropertiesHelper helper = new IdropPropertiesHelper();
+ propertiesLoadedFromIdropApplicationClasspath = helper.loadIdropProperties();
+ String currentVersion = propertiesLoadedFromIdropApplicationClasspath.getProperty(IdropConfigurationService.VERSION_NUMBER);
+
+ if (currentVersion == null || currentVersion.isEmpty()) {
+ throw new IdropRuntimeException("unknown version number, not present in idrop.config");
+ }
+
+ IdropPreDatabaseBootstrapperService idropPreBootstrapperService = new IdropPreDatabaseBootstrapperServiceImpl();
+ String cachedVersion = idropPreBootstrapperService.detectPriorVersion(derivedConfigHomeDirectory);
+ idropPreBootstrapperService.triggerMigrations(derivedConfigHomeDirectory, cachedVersion, currentVersion);
+ idropPreBootstrapperService.storePriorVersion(derivedConfigHomeDirectory, currentVersion);
+
+ } catch (IdropException ex) {
+ Logger.getLogger(StartupSequencer.class.getName()).log(
+ Level.SEVERE, null, ex);
+ throw new IdropRuntimeException(ex);
+ }
+ }
+
+ private String deriveConfigHomeDirectory() {
+ log.info("determine config root directory");
+ String userHomeDirectory = System.getProperty("user.home");
+ StringBuilder sb = new StringBuilder();
+ sb.append(userHomeDirectory);
+ sb.append("/.idrop");
+ String derivedConfigHomeDirectory = sb.toString();
+ log.info("set config home directory as: {}", derivedConfigHomeDirectory);
+ return derivedConfigHomeDirectory;
+ }
+
/**
- * Start up iDrop as a system tray application. This is the main entry point
- * for iDrop
- *
- * @param args
- * the command line arguments
+ * Start up iDrop as a system tray application. This is the main entry point for iDrop
+ *
+ * @param args the command line arguments
*/
public static void main(final String args[]) throws InterruptedException {
StartupSequencer startupSequencer = new StartupSequencer();
@@ -314,26 +345,4 @@ public class StartupSequencer {
System.exit(1);
}
}
-
- private void doFirstTimeConfigurationWizard() {
- log.info("doFirstTimeConfigurationWizard()..do I show");
- // there is a force.no.synch property in idrop.properties that prevents
- // synch from coming up if in the build that way
-
- if (idropCore.getIdropConfig().isShowStartupWizard()) {
- log.info("doing setup wizard");
- // idrop will be visible, don't z fight and declutter for wizard...s
- idrop.setVisible(false);
- SetupWizard setupWizard = new SetupWizard(idrop, true);
- setupWizard.toFront();
- final Toolkit toolkit = Toolkit.getDefaultToolkit();
- final Dimension screenSize = toolkit.getScreenSize();
- final int x = (screenSize.width - setupWizard.getWidth()) / 2;
- final int y = (screenSize.height - setupWizard.getHeight()) / 2;
- setupWizard.setLocation(x, y);
-
- setupWizard.setVisible(true);
- idrop.setVisible(true);
- }
- }
}
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropConfigurationService.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropConfigurationService.java
index 51c22ad..25742ca 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropConfigurationService.java
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropConfigurationService.java
@@ -4,7 +4,6 @@ import java.util.Properties;
import org.irods.jargon.core.connection.IRODSAccount;
import org.irods.jargon.core.connection.JargonProperties;
import org.irods.jargon.core.exception.JargonException;
-
import org.irods.jargon.idrop.exceptions.IdropException;
import org.irods.jargon.transfer.dao.domain.Synchronization;
import org.irods.jargon.transfer.engine.synch.ConflictingSynchException;
@@ -15,6 +14,11 @@ import org.irods.jargon.transfer.engine.synch.ConflictingSynchException;
*/
public interface IdropConfigurationService {
+ public static final String IDROP_VERSION_FILE_NAME = ".idropVersion";
+
+ public static final String VERSION_3_1 = "3.1.0.0";
+
+ public static final String VERSION_NUMBER = "idrop.version";
public static final String IDROP_PROPS_FILE_NAME = "idrop.properties";
public static final String FORCE_MODE = "force.mode";
public static final String FORCE_NO_SYNCH = "force.no.synch";
@@ -51,7 +55,7 @@ public interface IdropConfigurationService {
public static final String IRODS_IO_PUT_BUFFER_SIZE = "jargon.put.buffer.size";
public static final String IRODS_IO_GET_BUFFER_SIZE = "jargon.get.buffer.size";
- Properties bootstrapConfiguration() throws IdropException;
+ Properties bootstrapConfigurationAndMergePropertiesFromLocalAndClasspath() throws IdropException;
/**
* Save the database configuration information to a properties file
@@ -104,4 +108,6 @@ public interface IdropConfigurationService {
* @throws JargonException
*/
void restoreIDROPConfigFromJargonProperties(final JargonProperties jargonProperties) throws JargonException;
+
+
}
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropConfigurationServiceImpl.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropConfigurationServiceImpl.java
index 1080911..bcf066f 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropConfigurationServiceImpl.java
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropConfigurationServiceImpl.java
@@ -1,8 +1,6 @@
package org.irods.jargon.idrop.desktop.systraygui.services;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
+import java.io.*;
import java.util.Date;
import java.util.Properties;
import java.util.logging.Level;
@@ -11,8 +9,6 @@ import org.irods.jargon.core.connection.IRODSAccount;
import org.irods.jargon.core.connection.JargonProperties;
import org.irods.jargon.core.connection.SettableJargonProperties;
import org.irods.jargon.core.exception.JargonException;
-import org.irods.jargon.core.packinstr.TransferOptions;
-
import org.irods.jargon.idrop.desktop.systraygui.IDROPCore;
import org.irods.jargon.idrop.desktop.systraygui.utils.IdropConfig;
import org.irods.jargon.idrop.desktop.systraygui.utils.IdropPropertiesHelper;
@@ -24,7 +20,6 @@ import org.irods.jargon.transfer.TransferServiceFactoryImpl;
import org.irods.jargon.transfer.dao.domain.ConfigurationProperty;
import org.irods.jargon.transfer.dao.domain.Synchronization;
import org.irods.jargon.transfer.engine.ConfigurationService;
-import org.irods.jargon.transfer.engine.TransferEngineConfigurationProperties;
import org.irods.jargon.transfer.engine.synch.ConflictingSynchException;
import org.irods.jargon.transfer.engine.synch.SynchException;
import org.irods.jargon.transfer.engine.synch.SynchManagerService;
@@ -78,8 +73,9 @@ public class IdropConfigurationServiceImpl implements IdropConfigurationService
}
}
+
@Override
- public Properties bootstrapConfiguration() throws IdropException {
+ public Properties bootstrapConfigurationAndMergePropertiesFromLocalAndClasspath() throws IdropException {
log.info("bootstrapConfiguratiion()\nlooking for properties in database");
Properties databaseProperties;
Properties configFileProperties;
@@ -425,4 +421,6 @@ public class IdropConfigurationServiceImpl implements IdropConfigurationService
log.info("synch saved");
}
+
+
}
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropPreDatabaseBootstrapperService.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropPreDatabaseBootstrapperService.java
new file mode 100644
index 0000000..2460583
--- /dev/null
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropPreDatabaseBootstrapperService.java
@@ -0,0 +1,45 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.irods.jargon.idrop.desktop.systraygui.services;
+
+import org.irods.jargon.idrop.exceptions.IdropException;
+
+/**
+ *
+ * @author mikeconway
+ */
+public interface IdropPreDatabaseBootstrapperService {
+ /**
+ * Given the idrop home directory (the location of the .idrop config directory for a given user),
+ * see if an indicator exists that shows the current version of iDrop. This will be null if not found.
+ * <p/>
+ * This value can be used to determine any migration strategy for new versions of iDrop.
+ * @param idropHomeDir <code>String</code> with the absolute path to the .idrop directory in the users home directory
+ * @return <code>String</code> containing the existing version of iDrop deployed, or <code>null</code> if no prior version exists.
+ * @throws IdropException
+ */
+ String detectPriorVersion(final String idropHomeDir) throws IdropException;
+
+ /**
+ * Store a version number into the proper prior version file in the .idrop configuration directory. This is used to
+ * compare the current version of the code with any existing configuration/data to trigger any necessary migrations
+ * @param idropHomeDir <code>String</code> with the absolute path to the .idrop directory in the users home directory
+ * @param desiredVersionString <code>String</code> containing the existing version of iDrop deployed
+ * @throws IdropException
+ */
+ void storePriorVersion(final String idropHomeDir, final String desiredVersionString) throws IdropException;
+
+ /**
+ * Given the prior version contained in any existing properties file (can be null), the current version (in the classpath
+ * properties), and the target iDrop home directory, trigger any migration activities required to align the database and
+ * configurations to the new version
+ * @param idropHomeDirectory <code>String</code> with the required absolute path tot he idrop home directory (typically
+ * this is {user.home}/.idrop
+ * @param priorVersion <code>String</code>, which can be <code>null</code> that points to the previous version of
+ * @param thisVersion <code>String</code> representing the current version number. These are constants kept in the {@link IdropConfigurationService}
+ * @throws IdropException
+ */
+ void triggerMigrations(final String idropHomeDirectory, final String priorVersion, final String thisVersion) throws IdropException;
+}
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropPreDatabaseBootstrapperServiceImpl.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropPreDatabaseBootstrapperServiceImpl.java
new file mode 100644
index 0000000..0f4f4a8
--- /dev/null
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropPreDatabaseBootstrapperServiceImpl.java
@@ -0,0 +1,196 @@
+package org.irods.jargon.idrop.desktop.systraygui.services;
+
+import java.io.*;
+import java.util.Properties;
+import org.irods.jargon.idrop.desktop.systraygui.utils.IdropPropertiesHelper;
+import org.irods.jargon.idrop.exceptions.IdropException;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Represents an initial bootstrap service that will run before the iDrop database is started. This
+ * can do any pre-load checks and potentially can clear or detect any necessary migrations/exports
+ * before idrop itself starts
+ *
+ * @author Mike Conway - DICE (www.irods.org)
+ */
+public class IdropPreDatabaseBootstrapperServiceImpl implements IdropPreDatabaseBootstrapperService {
+
+ private static final org.slf4j.Logger log = LoggerFactory.getLogger(IdropPreDatabaseBootstrapperServiceImpl.class);
+
+ @Override
+ public String detectPriorVersion(final String idropHomeDir) throws IdropException {
+
+ log.info("detectPriorVersion()");
+
+ if (idropHomeDir == null || idropHomeDir.isEmpty()) {
+ throw new IllegalArgumentException("null or empty idropHomeDir");
+ }
+
+ String priorVersion = null;
+
+ log.info("home dir is:{}", idropHomeDir);
+
+ File versionFile = new File(idropHomeDir, IdropConfigurationService.IDROP_VERSION_FILE_NAME);
+ if (versionFile.exists()) {
+ log.debug("prior version exists...");
+ try {
+ priorVersion = readFileAsString(versionFile.getAbsolutePath()).trim();
+ } catch (IOException ex) {
+ log.error("error reading prior version file", ex);
+ throw new IdropException("Unable to read prior version file", ex);
+ }
+ }
+
+ return priorVersion;
+
+ }
+
+ @Override
+ public void storePriorVersion(final String idropHomeDir, final String desiredVersionString) throws IdropException {
+
+ log.info("storePriorVersion()");
+
+ if (idropHomeDir == null || idropHomeDir.isEmpty()) {
+ throw new IllegalArgumentException("null or empty idropHomeDir");
+ }
+
+ if (desiredVersionString == null || desiredVersionString.isEmpty()) {
+ throw new IllegalArgumentException("null or empty desiredVersionString");
+ }
+
+ log.info("home dir is:{}", idropHomeDir);
+ log.info("desired version string is:{}", desiredVersionString);
+
+ /*
+ * wipe out the previous version file and replace
+ */
+ File versionFile = new File(idropHomeDir, IdropConfigurationService.IDROP_VERSION_FILE_NAME);
+ versionFile.delete();
+
+ try {
+ versionFile.createNewFile();
+ PrintWriter out = new PrintWriter(versionFile.getAbsolutePath());
+ out.println(desiredVersionString.trim());
+ out.flush();
+ out.close();
+ } catch (Exception ex) {
+ log.error("error reading prior version file", ex);
+ throw new IdropException("Unable to read prior version file", ex);
+ }
+ }
+
+ /**
+ * delete and make an empty .idrop directory in the given location
+ *
+ * @param idropHomeDir
+ * <code>String</code> with the absolute path to the .idrop directory in the users home
+ * directory
+ * @throws IdropException
+ */
+ private void reinitializeIdropConfigData(final String idropHomeDir) throws IdropException {
+
+ log.info("reinitializeIdropConfigData()");
+
+ if (idropHomeDir == null || idropHomeDir.isEmpty()) {
+ throw new IllegalArgumentException("null or empty idropHomeDir");
+ }
+
+ log.info("idropHomeDir:{}...deleting to reinitialize...", idropHomeDir);
+ File homeDirFile = new File(idropHomeDir);
+ deleteChildDirsAndDir(idropHomeDir);
+ homeDirFile.mkdirs();
+ log.info("home dir initialized");
+ }
+
+ @Override
+ public void triggerMigrations(final String idropHomeDirectory, final String priorVersion, final String thisVersion) throws IdropException {
+
+ log.info("triggerMigrations()");
+
+ if (idropHomeDirectory == null || idropHomeDirectory.isEmpty()) {
+ throw new IllegalArgumentException("idropHomeDirectory is null or empty");
+ }
+
+ if (thisVersion == null || thisVersion.isEmpty()) {
+ throw new IllegalArgumentException("null or empty thisVersion");
+ }
+
+ /**
+ * Right now the only migration is from the point of 3.1 where we started keeping version
+ * numbers
+ */
+ if (priorVersion == null && thisVersion.equals(IdropConfigurationService.VERSION_3_1)) {
+ log.warn("migrating to 3.1 from prior version.clear out old database");
+ reinitializeIdropConfigData(idropHomeDirectory);
+ }
+
+ log.info("migration done");
+
+ }
+
+ /**
+ * Load the default idrop properties from the classpath
+ *
+ * @return
+ * <code>Properties</code> of idrop as in the provided class path
+ * @throws IdropException
+ */
+ private Properties getDefaultIdropProperties() throws IdropException {
+ log.info("getDefaultIdropProperties");
+ IdropPropertiesHelper idropPropertiesHelper = new IdropPropertiesHelper();
+ return idropPropertiesHelper.loadIdropProperties();
+ }
+
+ /**
+ * Given a file path, read the contents of that file into a String value
+ *
+ * @param filePath
+ * @return
+ * @throws java.io.IOException
+ */
+ private static String readFileAsString(String filePath)
+ throws java.io.IOException {
+ StringBuilder fileData = new StringBuilder();
+ BufferedReader reader = new BufferedReader(
+ new FileReader(filePath));
+ char[] buf = new char[1024];
+ int numRead = 0;
+ while ((numRead = reader.read(buf)) != -1) {
+ String readData = String.valueOf(buf, 0, numRead);
+ fileData.append(readData);
+ buf = new char[1024];
+ }
+ reader.close();
+ return fileData.toString();
+ }
+
+ private static void deleteChildDirsAndDir(String absolutePath) throws IdropException {
+ if (absolutePath == null || absolutePath.isEmpty()) {
+ throw new IllegalArgumentException("null or empty absolutepath");
+ }
+
+ // a little sanity check
+ if (absolutePath.length() <= 6) {
+ throw new IllegalArgumentException("path is too short, I shouldn't delete this");
+ }
+
+ File delFile = new File(absolutePath);
+ try {
+ delete(delFile);
+ } catch (IOException ex) {
+ log.error("error on delete of files under {}", absolutePath);
+ throw new IdropException("error on delete", ex);
+ }
+ }
+
+ private static void delete(File f) throws IOException {
+ if (f.isDirectory()) {
+ for (File c : f.listFiles()) {
+ delete(c);
+ }
+ }
+ if (!f.delete()) {
+ throw new FileNotFoundException("Failed to delete file: " + f);
+ }
+ }
+}
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/utils/IdropPropertiesHelper.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/utils/IdropPropertiesHelper.java
index 7e0a3f5..8c2c486 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/utils/IdropPropertiesHelper.java
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/utils/IdropPropertiesHelper.java
@@ -13,7 +13,6 @@ import org.irods.jargon.idrop.exceptions.IdropException;
*/
public class IdropPropertiesHelper {
-
public static final String LOGIN_PRESET = "login.preset";
public static final String LOGIN_PRESET_HOST = "login.preset.host";
public static final String LOGIN_PRESET_PORT = "login.preset.port";
@@ -25,7 +24,7 @@ public class IdropPropertiesHelper {
public static final String ROLLING_LOG_LEVEL = "rolling.log.level";
/**
- * Load the default iDrop poperties file
+ * Load the default iDrop properties file
*
* @return
* @throws IdropException
@@ -49,4 +48,5 @@ public class IdropPropertiesHelper {
return properties;
}
+
}
diff --git a/idrop-swing/src/main/resources/idrop.properties b/idrop-swing/src/main/resources/idrop.properties
index e299f75..ce5d671 100644
--- a/idrop-swing/src/main/resources/idrop.properties
+++ b/idrop-swing/src/main/resources/idrop.properties
@@ -1,3 +1,4 @@
+idrop.version=3.1.0.0
policy.aware=false
login.preset=false
force.mode=false
@@ -9,10 +10,10 @@ idrop.show.gui=true
# swing look and feel (Nimbus, GTK, System, Metal, Motif)
idrop.lookandfeel=System
transfer.database=transferDatabase
-login.preset.host=diamond.ils.unc.edu
-login.preset.zone=lifelibZone
-login.preset.resource=lifelibResc1
-login.preset.port=2247
+#login.preset.host=diamond.ils.unc.edu
+#login.preset.zone=lifelibZone
+#login.preset.resource=lifelibResc1
+#login.preset.port=2247
device.name=
transferengine.record.successful.files=true
diff --git a/idrop-swing/src/test/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropConfigurationServiceTest.java b/idrop-swing/src/test/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropConfigurationServiceTest.java
index 737fe82..cd1c6df 100644
--- a/idrop-swing/src/test/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropConfigurationServiceTest.java
+++ b/idrop-swing/src/test/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropConfigurationServiceTest.java
@@ -1,18 +1,14 @@
package org.irods.jargon.idrop.desktop.systraygui.services;
import java.util.Properties;
-
import junit.framework.Assert;
+import junit.framework.TestCase;
import org.irods.jargon.idrop.desktop.systraygui.IDROPCore;
import org.irods.jargon.testutils.TestingPropertiesHelper;
import org.irods.jargon.testutils.filemanip.ScratchFileUtils;
import org.irods.jargon.transfer.TransferServiceFactoryImpl;
import org.irods.jargon.transfer.engine.ConfigurationService;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.*;
/**
*
@@ -64,7 +60,7 @@ public class IdropConfigurationServiceTest {
Properties testProps = new Properties();
testProps.put(testPropKey, testPropVal);
configurationService.importProperties(testProps);
- Properties myProps = idropConfigurationService.bootstrapConfiguration();
+ Properties myProps = idropConfigurationService.bootstrapConfigurationAndMergePropertiesFromLocalAndClasspath();
Assert.assertNotNull("null props returned", myProps);
Assert.assertEquals(testPropVal, myProps.get(testPropKey));
}
@@ -73,10 +69,11 @@ public class IdropConfigurationServiceTest {
public void testBootstrapConfigurationWhenPropsInClasspath() throws Exception {
Properties testProps = new Properties();
configurationService.importProperties(testProps);
- Properties myProps = idropConfigurationService.bootstrapConfiguration();
+ Properties myProps = idropConfigurationService.bootstrapConfigurationAndMergePropertiesFromLocalAndClasspath();
Assert.assertNotNull("null props returned", myProps);
Assert.assertFalse("props shold not be empty will be loaded from classpath", myProps.isEmpty());
Assert.assertNotNull("should have loaded props from classpath", myProps.get("login.preset"));
}
+
}
diff --git a/idrop-swing/src/test/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropPreDatabaseBootstrapperServiceImplTest.java b/idrop-swing/src/test/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropPreDatabaseBootstrapperServiceImplTest.java
new file mode 100644
index 0000000..43ba3ac
--- /dev/null
+++ b/idrop-swing/src/test/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropPreDatabaseBootstrapperServiceImplTest.java
@@ -0,0 +1,81 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.irods.jargon.idrop.desktop.systraygui.services;
+
+import java.util.Properties;
+import junit.framework.TestCase;
+import org.irods.jargon.idrop.desktop.systraygui.IDROPCore;
+import org.irods.jargon.testutils.TestingPropertiesHelper;
+import org.irods.jargon.testutils.filemanip.ScratchFileUtils;
+import org.irods.jargon.transfer.TransferServiceFactoryImpl;
+import org.irods.jargon.transfer.engine.ConfigurationService;
+import org.junit.*;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author mikeconway
+ */
+public class IdropPreDatabaseBootstrapperServiceImplTest {
+
+ private static ConfigurationService configurationService;
+ private static Properties testingProperties = new Properties();
+ private static TestingPropertiesHelper testingPropertiesHelper = new TestingPropertiesHelper();
+ private static ScratchFileUtils scratchFileUtils = null;
+ private static final String TESTING_SUBDIR = "IdropPreDatabaseBootstrapperServiceImplTest";
+ private static IdropPreDatabaseBootstrapperService preDatabaseBootstrapperService;
+
+ public IdropPreDatabaseBootstrapperServiceImplTest() {
+ }
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ TestingPropertiesHelper testingPropertiesLoader = new TestingPropertiesHelper();
+ testingProperties = testingPropertiesLoader.getTestProperties();
+ scratchFileUtils = new ScratchFileUtils(testingProperties);
+ scratchFileUtils.clearAndReinitializeScratchDirectory(TESTING_SUBDIR);
+ preDatabaseBootstrapperService = new IdropPreDatabaseBootstrapperServiceImpl();
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() {
+ }
+
+ @After
+ public void tearDown() {
+ }
+
+ @Test
+ public void testDetectPriorVersionWhenSet() throws Exception {
+ String testIdropSubdir = "testDetectPriorVersionWhenNoPriorVersion";
+ String version = "3.1.0";
+ String absPath = scratchFileUtils.createAndReturnAbsoluteScratchPath(TESTING_SUBDIR);
+ preDatabaseBootstrapperService.storePriorVersion(absPath, version);
+ String returnedVersion = preDatabaseBootstrapperService.detectPriorVersion(absPath);
+ TestCase.assertEquals("did not get same version I set", version, returnedVersion);
+ }
+
+ @Test
+ public void testDetectPriorVersionWhenNotSet() throws Exception {
+ String testIdropSubdir = "testDetectPriorVersionWhenNotSet";
+ String absPath = scratchFileUtils.createAndReturnAbsoluteScratchPath(TESTING_SUBDIR);
+ String returnedVersion = preDatabaseBootstrapperService.detectPriorVersion(absPath);
+ TestCase.assertNull("should not get a version back", returnedVersion);
+ }
+
+ @Test(expected=IllegalArgumentException.class)
+ public void testStoreVersionNullFile() throws Exception {
+ preDatabaseBootstrapperService.storePriorVersion(null, "xx");
+ }
+
+ @Test(expected=IllegalArgumentException.class)
+ public void testStoreVersionBlankVersion() throws Exception {
+ preDatabaseBootstrapperService.storePriorVersion("xx", "");
+ }
+}
diff --git a/idrop-swing/src/test/java/org/irods/jargon/idrop/desktop/unittest/AllTests.java b/idrop-swing/src/test/java/org/irods/jargon/idrop/desktop/unittest/AllTests.java
index 9817b2e..3b065e5 100644
--- a/idrop-swing/src/test/java/org/irods/jargon/idrop/desktop/unittest/AllTests.java
+++ b/idrop-swing/src/test/java/org/irods/jargon/idrop/desktop/unittest/AllTests.java
@@ -5,14 +5,10 @@
package org.irods.jargon.idrop.desktop.unittest;
import org.irods.jargon.idrop.desktop.systraygui.services.IdropConfigurationServiceTest;
+import org.irods.jargon.idrop.desktop.systraygui.services.IdropPreDatabaseBootstrapperServiceImplTest;
import org.irods.jargon.idrop.desktop.systraygui.utils.IdropPropertiesHelperTest;
import org.irods.jargon.idrop.desktop.systraygui.utils.LocalFileUtilsTest;
-import org.irods.jargon.idrop.desktop.systraygui.viscomponents.FileSystemModelTest;
-import org.irods.jargon.idrop.desktop.systraygui.viscomponents.IRODSSearchTableModelTest;
-import org.irods.jargon.idrop.desktop.systraygui.viscomponents.LocalFileSystemModelTest;
-import org.irods.jargon.idrop.desktop.systraygui.viscomponents.MetadataTableModelTest;
-import org.irods.jargon.idrop.desktop.systraygui.viscomponents.QueueManagerDetailTableModelTest;
-import org.irods.jargon.idrop.desktop.systraygui.viscomponents.QueueManagerMasterTableModelTest;
+import org.irods.jargon.idrop.desktop.systraygui.viscomponents.*;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@@ -20,7 +16,7 @@ import org.junit.runners.Suite;
@Suite.SuiteClasses({ IdropPropertiesHelperTest.class, LocalFileUtilsTest.class,
FileSystemModelTest.class, IRODSSearchTableModelTest.class,
LocalFileSystemModelTest.class, MetadataTableModelTest.class,
- QueueManagerDetailTableModelTest.class, QueueManagerMasterTableModelTest.class, IdropConfigurationServiceTest.class
+ QueueManagerDetailTableModelTest.class, QueueManagerMasterTableModelTest.class, IdropPreDatabaseBootstrapperServiceImplTest.class,IdropConfigurationServiceTest.class
})
public class AllTests {
diff --git a/idrop-swing/src/test/resources/testing.properties b/idrop-swing/src/test/resources/testing.properties
index 8c79b7a..426e454 100644
--- a/idrop-swing/src/test/resources/testing.properties
+++ b/idrop-swing/src/test/resources/testing.properties
@@ -23,7 +23,7 @@ test.confirm=true
# test.data.directory=/temp/irodsscratch/ - unix example
# test.data.directory=C:/projects/eclipse_workspace/jargon-svn/target/scratch/ - windows example
-test.data.directory=/Users/mikeconway/temp/irodsscratch/
+test.data.directory=/Users/mikeconway/temp/idropscratch/
#test.data.directory=/tmp
# properties that point to a local IRODS that can be badly mangled by various tests
test.irods.admin=rods