Permalink
Browse files

Performed renaming of "Observable" to "Flowable"

  • Loading branch information...
snazha-blkio committed Oct 23, 2018
1 parent 9e38172 commit 5904769109342bfbbb1a8c318c456fa2761a9bf9
Showing with 272 additions and 282 deletions.
  1. +15 −15 codegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapper.java
  2. +4 −4 codegen/src/test/java/org/web3j/codegen/SolidityFunctionWrapperTest.java
  3. +1 −1 core/src/main/java/org/web3j/contracts/token/ERC20BasicInterface.java
  4. +1 −1 core/src/main/java/org/web3j/contracts/token/ERC20Interface.java
  5. +8 −8 core/src/main/java/org/web3j/ens/contracts/generated/ENS.java
  6. +12 −12 core/src/main/java/org/web3j/ens/contracts/generated/PublicResolver.java
  7. +3 −3 core/src/main/java/org/web3j/protocol/Web3jService.java
  8. +37 −37 core/src/main/java/org/web3j/protocol/core/JsonRpc2_0Web3j.java
  9. +3 −3 core/src/main/java/org/web3j/protocol/core/RemoteCall.java
  10. +2 −2 core/src/main/java/org/web3j/protocol/core/Request.java
  11. +49 −48 core/src/main/java/org/web3j/protocol/rx/JsonRpc2_0Rx.java
  12. +59 −59 core/src/main/java/org/web3j/protocol/rx/Web3jRx.java
  13. +1 −1 core/src/main/java/org/web3j/protocol/websocket/WebSocketService.java
  14. +3 −3 core/src/main/java/org/web3j/utils/{Observables.java → Flowables.java}
  15. +1 −1 core/src/test/java/org/web3j/protocol/core/filters/BlockFilterTest.java
  16. +2 −2 core/src/test/java/org/web3j/protocol/core/filters/FilterTester.java
  17. +1 −1 core/src/test/java/org/web3j/protocol/core/filters/LogFilterTest.java
  18. +1 −1 core/src/test/java/org/web3j/protocol/core/filters/PendingTransactionFilterTest.java
  19. +16 −28 core/src/test/java/org/web3j/protocol/rx/JsonRpc2_0RxTest.java
  20. +2 −2 core/src/test/java/org/web3j/protocol/websocket/WebSocketServiceTest.java
  21. +13 −13 core/src/test/java/org/web3j/utils/{ObservablesTests.java → FlowablesTests.java}
  22. +2 −2 geth/src/main/java/org/web3j/protocol/geth/Geth.java
  23. +2 −1 gradle/wrapper/gradle-wrapper.properties
  24. +4 −4 integration-tests/src/test/java/org/web3j/generated/Fibonacci.java
  25. +8 −8 integration-tests/src/test/java/org/web3j/generated/HumanStandardToken.java
  26. +4 −4 integration-tests/src/test/java/org/web3j/generated/MetaCoin.java
  27. +16 −16 integration-tests/src/test/java/org/web3j/protocol/core/{ObservableIT.java → FlowableIT.java}
  28. +2 −2 integration-tests/src/test/java/org/web3j/protocol/scenarios/HumanStandardTokenGeneratedIT.java
@@ -837,20 +837,20 @@ TypeSpec buildEventResponseObject(
return builder.build();
}
MethodSpec buildEventObservableFunction(
MethodSpec buildEventFlowableFunction(
String responseClassName,
String functionName,
List<org.web3j.codegen.SolidityFunctionWrapper.NamedTypeName> indexedParameters,
List<org.web3j.codegen.SolidityFunctionWrapper.NamedTypeName> nonIndexedParameters)
throws ClassNotFoundException {
String generatedFunctionName =
Strings.lowercaseFirstLetter(functionName) + "EventObservable";
Strings.lowercaseFirstLetter(functionName) + "EventFlowable";
ParameterizedTypeName parameterizedTypeName =
ParameterizedTypeName.get(ClassName.get(Flowable.class),
ClassName.get("", responseClassName));
MethodSpec.Builder observableMethodBuilder =
MethodSpec.Builder flowableMethodBuilder =
MethodSpec.methodBuilder(generatedFunctionName)
.addModifiers(Modifier.PUBLIC)
.addParameter(EthFilter.class, FILTER)
@@ -877,37 +877,37 @@ MethodSpec buildEventObservableFunction(
.build())
.build();
observableMethodBuilder
.addStatement("return web3j.ethLogObservable(filter).map($L)", converter);
flowableMethodBuilder
.addStatement("return web3j.ethLogFlowable(filter).map($L)", converter);
return observableMethodBuilder
return flowableMethodBuilder
.build();
}
MethodSpec buildDefaultEventObservableFunction(
MethodSpec buildDefaultEventFlowableFunction(
String responseClassName,
String functionName) {
String generatedFunctionName =
Strings.lowercaseFirstLetter(functionName) + "EventObservable";
Strings.lowercaseFirstLetter(functionName) + "EventFlowable";
ParameterizedTypeName parameterizedTypeName =
ParameterizedTypeName.get(ClassName.get(Flowable.class),
ClassName.get("", responseClassName));
MethodSpec.Builder observableMethodBuilder =
MethodSpec.Builder flowableMethodBuilder =
MethodSpec.methodBuilder(generatedFunctionName)
.addModifiers(Modifier.PUBLIC)
.addParameter(DefaultBlockParameter.class, START_BLOCK)
.addParameter(DefaultBlockParameter.class, END_BLOCK)
.returns(parameterizedTypeName);
observableMethodBuilder.addStatement("$1T filter = new $1T($2L, $3L, "
flowableMethodBuilder.addStatement("$1T filter = new $1T($2L, $3L, "
+ "getContractAddress())", EthFilter.class, START_BLOCK, END_BLOCK)
.addStatement("filter.addSingleTopic($T.encode("
+ buildEventDefinitionName(functionName) + "))", EventEncoder.class)
.addStatement("return " + generatedFunctionName + "(filter)");
return observableMethodBuilder
return flowableMethodBuilder
.build();
}
@@ -983,9 +983,9 @@ MethodSpec buildEventTransactionReceiptFunction(
methods.add(buildEventTransactionReceiptFunction(responseClassName,
functionName, indexedParameters, nonIndexedParameters));
methods.add(buildEventObservableFunction(responseClassName, functionName,
methods.add(buildEventFlowableFunction(responseClassName, functionName,
indexedParameters, nonIndexedParameters));
methods.add(buildDefaultEventObservableFunction(responseClassName,
methods.add(buildDefaultEventFlowableFunction(responseClassName,
functionName));
return methods;
}
@@ -994,7 +994,7 @@ CodeBlock buildTypedResponse(
String objectName,
List<org.web3j.codegen.SolidityFunctionWrapper.NamedTypeName> indexedParameters,
List<org.web3j.codegen.SolidityFunctionWrapper.NamedTypeName> nonIndexedParameters,
boolean observable) {
boolean flowable) {
String nativeConversion;
if (useNativeJavaTypes) {
@@ -1004,7 +1004,7 @@ CodeBlock buildTypedResponse(
}
CodeBlock.Builder builder = CodeBlock.builder();
if (observable) {
if (flowable) {
builder.addStatement("$L.log = log", objectName);
} else {
builder.addStatement(
@@ -390,8 +390,8 @@ public void testBuildEventConstantMultipleValueReturn() throws Exception {
+ " return responses;\n"
+ " }\n"
+ "\n"
+ " public io.reactivex.Flowable<TransferEventResponse> transferEventObservable(org.web3j.protocol.core.methods.request.EthFilter filter) {\n"
+ " return web3j.ethLogObservable(filter).map(new io.reactivex.functions.Function<org.web3j.protocol.core.methods.response.Log, TransferEventResponse>() {\n"
+ " public io.reactivex.Flowable<TransferEventResponse> transferEventFlowable(org.web3j.protocol.core.methods.request.EthFilter filter) {\n"
+ " return web3j.ethLogFlowable(filter).map(new io.reactivex.functions.Function<org.web3j.protocol.core.methods.response.Log, TransferEventResponse>() {\n"
+ " @java.lang.Override\n"
+ " public TransferEventResponse apply(org.web3j.protocol.core.methods.response.Log log) {\n"
+ " org.web3j.tx.Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(TRANSFER_EVENT, log);\n"
@@ -407,10 +407,10 @@ public void testBuildEventConstantMultipleValueReturn() throws Exception {
+ " });\n"
+ " }\n"
+ "\n"
+ " public io.reactivex.Flowable<TransferEventResponse> transferEventObservable(org.web3j.protocol.core.DefaultBlockParameter startBlock, org.web3j.protocol.core.DefaultBlockParameter endBlock) {\n"
+ " public io.reactivex.Flowable<TransferEventResponse> transferEventFlowable(org.web3j.protocol.core.DefaultBlockParameter startBlock, org.web3j.protocol.core.DefaultBlockParameter endBlock) {\n"
+ " org.web3j.protocol.core.methods.request.EthFilter filter = new org.web3j.protocol.core.methods.request.EthFilter(startBlock, endBlock, getContractAddress());\n"
+ " filter.addSingleTopic(org.web3j.abi.EventEncoder.encode(TRANSFER_EVENT));\n"
+ " return transferEventObservable(filter);\n"
+ " return transferEventFlowable(filter);\n"
+ " }\n"
+ "\n"
+ " public static class TransferEventResponse {\n"
@@ -31,7 +31,7 @@
List<T> getTransferEvents(TransactionReceipt transactionReceipt);
Flowable<T> transferEventObservable(DefaultBlockParameter startBlock,
Flowable<T> transferEventFlowable(DefaultBlockParameter startBlock,
DefaultBlockParameter endBlock);
}
@@ -30,7 +30,7 @@
List<R> getApprovalEvents(TransactionReceipt transactionReceipt);
Flowable<R> approvalEventObservable(DefaultBlockParameter startBlock,
Flowable<R> approvalEventFlowable(DefaultBlockParameter startBlock,
DefaultBlockParameter endBlock);
}
@@ -63,13 +63,13 @@ private ENS(String contractAddress, Web3j web3j, TransactionManager transactionM
return responses;
}
public Flowable<NewOwnerEventResponse> newOwnerEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
public Flowable<NewOwnerEventResponse> newOwnerEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
final Event event = new Event("NewOwner",
Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>(true) {}, new TypeReference<Bytes32>(true) {},
new TypeReference<Address>() {}));
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
filter.addSingleTopic(EventEncoder.encode(event));
return web3j.ethLogObservable(filter).map(log -> {
return web3j.ethLogFlowable(filter).map(log -> {
EventValues eventValues = extractEventParameters(event, log);
NewOwnerEventResponse typedResponse = new NewOwnerEventResponse();
typedResponse.node = (byte[]) eventValues.getIndexedValues().get(0).getValue();
@@ -94,13 +94,13 @@ private ENS(String contractAddress, Web3j web3j, TransactionManager transactionM
return responses;
}
public Flowable<TransferEventResponse> transferEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
public Flowable<TransferEventResponse> transferEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
final Event event = new Event("Transfer",
Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>(true) {},
new TypeReference<Address>() {}));
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
filter.addSingleTopic(EventEncoder.encode(event));
return web3j.ethLogObservable(filter).map(log -> {
return web3j.ethLogFlowable(filter).map(log -> {
EventValues eventValues = extractEventParameters(event, log);
TransferEventResponse typedResponse = new TransferEventResponse();
typedResponse.node = (byte[]) eventValues.getIndexedValues().get(0).getValue();
@@ -124,13 +124,13 @@ private ENS(String contractAddress, Web3j web3j, TransactionManager transactionM
return responses;
}
public Flowable<NewResolverEventResponse> newResolverEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
public Flowable<NewResolverEventResponse> newResolverEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
final Event event = new Event("NewResolver",
Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>(true) {},
new TypeReference<Address>() {}));
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
filter.addSingleTopic(EventEncoder.encode(event));
return web3j.ethLogObservable(filter).map(log -> {
return web3j.ethLogFlowable(filter).map(log -> {
EventValues eventValues = extractEventParameters(event, log);
NewResolverEventResponse typedResponse = new NewResolverEventResponse();
typedResponse.node = (byte[]) eventValues.getIndexedValues().get(0).getValue();
@@ -154,13 +154,13 @@ private ENS(String contractAddress, Web3j web3j, TransactionManager transactionM
return responses;
}
public Flowable<NewTTLEventResponse> newTTLEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
public Flowable<NewTTLEventResponse> newTTLEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
final Event event = new Event("NewTTL",
Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>(true) {},
new TypeReference<Uint64>() {}));
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
filter.addSingleTopic(EventEncoder.encode(event));
return web3j.ethLogObservable(filter).map(log -> {
return web3j.ethLogFlowable(filter).map(log -> {
EventValues eventValues = extractEventParameters(event, log);
NewTTLEventResponse typedResponse = new NewTTLEventResponse();
typedResponse.node = (byte[]) eventValues.getIndexedValues().get(0).getValue();
@@ -66,12 +66,12 @@ private PublicResolver(String contractAddress, Web3j web3j, TransactionManager t
return responses;
}
public Flowable<AddrChangedEventResponse> addrChangedEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
public Flowable<AddrChangedEventResponse> addrChangedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
final Event event = new Event("AddrChanged",
Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>(true) {}, new TypeReference<Address>() {}));
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
filter.addSingleTopic(EventEncoder.encode(event));
return web3j.ethLogObservable(filter).map(log -> {
return web3j.ethLogFlowable(filter).map(log -> {
EventValues eventValues = extractEventParameters(event, log);
AddrChangedEventResponse typedResponse = new AddrChangedEventResponse();
typedResponse.node = (byte[]) eventValues.getIndexedValues().get(0).getValue();
@@ -94,12 +94,12 @@ private PublicResolver(String contractAddress, Web3j web3j, TransactionManager t
return responses;
}
public Flowable<ContentChangedEventResponse> contentChangedEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
public Flowable<ContentChangedEventResponse> contentChangedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
final Event event = new Event("ContentChanged",
Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>(true) {}, new TypeReference<Bytes32>() {}));
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
filter.addSingleTopic(EventEncoder.encode(event));
return web3j.ethLogObservable(filter).map(log -> {
return web3j.ethLogFlowable(filter).map(log -> {
EventValues eventValues = extractEventParameters(event, log);
ContentChangedEventResponse typedResponse = new ContentChangedEventResponse();
typedResponse.node = (byte[]) eventValues.getIndexedValues().get(0).getValue();
@@ -122,12 +122,12 @@ private PublicResolver(String contractAddress, Web3j web3j, TransactionManager t
return responses;
}
public Flowable<NameChangedEventResponse> nameChangedEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
public Flowable<NameChangedEventResponse> nameChangedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
final Event event = new Event("NameChanged",
Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>(true) {}, new TypeReference<Utf8String>() {}));
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
filter.addSingleTopic(EventEncoder.encode(event));
return web3j.ethLogObservable(filter).map(log -> {
return web3j.ethLogFlowable(filter).map(log -> {
EventValues eventValues = extractEventParameters(event, log);
NameChangedEventResponse typedResponse = new NameChangedEventResponse();
typedResponse.node = (byte[]) eventValues.getIndexedValues().get(0).getValue();
@@ -150,12 +150,12 @@ private PublicResolver(String contractAddress, Web3j web3j, TransactionManager t
return responses;
}
public Flowable<ABIChangedEventResponse> aBIChangedEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
public Flowable<ABIChangedEventResponse> aBIChangedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
final Event event = new Event("ABIChanged",
Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>(true) {}, new TypeReference<Uint256>(true) {}));
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
filter.addSingleTopic(EventEncoder.encode(event));
return web3j.ethLogObservable(filter).map(log -> {
return web3j.ethLogFlowable(filter).map(log -> {
EventValues eventValues = extractEventParameters(event, log);
ABIChangedEventResponse typedResponse = new ABIChangedEventResponse();
typedResponse.node = (byte[]) eventValues.getIndexedValues().get(0).getValue();
@@ -179,12 +179,12 @@ private PublicResolver(String contractAddress, Web3j web3j, TransactionManager t
return responses;
}
public Flowable<PubkeyChangedEventResponse> pubkeyChangedEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
public Flowable<PubkeyChangedEventResponse> pubkeyChangedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
final Event event = new Event("PubkeyChanged",
Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>(true) {}, new TypeReference<Bytes32>() {}, new TypeReference<Bytes32>() {}));
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
filter.addSingleTopic(EventEncoder.encode(event));
return web3j.ethLogObservable(filter).map(log -> {
return web3j.ethLogFlowable(filter).map(log -> {
EventValues eventValues = extractEventParameters(event, log);
PubkeyChangedEventResponse typedResponse = new PubkeyChangedEventResponse();
typedResponse.node = (byte[]) eventValues.getIndexedValues().get(0).getValue();
@@ -209,12 +209,12 @@ private PublicResolver(String contractAddress, Web3j web3j, TransactionManager t
return responses;
}
public Flowable<TextChangedEventResponse> textChangedEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
public Flowable<TextChangedEventResponse> textChangedEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
final Event event = new Event("TextChanged",
Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>(true) {}, new TypeReference<Utf8String>(true) {}, new TypeReference<Utf8String>() {}));
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
filter.addSingleTopic(EventEncoder.encode(event));
return web3j.ethLogObservable(filter).map(log -> {
return web3j.ethLogFlowable(filter).map(log -> {
EventValues eventValues = extractEventParameters(event, log);
TextChangedEventResponse typedResponse = new TextChangedEventResponse();
typedResponse.node = (byte[]) eventValues.getIndexedValues().get(0).getValue();
@@ -44,8 +44,8 @@
* the unsubscribe method. Different WebSocket implementations use different pair of
* subscribe/unsubscribe methods.
*
* <p>This method creates an Observable that can be used to subscribe to new notifications.
* When a client unsubscribes from this Observable the service unsubscribes from
* <p>This method creates an Flowable that can be used to subscribe to new notifications.
* When a client unsubscribes from this Flowable the service unsubscribes from
* the underlying stream of events.
*
* @param request JSON-RPC request that will be send to subscribe to a stream of
@@ -54,7 +54,7 @@
* stream of notifications
* @param responseType class of incoming events objects in a stream
* @param <T> type of incoming event objects
* @return a @{@link Flowable} instance that emits incoming events
* @return a {@link Flowable} instance that emits incoming events
*/
<T extends Notification<?>> Flowable<T> subscribe(
Request request,
Oops, something went wrong.

0 comments on commit 5904769

Please sign in to comment.