Skip to content

Commit

Permalink
Add test for getAllDescriptors
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks committed Jul 15, 2024
1 parent 7992ed2 commit 8c3d0b5
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

import static java.util.Collections.emptyMap;
import static java.util.Collections.singletonList;
Expand Down Expand Up @@ -189,6 +191,26 @@ public void testSystemIndexMatching() {
assertThat(SystemIndexRegistry.matchesSystemIndexPattern(Set.of(".not-system")), equalTo(Collections.emptySet()));
}

public void testRegisteredSystemIndexGetAllDescriptors() {
SystemIndexPlugin plugin1 = new SystemIndexPlugin1();
SystemIndexPlugin plugin2 = new SystemIndexPlugin2();
SystemIndices pluginSystemIndices = new SystemIndices(
Map.of(
SystemIndexPlugin1.class.getCanonicalName(),
plugin1.getSystemIndexDescriptors(Settings.EMPTY),
SystemIndexPlugin2.class.getCanonicalName(),
plugin2.getSystemIndexDescriptors(Settings.EMPTY)
)
);
assertEquals(
SystemIndexRegistry.getAllDescriptors()
.stream()
.map(SystemIndexDescriptor::getIndexPattern)
.collect(Collectors.toUnmodifiableList()),
List.of(SystemIndexPlugin1.SYSTEM_INDEX_1, SystemIndexPlugin2.SYSTEM_INDEX_2, TASK_INDEX + "*")
);
}

public void testRegisteredSystemIndexMatching() {
SystemIndexPlugin plugin1 = new SystemIndexPlugin1();
SystemIndexPlugin plugin2 = new SystemIndexPlugin2();
Expand Down

0 comments on commit 8c3d0b5

Please sign in to comment.