ResAllocsUtil { public static ResAllocs ceilingOf(ResAllocs first, ResAllocs second) { return new ResAllocsBuilder(first.getTaskGroupName()) .withCores(Math.max(first.getCores(), second.getCores())) .withMemory(Math.max(first.getMemory(), second.getMemory())) .withNetworkMbps(Math.max(first.getNetworkMbps(), second.getNetworkMbps())) .withDisk(Math.max(first.getDisk(), second.getDisk())) .build(); }  static ResAllocs add(ResAllocs first, ResAllocs second); static ResAllocs add(ResAllocs first, QueuableTask second); static ResAllocs subtract(ResAllocs first, ResAllocs second); static ResAllocs ceilingOf(ResAllocs first, ResAllocs second); static boolean isBounded(QueuableTask first, ResAllocs second); static boolean isBounded(ResAllocs first, QueuableTask second); static boolean isBounded(ResAllocs first, ResAllocs second); static boolean hasEqualResources(ResAllocs first, ResAllocs second); static ResAllocs empty(); static ResAllocs emptyOf(String name); static ResAllocs rename(String newName, ResAllocs allocs); static ResAllocs toResAllocs(String name, Map<VMResource, Double> resourceMap);  }
@Test public void testCeilingOf() throws Exception { ResAllocs result = ResAllocsUtil.ceilingOf( new ResAllocsBuilder("any").withCores(10).withMemory(20).withNetworkMbps(30).withDisk(40).build(), new ResAllocsBuilder("any").withCores(5).withMemory(25).withNetworkMbps(15).withDisk(45).build() ); assertThat(hasEqualResources( new ResAllocsBuilder("any").withCores(10).withMemory(25).withNetworkMbps(30).withDisk(45).build(), result ), is(true)); }