@Test public void testUpdateFilters() { GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(new Date()); calendar.add(GregorianCalendar.HOUR, -2); notifier.updateFilters(calendar.getTime()); Date previousDate = calendar.getTime(); BsonDocument rtscannerFilter = notifier.rtscannerFilter.toBsonDocument(BsonDocument.class, MongoClient.getDefaultCodecRegistry()); BsonDocument repairAttemptsFilter = notifier.repairAttemptsFilter.toBsonDocument(BsonDocument.class, MongoClient.getDefaultCodecRegistry()); BsonDocument patchesFilter = notifier.patchedBuildsFilter.toBsonDocument(BsonDocument.class, MongoClient.getDefaultCodecRegistry()); BsonDocument[] toolFilters = new BsonDocument[tools.length]; for(int i = 0; i < tools.length; i++) { toolFilters[i] = notifier.toolFilters.get(tools[i]).toBsonDocument(BsonDocument.class, MongoClient.getDefaultCodecRegistry()); } System.out.println(rtscannerFilter); System.out.println(repairAttemptsFilter); System.out.println(patchesFilter); System.out.println(Filters.and( Filters.gte("buildReproductionDate", previousDate), Filters.or( Filters.eq("status", "test failure"), Filters.eq("status", "PATCHED") )).toBsonDocument(BsonDocument.class, MongoClient.getDefaultCodecRegistry())); assertTrue(rtscannerFilter.equals(Filters.gte("dateWatched",previousDate).toBsonDocument(BsonDocument.class, MongoClient.getDefaultCodecRegistry()))); assertTrue(repairAttemptsFilter.equals(Filters.and( Filters.gte("buildReproductionDate", previousDate), Filters.or( Filters.eq("status", "test failure"), Filters.eq("status", "PATCHED") )).toBsonDocument(BsonDocument.class, MongoClient.getDefaultCodecRegistry()))); assertTrue(patchesFilter.equals(Filters.and( Filters.gte("buildReproductionDate", previousDate), Filters.eq("status", "PATCHED")).toBsonDocument(BsonDocument.class, MongoClient.getDefaultCodecRegistry()))); for(int i = 0; i < toolFilters.length; i++) { assertTrue(toolFilters[i].equals( Filters.and(Filters.gte("date",previousDate), Filters.eq("toolname", tools[i])).toBsonDocument(BsonDocument.class, MongoClient.getDefaultCodecRegistry()))); } }
protected void updateFilters(Date previousDate) { this.rtscannerFilter = Filters.gte("dateWatched", previousDate); this.patchedBuildsFilter = Filters.and(Filters.gte("buildReproductionDate", previousDate), Filters.eq("status", "PATCHED")); this.repairAttemptsFilter = Filters.and(Filters.gte("buildReproductionDate", previousDate), Filters.or(Filters.eq("status", "test failure"), Filters.eq("status", "PATCHED"))); this.toolFilters = new HashMap<String, Bson>(); for (String tool : repairTools) { this.toolFilters.put(tool, Filters.and(Filters.gte("date", previousDate), Filters.eq("toolname", tool))); } }
TimedSummaryNotifier implements Runnable { protected void updateFilters(Date previousDate) { this.rtscannerFilter = Filters.gte("dateWatched", previousDate); this.patchedBuildsFilter = Filters.and(Filters.gte("buildReproductionDate", previousDate), Filters.eq("status", "PATCHED")); this.repairAttemptsFilter = Filters.and(Filters.gte("buildReproductionDate", previousDate), Filters.or(Filters.eq("status", "test failure"), Filters.eq("status", "PATCHED"))); this.toolFilters = new HashMap<String, Bson>(); for (String tool : repairTools) { this.toolFilters.put(tool, Filters.and(Filters.gte("date", previousDate), Filters.eq("toolname", tool))); } } }
TimedSummaryNotifier implements Runnable { protected void updateFilters(Date previousDate) { this.rtscannerFilter = Filters.gte("dateWatched", previousDate); this.patchedBuildsFilter = Filters.and(Filters.gte("buildReproductionDate", previousDate), Filters.eq("status", "PATCHED")); this.repairAttemptsFilter = Filters.and(Filters.gte("buildReproductionDate", previousDate), Filters.or(Filters.eq("status", "test failure"), Filters.eq("status", "PATCHED"))); this.toolFilters = new HashMap<String, Bson>(); for (String tool : repairTools) { this.toolFilters.put(tool, Filters.and(Filters.gte("date", previousDate), Filters.eq("toolname", tool))); } } TimedSummaryNotifier(List<NotifierEngine> engines, Duration interval,
            String[] tools, String mongodbHost, String mongodbName, Date notificationTime);  TimedSummaryNotifier(List<NotifierEngine> engines, Duration interval, String[] tools,
            String mongdbHost, String mongodbName); }
TimedSummaryNotifier implements Runnable { protected void updateFilters(Date previousDate) { this.rtscannerFilter = Filters.gte("dateWatched", previousDate); this.patchedBuildsFilter = Filters.and(Filters.gte("buildReproductionDate", previousDate), Filters.eq("status", "PATCHED")); this.repairAttemptsFilter = Filters.and(Filters.gte("buildReproductionDate", previousDate), Filters.or(Filters.eq("status", "test failure"), Filters.eq("status", "PATCHED"))); this.toolFilters = new HashMap<String, Bson>(); for (String tool : repairTools) { this.toolFilters.put(tool, Filters.and(Filters.gte("date", previousDate), Filters.eq("toolname", tool))); } } TimedSummaryNotifier(List<NotifierEngine> engines, Duration interval,
            String[] tools, String mongodbHost, String mongodbName, Date notificationTime);  TimedSummaryNotifier(List<NotifierEngine> engines, Duration interval, String[] tools,
            String mongdbHost, String mongodbName); @Override void run(); }
TimedSummaryNotifier implements Runnable { protected void updateFilters(Date previousDate) { this.rtscannerFilter = Filters.gte("dateWatched", previousDate); this.patchedBuildsFilter = Filters.and(Filters.gte("buildReproductionDate", previousDate), Filters.eq("status", "PATCHED")); this.repairAttemptsFilter = Filters.and(Filters.gte("buildReproductionDate", previousDate), Filters.or(Filters.eq("status", "test failure"), Filters.eq("status", "PATCHED"))); this.toolFilters = new HashMap<String, Bson>(); for (String tool : repairTools) { this.toolFilters.put(tool, Filters.and(Filters.gte("date", previousDate), Filters.eq("toolname", tool))); } } TimedSummaryNotifier(List<NotifierEngine> engines, Duration interval,
            String[] tools, String mongodbHost, String mongodbName, Date notificationTime);  TimedSummaryNotifier(List<NotifierEngine> engines, Duration interval, String[] tools,
            String mongdbHost, String mongodbName); @Override void run();  }