@GET
    @Operation(summary = "List all connector plugins installed")
    public List<PluginInfo> listConnectorPlugins(
            @DefaultValue("true") @QueryParam("connectorsOnly") @Parameter(description = "Whether to list only connectors instead of all plugins") boolean connectorsOnly
    ) {
        synchronized (this) {
            if (connectorsOnly) {
                return Collections.unmodifiableList(connectorPlugins.stream()
                        .filter(p -> PluginType.SINK.toString().equals(p.type()) || PluginType.SOURCE.toString().equals(p.type()))
                        .collect(Collectors.toList()));
            } else {
                return Collections.unmodifiableList(new ArrayList<>(connectorPlugins));
            }
        }
    }
@Test
    public void testListAllPlugins() {
        List<PluginInfo> expectedConnectorPlugins = Stream.of(
                        SINK_CONNECTOR_PLUGINS,
                        SOURCE_CONNECTOR_PLUGINS,
                        CONVERTER_PLUGINS,
                        HEADER_CONVERTER_PLUGINS,
                        TRANSFORMATION_PLUGINS,
                        PREDICATE_PLUGINS
                ).flatMap(Collection::stream)
                .map(PluginInfo::new)
                .distinct()
                .collect(Collectors.toList());
        List<PluginInfo> actualConnectorPlugins = new ArrayList<>(connectorPluginsResource.listConnectorPlugins(false));
        Comparator<PluginInfo> compare = Comparator.comparing(PluginInfo::className)
                .thenComparing(PluginInfo::type)
                .thenComparing(PluginInfo::version);
        actualConnectorPlugins.sort(compare);
        expectedConnectorPlugins.sort(compare);
        assertEquals(expectedConnectorPlugins, actualConnectorPlugins);
        verify(herder, atLeastOnce()).plugins();
    }