@Test public void testOneAllocationInRack1AndTwoInDatacenter2() throws InjectionException { final List<String> availableRacks = Arrays.asList("/dc1/rack1", "/dc2/rack1", "/dc2/rack2"); final Set<String> availableRacksSet = new HashSet<>(availableRacks); injector.bindVolatileParameter(RackNames.class, availableRacksSet); injector.bindVolatileParameter(MaxNumberOfEvaluators.class, 3); containerManager = injector.getInstance(ContainerManager.class); sendNodeDescriptors(); resourceManager = new ResourceManager(containerManager, mockResourceAllocationHandler, mockRuntimeStatusHandler, JVM_HEAP_SLACK, configurationSerializer, remoteManager, filenames, loggingScopeFactory); final ResourceRequestEvent request = ResourceRequestEventImpl.newBuilder().setResourceCount(3).setVirtualCores(1) .setMemorySize(64).addRackName("dc1/*").addRackName("/dc2/*").build(); resourceManager.onResourceRequest(request); final ArgumentCaptor<ResourceAllocationEvent> argument = ArgumentCaptor.forClass(ResourceAllocationEvent.class); verify(mockResourceAllocationHandler, times(3)).onNext(argument.capture()); final List<ResourceAllocationEvent> actualResourceAllocationEvent = argument.getAllValues(); Assert.assertTrue(actualResourceAllocationEvent.get(0).getRackName().get().contains("/dc1")); Assert.assertTrue(actualResourceAllocationEvent.get(1).getRackName().get().contains("/dc2")); Assert.assertTrue(actualResourceAllocationEvent.get(2).getRackName().get().contains("/dc2")); verify(mockRuntimeStatusHandler, times(4)).onNext(any(RuntimeStatusEvent.class)); }
void onResourceRequest(final ResourceRequestEvent resourceRequest) { synchronized (this.theContainers) { this.requestQueue.add(new ResourceRequest(resourceRequest)); this.checkRequestQueue(); } }
ResourceManager { void onResourceRequest(final ResourceRequestEvent resourceRequest) { synchronized (this.theContainers) { this.requestQueue.add(new ResourceRequest(resourceRequest)); this.checkRequestQueue(); } } }
ResourceManager { void onResourceRequest(final ResourceRequestEvent resourceRequest) { synchronized (this.theContainers) { this.requestQueue.add(new ResourceRequest(resourceRequest)); this.checkRequestQueue(); } } @Inject  ResourceManager(
      final ContainerManager containerManager,
      @Parameter(RuntimeParameters.ResourceAllocationHandler.class)
      final EventHandler<ResourceAllocationEvent> allocationHandler,
      @Parameter(RuntimeParameters.RuntimeStatusHandler.class)
      final EventHandler<RuntimeStatusEvent> runtimeStatusHandlerEventHandler,
      @Parameter(JVMHeapSlack.class) final double jvmHeapSlack,
      final ConfigurationSerializer configurationSerializer,
      final RemoteManager remoteManager,
      final REEFFileNames fileNames,
      final LoggingScopeFactory loggingScopeFactory); }
ResourceManager { void onResourceRequest(final ResourceRequestEvent resourceRequest) { synchronized (this.theContainers) { this.requestQueue.add(new ResourceRequest(resourceRequest)); this.checkRequestQueue(); } } @Inject  ResourceManager(
      final ContainerManager containerManager,
      @Parameter(RuntimeParameters.ResourceAllocationHandler.class)
      final EventHandler<ResourceAllocationEvent> allocationHandler,
      @Parameter(RuntimeParameters.RuntimeStatusHandler.class)
      final EventHandler<RuntimeStatusEvent> runtimeStatusHandlerEventHandler,
      @Parameter(JVMHeapSlack.class) final double jvmHeapSlack,
      final ConfigurationSerializer configurationSerializer,
      final RemoteManager remoteManager,
      final REEFFileNames fileNames,
      final LoggingScopeFactory loggingScopeFactory); void onEvaluatorExit(final String evaluatorId); }
ResourceManager { void onResourceRequest(final ResourceRequestEvent resourceRequest) { synchronized (this.theContainers) { this.requestQueue.add(new ResourceRequest(resourceRequest)); this.checkRequestQueue(); } } @Inject  ResourceManager(
      final ContainerManager containerManager,
      @Parameter(RuntimeParameters.ResourceAllocationHandler.class)
      final EventHandler<ResourceAllocationEvent> allocationHandler,
      @Parameter(RuntimeParameters.RuntimeStatusHandler.class)
      final EventHandler<RuntimeStatusEvent> runtimeStatusHandlerEventHandler,
      @Parameter(JVMHeapSlack.class) final double jvmHeapSlack,
      final ConfigurationSerializer configurationSerializer,
      final RemoteManager remoteManager,
      final REEFFileNames fileNames,
      final LoggingScopeFactory loggingScopeFactory); void onEvaluatorExit(final String evaluatorId);  }