You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by "jinmeiliao (GitHub)" <gi...@apache.org> on 2018/10/31 23:12:54 UTC

[GitHub] [geode] jinmeiliao commented on issue #2751: GEODE-5960: Add test to verify CommandMarker file for the JDBC connector

@dschneider-pivotal now I see that this test is to make sure all commands defined in the commandMarker file is able to load, then you don't need to scan the packages to get a list of all the commands at all, you can just get the list of commands loaded by service loader and make sure they exists in the command manager, this can make your test a lot shorter. Something like this:

ServiceLoader<CommandMarker> loader =
        ServiceLoader.load(CommandMarker.class, ClassPathLoader.getLatest().asClassLoader());
    loader.reload();
    Iterator<CommandMarker> iterator = loader.iterator();

    List<Class>
        allCommandClass = commandManager.getCommandMarkers().stream().map(CommandMarker::getClass).collect(
        Collectors.toList());
    while (iterator.hasNext()) {
      Class<? extends CommandMarker> commandClass = iterator.next().getClass();
      assertThat(allCommandClass).contains(commandClass);
    }

[ Full content available at: https://github.com/apache/geode/pull/2751 ]
This message was relayed via gitbox.apache.org for notifications@geode.apache.org