Search in sources :

Example 1 with NoopChannelLogger

use of io.grpc.internal.TestUtils.NoopChannelLogger in project grpc-java by grpc.

the class AltsTsiHandshakerTest method setUp.

@Before
public void setUp() throws Exception {
    mockClient = mock(AltsHandshakerClient.class);
    mockServer = mock(AltsHandshakerClient.class);
    NoopChannelLogger channelLogger = new NoopChannelLogger();
    handshakerClient = new AltsTsiHandshaker(true, mockClient, channelLogger);
    handshakerServer = new AltsTsiHandshaker(false, mockServer, channelLogger);
}
Also used : NoopChannelLogger(io.grpc.internal.TestUtils.NoopChannelLogger) Before(org.junit.Before)

Example 2 with NoopChannelLogger

use of io.grpc.internal.TestUtils.NoopChannelLogger in project grpc-java by grpc.

the class AltsTsiTest method setUp.

@Before
public void setUp() throws Exception {
    ResourceLeakDetector.setLevel(Level.PARANOID);
    // Use MockAltsHandshakerStub for all the tests.
    AltsHandshakerOptions handshakerOptions = new AltsHandshakerOptions(null);
    MockAltsHandshakerStub clientStub = new MockAltsHandshakerStub();
    MockAltsHandshakerStub serverStub = new MockAltsHandshakerStub();
    NoopChannelLogger channelLogger = new NoopChannelLogger();
    client = new AltsHandshakerClient(clientStub, handshakerOptions, channelLogger);
    server = new AltsHandshakerClient(serverStub, handshakerOptions, channelLogger);
}
Also used : NoopChannelLogger(io.grpc.internal.TestUtils.NoopChannelLogger) Before(org.junit.Before)

Example 3 with NoopChannelLogger

use of io.grpc.internal.TestUtils.NoopChannelLogger in project grpc-java by grpc.

the class AltsTsiTest method newHandshakers.

private Handshakers newHandshakers() {
    NoopChannelLogger channelLogger = new NoopChannelLogger();
    TsiHandshaker clientHandshaker = new AltsTsiHandshaker(true, client, channelLogger);
    TsiHandshaker serverHandshaker = new AltsTsiHandshaker(false, server, channelLogger);
    return new Handshakers(clientHandshaker, serverHandshaker);
}
Also used : NoopChannelLogger(io.grpc.internal.TestUtils.NoopChannelLogger) Handshakers(io.grpc.alts.internal.TsiTest.Handshakers)

Example 4 with NoopChannelLogger

use of io.grpc.internal.TestUtils.NoopChannelLogger in project grpc-java by grpc.

the class AltsHandshakerClientTest method setRpcVersions.

@Test
public void setRpcVersions() throws Exception {
    when(mockStub.send(ArgumentMatchers.<HandshakerReq>any())).thenReturn(MockAltsHandshakerResp.getOkResponse(0));
    RpcProtocolVersions rpcVersions = RpcProtocolVersions.newBuilder().setMinRpcVersion(RpcProtocolVersions.Version.newBuilder().setMajor(3).setMinor(4).build()).setMaxRpcVersion(RpcProtocolVersions.Version.newBuilder().setMajor(5).setMinor(6).build()).build();
    clientOptions = new AltsClientOptions.Builder().setTargetName(TEST_TARGET_NAME).setTargetServiceAccounts(ImmutableList.of(TEST_TARGET_SERVICE_ACCOUNT)).setRpcProtocolVersions(rpcVersions).build();
    NoopChannelLogger channelLogger = new NoopChannelLogger();
    handshaker = new AltsHandshakerClient(mockStub, clientOptions, channelLogger);
    handshaker.startClientHandshake();
    ArgumentCaptor<HandshakerReq> reqCaptor = ArgumentCaptor.forClass(HandshakerReq.class);
    verify(mockStub).send(reqCaptor.capture());
    assertEquals(rpcVersions, reqCaptor.getValue().getClientStart().getRpcVersions());
}
Also used : NoopChannelLogger(io.grpc.internal.TestUtils.NoopChannelLogger) Test(org.junit.Test)

Example 5 with NoopChannelLogger

use of io.grpc.internal.TestUtils.NoopChannelLogger in project grpc-java by grpc.

the class AltsHandshakerClientTest method setUp.

@Before
public void setUp() {
    mockStub = mock(AltsHandshakerStub.class);
    clientOptions = new AltsClientOptions.Builder().setTargetName(TEST_TARGET_NAME).setTargetServiceAccounts(ImmutableList.of(TEST_TARGET_SERVICE_ACCOUNT)).build();
    NoopChannelLogger channelLogger = new NoopChannelLogger();
    handshaker = new AltsHandshakerClient(mockStub, clientOptions, channelLogger);
}
Also used : NoopChannelLogger(io.grpc.internal.TestUtils.NoopChannelLogger) Before(org.junit.Before)

Aggregations

NoopChannelLogger (io.grpc.internal.TestUtils.NoopChannelLogger)5 Before (org.junit.Before)3 Handshakers (io.grpc.alts.internal.TsiTest.Handshakers)1 Test (org.junit.Test)1