You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by StephanEwen <gi...@git.apache.org> on 2016/08/19 22:09:58 UTC

[GitHub] flink pull request #2394: [FLINK-4434] [rpc] Add a testing RPC service.

GitHub user StephanEwen opened a pull request:

    https://github.com/apache/flink/pull/2394

    [FLINK-4434] [rpc] Add a testing RPC service.

    Adds an RPC Service implementation for testing. This RPC service acts as a replacement for the regular RPC service for cases where tests need to return prepared mock gateways instead of proper RPC gateways.
    
    The TestingRpcService can be used for example in the following fashion, using *Mockito* for mocks and verification:
     
    ```java
    TestingRpcService rpc = new TestingRpcService();
    
    ResourceManagerGateway testGateway = mock(ResourceManagerGateway.class);
    rpc.registerGateway("myAddress", testGateway);
     
    MyComponentToTest component = new MyComponentToTest();
    component.triggerSomethingThatCallsTheGateway();
     
    verify(testGateway, timeout(1000)).theTestMethod(any(UUID.class), anyString());
    ```
    
    This also adds a utility to create futures with a predetermined timeout.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/StephanEwen/incubator-flink test_rpc_service

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/2394.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2394
    
----
commit a685ffa00d748de4ab22f91b1dc3b6420f687c24
Author: Stephan Ewen <se...@apache.org>
Date:   2016-08-19T21:29:45Z

    [FLINK-4434] [rpc] Add a testing RPC service.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #2394: [FLINK-4434] [rpc] Add a testing RPC service.

Posted by uce <gi...@git.apache.org>.
Github user uce commented on the issue:

    https://github.com/apache/flink/pull/2394
  
    Cool stuff! Really looking forward to when this is merged back to `master` some day. \U0001f44d 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #2394: [FLINK-4434] [rpc] Add a testing RPC service.

Posted by StephanEwen <gi...@git.apache.org>.
Github user StephanEwen commented on the issue:

    https://github.com/apache/flink/pull/2394
  
    Manually merged to the `flip-6` branch in eee149765db992a7b787ed0a535c4fd2f5c78ce1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #2394: [FLINK-4434] [rpc] Add a testing RPC service.

Posted by StephanEwen <gi...@git.apache.org>.
Github user StephanEwen closed the pull request at:

    https://github.com/apache/flink/pull/2394


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #2394: [FLINK-4434] [rpc] Add a testing RPC service.

Posted by uce <gi...@git.apache.org>.
Github user uce commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2394#discussion_r75664816
  
    --- Diff: flink-runtime/src/test/java/org/apache/flink/runtime/rpc/TestingRpcService.java ---
    @@ -0,0 +1,115 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.flink.runtime.rpc;
    +
    +import akka.dispatch.Futures;
    +import akka.util.Timeout;
    +
    +import org.apache.flink.configuration.Configuration;
    +import org.apache.flink.runtime.akka.AkkaUtils;
    +import org.apache.flink.runtime.rpc.akka.AkkaRpcService;
    +
    +import scala.concurrent.Future;
    +import scala.concurrent.duration.FiniteDuration;
    +
    +import java.util.concurrent.ConcurrentHashMap;
    +import java.util.concurrent.TimeUnit;
    +
    +import static org.apache.flink.util.Preconditions.checkNotNull;
    +
    +/**
    + * An RPC Service implementation for testing. This RPC service acts as a replacement for
    + * teh regular RPC service for cases where tests need to return prepared mock gateways instead of
    --- End diff --
    
    typoe `teh` => `the`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #2394: [FLINK-4434] [rpc] Add a testing RPC service.

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on the issue:

    https://github.com/apache/flink/pull/2394
  
    Changes look very good to me :-) Thanks for your work @StephanEwen. Will merge this PR.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---