|
2 | 2 |
|
3 | 3 | import static com.google.common.truth.Truth.assertThat; |
4 | 4 |
|
| 5 | +import com.google.common.collect.ImmutableList; |
5 | 6 | import com.google.common.collect.ImmutableMap; |
6 | 7 | import com.google.protobuf.Any; |
7 | 8 | import io.envoyproxy.envoy.config.core.v3.GrpcService; |
|
41 | 42 | import io.grpc.xds.ExternalProcessorFilter.ExternalProcessorFilterConfig; |
42 | 43 | import io.grpc.xds.ExternalProcessorFilter.ExternalProcessorInterceptor; |
43 | 44 | import io.grpc.xds.client.Bootstrapper; |
| 45 | +import io.grpc.xds.client.EnvoyProtoData.Node; |
44 | 46 | import io.grpc.xds.internal.grpcservice.AllowedGrpcService; |
45 | 47 | import io.grpc.xds.internal.grpcservice.AllowedGrpcServices; |
46 | 48 | import io.grpc.xds.internal.grpcservice.CachedChannelManager; |
@@ -158,21 +160,22 @@ public void setUp() throws Exception { |
158 | 160 | this.provider = new ExternalProcessorFilter.Provider(); |
159 | 161 | this.provider.newInstance("ext-proc"); |
160 | 162 |
|
161 | | - Bootstrapper.BootstrapInfo bootstrapInfo = Mockito.mock(Bootstrapper.BootstrapInfo.class); |
162 | | - |
163 | | - // Create an AllowedGrpcServices mock |
164 | | - AllowedGrpcServices allowedServices = |
| 163 | + AllowedGrpcServices allowedServices = |
165 | 164 | AllowedGrpcServices.create( |
166 | | - ImmutableMap.of("in-process:" + extProcServerName, |
| 165 | + ImmutableMap.of("in-process:" + extProcServerName, |
167 | 166 | AllowedGrpcService.builder() |
168 | 167 | .configuredChannelCredentials(ConfiguredChannelCredentials.create( |
169 | 168 | InsecureChannelCredentials.create(), new InProcessChannelCredsConfig())) |
170 | 169 | .build())); |
171 | | - |
172 | | - Mockito.when(bootstrapInfo.allowedGrpcServices()).thenReturn(Optional.of(allowedServices)); |
173 | | - |
174 | | - Bootstrapper.ServerInfo serverInfo = Mockito.mock(Bootstrapper.ServerInfo.class); |
175 | | - Mockito.when(serverInfo.isTrustedXdsServer()).thenReturn(false); |
| 170 | + |
| 171 | + Bootstrapper.ServerInfo serverInfo = Bootstrapper.ServerInfo.create( |
| 172 | + "xds-server", InsecureChannelCredentials.create()); |
| 173 | + |
| 174 | + Bootstrapper.BootstrapInfo bootstrapInfo = Bootstrapper.BootstrapInfo.builder() |
| 175 | + .servers(ImmutableList.of(serverInfo)) |
| 176 | + .node(Node.newBuilder().build()) |
| 177 | + .allowedGrpcServices(Optional.of(allowedServices)) |
| 178 | + .build(); |
176 | 179 |
|
177 | 180 | this.filterContext = Filter.FilterContext.builder() |
178 | 181 | .bootstrapInfo(bootstrapInfo) |
|
0 commit comments