Search in sources :

Example 1 with Constraint

use of org.btrplace.model.constraint.Constraint in project scheduler by btrplace.

the class MaxOnlineConverterTest method testViables.

@Test
public void testViables() throws JSONConverterException {
    Model model = new DefaultModel();
    Set<Node> s = new HashSet<>(Arrays.asList(model.newNode(), model.newNode(), model.newNode()));
    MaxOnline mo = new MaxOnline(s, 2);
    ConstraintsConverter conv = new ConstraintsConverter();
    conv.register(new MaxOnlineConverter());
    Constraint new_max = conv.fromJSON(model, conv.toJSON(mo));
    Assert.assertEquals(mo, new_max);
    System.out.println(conv.toJSON(mo));
}
Also used : DefaultModel(org.btrplace.model.DefaultModel) MaxOnline(org.btrplace.model.constraint.MaxOnline) Constraint(org.btrplace.model.constraint.Constraint) Node(org.btrplace.model.Node) Model(org.btrplace.model.Model) DefaultModel(org.btrplace.model.DefaultModel) HashSet(java.util.HashSet) Test(org.testng.annotations.Test)

Aggregations

HashSet (java.util.HashSet)1 DefaultModel (org.btrplace.model.DefaultModel)1 Model (org.btrplace.model.Model)1 Node (org.btrplace.model.Node)1 Constraint (org.btrplace.model.constraint.Constraint)1 MaxOnline (org.btrplace.model.constraint.MaxOnline)1 Test (org.testng.annotations.Test)1