@Test
  public void test_serversThreadDump_all() throws Exception {
    LocalManagementSource localManagementSource = mock(LocalManagementSource.class);
    TimeoutServiceImpl timeoutService = new TimeoutServiceImpl(1000L);
    DfltSecurityContextService securityContextService = new DfltSecurityContextService();
    RemoteManagementSource remoteManagementSource =
        spy(new RemoteManagementSource(localManagementSource, timeoutService));

    when(localManagementSource.getL2Infos()).thenReturn(L2_INFOS);
    when(localManagementSource.getLocalServerName()).thenReturn("s1");
    when(localManagementSource.isActiveCoordinator()).thenReturn(true);
    when(localManagementSource.serverThreadDump()).thenReturn("thread dump");

    ServerManagementService serverManagementService =
        new ServerManagementService(
            executorService,
            timeoutService,
            localManagementSource,
            remoteManagementSource,
            securityContextService);

    Collection<ThreadDumpEntity> response =
        serverManagementService.serversThreadDump(
            new HashSet<String>(Arrays.asList("s1", "s2", "s3")));
    assertThat(response.size(), is(1));
    ThreadDumpEntity entity = response.iterator().next();
    assertThat(entity.getSourceId(), equalTo("s1"));
    assertThat(entity.getDump(), equalTo("thread dump"));
    assertThat(entity.getNodeType(), equalTo(ThreadDumpEntity.NodeType.SERVER));

    verify(remoteManagementSource)
        .getFromRemoteL2(
            eq("s2"),
            eq(new URI("tc-management-api/agents/diagnostics/threadDump/servers;names=s2")),
            eq(Collection.class),
            eq(ThreadDumpEntity.class));
    verify(remoteManagementSource)
        .getFromRemoteL2(
            eq("s3"),
            eq(new URI("tc-management-api/agents/diagnostics/threadDump/servers;names=s3")),
            eq(Collection.class),
            eq(ThreadDumpEntity.class));
  }