use of com.netflix.titus.runtime.endpoint.metadata.AnonymousCallMetadataResolver in project titus-control-plane by Netflix.
the class AggregatingLoadBalancerServiceTest method setup.
@Before
public void setup() {
CellConnector connector = mock(CellConnector.class);
Map<Cell, ManagedChannel> cellMap = new HashMap<>();
cellMap.put(new Cell("one", "1"), cellOne.getChannel());
cellMap.put(new Cell("two", "2"), cellTwo.getChannel());
when(connector.getChannels()).thenReturn(cellMap);
when(connector.getChannelForCell(any())).then(invocation -> Optional.ofNullable(cellMap.get(invocation.getArgument(0))));
GrpcConfiguration grpcConfiguration = mock(GrpcConfiguration.class);
when(grpcConfiguration.getRequestTimeoutMs()).thenReturn(1000L);
final AnonymousCallMetadataResolver anonymousCallMetadataResolver = new AnonymousCallMetadataResolver();
final AggregatingCellClient aggregatingCellClient = new AggregatingCellClient(connector);
service = new AggregatingLoadbalancerService(connector, anonymousCallMetadataResolver, grpcConfiguration, aggregatingCellClient, new AggregatingJobManagementServiceHelper(aggregatingCellClient, grpcConfiguration));
}
use of com.netflix.titus.runtime.endpoint.metadata.AnonymousCallMetadataResolver in project titus-control-plane by Netflix.
the class AggregatingHealthServiceTest method setup.
@Before
public void setup() {
Map<Cell, ManagedChannel> cellMap = new HashMap<>();
cellMap.put(new Cell("one", "1"), cellOne.getChannel());
cellMap.put(new Cell("two", "2"), cellTwo.getChannel());
when(connector.getChannels()).thenReturn(cellMap);
when(connector.getChannelForCell(any())).then(invocation -> Optional.ofNullable(cellMap.get(invocation.getArgument(0))));
GrpcConfiguration grpcConfiguration = mock(GrpcConfiguration.class);
when(grpcConfiguration.getRequestTimeoutMs()).thenReturn(1000L);
AnonymousCallMetadataResolver anonymousCallMetadataResolver = new AnonymousCallMetadataResolver();
AggregatingCellClient aggregatingCellClient = new AggregatingCellClient(connector);
service = new AggregatingHealthService(aggregatingCellClient, anonymousCallMetadataResolver, grpcConfiguration);
}
use of com.netflix.titus.runtime.endpoint.metadata.AnonymousCallMetadataResolver in project titus-control-plane by Netflix.
the class AggregatingJobServiceGatewayWithSingleCellTest method setUp.
@Before
public void setUp() {
stackName = UUID.randomUUID().toString();
GrpcConfiguration grpcClientConfiguration = mock(GrpcConfiguration.class);
when(grpcClientConfiguration.getRequestTimeoutMs()).thenReturn(1000L);
TitusFederationConfiguration titusFederationConfiguration = mock(TitusFederationConfiguration.class);
when(titusFederationConfiguration.getStack()).thenReturn(stackName);
when(titusFederationConfiguration.getCells()).thenReturn("one=1");
when(titusFederationConfiguration.getRoutingRules()).thenReturn("one=(app1.*|app2.*);two=(app3.*)");
CellInfoResolver cellInfoResolver = new DefaultCellInfoResolver(titusFederationConfiguration);
ApplicationCellRouter cellRouter = new ApplicationCellRouter(cellInfoResolver, titusFederationConfiguration);
List<Cell> cells = cellInfoResolver.resolve();
cellToServiceMap = ImmutableMap.of(cells.get(0), cell);
RemoteFederationConnector fedConnector = mock(RemoteFederationConnector.class);
when(fedConnector.getChannel()).thenReturn(remoteFederationRule.getChannel());
CellConnector cellConnector = mock(CellConnector.class);
when(cellConnector.getChannels()).thenReturn(cellToServiceMap.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, cellPairEntry -> cellPairEntry.getValue().getChannel())));
when(cellConnector.getChannelForCell(any(Cell.class))).thenAnswer(invocation -> Optional.ofNullable(cellToServiceMap.get(invocation.<Cell>getArgument(0))).map(GrpcServerRule::getChannel));
final AggregatingCellClient aggregatingCellClient = new AggregatingCellClient(cellConnector);
final AnonymousCallMetadataResolver anonymousCallMetadataResolver = new AnonymousCallMetadataResolver();
service = new AggregatingJobServiceGateway(grpcClientConfiguration, titusFederationConfiguration, cellConnector, cellRouter, aggregatingCellClient, new AggregatingJobManagementServiceHelper(aggregatingCellClient, grpcClientConfiguration), titusRuntime);
clock = Clocks.test();
dataGenerator = new ServiceDataGenerator(clock, TASKS_IN_GENERATED_JOBS);
}
Aggregations