@Test public void testAllocateNode8AndTwoRandomOnesInDefaultRack() throws InjectionException { injector.bindVolatileParameter(MaxNumberOfEvaluators.class, 8); 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).addNodeName("Node-8").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.assertEquals("Node-8", actualResourceAllocationEvent.get(0).getNodeId()); Assert.assertEquals(RackNames.DEFAULT_RACK_NAME, actualResourceAllocationEvent.get(0).getRackName().get()); Assert.assertNotEquals("Node-8", actualResourceAllocationEvent.get(1).getNodeId()); Assert.assertEquals(RackNames.DEFAULT_RACK_NAME, actualResourceAllocationEvent.get(1).getRackName().get()); Assert.assertNotEquals("Node-8", actualResourceAllocationEvent.get(2).getNodeId()); Assert.assertEquals(RackNames.DEFAULT_RACK_NAME, actualResourceAllocationEvent.get(2).getRackName().get()); 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);  }