Skip to content

Commit

Permalink
Merge pull request #810 from scalecube/cleanup
Browse files Browse the repository at this point in the history
Cleanup
  • Loading branch information
artem-v authored Apr 6, 2021
2 parents 7c4d0ae + 68f209f commit 05ff22f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import java.util.Map.Entry;
import java.util.Objects;
import java.util.StringJoiner;
import java.util.stream.Collectors;

public final class ConnectionSetup implements Externalizable {

Expand Down Expand Up @@ -49,15 +48,10 @@ public boolean hasCredentials() {
@Override
public String toString() {
return new StringJoiner(", ", ConnectionSetup.class.getSimpleName() + "[", "]")
.add("credentials=" + mask(credentials))
.add("credentials=" + MaskUtil.mask(credentials))
.toString();
}

private static Map<String, String> mask(Map<String, String> creds) {
return creds.entrySet().stream()
.collect(Collectors.toMap(Entry::getKey, entry -> MaskUtil.mask(entry.getValue())));
}

@Override
public void writeExternal(ObjectOutput out) throws IOException {
// credentials
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import reactor.core.publisher.Mono;
Expand Down Expand Up @@ -94,7 +92,7 @@ private Mono<Map<String, String>> getCredentials(ServiceReference serviceReferen
creds ->
LOGGER.debug(
"[credentialsSupplier] Got credentials ({}) for service: {}",
mask(creds),
MaskUtil.mask(creds),
serviceReference))
.doOnError(
ex ->
Expand Down Expand Up @@ -138,11 +136,6 @@ private Mono<RSocket> connect(
"[rsocket][client][{}] Failed to connect, cause: {}", address, th.toString()));
}

private static Map<String, String> mask(Map<String, String> creds) {
return creds.entrySet().stream()
.collect(Collectors.toMap(Entry::getKey, entry -> MaskUtil.mask(entry.getValue())));
}

private Payload encodeConnectionSetup(ConnectionSetup connectionSetup) {
ByteBuf byteBuf = ByteBufAllocator.DEFAULT.buffer();
try {
Expand Down
6 changes: 6 additions & 0 deletions services/src/test/java/io/scalecube/services/BaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@
import org.junit.jupiter.api.TestInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import reactor.core.publisher.Hooks;

public abstract class BaseTest {

protected static final Logger LOGGER = LoggerFactory.getLogger(BaseTest.class);

static {
Hooks.onErrorDropped(
throwable -> LOGGER.warn("[onErrorDropped] error: {}", throwable.toString()));
}

@BeforeEach
public final void baseSetUp(TestInfo testInfo) {
LOGGER.info(
Expand Down

0 comments on commit 05ff22f

Please sign in to comment.