@Test public void streamIdsFor() { testSubject.register("clientStreamId", "clientId", ClientIdRegistry.ConnectionType.COMMAND); testSubject.register("clientStreamId2", "clientId", ClientIdRegistry.ConnectionType.COMMAND); Set<String> streamIds = testSubject.streamIdsFor("clientId", ClientIdRegistry.ConnectionType.COMMAND); assertTrue(streamIds.contains("clientStreamId")); assertTrue(streamIds.contains("clientStreamId2")); }
@Override public Set<String> streamIdsFor(String clientId, ConnectionType type) { Map<String, String> connectionTypeMap = clientIdMapPerType.getOrDefault(type, Collections.emptyMap()); Set<String> current = connectionTypeMap.entrySet() .stream() .filter(e -> e.getValue().equals(clientId)) .map(Map.Entry::getKey) .collect(Collectors.toSet()); return Collections.unmodifiableSet(current); }
DefaultClientIdRegistry implements ClientIdRegistry { @Override public Set<String> streamIdsFor(String clientId, ConnectionType type) { Map<String, String> connectionTypeMap = clientIdMapPerType.getOrDefault(type, Collections.emptyMap()); Set<String> current = connectionTypeMap.entrySet() .stream() .filter(e -> e.getValue().equals(clientId)) .map(Map.Entry::getKey) .collect(Collectors.toSet()); return Collections.unmodifiableSet(current); } }
DefaultClientIdRegistry implements ClientIdRegistry { @Override public Set<String> streamIdsFor(String clientId, ConnectionType type) { Map<String, String> connectionTypeMap = clientIdMapPerType.getOrDefault(type, Collections.emptyMap()); Set<String> current = connectionTypeMap.entrySet() .stream() .filter(e -> e.getValue().equals(clientId)) .map(Map.Entry::getKey) .collect(Collectors.toSet()); return Collections.unmodifiableSet(current); }  }
DefaultClientIdRegistry implements ClientIdRegistry { @Override public Set<String> streamIdsFor(String clientId, ConnectionType type) { Map<String, String> connectionTypeMap = clientIdMapPerType.getOrDefault(type, Collections.emptyMap()); Set<String> current = connectionTypeMap.entrySet() .stream() .filter(e -> e.getValue().equals(clientId)) .map(Map.Entry::getKey) .collect(Collectors.toSet()); return Collections.unmodifiableSet(current); }  @Override boolean register(String clientStreamId, String clientId, ConnectionType type); @Override boolean unregister(String clientStreamId, ConnectionType type); @Override String clientId(String clientStreamId); @Override Set<String> streamIdsFor(String clientId, ConnectionType type); @Override void printOn(Media media); @EventListener void on(ApplicationConnected event); @EventListener void on(ApplicationDisconnected event); @EventListener void on(SubscribeCommand event); @EventListener void on(CommandHandlerDisconnected event); @EventListener void on(SubscribeQuery event); @EventListener void on(QueryHandlerDisconnected event); }
DefaultClientIdRegistry implements ClientIdRegistry { @Override public Set<String> streamIdsFor(String clientId, ConnectionType type) { Map<String, String> connectionTypeMap = clientIdMapPerType.getOrDefault(type, Collections.emptyMap()); Set<String> current = connectionTypeMap.entrySet() .stream() .filter(e -> e.getValue().equals(clientId)) .map(Map.Entry::getKey) .collect(Collectors.toSet()); return Collections.unmodifiableSet(current); }  @Override boolean register(String clientStreamId, String clientId, ConnectionType type); @Override boolean unregister(String clientStreamId, ConnectionType type); @Override String clientId(String clientStreamId); @Override Set<String> streamIdsFor(String clientId, ConnectionType type); @Override void printOn(Media media); @EventListener void on(ApplicationConnected event); @EventListener void on(ApplicationDisconnected event); @EventListener void on(SubscribeCommand event); @EventListener void on(CommandHandlerDisconnected event); @EventListener void on(SubscribeQuery event); @EventListener void on(QueryHandlerDisconnected event);  }