@Test @Ignore("tests fail on jenkins due to file permisssions") public void testScanOlderThan() throws IOException, InterruptedException { Formatter f = new Formatter(System.out); CollectionManager dcm = MFileCollectionManager.open("testScanOlderThan", TestDir.cdmUnitTestDir + "agg/updating/.*nc$", null, f); dcm.scan(true); List<MFile> fileList = (List<MFile>) Misc.getList(dcm.getFilesSorted()); assert fileList.size() == 3 : dcm; assert touch(TestDir.cdmUnitTestDir + "agg/updating/extra.nc"); dcm = MFileCollectionManager.open("testScanOlderThan", TestDir.cdmUnitTestDir + "agg/updating/.*nc$", "10 sec", f); dcm.scan(true); fileList = (List<MFile>) Misc.getList(dcm.getFilesSorted()); assert fileList.size() == 2 : dcm; }
@Test public void testScan() throws IOException { // count scanned files Formatter f = new Formatter(System.out); CollectionManager dcm = MFileCollectionManager.open("testScan", TestDir.cdmUnitTestDir + "agg/narr/narr-a_221_#yyyyMMdd_HHmm#.*grb$", null, f); dcm.scan(true); List<MFile> fileList = (List<MFile>) Misc.getList(dcm.getFilesSorted()); assert fileList.size() == 3 : dcm; // check date extractor int count = 0; String[] result = new String[] {"2000-01-18T12:00:00", "2000-01-19T00:00:00", "2000-01-20T12:00:00"}; for (MFile mfile : dcm.getFilesSorted()) { CalendarDate de = dcm.extractDate(mfile); System.out.printf(" %s == %s%n", mfile.getPath(), de); assert de.toString().startsWith(result[count]); count++; } }
@Test @Ignore("tests fail on jenkins due to file permisssions") public void testScanFromConfig() throws IOException { //public FeatureCollectionConfig(String name, FeatureCollectionType fcType, String spec, String dateFormatMark, String olderThan, String recheckAfter, // String timePartition, String useIndexOnlyS, Element innerNcml) { // public FeatureCollectionConfig(String name, String path, FeatureCollectionType fcType, String spec, // String dateFormatMark, String olderThan, // String timePartition, String useIndexOnlyS, Element innerNcml) { FeatureCollectionConfig config = new FeatureCollectionConfig("testScanFromConfig", "path", FeatureCollectionType.FMRC, TestDir.cdmUnitTestDir + "agg/updating/.*nc$", null, null, "10 sec", null, null); assert touch(TestDir.cdmUnitTestDir + "agg/updating/extra.nc"); // count scanned files Formatter f = new Formatter(System.out); MFileCollectionManager dcm = new MFileCollectionManager(config, f, null); dcm.scan(true); List<MFile> fileList = (List<MFile>) Misc.getList(dcm.getFilesSorted()); assert fileList.size() == 2 : dcm; }