Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
~
Browse files Browse the repository at this point in the history
  • Loading branch information
smatthewenglish committed May 14, 2019
1 parent e7497c4 commit 72e6872
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package tech.pegasys.pantheon.tests.acceptance.dsl.condition.net;

import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.Node;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.net.NetServicesTransaction;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.net.NetVersionTransaction;

import static org.assertj.core.api.Assertions.assertThat;

public class ExpectNetServicesValidPort implements Condition {

private final NetServicesTransaction transaction;

public ExpectNetServicesValidPort(final NetServicesTransaction transaction) {
this.transaction = transaction;
}

@Override
public void verify(Node node) {

final Boolean result = node.execute();

assertThat(result).isTrue();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public Net(final NetTransactions transactions) {
this.transactions = transactions;
}

public Condition netServices() {

return transactions.netServices();
}

public Condition netVersion() {
return new ExpectNetVersionIsNotBlank(transactions.netVersion());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package tech.pegasys.pantheon.tests.acceptance.dsl.transaction.net;

import org.web3j.protocol.core.Request;
import org.web3j.protocol.core.methods.response.NetVersion;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.NetServicesJsonRpcRequestFactory;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction;

import java.util.Map;

public class NetServicesTransaction implements Transaction<Map<String, Map<String, String>>> {

NetServicesTransaction() {}

@Override
public Map<String, Map<String, String>> execute(
final JsonRequestFactories requestFactories) {
NetServicesJsonRpcRequestFactory.NetServicesResponse netServicesResponse = null;
try {
NetServicesJsonRpcRequestFactory netServicesJsonRpcRequestFactory = requestFactories.netServices();
Request<?, NetServicesJsonRpcRequestFactory.NetServicesResponse> request =
netServicesJsonRpcRequestFactory.netServices();
netServicesResponse = request.send();
} catch (final Exception ignored) {
}
return netServicesResponse.getResult();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ public NetVersionTransaction netVersion() {
return new NetVersionTransaction();
}

public NetServicesTransaction netServices() {
return new NetServicesTransaction();
}
public NetPeerCountTransaction peerCount() {
return new NetPeerCountTransaction();
}

}

0 comments on commit 72e6872

Please sign in to comment.