From d7db78d9e86ec3cb1fe3709981d3b76704eb86b4 Mon Sep 17 00:00:00 2001 From: Roger Ferrel Date: Wed, 14 Aug 2013 10:22:02 -0500 Subject: [PATCH] Issue #2224 Bug fixes to pass unit test. Change-Id: I6f1c5721afaab21ade5a7f780ba92ca7b4ea8a00 Former-commit-id: 3569155bc0fe4260bf5abbecd2cf3121805bac75 [formerly 3a7e798e473e90de6fe4e6f50c645ecce5a37c51] Former-commit-id: ac538a04765ae472b4d8cb209b3e222384da5b36 --- .../common/archive/config/CategoryDataSet.java | 17 +++++++++-------- .../uf/common/archive/config/DisplayData.java | 7 +++++-- .../base/archiver/purger/PROCESSED_DATA.xml | 10 +++++----- .../base/archiver/purger/RAW_DATA.xml | 9 +++++++-- .../archive/ArchiveConfigManagerTest.java | 14 ++++++-------- 5 files changed, 32 insertions(+), 25 deletions(-) diff --git a/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/config/CategoryDataSet.java b/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/config/CategoryDataSet.java index 4a68ab7714..91f61d4b45 100644 --- a/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/config/CategoryDataSet.java +++ b/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/config/CategoryDataSet.java @@ -92,7 +92,7 @@ public class CategoryDataSet { private String filePattern; @XmlElement(name = "timeType") - private TimeType timeType; + private TimeType timeType = TimeType.Date; /** * The display label. @@ -197,12 +197,11 @@ public class CategoryDataSet { } /** - * Get time stamp for file based on timetype. Assumes file path matches + * Get time stamp for file based on time type. * * @param timeIndices * @param matcher - * @param file - * @return + * @return fileTime */ public Long getMatchTimeInMilliseconds(int[] timeIndices, Matcher matcher) { return CategoryDataSet.getMatchTimeInMilliseconds(timeType, @@ -210,13 +209,15 @@ public class CategoryDataSet { } /** - * Get file time based on time type. + * Get file time based on time type. Assumes the matcher is set up matching + * a file's path name so the groups in the matcher can be used to get the + * time stamp. * * @param timeType * @param timeIndices * @param matcher - * @param file - * @return fileTime + * @return fileTime or null if time type does not get time using the + * matcher. */ public static Long getMatchTimeInMilliseconds( CategoryDataSet.TimeType timeType, int[] timeIndices, @@ -265,7 +266,7 @@ public class CategoryDataSet { public String toString() { StringBuilder sb = new StringBuilder("DataSet[ "); sb.append("TimeType: ").append(getTimeType()); - sb.append("dateGroupIndices: ").append(getDateGroupIndices()); + sb.append(", dateGroupIndices: ").append(getDateGroupIndices()); sb.append(", isDirOnly: ").append(isDirOnly()); sb.append(", displayLabel: ").append(getDisplayLabel()); sb.append(", dirPatterns[ "); diff --git a/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/config/DisplayData.java b/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/config/DisplayData.java index e5cb689683..3660db4578 100644 --- a/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/config/DisplayData.java +++ b/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/config/DisplayData.java @@ -75,7 +75,8 @@ public class DisplayData implements Comparable { /** The data's category configuration. */ protected final CategoryConfig categoryConfig; - protected final List dataSets = new ArrayList(); + protected final List dataSets = new ArrayList( + 1); /** The display label for this data. */ protected final String displayLabel; @@ -106,10 +107,12 @@ public class DisplayData implements Comparable { * @param displayLabel */ public DisplayData(ArchiveConfig archiveConfig, - CategoryConfig categoryConfig, CategoryDataSet dataSet, String displayLabel) { + CategoryConfig categoryConfig, CategoryDataSet dataSet, + String displayLabel) { this.archiveConfig = archiveConfig; this.categoryConfig = categoryConfig; this.displayLabel = displayLabel; + this.dataSets.add(dataSet); } /** diff --git a/edexOsgi/com.raytheon.uf.edex.archive/utility/common_static/base/archiver/purger/PROCESSED_DATA.xml b/edexOsgi/com.raytheon.uf.edex.archive/utility/common_static/base/archiver/purger/PROCESSED_DATA.xml index 48b1d5d0d8..2f59c9d30c 100644 --- a/edexOsgi/com.raytheon.uf.edex.archive/utility/common_static/base/archiver/purger/PROCESSED_DATA.xml +++ b/edexOsgi/com.raytheon.uf.edex.archive/utility/common_static/base/archiver/purger/PROCESSED_DATA.xml @@ -153,12 +153,12 @@ Local 168 - + (ldadhydro|ldadmesonet|ldadprofiler|ldad_manual|mesowest|qc) .*(\d{4})-(\d{2})-(\d{2})-(\d{2}).* {1} 2,3,4,5 - + Model @@ -167,7 +167,7 @@ (grid)/(.*)/(.*) {2} 4,5,6,7 - [^/]*-(\d{4})-(\d{2})-(\d{2})-(\d{2})-.* + .*-(\d{4})-(\d{2})-(\d{2})-(\d{2})-.* (modelsounding)/(.*) @@ -196,7 +196,7 @@ (sfcobs)/.* {1} 2,3,4,5 - [^/]*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..* + .*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..* @@ -223,7 +223,7 @@ (acarssounding|bufrua|goessounding|poessounding|profiler) {1} 2,3,4,5 - [^/]*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..* + .*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..* diff --git a/edexOsgi/com.raytheon.uf.edex.archive/utility/common_static/base/archiver/purger/RAW_DATA.xml b/edexOsgi/com.raytheon.uf.edex.archive/utility/common_static/base/archiver/purger/RAW_DATA.xml index 945e0731d6..9c0ea2d1b1 100644 --- a/edexOsgi/com.raytheon.uf.edex.archive/utility/common_static/base/archiver/purger/RAW_DATA.xml +++ b/edexOsgi/com.raytheon.uf.edex.archive/utility/common_static/base/archiver/purger/RAW_DATA.xml @@ -107,13 +107,19 @@ Observation 168 - (acars|airep|airmet|taf) + (airep|airmet|taf) (bufrsigwx|sfcobs)/.* {1} Date 2,3,4,5 [^/]*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..* + + (acars)/(.*) + {1} + [^/]*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..* + finish this + The first looks for files matching the in the directories acars, airep, airmet or taf. The second expects to find the files in subdirectories of bufrsigwx or sfcobs such as bufrsigwx/SWH. @@ -161,7 +167,6 @@ 2,3,4,5 - (airep|binlightning|bufrascat|bufrhdw|bufrmthdw|bufrssmi|idft|lsr|MAROB|maritime|metar|misc_sfc_obs|pirep|sfcobs|shef|svrwx|synoptic)/(\d{4})(\d{2})(\d{2})/(\d{2}) (acars)/(.*)/(\d{4})(\d{2})(\d{2})/(\d{2}) {1} - {2} 3,4,5,6 diff --git a/tests/unit/com/raytheon/uf/common/archive/ArchiveConfigManagerTest.java b/tests/unit/com/raytheon/uf/common/archive/ArchiveConfigManagerTest.java index b813cd2dab..f70e3bb98b 100644 --- a/tests/unit/com/raytheon/uf/common/archive/ArchiveConfigManagerTest.java +++ b/tests/unit/com/raytheon/uf/common/archive/ArchiveConfigManagerTest.java @@ -40,7 +40,6 @@ import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.filefilter.FileFilterUtils; import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import com.raytheon.uf.common.archive.config.ArchiveConfig; @@ -71,7 +70,6 @@ import com.raytheon.uf.common.util.TestUtil; * @author bgonzale * @version 1.0 */ -@Ignore public class ArchiveConfigManagerTest { private static final String RAW = "Raw"; @@ -189,22 +187,22 @@ public class ArchiveConfigManagerTest { // **** binlightning **** MessageFormat binlightningFormat_Raw = new MessageFormat( "/binlightning/{0}{1}{2}/{3}/SFUS41_KWBC_{6}{7}{8}_22725485.nldn.{4}{5}{6}{7}"); - createTestFiles(binlightningFormat_Raw, archiveRaw, "Misc", false, - archiveStart, archiveEnd); + createTestFiles(binlightningFormat_Raw, archiveRaw, "Observation", + false, archiveStart, archiveEnd); MessageFormat binlightningFormat_Processed = new MessageFormat( "/binlightning/binlightning-{4}-{5}-{6}-{7}.h5"); - createTestFiles(binlightningFormat_Processed, archiveProcessed, "Misc", - false, archiveStart, archiveEnd); + createTestFiles(binlightningFormat_Processed, archiveProcessed, + "Observation", false, archiveStart, archiveEnd); // **** bufrsigwx **** MessageFormat bufrsigwxFormat_Raw = new MessageFormat( "/bufrsigwx/{0}{1}{2}/{3}/JUWE96_KKCI_{6}{7}{8}_31368878.bufr.{4}{5}{6}{7}"); - createTestFiles(bufrsigwxFormat_Raw, archiveRaw, "Observation", false, + createTestFiles(bufrsigwxFormat_Raw, archiveRaw, "Products", false, archiveStart, archiveEnd); MessageFormat bufrsigwxFormat_Processed = new MessageFormat( "/bufrsigwx/SWH/sigwxCAT-{4}-{5}-{6}-{7}.h5"); createTestFiles(bufrsigwxFormat_Processed, archiveProcessed, - "Observation", false, archiveStart, archiveEnd); + "Products", false, archiveStart, archiveEnd); // create test archive data dir archiveDir = new File(TEST_DIR, TEST_ARCHIVE_DIR);