@Override
    public int deleteAll() {
        final Set<String> patternNames = store.values().stream()
                .map(GrokPattern::name)
                .collect(Collectors.toSet());

        if (!patternNames.isEmpty()) {
            store.clear();
            clusterBus.post(GrokPatternsDeletedEvent.create(patternNames));
        }

        return patternNames.size();
    }
@Test
    public void deleteAll() throws Exception {
        Collection<GrokPattern> patterns = ImmutableList.of(GrokPattern.create("1", ".*"),
                GrokPattern.create("2", ".+"));
        final List<GrokPattern> saved = service.saveAll(patterns, ABORT_ON_CONFLICT);
        assertThat(service.deleteAll()).isEqualTo(2);
        assertThat(service.loadAll()).isEmpty();
    }