use of rx.functions.Action1 in project jocean-http by isdom.
the class MessageUtil method toRequest.
public static Action1<Object> toRequest(final Object... beans) {
return new Action1<Object>() {
@Override
public void call(final Object obj) {
if (obj instanceof HttpRequest) {
final HttpRequest request = (HttpRequest) obj;
for (Object bean : beans) {
setUriToRequest(request, bean);
addQueryParams(request, bean);
addHeaderParams(request, bean);
}
}
}
};
}
use of rx.functions.Action1 in project photon-model by vmware.
the class AzureUtils method injectOperationContext.
public static <T> Action1<T> injectOperationContext(Action1<T> original) {
OperationContext operationContext = OperationContext.getOperationContext();
return new Action1<T>() {
@Override
public void call(T t) {
OperationContext.restoreOperationContext(operationContext);
original.call(t);
}
};
}
use of rx.functions.Action1 in project knotx by Cognifide.
the class FragmentAssemblerTest method callAssemblerWithAssertions.
private void callAssemblerWithAssertions(TestContext context, List<Pair<List<String>, String>> fragments, Action1<KnotContext> testFunction) {
Async async = context.async();
KnotProxy service = KnotProxy.createProxy(new Vertx(vertx.vertx()), ADDRESS);
service.rxProcess(KnotContextFactory.create(fragments)).map(ctx -> Pair.of(async, ctx)).doOnSuccess(success -> testFunction.call(success.getRight())).subscribe(success -> async.complete(), context::fail);
}
use of rx.functions.Action1 in project knotx by Cognifide.
the class HtmlFragmentSplitterVerticleTest method callFragmentSplitterWithAssertions.
private void callFragmentSplitterWithAssertions(TestContext context, String template, Action1<KnotContext> testFunction) {
Async async = context.async();
KnotProxy service = KnotProxy.createProxy(new Vertx(vertx.vertx()), ADDRESS);
service.rxProcess(KnotContextFactory.empty(template)).map(ctx -> Pair.of(async, ctx)).doOnSuccess(success -> testFunction.call(success.getRight())).subscribe(success -> async.complete(), context::fail);
}
use of rx.functions.Action1 in project jbpm-work-items by kiegroup.
the class EthereumWorkitemHandlerTest method setUp.
@Before
public void setUp() {
try {
when(web3j.ethGetBalance(anyString(), any(DefaultBlockParameterName.class))).thenReturn(balanceRequest);
when(balanceRequest.send()).thenReturn(ethGetBalance);
when(ethGetBalance.getBalance()).thenReturn(BigInteger.valueOf(100));
when(transfer.sendFunds(anyString(), any(BigDecimal.class), any(Unit.class))).thenReturn(transferRequest);
when(transferRequest.send()).thenReturn(transactionReceipt);
when(transactionReceipt.getStatus()).thenReturn("testStatus");
when(transactionReceipt.getBlockHash()).thenReturn("testBlockHash");
when(transactionReceipt.getBlockNumber()).thenReturn(BigInteger.valueOf(1));
when(web3j.ethCall(any(Transaction.class), any(DefaultBlockParameterName.class))).thenReturn(ethCallRequest);
when(ethCallRequest.sendAsync()).thenReturn(ethCallCompletable);
when(ethCallCompletable.get()).thenReturn(ethCall);
when(ethCall.getValue()).thenReturn("testResultValue");
when(web3j.ethGetTransactionCount(anyString(), any(DefaultBlockParameterName.class))).thenReturn(ethCountRequest);
when(ethCountRequest.sendAsync()).thenReturn(ethCountCompletable);
when(ethCountCompletable.get()).thenReturn(transactionCount);
when(transactionCount.getTransactionCount()).thenReturn(BigInteger.valueOf(10));
when(web3j.ethSendTransaction(any(Transaction.class))).thenReturn(ethSendRequest);
when(ethSendRequest.sendAsync()).thenReturn(ethSendCompletable);
when(ethSendCompletable.get()).thenReturn(ethSendTransaction);
when(ethSendTransaction.getTransactionHash()).thenReturn("testTransactionHash");
when(web3j.ethSendRawTransaction(anyString())).thenReturn(ethSendRawRequest);
when(ethSendRawRequest.sendAsync()).thenReturn(ethSendRawCompletable);
when(ethSendRawCompletable.get()).thenReturn(ethSendRawTransaction);
when(ethSendRawTransaction.getTransactionHash()).thenReturn("testTransactionHash");
when(web3j.ethGetTransactionReceipt(anyString())).thenReturn(ethSendTransactionReceipt);
when(ethSendTransactionReceipt.send()).thenReturn(ethGetTransactionReceipt);
when(ethGetTransactionReceipt.getTransactionReceipt()).thenReturn(Optional.of(rawTransactionalRecept));
when(ethGetTransactionReceipt.getResult()).thenReturn(rawTransactionalRecept);
when(rawTransactionalRecept.getContractAddress()).thenReturn("testContractAddress");
signalList = new ArrayList();
doAnswer(new Answer() {
public Void answer(InvocationOnMock invocation) {
signalList.add(Arrays.toString(invocation.getArguments()));
return null;
}
}).when(kieSession).signalEvent(anyString(), any(Object.class));
Observable logObservable = PowerMockito.mock(Observable.class);
when(web3j.ethLogObservable(any(EthFilter.class))).thenReturn(logObservable);
when(logObservable.subscribe()).thenReturn(subscription);
when(logObservable.subscribe(any(Action1.class))).thenReturn(subscription);
} catch (Exception e) {
fail(e.getMessage());
}
}
Aggregations