From c683b4d967697484daf2de6cc28a8407dd3ed0bb Mon Sep 17 00:00:00 2001 From: ribeaudc <ribeaudc> Date: Mon, 26 May 2008 20:30:56 +0000 Subject: [PATCH] [DMV-15] change: - Remove dots from properties. - Allow properties to be overwritten by command line parameters. add: - More Unit tests. SVN: 6310 --- .../cisd/common/highwatermark/FileWithHighwaterMark.java | 4 +++- .../cisd/common/highwatermark/FileWithHighwaterMarkTest.java | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/common/source/java/ch/systemsx/cisd/common/highwatermark/FileWithHighwaterMark.java b/common/source/java/ch/systemsx/cisd/common/highwatermark/FileWithHighwaterMark.java index 92fe45ab73e..43d618498a3 100644 --- a/common/source/java/ch/systemsx/cisd/common/highwatermark/FileWithHighwaterMark.java +++ b/common/source/java/ch/systemsx/cisd/common/highwatermark/FileWithHighwaterMark.java @@ -35,6 +35,8 @@ import ch.systemsx.cisd.common.utilities.PropertyUtils; public final class FileWithHighwaterMark extends AbstractHashable implements Serializable { + static final String SEP = "-"; + public static final int DEFAULT_HIGHWATER_MARK = -1; private static final long serialVersionUID = 1L; @@ -82,7 +84,7 @@ public final class FileWithHighwaterMark extends AbstractHashable implements Ser assert StringUtils.isNotBlank(filePropertyKey) : "File property key is blank"; final String filePath = PropertyUtils.getMandatoryProperty(properties, filePropertyKey); final long highwaterMarkInKb = - PropertyUtils.getLong(properties, filePropertyKey.concat(".").concat( + PropertyUtils.getLong(properties, filePropertyKey.concat(SEP).concat( HIGHWATER_MARK_PROPERTY_KEY), -1L); return new FileWithHighwaterMark(new File(filePath), highwaterMarkInKb); } diff --git a/common/sourceTest/java/ch/systemsx/cisd/common/highwatermark/FileWithHighwaterMarkTest.java b/common/sourceTest/java/ch/systemsx/cisd/common/highwatermark/FileWithHighwaterMarkTest.java index c72ce214cb0..7c49ac89eb2 100644 --- a/common/sourceTest/java/ch/systemsx/cisd/common/highwatermark/FileWithHighwaterMarkTest.java +++ b/common/sourceTest/java/ch/systemsx/cisd/common/highwatermark/FileWithHighwaterMarkTest.java @@ -64,13 +64,13 @@ public final class FileWithHighwaterMarkTest assertEquals(new File(path), fileWithHighwaterMark.getFile()); assertEquals(-1, fileWithHighwaterMark.getHighwaterMark()); // 100Kb - properties.setProperty(filePropertyKey + "." + properties.setProperty(filePropertyKey + FileWithHighwaterMark.SEP + FileWithHighwaterMark.HIGHWATER_MARK_PROPERTY_KEY, "100"); fileWithHighwaterMark = FileWithHighwaterMark.fromProperties(properties, filePropertyKey); assertEquals(new File(path), fileWithHighwaterMark.getFile()); assertEquals(100, fileWithHighwaterMark.getHighwaterMark()); // Meaningless value - properties.setProperty(filePropertyKey + "." + properties.setProperty(filePropertyKey + FileWithHighwaterMark.SEP + FileWithHighwaterMark.HIGHWATER_MARK_PROPERTY_KEY, "notANumber"); fileWithHighwaterMark = FileWithHighwaterMark.fromProperties(properties, filePropertyKey); assertEquals(new File(path), fileWithHighwaterMark.getFile()); -- GitLab