Search in sources :

Example 1 with ChildPolicyReportingHelper

use of io.grpc.rls.LbPolicyConfiguration.ChildPolicyWrapper.ChildPolicyReportingHelper in project grpc-java by grpc.

the class LbPolicyConfigurationTest method updateBalancingState_triggersListener.

@Test
public void updateBalancingState_triggersListener() {
    ChildPolicyWrapper childPolicyWrapper = factory.createOrGet("foo.google.com");
    ChildPolicyReportingHelper childPolicyReportingHelper = childPolicyWrapper.getHelper();
    SubchannelPicker childPicker = mock(SubchannelPicker.class);
    childPolicyReportingHelper.updateBalancingState(ConnectivityState.READY, childPicker);
    verify(childLbStatusListener).onStatusChanged(ConnectivityState.READY);
    assertThat(childPolicyWrapper.getPicker()).isEqualTo(childPicker);
    // picker governs childPickers will be reported to parent LB
    verify(helper).updateBalancingState(ConnectivityState.READY, picker);
}
Also used : SubchannelPicker(io.grpc.LoadBalancer.SubchannelPicker) ChildPolicyWrapper(io.grpc.rls.LbPolicyConfiguration.ChildPolicyWrapper) ChildPolicyReportingHelper(io.grpc.rls.LbPolicyConfiguration.ChildPolicyWrapper.ChildPolicyReportingHelper) Test(org.junit.Test)

Aggregations

SubchannelPicker (io.grpc.LoadBalancer.SubchannelPicker)1 ChildPolicyWrapper (io.grpc.rls.LbPolicyConfiguration.ChildPolicyWrapper)1 ChildPolicyReportingHelper (io.grpc.rls.LbPolicyConfiguration.ChildPolicyWrapper.ChildPolicyReportingHelper)1 Test (org.junit.Test)1