From 06629c9fb1e264d07df18caf32a5d26b45fe402d Mon Sep 17 00:00:00 2001 From: cramakri <cramakri> Date: Fri, 27 Jul 2012 09:18:36 +0000 Subject: [PATCH] BIS-38 SP-204 : Changes to make the DataSetAndPathInfoDBConsistencyCheckProcessingPlugin more easily testable SVN: 26236 --- ...nfoDBConsistencyCheckProcessingPlugin.java | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/standard/DataSetAndPathInfoDBConsistencyCheckProcessingPlugin.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/standard/DataSetAndPathInfoDBConsistencyCheckProcessingPlugin.java index e12e6c35061..b20e20712a7 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/standard/DataSetAndPathInfoDBConsistencyCheckProcessingPlugin.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/standard/DataSetAndPathInfoDBConsistencyCheckProcessingPlugin.java @@ -55,7 +55,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.DatasetDescription; public class DataSetAndPathInfoDBConsistencyCheckProcessingPlugin implements IProcessingPluginTask { - private static final Logger log = LogFactory.getLogger(LogCategory.OPERATION, + private static final Logger operationLog = LogFactory.getLogger(LogCategory.OPERATION, DataSetAndPathInfoDBConsistencyCheckProcessingPlugin.class); private transient IHierarchicalContentProvider fileProvider; @@ -69,6 +69,21 @@ public class DataSetAndPathInfoDBConsistencyCheckProcessingPlugin implements IPr { } + /** + * A package visible constructor for testing purposes. + * + * @param properties The configuration properties. + * @param storeRoot The root of the dss store. + * @param fileProvider The hierarchical content provider that references the file system. + * @param pathInfoProvider The hierarchical content provider that references the path-info db. + */ + DataSetAndPathInfoDBConsistencyCheckProcessingPlugin(Properties properties, File storeRoot, + IHierarchicalContentProvider fileProvider, IHierarchicalContentProvider pathInfoProvider) + { + this.fileProvider = fileProvider; + this.pathInfoProvider = pathInfoProvider; + } + @Override public ProcessingStatus process(List<DatasetDescription> datasets, DataSetProcessingContext context) @@ -105,7 +120,7 @@ public class DataSetAndPathInfoDBConsistencyCheckProcessingPlugin implements IPr } catch (Exception e) { - log.error( + operationLog.error( "Couldn't check consistency of the file system and the path info database for a data set: " + dataset.getDataSetCode(), e); status.addDatasetStatus( @@ -418,8 +433,8 @@ public class DataSetAndPathInfoDBConsistencyCheckProcessingPlugin implements IPr public String getDescription() { return "'" + getPath() + "' CRC32 checksum in the file system = " - + IOUtilities.crc32ToString(checksumInFS) - + " but in the path info database = " + IOUtilities.crc32ToString(checksumInDB); + + IOUtilities.crc32ToString(checksumInFS) + " but in the path info database = " + + IOUtilities.crc32ToString(checksumInDB); } } -- GitLab