@Test public void testCapacityConstraints() { final String capacityConstraint = "create view constraint_capacity as " + "select * from virtual_machine " + "join physical_machine " + " on physical_machine.name = virtual_machine.controllable__physical_machine " + "group by physical_machine.name, physical_machine.cpu_capacity, physical_machine.memory_capacity " + "check sum(virtual_machine.cpu) <= physical_machine.cpu_capacity and " + " sum(virtual_machine.memory) <= physical_machine.memory_capacity"; final LoadBalance lb = new LoadBalance(Collections.singletonList(capacityConstraint)); addInventory(lb); final Result<? extends Record> results = lb.run(); System.out.println(results); final Set<String> setOfPhysicalMachines = results.stream() .map(e -> e.get("CONTROLLABLE__PHYSICAL_MACHINE", String.class)) .collect(Collectors.toSet()); assertTrue(setOfPhysicalMachines.size() >= 2); }
Result<? extends Record> run() { model.updateData(); return model.solve(VIRTUAL_MACHINES_TABLE); }
LoadBalance { Result<? extends Record> run() { model.updateData(); return model.solve(VIRTUAL_MACHINES_TABLE); } }
LoadBalance { Result<? extends Record> run() { model.updateData(); return model.solve(VIRTUAL_MACHINES_TABLE); } LoadBalance(final List<String> constraints); }
LoadBalance { Result<? extends Record> run() { model.updateData(); return model.solve(VIRTUAL_MACHINES_TABLE); } LoadBalance(final List<String> constraints);  }
LoadBalance { Result<? extends Record> run() { model.updateData(); return model.solve(VIRTUAL_MACHINES_TABLE); } LoadBalance(final List<String> constraints);   }