KubeApiServerIntegrator implements VirtualMachineMasterService { @VisibleForTesting static boolean hasRequiredNodeAttributes(List<Protos.Attribute> nodeAttributes) { Set<String> names = nodeAttributes.stream().map(Protos.Attribute::getName).collect(Collectors.toSet()); return names.containsAll(REQUIRED_NODE_ATTRIBUTES); } @Inject  KubeApiServerIntegrator(TitusRuntime titusRuntime,
                                   MesosConfiguration mesosConfiguration,
                                   DirectKubeConfiguration directKubeConfiguration,
                                   Injector injector,
                                   KubeApiFacade kubeApiFacade,
                                   ContainerResultCodeResolver containerResultCodeResolver); @Override void enterActiveMode(); @Override void launchTasks(TaskAssignments assignments); @Override void rejectLease(VirtualMachineLease lease); @Override void killTask(String taskId); @Override void setVMLeaseHandler(Action1<List<? extends VirtualMachineLease>> leaseHandler); @Override void setRescindLeaseHandler(Action1<List<LeaseRescindedEvent>> rescindLeaseHandler); @Override Observable<LeaseRescindedEvent> getLeaseRescindedObservable(); @Override Observable<ContainerEvent> getTaskStatusObservable(); static final String CLIENT_METRICS_PREFIX; }
@Test public void testHasRequiredNodeAttributes() { List<Protos.Attribute> attributes = new ArrayList<>(); assertThat(KubeApiServerIntegrator.hasRequiredNodeAttributes(attributes)).isFalse(); attributes.add(Protos.Attribute.newBuilder().setName(KubeApiServerIntegrator.NODE_ATTRIBUTE_ID).setType(Protos.Value.Type.TEXT).build()); attributes.add(Protos.Attribute.newBuilder().setName(KubeApiServerIntegrator.NODE_ATTRIBUTE_HOST_IP).setType(Protos.Value.Type.TEXT).build()); attributes.add(Protos.Attribute.newBuilder().setName(KubeApiServerIntegrator.NODE_ATTRIBUTE_RES).setType(Protos.Value.Type.TEXT).build()); attributes.add(Protos.Attribute.newBuilder().setName(KubeApiServerIntegrator.NODE_ATTRIBUTE_REGION).setType(Protos.Value.Type.TEXT).build()); attributes.add(Protos.Attribute.newBuilder().setName(KubeApiServerIntegrator.NODE_ATTRIBUTE_ZONE).setType(Protos.Value.Type.TEXT).build()); attributes.add(Protos.Attribute.newBuilder().setName(KubeApiServerIntegrator.NODE_ATTRIBUTE_I_TYPE).setType(Protos.Value.Type.TEXT).build()); assertThat(KubeApiServerIntegrator.hasRequiredNodeAttributes(attributes)).isTrue(); }