File tree 2 files changed +9
-6
lines changed
main/java/tech/pegasys/teku/validator/client/loader
test/java/tech/pegasys/teku/validator/client/loader
2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 16
16
import static tech .pegasys .teku .infrastructure .logging .StatusLogger .STATUS_LOG ;
17
17
18
18
import com .fasterxml .jackson .databind .ObjectMapper ;
19
+ import com .google .common .annotations .VisibleForTesting ;
19
20
import java .io .IOException ;
20
21
import java .net .MalformedURLException ;
21
22
import java .net .URL ;
@@ -58,15 +59,16 @@ public Stream<BLSPublicKey> readKeys() {
58
59
return Arrays .stream (keys ).map (key -> BLSPublicKey .fromSSZBytes (Bytes .fromHexString (key )));
59
60
}
60
61
61
- public SafeFuture <String []> readUrl () {
62
+ private SafeFuture <String []> readUrl () {
62
63
try {
63
64
return SafeFuture .completedFuture (mapper .readValue (new URL (url ), String [].class ));
64
65
} catch (IOException e ) {
65
66
return SafeFuture .failedFuture (e );
66
67
}
67
68
}
68
69
69
- public SafeFuture <String []> retry () {
70
+ @ VisibleForTesting
71
+ SafeFuture <String []> retry () {
70
72
return asyncRunner
71
73
.runWithRetry (
72
74
() -> {
Original file line number Diff line number Diff line change 44
44
class ExternalUrlKeyReaderTest {
45
45
private static final Duration DELAY = Duration .ofSeconds (5 );
46
46
private static final String VALID_URL = "http://test:0000/api/v1/eth2/publicKeys" ;
47
- private final ObjectMapper mapper = mock (ObjectMapper .class );
48
47
48
+ private final ObjectMapper mapper = mock (ObjectMapper .class );
49
49
private final StubTimeProvider timeProvider = StubTimeProvider .withTimeInMillis (0 );
50
50
private final StubAsyncRunner asyncRunner = new StubAsyncRunner (timeProvider );
51
51
52
52
private final DataStructureUtil dataStructureUtil =
53
53
new DataStructureUtil (TestSpecFactory .createDefault ());
54
54
55
- final BLSPublicKey publicKey1 = dataStructureUtil .randomPublicKey ();
56
- final BLSPublicKey publicKey2 = dataStructureUtil .randomPublicKey ();
57
- final String [] expectedKeys = new String [] {publicKey1 .toHexString (), publicKey2 .toHexString ()};
55
+ private final BLSPublicKey publicKey1 = dataStructureUtil .randomPublicKey ();
56
+ private final BLSPublicKey publicKey2 = dataStructureUtil .randomPublicKey ();
57
+ private final String [] expectedKeys =
58
+ new String [] {publicKey1 .toHexString (), publicKey2 .toHexString ()};
58
59
59
60
@ Test
60
61
void readKeys_validUrlReturnsValidKeys () throws IOException {
You can’t perform that action at this time.
0 commit comments