Issue #2224 Bug fixes to pass unit test.
Change-Id: I6f1c5721afaab21ade5a7f780ba92ca7b4ea8a00 Former-commit-id:3569155bc0
[formerly 3a7e798e473e90de6fe4e6f50c645ecce5a37c51] Former-commit-id:ac538a0476
This commit is contained in:
parent
08e8f3a353
commit
d7db78d9e8
5 changed files with 32 additions and 25 deletions
|
@ -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[ ");
|
||||
|
|
|
@ -75,7 +75,8 @@ public class DisplayData implements Comparable<DisplayData> {
|
|||
/** The data's category configuration. */
|
||||
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. */
|
||||
protected final String displayLabel;
|
||||
|
@ -106,10 +107,12 @@ public class DisplayData implements Comparable<DisplayData> {
|
|||
* @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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -153,12 +153,12 @@
|
|||
<category>
|
||||
<name>Local</name>
|
||||
<extRetentionHours>168</extRetentionHours>
|
||||
<dataset>
|
||||
<dataSet>
|
||||
<dirPattern>(ldadhydro|ldadmesonet|ldadprofiler|ldad_manual|mesowest|qc)</dirPattern>
|
||||
<filePattern>.*(\d{4})-(\d{2})-(\d{2})-(\d{2}).*</filePattern>
|
||||
<displayLabel>{1}</displayLabel>
|
||||
<dateGroupIndices>2,3,4,5</dateGroupIndices>
|
||||
</dataset>
|
||||
</dataSet>
|
||||
</category>
|
||||
<category>
|
||||
<name>Model</name>
|
||||
|
@ -167,7 +167,7 @@
|
|||
<dirPattern>(grid)/(.*)/(.*)</dirPattern>
|
||||
<displayLabel>{2}</displayLabel>
|
||||
<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>
|
||||
<dirPattern>(modelsounding)/(.*)</dirPattern>
|
||||
|
@ -196,7 +196,7 @@
|
|||
<dirPattern>(sfcobs)/.*</dirPattern>
|
||||
<displayLabel>{1}</displayLabel>
|
||||
<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>
|
||||
</category>
|
||||
<category>
|
||||
|
@ -223,7 +223,7 @@
|
|||
<dirPattern>(acarssounding|bufrua|goessounding|poessounding|profiler)</dirPattern>
|
||||
<displayLabel>{1}</displayLabel>
|
||||
<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>
|
||||
</category>
|
||||
<category>
|
||||
|
|
|
@ -107,13 +107,19 @@
|
|||
<name>Observation</name>
|
||||
<extRetentionHours>168</extRetentionHours>
|
||||
<dataSet>
|
||||
<dirPattern>(acars|airep|airmet|taf)</dirPattern>
|
||||
<dirPattern>(airep|airmet|taf)</dirPattern>
|
||||
<dirPattern>(bufrsigwx|sfcobs)/.*</dirPattern>
|
||||
<displayLabel>{1}</displayLabel>
|
||||
<timeType>Date</timeType>
|
||||
<dateGroupIndices>2,3,4,5</dateGroupIndices>
|
||||
<filePattern>[^/]*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..*</filePattern>
|
||||
</dataSet>
|
||||
<dataSet>
|
||||
<dirPattern>(acars)/(.*)</dirPattern>
|
||||
<displayLabel>{1}</displayLabel>
|
||||
<filePattern>[^/]*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..*</filePattern>
|
||||
finish this
|
||||
</dataSet>
|
||||
</category>
|
||||
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.
|
||||
|
@ -161,7 +167,6 @@
|
|||
<dateGroupIndices>2,3,4,5</dateGroupIndices>
|
||||
</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>
|
||||
<displayLabel>{1} - {2}</displayLabel>
|
||||
<dateGroupIndices>3,4,5,6</dateGroupIndices>
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue