Search in sources :

Example 1 with RootChannelList

use of io.grpc.InternalChannelz.RootChannelList in project grpc-java by grpc.

the class InternalChannelzTest method getRootChannels_onePage.

@Test
public void getRootChannels_onePage() {
    InternalInstrumented<ChannelStats> root1 = create();
    channelz.addRootChannel(root1);
    RootChannelList page = channelz.getRootChannels(/*fromId=*/
    0, /*maxPageSize=*/
    1);
    assertTrue(page.end);
    assertThat(page.channels).containsExactly(root1);
}
Also used : ChannelStats(io.grpc.InternalChannelz.ChannelStats) RootChannelList(io.grpc.InternalChannelz.RootChannelList) Test(org.junit.Test)

Example 2 with RootChannelList

use of io.grpc.InternalChannelz.RootChannelList in project grpc-java by grpc.

the class InternalChannelzTest method getRootChannels_onePage_multi.

@Test
public void getRootChannels_onePage_multi() {
    InternalInstrumented<ChannelStats> root1 = create();
    InternalInstrumented<ChannelStats> root2 = create();
    channelz.addRootChannel(root1);
    channelz.addRootChannel(root2);
    RootChannelList page = channelz.getRootChannels(/*fromId=*/
    0, /*maxPageSize=*/
    2);
    assertTrue(page.end);
    assertThat(page.channels).containsExactly(root1, root2);
}
Also used : ChannelStats(io.grpc.InternalChannelz.ChannelStats) RootChannelList(io.grpc.InternalChannelz.RootChannelList) Test(org.junit.Test)

Example 3 with RootChannelList

use of io.grpc.InternalChannelz.RootChannelList in project grpc-java by grpc.

the class InternalChannelzTest method getRootChannels_empty.

@Test
public void getRootChannels_empty() {
    RootChannelList rootChannels = channelz.getRootChannels(/*fromId=*/
    0, /*maxPageSize=*/
    1);
    assertTrue(rootChannels.end);
    assertThat(rootChannels.channels).isEmpty();
}
Also used : RootChannelList(io.grpc.InternalChannelz.RootChannelList) Test(org.junit.Test)

Example 4 with RootChannelList

use of io.grpc.InternalChannelz.RootChannelList in project grpc-java by grpc.

the class InternalChannelzTest method getRootChannels_remove.

@Test
public void getRootChannels_remove() {
    InternalInstrumented<ChannelStats> root1 = create();
    channelz.addRootChannel(root1);
    channelz.removeRootChannel(root1);
    RootChannelList page = channelz.getRootChannels(/*fromId=*/
    0, /*maxPageSize=*/
    1);
    assertTrue(page.end);
    assertThat(page.channels).isEmpty();
}
Also used : ChannelStats(io.grpc.InternalChannelz.ChannelStats) RootChannelList(io.grpc.InternalChannelz.RootChannelList) Test(org.junit.Test)

Example 5 with RootChannelList

use of io.grpc.InternalChannelz.RootChannelList in project grpc-java by grpc.

the class InternalChannelzTest method getRootChannels_paginate.

@Test
public void getRootChannels_paginate() {
    InternalInstrumented<ChannelStats> root1 = create();
    InternalInstrumented<ChannelStats> root2 = create();
    channelz.addRootChannel(root1);
    channelz.addRootChannel(root2);
    RootChannelList page1 = channelz.getRootChannels(/*fromId=*/
    0, /*maxPageSize=*/
    1);
    assertFalse(page1.end);
    assertThat(page1.channels).containsExactly(root1);
    RootChannelList page2 = channelz.getRootChannels(/*fromId=*/
    id(root1) + 1, /*maxPageSize=*/
    1);
    assertTrue(page2.end);
    assertThat(page2.channels).containsExactly(root2);
}
Also used : ChannelStats(io.grpc.InternalChannelz.ChannelStats) RootChannelList(io.grpc.InternalChannelz.RootChannelList) Test(org.junit.Test)

Aggregations

RootChannelList (io.grpc.InternalChannelz.RootChannelList)6 Test (org.junit.Test)6 ChannelStats (io.grpc.InternalChannelz.ChannelStats)5 TestChannel (io.grpc.protobuf.services.ChannelzTestHelper.TestChannel)1