Skip to content

Commit

Permalink
spotlessapply fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
apratt3377 committed Sep 10, 2020
1 parent 32a5d82 commit dafe4a8
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 32 deletions.
10 changes: 5 additions & 5 deletions core/src/main/java/org/web3j/protocol/core/Ethereum.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
import org.web3j.protocol.core.methods.response.ShhNewIdentity;
import org.web3j.protocol.core.methods.response.ShhUninstallFilter;
import org.web3j.protocol.core.methods.response.ShhVersion;
import org.web3j.protocol.core.methods.response.TxPoolStatus;
import org.web3j.protocol.core.methods.response.Web3ClientVersion;
import org.web3j.protocol.core.methods.response.Web3Sha3;
import org.web3j.protocol.core.methods.response.TxPoolStatus;
import org.web3j.protocol.core.methods.response.admin.AdminDataDir;
import org.web3j.protocol.core.methods.response.admin.AdminNodeInfo;
import org.web3j.protocol.core.methods.response.admin.AdminPeers;
Expand All @@ -85,11 +85,11 @@ public interface Ethereum {
Request<?, AdminNodeInfo> adminNodeInfo();

Request<?, AdminPeers> adminPeers();

Request<?, BooleanResponse> adminAddPeer(String url);

Request<?, BooleanResponse> adminRemovePeer(String url);

Request<?, AdminDataDir> adminDataDir();

Request<?, EthProtocolVersion> ethProtocolVersion();
Expand Down Expand Up @@ -224,6 +224,6 @@ Request<?, org.web3j.protocol.core.methods.response.ShhPost> shhPost(
Request<?, ShhMessages> shhGetFilterChanges(BigInteger filterId);

Request<?, ShhMessages> shhGetMessages(BigInteger filterId);

Request<?, TxPoolStatus> txPoolStatus();
}
10 changes: 5 additions & 5 deletions core/src/main/java/org/web3j/protocol/core/JsonRpc2_0Web3j.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@
import org.web3j.protocol.core.methods.response.ShhNewIdentity;
import org.web3j.protocol.core.methods.response.ShhUninstallFilter;
import org.web3j.protocol.core.methods.response.ShhVersion;
import org.web3j.protocol.core.methods.response.TxPoolStatus;
import org.web3j.protocol.core.methods.response.Web3ClientVersion;
import org.web3j.protocol.core.methods.response.Web3Sha3;
import org.web3j.protocol.core.methods.response.TxPoolStatus;
import org.web3j.protocol.core.methods.response.admin.AdminDataDir;
import org.web3j.protocol.core.methods.response.admin.AdminNodeInfo;
import org.web3j.protocol.core.methods.response.admin.AdminPeers;
Expand Down Expand Up @@ -157,19 +157,19 @@ public Request<?, AdminPeers> adminPeers() {
return new Request<>(
"admin_peers", Collections.emptyList(), web3jService, AdminPeers.class);
}

@Override
public Request<?, BooleanResponse> adminAddPeer(String url) {
return new Request<>(
"admin_addPeer", Arrays.asList(url), web3jService, BooleanResponse.class);
}

@Override
public Request<?, BooleanResponse> adminRemovePeer(String url) {
return new Request<>(
"admin_removePeer", Arrays.asList(url), web3jService, BooleanResponse.class);
}

@Override
public Request<?, AdminDataDir> adminDataDir() {
return new Request<>(
Expand Down Expand Up @@ -672,7 +672,7 @@ public Request<?, ShhMessages> shhGetMessages(BigInteger filterId) {
web3jService,
ShhMessages.class);
}

@Override
public Request<?, TxPoolStatus> txPoolStatus() {
return new Request<>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
*/
package org.web3j.protocol.core.methods.response;

import org.web3j.protocol.core.Response;
import java.util.Map;

import org.web3j.protocol.core.Response;
import org.web3j.utils.Numeric;
import java.util.Map;

/** txpool_status. */
public class TxPoolStatus extends Response<Map<String, String>> {
public Integer getPending() {
return Numeric.decodeQuantity((String) getResult().get("pending")).intValue();
public Integer getPending() {
return Numeric.decodeQuantity((String) getResult().get("pending")).intValue();
}
public Integer getQueued() {
return Numeric.decodeQuantity((String) getResult().get("queued")).intValue();

public Integer getQueued() {
return Numeric.decodeQuantity((String) getResult().get("queued")).intValue();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.ObjectReader;
Expand All @@ -43,19 +43,19 @@ public static class NodeInfo {
private String listenAddr;
private String name;
private String consensus;

@JsonProperty("protocols")
@SuppressWarnings("unchecked")
private void consensusDeserializer(Map<String, Object> protocols) {
if(protocols.containsKey("istanbul")) {
if (protocols.containsKey("istanbul")) {
consensus = "istanbul";
} else if (protocols.containsKey("clique")) {
consensus = "clique";
consensus = "clique";
} else if (protocols.containsKey("eth")) {
Map<String, Object> eth = (Map<String, Object>) protocols.get("eth");
consensus = (String) eth.get("consensus");
} else {
consensus = "unknown";
consensus = "unknown";
}
}

Expand Down Expand Up @@ -95,7 +95,7 @@ public String getListenAddr() {
public String getName() {
return name;
}

public String getConsensus() {
return consensus;
}
Expand Down
14 changes: 8 additions & 6 deletions core/src/test/java/org/web3j/protocol/core/RequestTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,26 +79,28 @@ public void testAdminNodeInfo() throws Exception {

verifyResult("{\"jsonrpc\":\"2.0\",\"method\":\"admin_nodeInfo\",\"params\":[],\"id\":1}");
}

@Test
public void testAdminAddPeer() throws Exception {
web3j.adminAddPeer("url").send();

verifyResult("{\"jsonrpc\":\"2.0\",\"method\":\"admin_addPeer\",\"params\":[\"url\"],\"id\":1}");
verifyResult(
"{\"jsonrpc\":\"2.0\",\"method\":\"admin_addPeer\",\"params\":[\"url\"],\"id\":1}");
}

@Test
public void testAdminDataDir() throws Exception {
web3j.adminDataDir().send();

verifyResult("{\"jsonrpc\":\"2.0\",\"method\":\"admin_datadir\",\"params\":[],\"id\":1}");
}

@Test
public void testAdminRemovePeer() throws Exception {
web3j.adminRemovePeer("url").send();

verifyResult("{\"jsonrpc\":\"2.0\",\"method\":\"admin_removePeer\",\"params\":[\"url\"],\"id\":1}");
verifyResult(
"{\"jsonrpc\":\"2.0\",\"method\":\"admin_removePeer\",\"params\":[\"url\"],\"id\":1}");
}

@Test
Expand Down Expand Up @@ -737,7 +739,7 @@ public void testShhGetMessages() throws Exception {
"{\"jsonrpc\":\"2.0\",\"method\":\"shh_getMessages\","
+ "\"params\":[\"0x07\"],\"id\":1}");
}

@Test
public void testTxPoolStatus() throws Exception {
web3j.txPoolStatus().send();
Expand Down
6 changes: 3 additions & 3 deletions core/src/test/java/org/web3j/protocol/core/ResponseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1571,7 +1571,7 @@ public void testSshMessages() {
ShhMessages shhMessages = deserialiseResponse(ShhMessages.class);
assertEquals(shhMessages.getMessages(), (messages));
}

@Test
public void testBooleanResponse() {
buildResponse(
Expand All @@ -1584,7 +1584,7 @@ public void testBooleanResponse() {
BooleanResponse booleanResponse = deserialiseResponse(BooleanResponse.class);
assertTrue(booleanResponse.success());
}

@Test
public void testAdminDataDir() {
buildResponse(
Expand All @@ -1597,7 +1597,7 @@ public void testAdminDataDir() {
AdminDataDir dataDir = deserialiseResponse(AdminDataDir.class);
assertEquals(dataDir.getDataDir(), "sampleDir");
}

@Test
public void testTxPoolStatus() {
buildResponse(
Expand Down

0 comments on commit dafe4a8

Please sign in to comment.