@Test public void testSubscribeEvent() throws Exception { final ContractTemplate contractTemplate = new ContractTemplate(contextStorage); final Requester mockRequester = mock(Requester.class); final Subscription<Event> expected = mock(Subscription.class); when(mockRequester.request(ArgumentMatchers.<Invocation<?>>any())) .thenReturn(expected); contractTemplate.requester = mockRequester; final EventFilter eventFilter = EventFilter.newBuilder(anyContractAddress).build(); final Subscription<Event> actual = contractTemplate.subscribeEvent(eventFilter, new StreamObserver<Event>() { @Override public void onNext(Event value) { } @Override public void onError(Throwable t) { } @Override public void onCompleted() { } }); assertEquals(expected, actual); }
@Override public Subscription<Event> subscribeEvent(final EventFilter filter, final StreamObserver<Event> observer) { return request(contractMethods.getSubscribeEvent(), Arrays.asList(filter, observer)); }
ContractTemplate extends AbstractTemplate implements ContractOperation { @Override public Subscription<Event> subscribeEvent(final EventFilter filter, final StreamObserver<Event> observer) { return request(contractMethods.getSubscribeEvent(), Arrays.asList(filter, observer)); } }
ContractTemplate extends AbstractTemplate implements ContractOperation { @Override public Subscription<Event> subscribeEvent(final EventFilter filter, final StreamObserver<Event> observer) { return request(contractMethods.getSubscribeEvent(), Arrays.asList(filter, observer)); } ContractTemplate(final ContextStorage<Context> contextStorage); }
ContractTemplate extends AbstractTemplate implements ContractOperation { @Override public Subscription<Event> subscribeEvent(final EventFilter filter, final StreamObserver<Event> observer) { return request(contractMethods.getSubscribeEvent(), Arrays.asList(filter, observer)); } ContractTemplate(final ContextStorage<Context> contextStorage); @Override ContractTxReceipt getReceipt(final ContractTxHash contractTxHash); @Override ContractTxReceipt getContractTxReceipt(final TxHash txHash); @Override ContractTxHash deploy(final Account creator, final ContractDefinition contractDefinition,
      final long nonce); @Override ContractTxHash deploy(final Account creator, final ContractDefinition contractDefinition,
      final long nonce, final Fee fee); @Override ContractTxHash deploy(final Signer signer, final ContractDefinition contractDefinition,
      final long nonce, final Fee fee); @Override TxHash deployTx(final Signer signer, final ContractDefinition contractDefinition,
      final long nonce, final Fee fee); @Override ContractTxHash redeploy(final Signer signer, final ContractAddress existingContract,
      final ContractDefinition contractDefinition, final long nonce, final Fee fee); @Override TxHash redeployTx(final Signer signer, final ContractAddress existingContract,
      final ContractDefinition contractDefinition, final long nonce, final Fee fee); @Override ContractInterface getContractInterface(final ContractAddress contractAddress); @Override ContractTxHash execute(final Account executor, final ContractInvocation contractInvocation,
      final long nonce); @Override ContractTxHash execute(final Account executor, final ContractInvocation contractInvocation,
      final long nonce, final Fee fee); @Override ContractTxHash execute(final Signer signer, final ContractInvocation contractInvocation,
      final long nonce, final Fee fee); @Override TxHash executeTx(final Signer signer, final ContractInvocation contractInvocation,
      final long nonce, final Fee fee); @Override ContractResult query(final ContractInvocation contractInvocation); @Override List<Event> listEvents(final EventFilter filter); @Override Subscription<Event> subscribeEvent(final EventFilter filter,
      final StreamObserver<Event> observer); }
ContractTemplate extends AbstractTemplate implements ContractOperation { @Override public Subscription<Event> subscribeEvent(final EventFilter filter, final StreamObserver<Event> observer) { return request(contractMethods.getSubscribeEvent(), Arrays.asList(filter, observer)); } ContractTemplate(final ContextStorage<Context> contextStorage); @Override ContractTxReceipt getReceipt(final ContractTxHash contractTxHash); @Override ContractTxReceipt getContractTxReceipt(final TxHash txHash); @Override ContractTxHash deploy(final Account creator, final ContractDefinition contractDefinition,
      final long nonce); @Override ContractTxHash deploy(final Account creator, final ContractDefinition contractDefinition,
      final long nonce, final Fee fee); @Override ContractTxHash deploy(final Signer signer, final ContractDefinition contractDefinition,
      final long nonce, final Fee fee); @Override TxHash deployTx(final Signer signer, final ContractDefinition contractDefinition,
      final long nonce, final Fee fee); @Override ContractTxHash redeploy(final Signer signer, final ContractAddress existingContract,
      final ContractDefinition contractDefinition, final long nonce, final Fee fee); @Override TxHash redeployTx(final Signer signer, final ContractAddress existingContract,
      final ContractDefinition contractDefinition, final long nonce, final Fee fee); @Override ContractInterface getContractInterface(final ContractAddress contractAddress); @Override ContractTxHash execute(final Account executor, final ContractInvocation contractInvocation,
      final long nonce); @Override ContractTxHash execute(final Account executor, final ContractInvocation contractInvocation,
      final long nonce, final Fee fee); @Override ContractTxHash execute(final Signer signer, final ContractInvocation contractInvocation,
      final long nonce, final Fee fee); @Override TxHash executeTx(final Signer signer, final ContractInvocation contractInvocation,
      final long nonce, final Fee fee); @Override ContractResult query(final ContractInvocation contractInvocation); @Override List<Event> listEvents(final EventFilter filter); @Override Subscription<Event> subscribeEvent(final EventFilter filter,
      final StreamObserver<Event> observer);  }