Issue #2224 Bug fixes to pass unit test.

Change-Id: I6f1c5721afaab21ade5a7f780ba92ca7b4ea8a00

Former-commit-id: ca2bb73e1fd77bc289a106eb7743ee5344be3a52
This commit is contained in:
Roger Ferrel 2013-08-14 10:22:02 -05:00
parent c844396230
commit 87f9cb2fb3
5 changed files with 32 additions and 25 deletions

View file

@ -92,7 +92,7 @@ public class CategoryDataSet {
private String filePattern; private String filePattern;
@XmlElement(name = "timeType") @XmlElement(name = "timeType")
private TimeType timeType; private TimeType timeType = TimeType.Date;
/** /**
* The display label. * 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 timeIndices
* @param matcher * @param matcher
* @param file * @return fileTime
* @return
*/ */
public Long getMatchTimeInMilliseconds(int[] timeIndices, Matcher matcher) { public Long getMatchTimeInMilliseconds(int[] timeIndices, Matcher matcher) {
return CategoryDataSet.getMatchTimeInMilliseconds(timeType, 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 timeType
* @param timeIndices * @param timeIndices
* @param matcher * @param matcher
* @param file * @return fileTime or null if time type does not get time using the
* @return fileTime * matcher.
*/ */
public static Long getMatchTimeInMilliseconds( public static Long getMatchTimeInMilliseconds(
CategoryDataSet.TimeType timeType, int[] timeIndices, CategoryDataSet.TimeType timeType, int[] timeIndices,
@ -265,7 +266,7 @@ public class CategoryDataSet {
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder("DataSet[ "); StringBuilder sb = new StringBuilder("DataSet[ ");
sb.append("TimeType: ").append(getTimeType()); sb.append("TimeType: ").append(getTimeType());
sb.append("dateGroupIndices: ").append(getDateGroupIndices()); sb.append(", dateGroupIndices: ").append(getDateGroupIndices());
sb.append(", isDirOnly: ").append(isDirOnly()); sb.append(", isDirOnly: ").append(isDirOnly());
sb.append(", displayLabel: ").append(getDisplayLabel()); sb.append(", displayLabel: ").append(getDisplayLabel());
sb.append(", dirPatterns[ "); sb.append(", dirPatterns[ ");

View file

@ -75,7 +75,8 @@ public class DisplayData implements Comparable<DisplayData> {
/** The data's category configuration. */ /** The data's category configuration. */
protected final CategoryConfig categoryConfig; protected final CategoryConfig categoryConfig;
protected final List<CategoryDataSet> dataSets = new ArrayList<CategoryDataSet>(); protected final List<CategoryDataSet> dataSets = new ArrayList<CategoryDataSet>(
1);
/** The display label for this data. */ /** The display label for this data. */
protected final String displayLabel; protected final String displayLabel;
@ -106,10 +107,12 @@ public class DisplayData implements Comparable<DisplayData> {
* @param displayLabel * @param displayLabel
*/ */
public DisplayData(ArchiveConfig archiveConfig, public DisplayData(ArchiveConfig archiveConfig,
CategoryConfig categoryConfig, CategoryDataSet dataSet, String displayLabel) { CategoryConfig categoryConfig, CategoryDataSet dataSet,
String displayLabel) {
this.archiveConfig = archiveConfig; this.archiveConfig = archiveConfig;
this.categoryConfig = categoryConfig; this.categoryConfig = categoryConfig;
this.displayLabel = displayLabel; this.displayLabel = displayLabel;
this.dataSets.add(dataSet);
} }
/** /**

View file

@ -153,12 +153,12 @@
<category> <category>
<name>Local</name> <name>Local</name>
<extRetentionHours>168</extRetentionHours> <extRetentionHours>168</extRetentionHours>
<dataset> <dataSet>
<dirPattern>(ldadhydro|ldadmesonet|ldadprofiler|ldad_manual|mesowest|qc)</dirPattern> <dirPattern>(ldadhydro|ldadmesonet|ldadprofiler|ldad_manual|mesowest|qc)</dirPattern>
<filePattern>.*(\d{4})-(\d{2})-(\d{2})-(\d{2}).*</filePattern> <filePattern>.*(\d{4})-(\d{2})-(\d{2})-(\d{2}).*</filePattern>
<displayLabel>{1}</displayLabel> <displayLabel>{1}</displayLabel>
<dateGroupIndices>2,3,4,5</dateGroupIndices> <dateGroupIndices>2,3,4,5</dateGroupIndices>
</dataset> </dataSet>
</category> </category>
<category> <category>
<name>Model</name> <name>Model</name>
@ -167,7 +167,7 @@
<dirPattern>(grid)/(.*)/(.*)</dirPattern> <dirPattern>(grid)/(.*)/(.*)</dirPattern>
<displayLabel>{2}</displayLabel> <displayLabel>{2}</displayLabel>
<dateGroupIndices>4,5,6,7</dateGroupIndices> <dateGroupIndices>4,5,6,7</dateGroupIndices>
<filePattern>[^/]*-(\d{4})-(\d{2})-(\d{2})-(\d{2})-.*</filePattern> <filePattern>.*-(\d{4})-(\d{2})-(\d{2})-(\d{2})-.*</filePattern>
</dataSet> </dataSet>
<dataSet> <dataSet>
<dirPattern>(modelsounding)/(.*)</dirPattern> <dirPattern>(modelsounding)/(.*)</dirPattern>
@ -196,7 +196,7 @@
<dirPattern>(sfcobs)/.*</dirPattern> <dirPattern>(sfcobs)/.*</dirPattern>
<displayLabel>{1}</displayLabel> <displayLabel>{1}</displayLabel>
<dateGroupIndices>2,3,4,5</dateGroupIndices> <dateGroupIndices>2,3,4,5</dateGroupIndices>
<filePattern>[^/]*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..*</filePattern> <filePattern>.*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..*</filePattern>
</dataSet> </dataSet>
</category> </category>
<category> <category>
@ -223,7 +223,7 @@
<dirPattern>(acarssounding|bufrua|goessounding|poessounding|profiler)</dirPattern> <dirPattern>(acarssounding|bufrua|goessounding|poessounding|profiler)</dirPattern>
<displayLabel>{1}</displayLabel> <displayLabel>{1}</displayLabel>
<dateGroupIndices>2,3,4,5</dateGroupIndices> <dateGroupIndices>2,3,4,5</dateGroupIndices>
<filePattern>[^/]*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..*</filePattern> <filePattern>.*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..*</filePattern>
</dataSet> </dataSet>
</category> </category>
<category> <category>

View file

@ -107,13 +107,19 @@
<name>Observation</name> <name>Observation</name>
<extRetentionHours>168</extRetentionHours> <extRetentionHours>168</extRetentionHours>
<dataSet> <dataSet>
<dirPattern>(acars|airep|airmet|taf)</dirPattern> <dirPattern>(airep|airmet|taf)</dirPattern>
<dirPattern>(bufrsigwx|sfcobs)/.*</dirPattern> <dirPattern>(bufrsigwx|sfcobs)/.*</dirPattern>
<displayLabel>{1}</displayLabel> <displayLabel>{1}</displayLabel>
<timeType>Date</timeType> <timeType>Date</timeType>
<dateGroupIndices>2,3,4,5</dateGroupIndices> <dateGroupIndices>2,3,4,5</dateGroupIndices>
<filePattern>[^/]*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..*</filePattern> <filePattern>[^/]*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..*</filePattern>
</dataSet> </dataSet>
<dataSet>
<dirPattern>(acars)/(.*)</dirPattern>
<displayLabel>{1}</displayLabel>
<filePattern>[^/]*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..*</filePattern>
finish this
</dataSet>
</category> </category>
The first <dirPattern> looks for files matching the <filePattern> in the directories acars, airep, airmet or taf. The first <dirPattern> looks for files matching the <filePattern> in the directories acars, airep, airmet or taf.
The second <dirPattern> expects to find the files in subdirectories of bufrsigwx or sfcobs such as bufrsigwx/SWH. The second <dirPattern> expects to find the files in subdirectories of bufrsigwx or sfcobs such as bufrsigwx/SWH.
@ -161,7 +167,6 @@
<dateGroupIndices>2,3,4,5</dateGroupIndices> <dateGroupIndices>2,3,4,5</dateGroupIndices>
</dataSet> </dataSet>
<dataSet> <dataSet>
<dirPattern>(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})</dirPattern>
<dirPattern>(acars)/(.*)/(\d{4})(\d{2})(\d{2})/(\d{2})</dirPattern> <dirPattern>(acars)/(.*)/(\d{4})(\d{2})(\d{2})/(\d{2})</dirPattern>
<displayLabel>{1} - {2}</displayLabel> <displayLabel>{1} - {2}</displayLabel>
<dateGroupIndices>3,4,5,6</dateGroupIndices> <dateGroupIndices>3,4,5,6</dateGroupIndices>

View file

@ -40,7 +40,6 @@ import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.filefilter.FileFilterUtils; import org.apache.commons.io.filefilter.FileFilterUtils;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import com.raytheon.uf.common.archive.config.ArchiveConfig; import com.raytheon.uf.common.archive.config.ArchiveConfig;
@ -71,7 +70,6 @@ import com.raytheon.uf.common.util.TestUtil;
* @author bgonzale * @author bgonzale
* @version 1.0 * @version 1.0
*/ */
@Ignore
public class ArchiveConfigManagerTest { public class ArchiveConfigManagerTest {
private static final String RAW = "Raw"; private static final String RAW = "Raw";
@ -173,22 +171,22 @@ public class ArchiveConfigManagerTest {
// **** binlightning **** // **** binlightning ****
MessageFormat binlightningFormat_Raw = new MessageFormat( MessageFormat binlightningFormat_Raw = new MessageFormat(
"/binlightning/{0}{1}{2}/{3}/SFUS41_KWBC_{6}{7}{8}_22725485.nldn.{4}{5}{6}{7}"); "/binlightning/{0}{1}{2}/{3}/SFUS41_KWBC_{6}{7}{8}_22725485.nldn.{4}{5}{6}{7}");
createTestFiles(binlightningFormat_Raw, archiveRaw, "Misc", false, createTestFiles(binlightningFormat_Raw, archiveRaw, "Observation",
archiveStart, archiveEnd); false, archiveStart, archiveEnd);
MessageFormat binlightningFormat_Processed = new MessageFormat( MessageFormat binlightningFormat_Processed = new MessageFormat(
"/binlightning/binlightning-{4}-{5}-{6}-{7}.h5"); "/binlightning/binlightning-{4}-{5}-{6}-{7}.h5");
createTestFiles(binlightningFormat_Processed, archiveProcessed, "Misc", createTestFiles(binlightningFormat_Processed, archiveProcessed,
false, archiveStart, archiveEnd); "Observation", false, archiveStart, archiveEnd);
// **** bufrsigwx **** // **** bufrsigwx ****
MessageFormat bufrsigwxFormat_Raw = new MessageFormat( MessageFormat bufrsigwxFormat_Raw = new MessageFormat(
"/bufrsigwx/{0}{1}{2}/{3}/JUWE96_KKCI_{6}{7}{8}_31368878.bufr.{4}{5}{6}{7}"); "/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); archiveStart, archiveEnd);
MessageFormat bufrsigwxFormat_Processed = new MessageFormat( MessageFormat bufrsigwxFormat_Processed = new MessageFormat(
"/bufrsigwx/SWH/sigwxCAT-{4}-{5}-{6}-{7}.h5"); "/bufrsigwx/SWH/sigwxCAT-{4}-{5}-{6}-{7}.h5");
createTestFiles(bufrsigwxFormat_Processed, archiveProcessed, createTestFiles(bufrsigwxFormat_Processed, archiveProcessed,
"Observation", false, archiveStart, archiveEnd); "Products", false, archiveStart, archiveEnd);
// create test archive data dir // create test archive data dir
archiveDir = new File(TEST_DIR, TEST_ARCHIVE_DIR); archiveDir = new File(TEST_DIR, TEST_ARCHIVE_DIR);