Search in sources :

Example 96 with DefaultModel

use of org.btrplace.model.DefaultModel in project scheduler by btrplace.

the class BtrpNumberTest method testNonViableGeq.

@Test(expectedExceptions = { UnsupportedOperationException.class })
public void testNonViableGeq() {
    BtrpNumber i = new BtrpNumber(5, BtrpNumber.Base.BASE_16);
    Model mo = new DefaultModel();
    BtrpElement j = new BtrpElement(BtrpOperand.Type.VM, "foo", mo.newVM());
    i.remainder(j);
}
Also used : DefaultModel(org.btrplace.model.DefaultModel) Model(org.btrplace.model.Model) DefaultModel(org.btrplace.model.DefaultModel) Test(org.testng.annotations.Test)

Example 97 with DefaultModel

use of org.btrplace.model.DefaultModel in project scheduler by btrplace.

the class BtrpNumberTest method testNonViablePower.

@Test(expectedExceptions = { UnsupportedOperationException.class })
public void testNonViablePower() {
    BtrpNumber i = new BtrpNumber(5, BtrpNumber.Base.BASE_16);
    Model mo = new DefaultModel();
    BtrpElement j = new BtrpElement(BtrpOperand.Type.VM, "foo", mo.newVM());
    i.power(j);
}
Also used : DefaultModel(org.btrplace.model.DefaultModel) Model(org.btrplace.model.Model) DefaultModel(org.btrplace.model.DefaultModel) Test(org.testng.annotations.Test)

Example 98 with DefaultModel

use of org.btrplace.model.DefaultModel in project scheduler by btrplace.

the class BtrpSetTest method testNonViableDivCauseType.

@Test(expectedExceptions = { UnsupportedOperationException.class })
public void testNonViableDivCauseType() {
    BtrpSet s = new BtrpSet(1, BtrpOperand.Type.NUMBER);
    Model mo = new DefaultModel();
    s.div(new BtrpElement(BtrpOperand.Type.VM, "V", mo.newVM()));
}
Also used : DefaultModel(org.btrplace.model.DefaultModel) Model(org.btrplace.model.Model) DefaultModel(org.btrplace.model.DefaultModel) Test(org.testng.annotations.Test)

Example 99 with DefaultModel

use of org.btrplace.model.DefaultModel in project scheduler by btrplace.

the class BtrpSetTest method testNonViableRemainderCauseType.

@Test(expectedExceptions = { UnsupportedOperationException.class })
public void testNonViableRemainderCauseType() {
    BtrpSet s = new BtrpSet(1, BtrpOperand.Type.NUMBER);
    Model mo = new DefaultModel();
    s.remainder(new BtrpElement(BtrpOperand.Type.VM, "V", mo.newVM()));
}
Also used : DefaultModel(org.btrplace.model.DefaultModel) Model(org.btrplace.model.Model) DefaultModel(org.btrplace.model.DefaultModel) Test(org.testng.annotations.Test)

Example 100 with DefaultModel

use of org.btrplace.model.DefaultModel in project scheduler by btrplace.

the class DefaultTemplateFactoryTest method testTypingIssue.

/*@Test(dependsOnMethods = {"testInstantiation", "testRegister"})
    public void testAccessibleWithStrict() throws ElementBuilderException {
        Model mo = new DefaultModel();
        DefaultTemplateFactory tplf = new DefaultTemplateFactory(new InMemoryNamingService(mo));
        tplf.register(new MockVMTemplate("mock1"));
        Script scr = new Script();
        tplf.check(scr, "mock1", null, new HashMap<String, String>());
        Assert.assertEquals(mo.getAttributes().get(el.getElement(), "template"), "mock1");
    }         */
/*@Test(dependsOnMethods = {"testInstantiation", "testRegister"}, expectedExceptions = {ElementBuilderException.class})
    public void testInaccessibleWithStrict() throws ElementBuilderException {
        DefaultTemplateFactory tplf = new DefaultTemplateFactory(new InMemoryNamingService(), new DefaultModel());
        Script scr = new Script();
        tplf.check(scr, "bar", , "foo", new HashMap<String, String>());
    } */
/*@Test(dependsOnMethods = {"testInstantiation", "testRegister"})
    public void testAccessibleWithoutStrict() throws ElementBuilderException {
        Model mo = new DefaultModel();
        DefaultTemplateFactory tplf = new DefaultTemplateFactory(new InMemoryNamingService(), mo);
        tplf.register(new MockVMTemplate("mock1"));
        Script scr = new Script();
        tplf.check(scr, "mock1", null, new HashMap<String, String>());
        Assert.assertEquals(mo.getAttributes().get(el.getElement(), "template"), "mock1");
    } */
/*@Test(dependsOnMethods = {"testInstantiation", "testRegister"})
    public void testInaccessibleWithoutStrict() throws ElementBuilderException {
        Model mo = new DefaultModel();
        DefaultTemplateFactory tplf = new DefaultTemplateFactory(new InMemoryNamingService(), mo);
        Map<String, String> m = new HashMap<>();
        m.put("migratable", null);
        m.put("foo", "7.5");
        m.put("bar", "1243");
        m.put("template", "bar");
        Script scr = new Script();
        tplf.check(scr, "bar", null, m);
        Assert.assertEquals(mo.getAttributes().get(el.getElement(), "template"), "bar");
        Assert.assertEquals(el.getName(), "foo");
        Assert.assertTrue(mo.getAttributes().getBoolean(el.getElement(), "migratable"));
        Assert.assertEquals(mo.getAttributes().getInteger(el.getElement(), "bar").longValue(), 1243);
        Assert.assertEquals(mo.getAttributes().getDouble(el.getElement(), "foo"), 7.5);
        Assert.assertEquals(mo.getAttributes().getKeys(el.getElement()), m.keySet());
    }                    */
@Test(expectedExceptions = { ElementBuilderException.class })
public void testTypingIssue() throws ElementBuilderException {
    Model mo = new DefaultModel();
    DefaultTemplateFactory tplf = new DefaultTemplateFactory(NamingService.newNodeNS(), NamingService.newVMNS(), mo);
    tplf.register(new MockVMTemplate("mock1"));
    Script scr = new Script();
    tplf.check(scr, "mock1", mo.newNode(), new HashMap<>());
}
Also used : DefaultModel(org.btrplace.model.DefaultModel) Script(org.btrplace.btrpsl.Script) Model(org.btrplace.model.Model) DefaultModel(org.btrplace.model.DefaultModel) Test(org.testng.annotations.Test)

Aggregations

DefaultModel (org.btrplace.model.DefaultModel)201 Test (org.testng.annotations.Test)177 Model (org.btrplace.model.Model)157 Node (org.btrplace.model.Node)91 VM (org.btrplace.model.VM)91 HashSet (java.util.HashSet)48 ReconfigurationPlan (org.btrplace.plan.ReconfigurationPlan)43 SatConstraint (org.btrplace.model.constraint.SatConstraint)40 Mapping (org.btrplace.model.Mapping)39 ArrayList (java.util.ArrayList)26 ShareableResource (org.btrplace.model.view.ShareableResource)24 ScriptBuilder (org.btrplace.btrpsl.ScriptBuilder)22 DefaultChocoScheduler (org.btrplace.scheduler.choco.DefaultChocoScheduler)18 BootableNode (org.btrplace.scheduler.choco.transition.BootableNode)17 ShutdownableNode (org.btrplace.scheduler.choco.transition.ShutdownableNode)17 MigrateVM (org.btrplace.plan.event.MigrateVM)16 ChocoScheduler (org.btrplace.scheduler.choco.ChocoScheduler)16 BootVM (org.btrplace.scheduler.choco.transition.BootVM)16 ForgeVM (org.btrplace.scheduler.choco.transition.ForgeVM)16 KillVM (org.btrplace.scheduler.choco.transition.KillVM)16