From: <an...@us...> - 2008-07-17 22:16:01
|
Revision: 6821 http://smartfrog.svn.sourceforge.net/smartfrog/?rev=6821&view=rev Author: anfarr Date: 2008-07-17 22:15:48 +0000 (Thu, 17 Jul 2008) Log Message: ----------- SFOS-922: Update of tests for constraints work Modified Paths: -------------- trunk/core/testharness/testcases/org/smartfrog/test/system/deadlock/DeadLockSystemTest.java trunk/core/testharness/testcases/org/smartfrog/test/system/reference/CyclicReferenceTest.java Added Paths: ----------- trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ConstraintsTest.java trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn1.sf trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn10.sf trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn11.sf trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn12.sf trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn13.sf trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn14.sf trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn15.sf trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn16.sf trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn17.sf trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn18.sf trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn19.sf trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn2.sf trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn3.sf trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn4.sf trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn5.sf trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn6.sf trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn7.sf trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn9.sf trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctnuv.sf Added: trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ConstraintsTest.java =================================================================== --- trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ConstraintsTest.java (rev 0) +++ trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ConstraintsTest.java 2008-07-17 22:15:48 UTC (rev 6821) @@ -0,0 +1,467 @@ +/** (C) Copyright 2004 Hewlett-Packard Development Company, LP + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information: www.smartfrog.org + + */ + + +package org.smartfrog.test.system.constraints; + +import java.util.Vector; + +import junit.framework.TestCase; + +import org.smartfrog.SFParse; +import org.smartfrog.sfcore.common.Context; +import org.smartfrog.sfcore.componentdescription.ComponentDescription; + + +public class ConstraintsTest extends TestCase { + + private static final String FILES = "org/smartfrog/test/system/constraints/"; + private boolean succ=false; + private boolean first=true; + + public ConstraintsTest(String name) { + super(name); + } + + private boolean failedSolver(){ + if (first){ + first=false; + succ=(System.getenv("ECLIPSEDIRECTORY")!=null && System.getenv("SOLVERCLASS")!=null); + } + + if (!succ) { + System.out.println("No Constraint Solver Present. Aborting test with (degenerative) success"); + return true; + } else return false; + } + + /** + * test case CTN1 + * @throws Throwable on failure + */ + public void testCaseCTN1() throws Throwable { + if (failedSolver()) return; + + ComponentDescription cd = SFParse.parseFileToDescription(FILES+"ctn1.sf"); + assertNotNull(cd); + //It parses... + + Context cxt = cd.sfContext(); + assertEquals(cd.sfContext().size(), 2); + + Object foo1 = cxt.get("foo1"); assertNotNull(foo1); + assertTrue(foo1 instanceof ComponentDescription); + + Object foo2 = cxt.get("foo2"); assertNotNull(foo2); + assertTrue(foo2 instanceof ComponentDescription); + + Context f1c = ((ComponentDescription) foo1).sfContext(); + Context f2c = ((ComponentDescription) foo2).sfContext(); + + Object f1x = f1c.get("x"); assertNotNull(f1x); assertTrue(f1x instanceof Integer); + assertEquals(((Integer)f1x).intValue(), 1); + Object f1y = f1c.get("y"); assertNotNull(f1y); assertTrue(f1y instanceof Integer); + assertEquals(((Integer)f1y).intValue(), 2); + Object f1z = f1c.get("z"); assertNotNull(f1z); assertTrue(f1z instanceof Integer); + assertEquals(((Integer)f1z).intValue(), 2); + Object f2x = f2c.get("x"); assertNotNull(f2x); assertTrue(f2x instanceof Integer); + assertEquals(((Integer)f2x).intValue(), 1); + } + + /** + * test case CTN2 + * @throws Throwable on failure + */ + public void testCaseCTN2() throws Throwable { + if (failedSolver()) return; + + ComponentDescription cd = SFParse.parseFileToDescription(FILES+"ctn2.sf"); + assertNotNull(cd); + //It parses... + + Context cxt = cd.sfContext(); + + Object elements = cxt.get("elements"); assertNotNull(elements); + assertTrue(elements instanceof ComponentDescription); + + Context elc = ((ComponentDescription) elements).sfContext(); + + Object x = elc.get("x"); assertNotNull(x); assertTrue(x instanceof String); + assertEquals((String)x, "one"); + Object y = elc.get("y"); assertNotNull(y); assertTrue(y instanceof String); + assertEquals((String)y, "two"); + Object z = elc.get("z"); assertNotNull(z); assertTrue(z instanceof String); + assertEquals((String)z, "three"); + } + + /** + * test case CTN3 + * @throws Throwable on failure + */ + public void testCaseCTN3() throws Throwable { + if (failedSolver()) return; + + ComponentDescription cd = SFParse.parseFileToDescription(FILES+"ctn3.sf"); + assertNotNull(cd); + //It parses... + + Context cxt = cd.sfContext(); + + Object foo = cxt.get("foo"); assertNotNull(foo); assertTrue(foo instanceof ComponentDescription); + Context fooc = ((ComponentDescription)foo).sfContext(); + Object fool = fooc.get("theList"); assertNotNull(fool); assertTrue(fool instanceof Vector); Vector foov = (Vector)fool; + assertEquals(((Integer) foov.get(0)).intValue(), 1); assertEquals(((Integer) foov.get(1)).intValue(), 2); assertEquals(((Integer) foov.get(2)).intValue(), 3); + + Object foo2 = cxt.get("foo2"); assertNotNull(foo2); assertTrue(foo2 instanceof ComponentDescription); + Context foo2c = ((ComponentDescription)foo2).sfContext(); + Object foo2l = foo2c.get("theList"); assertNotNull(foo2l); assertTrue(foo2l instanceof Vector); Vector foo2v = (Vector)foo2l; + assertEquals(((Integer) foo2v.get(0)).intValue(), 1); assertEquals(((Integer) foo2v.get(1)).intValue(), 2); assertEquals(((Integer) foo2v.get(2)).intValue(), 3); + + Object foo3 = cxt.get("foo3"); assertNotNull(foo3); assertTrue(foo3 instanceof ComponentDescription); + Context foo3c = ((ComponentDescription)foo3).sfContext(); + Object foo3l = foo3c.get("theList"); assertNotNull(foo3l); assertTrue(foo3l instanceof Vector); Vector foo3v = (Vector)foo3l; + assertEquals(((Integer) foo3v.get(0)).intValue(), 1); assertEquals(((Integer) foo3v.get(1)).intValue(), 2); assertEquals(((Integer) foo3v.get(2)).intValue(), 3); + + + } + + /** + * test case CTN4 + * @throws Throwable on failure + */ + public void testCaseCTN4() throws Throwable { + if (failedSolver()) return; + + ComponentDescription cd = SFParse.parseFileToDescription(FILES+"ctn4.sf"); + assertNotNull(cd); + //It parses... + + Context cxt = cd.sfContext(); + + Object foo1 = cxt.get("foo1"); assertNotNull(foo1); assertTrue(foo1 instanceof ComponentDescription); + Context foo1c = ((ComponentDescription)foo1).sfContext(); + + Object foo = foo1c.get("foo"); assertNotNull(foo); assertTrue(foo instanceof ComponentDescription); + Context fooc = ((ComponentDescription)foo).sfContext(); + + Object bar = fooc.get("bar"); assertNotNull(bar); assertTrue(bar instanceof String); assertEquals((String)bar, "32"); + Object bar2 = fooc.get("bar2"); assertNotNull(bar2); assertTrue(bar2 instanceof String); assertEquals((String)bar2, "48"); + Object bar3 = fooc.get("bar3"); assertNotNull(bar3); assertTrue(bar3 instanceof String); assertEquals((String)bar3, "51"); + + } + + + /** + * test case CTN5 + * @throws Throwable on failure + */ + public void testCaseCTN5() throws Throwable { + if (failedSolver()) return; + + ComponentDescription cd = SFParse.parseFileToDescription(FILES+"ctn5.sf"); + assertNotNull(cd); + //It parses... + + Context cxt = cd.sfContext(); + + Object foo1 = cxt.get("foo1"); assertNotNull(foo1); assertTrue(foo1 instanceof ComponentDescription); + Context foo1c = ((ComponentDescription)foo1).sfContext(); + + Object foo = foo1c.get("foo"); assertNotNull(foo); assertTrue(foo instanceof ComponentDescription); + Context fooc = ((ComponentDescription)foo).sfContext(); + + Object bar = fooc.get("bar4"); assertNotNull(bar); assertTrue(bar instanceof String); assertEquals((String)bar, "73"); + + } + + + + /** + * test case CTN6 + * @throws Throwable on failure + */ + public void testCaseCTN6() throws Throwable { + if (failedSolver()) return; + + ComponentDescription cd = SFParse.parseFileToDescription(FILES+"ctn6.sf"); + assertNotNull(cd); + //It parses... + + Context cxt = cd.sfContext(); + + Object foo1 = cxt.get("foo1"); assertNotNull(foo1); assertTrue(foo1 instanceof ComponentDescription); + Context foo1c = ((ComponentDescription)foo1).sfContext(); + + Object foo = foo1c.get("foo"); assertNotNull(foo); assertTrue(foo instanceof ComponentDescription); + Context fooc = ((ComponentDescription)foo).sfContext(); + + Object bar = fooc.get("bar"); assertNotNull(bar); assertTrue(bar instanceof String); assertEquals((String)bar, "32"); + Object bar2 = fooc.get("bar2"); assertNotNull(bar2); assertTrue(bar2 instanceof String); assertEquals((String)bar2, "48"); + Object bar3 = fooc.get("bar3"); assertNotNull(bar3); assertTrue(bar3 instanceof String); assertEquals((String)bar3, "51"); + + } + + + /** + * test case CTN7 + * @throws Throwable on failure + */ + public void testCaseCTN7() throws Throwable { + if (failedSolver()) return; + + ComponentDescription cd = SFParse.parseFileToDescription(FILES+"ctn7.sf"); + assertNotNull(cd); + //It parses... + + Context cxt = cd.sfContext(); + + Object foo1 = cxt.get("foo1"); assertNotNull(foo1); assertTrue(foo1 instanceof ComponentDescription); + Context foo1c = ((ComponentDescription)foo1).sfContext(); + + Object y = foo1c.get("y"); assertNotNull(y); assertTrue(y instanceof String); assertEquals((String)y, "one"); + + } + + + /** + * test case CTN9 + * @throws Throwable on failure + */ + public void testCaseCTN9() throws Throwable { + if (failedSolver()) return; + + ComponentDescription cd = SFParse.parseFileToDescription(FILES+"ctn9.sf"); + assertNotNull(cd); + //It parses... + + Context cxt = cd.sfContext(); + + Object baz = cxt.get("baz"); assertNotNull(baz); assertTrue(baz instanceof ComponentDescription); + Context bazc = ((ComponentDescription)baz).sfContext(); + + Object foof = bazc.get("foofred"); assertNotNull(foof); assertTrue(foof instanceof ComponentDescription); + Context foofc = ((ComponentDescription)foof).sfContext(); + + Object barf = foofc.get("bar"); assertNotNull(barf); assertTrue(barf instanceof String); assertEquals((String)barf, "hello world"); + Object aif = foofc.get("sfArrayIndex"); assertNotNull(aif); assertTrue(aif instanceof String); assertEquals((String)aif, "fred"); + Object atf = foofc.get("sfArrayTag"); assertNotNull(atf); assertTrue(atf instanceof String); assertEquals((String)atf, "foofred"); + + Object fooc = bazc.get("fooclive"); assertNotNull(fooc); assertTrue(fooc instanceof ComponentDescription); + Context foocc = ((ComponentDescription)fooc).sfContext(); + + Object barc = foocc.get("bar"); assertNotNull(barc); assertTrue(barc instanceof String); assertEquals((String)barc, "hello world"); + Object aic = foocc.get("sfArrayIndex"); assertNotNull(aic); assertTrue(aic instanceof String); assertEquals((String)aic, "clive"); + Object atc = foocc.get("sfArrayTag"); assertNotNull(atc); assertTrue(atc instanceof String); assertEquals((String)atc, "fooclive"); + + Object fooj = bazc.get("foojoe"); assertNotNull(fooj); assertTrue(fooj instanceof ComponentDescription); + Context foojc = ((ComponentDescription)fooj).sfContext(); + + Object barj = foojc.get("bar"); assertNotNull(barj); assertTrue(barj instanceof String); assertEquals((String)barj, "hello world"); + Object aij = foojc.get("sfArrayIndex"); assertNotNull(aij); assertTrue(aij instanceof String); assertEquals((String)aij, "joe"); + Object atj = foojc.get("sfArrayTag"); assertNotNull(atj); assertTrue(atj instanceof String); assertEquals((String)atj, "foojoe"); + + } + + + + /** + * test case CTN10 + * @throws Throwable on failure + */ + public void testCaseCTN10() throws Throwable { + if (failedSolver()) return; + + ComponentDescription cd = SFParse.parseFileToDescription(FILES+"ctn10.sf"); + assertNotNull(cd); + //It parses... + + Context cxt = cd.sfContext(); + + Object foo2 = cxt.get("foo2"); assertNotNull(foo2); assertTrue(foo2 instanceof ComponentDescription); + Context foo2c = ((ComponentDescription)foo2).sfContext(); + + Object foo3 = foo2c.get("foo3"); assertNotNull(foo3); assertTrue(foo3 instanceof String); assertEquals((String)foo3, "011"); + + } + + /** + * test case CTN11 + * @throws Throwable on failure + */ + public void testCaseCTN11() throws Throwable { + if (failedSolver()) return; + + ComponentDescription cd = SFParse.parseFileToDescription(FILES+"ctn11.sf"); + assertNotNull(cd); + //It parses... + + Context cxt = cd.sfContext(); + + Object foo2 = cxt.get("foo2"); assertNotNull(foo2); assertTrue(foo2 instanceof ComponentDescription); + Context foo2c = ((ComponentDescription)foo2).sfContext(); + + Object foo3 = foo2c.get("foo3"); assertNotNull(foo3); assertTrue(foo3 instanceof Boolean); assertEquals(((Boolean)foo3).booleanValue(), false); + + } + + /** + * test case CTN12 + * @throws Throwable on failure + */ + public void testCaseCTN12() throws Throwable { + if (failedSolver()) return; + + ComponentDescription cd = SFParse.parseFileToDescription(FILES+"ctn12.sf"); + assertNotNull(cd); + //It parses... + + Context cxt = cd.sfContext(); + + Object foo2 = cxt.get("foo2"); assertNotNull(foo2); assertTrue(foo2 instanceof ComponentDescription); + Context foo2c = ((ComponentDescription)foo2).sfContext(); + + Object foo3 = foo2c.get("foo3"); assertNotNull(foo3); assertTrue(foo3 instanceof Integer); assertEquals(((Integer)foo3).intValue(), 512); + + } + + /** + * test case CTN13 + * @throws Throwable on failure + */ + public void testCaseCTN13() throws Throwable { + if (failedSolver()) return; + + ComponentDescription cd = SFParse.parseFileToDescription(FILES+"ctn13.sf"); + assertNotNull(cd); + //It parses... + + Context cxt = cd.sfContext(); + + Object foo = cxt.get("foo"); assertNotNull(foo); assertTrue(foo instanceof ComponentDescription); + Context fooc = ((ComponentDescription)foo).sfContext(); + + Object bar = fooc.get("bar"); assertNotNull(bar); assertTrue(bar instanceof Integer); assertEquals(((Integer)bar).intValue(), 3); + + } + + /** + * test case CTN14 + * @throws Throwable on failure + */ + public void testCaseCTN14() throws Throwable { + if (failedSolver()) return; + + ComponentDescription cd = SFParse.parseFileToDescription(FILES+"ctn14.sf"); + assertNotNull(cd); + //It parses... + + Context cxt = cd.sfContext(); + + Object foo2 = cxt.get("foo2"); assertNotNull(foo2); assertTrue(foo2 instanceof ComponentDescription); + Context foo2c = ((ComponentDescription)foo2).sfContext(); + + Object foo3 = foo2c.get("foo3"); assertNotNull(foo3); assertTrue(foo3 instanceof String); assertEquals((String)foo3, "011"); + + } + + + /** + * test case CTN15 + * @throws Throwable on failure + */ + public void testCaseCTN15() throws Throwable { + if (failedSolver()) return; + + ComponentDescription cd = SFParse.parseFileToDescription(FILES+"ctn15.sf"); + assertNotNull(cd); + //It parses... + + Context cxt = cd.sfContext(); + Object alloc = cxt.get("allocation"); assertNotNull(alloc); assertTrue(alloc instanceof Vector); Vector allocv = (Vector)alloc; + + assertEquals((String) allocv.get(0), "host0"); assertEquals((String) allocv.get(1), "host0"); + assertEquals((String) allocv.get(2), "host1"); assertEquals((String) allocv.get(3), "host2"); + } + + + /** + * test case CTN16 + * @throws Throwable on failure + */ + public void testCaseCTN16() throws Throwable { + if (failedSolver()) return; + + ComponentDescription cd = SFParse.parseFileToDescription(FILES+"ctn16.sf"); + assertNotNull(cd); + //It parses... + + Context cxt = cd.sfContext(); + + Object foo = cxt.get("foo"); assertNotNull(foo); assertTrue(foo instanceof ComponentDescription); + Context fooc = ((ComponentDescription)foo).sfContext(); + + Object alloc = fooc.get("allocation"); assertNotNull(alloc); assertTrue(alloc instanceof Vector); Vector allocv = (Vector)alloc; + + assertEquals((String) allocv.get(0), "host0"); assertEquals((String) allocv.get(1), "host0"); + assertEquals((String) allocv.get(2), "host1"); assertEquals((String) allocv.get(3), "host2"); + } + + + /** + * test case CTN17 + * @throws Throwable on failure + */ + public void testCaseCTN17() throws Throwable { + if (failedSolver()) return; + + ComponentDescription cd = SFParse.parseFileToDescription(FILES+"ctn17.sf"); + assertNotNull(cd); + //It parses... + + Context cxt = cd.sfContext(); + Object foo = cxt.get("foo"); assertNotNull(foo); assertTrue(foo instanceof ComponentDescription); + Context fooc = ((ComponentDescription)foo).sfContext(); + + Object test = fooc.get("test"); assertNotNull(test); assertTrue(test instanceof String); assertEquals((String)test, "the the"); + + } + + + /** + * test case CTN19 + * @throws Throwable on failure + */ + public void testCaseCTN19() throws Throwable { + if (failedSolver()) return; + + ComponentDescription cd = SFParse.parseFileToDescription(FILES+"ctn19.sf"); + assertNotNull(cd); + //It parses... + + Context cxt = cd.sfContext(); + Object diff = cxt.get("diff"); assertNotNull(diff); assertTrue(diff instanceof ComponentDescription); + Context diffc = ((ComponentDescription)diff).sfContext(); + + Object elvals = diffc.get("element_vals"); assertNotNull(elvals); assertTrue(elvals instanceof Vector); Vector elvalsv = (Vector)elvals; + assertEquals((String) elvalsv.get(0), "one"); assertEquals((String) elvalsv.get(1), "two"); assertEquals((String) elvalsv.get(2), "three"); + } + + +} Added: trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn1.sf =================================================================== --- trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn1.sf (rev 0) +++ trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn1.sf 2008-07-17 22:15:48 UTC (rev 6821) @@ -0,0 +1,16 @@ +#include "/org/smartfrog/functions.sf" + + +sfConfig extends { + foo1 extends Constraint { + x foo2:x; + y VAR "[1..6]"; + z (x + 1); + [sfConstraint] p3 "y lt 6"; + [sfConstraint] p4 "y is x*z"; + } + foo2 extends Constraint { + x VAR; + [sfConstraint] -- "(x=2; x=1)"; + } +} Added: trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn10.sf =================================================================== --- trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn10.sf (rev 0) +++ trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn10.sf 2008-07-17 22:15:48 UTC (rev 6821) @@ -0,0 +1,16 @@ +#include "/org/smartfrog/functions.sf" + +sfConfig extends { + foo1 extends Array { + sfArrayGenerator extends ArrayGenerator, Constraint { + bar VAR "[0,1]"; + index sfArrayIndex; + [sfConstraint] -- "(index==0 -> bar=0; bar=1)"; + } + } + + foo2 extends Aggregator { + sfAggregatorPath "foo1:bar"; + foo3 extends concat; + } +} Added: trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn11.sf =================================================================== --- trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn11.sf (rev 0) +++ trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn11.sf 2008-07-17 22:15:48 UTC (rev 6821) @@ -0,0 +1,20 @@ +#include "/org/smartfrog/functions.sf" + +sfConfig extends { + foo1 extends Array { + sfArrayGenerator extends ArrayGenerator, Constraint { + bar VAR "[0,1]"; + index sfArrayIndex; + [sfConstraint] -- "(index==0 -> bar=0; bar=1)"; + } + } + + foo2 extends Aggregator { + sfAggregatorArraySource foo1; + sfAggregatorAttributePath "bar"; + foo3 extends forall { + sfAEOperator extends EQ; + sfAELeftArg 1; + } + } +} Added: trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn12.sf =================================================================== --- trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn12.sf (rev 0) +++ trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn12.sf 2008-07-17 22:15:48 UTC (rev 6821) @@ -0,0 +1,18 @@ +#include "/org/smartfrog/functions.sf" + +sfConfig extends { + foo1 extends Array { + sfArrayGenerator extends { + help extends { + help2 8; + } + } + sfArrayPrefix "zoo"; + sfArrayExtent 3; + } + + foo2 extends Aggregator { + sfAggregatorPath "foo1:help:help2"; + foo3 extends nproduct; + } +} Added: trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn13.sf =================================================================== --- trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn13.sf (rev 0) +++ trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn13.sf 2008-07-17 22:15:48 UTC (rev 6821) @@ -0,0 +1,7 @@ +#include "/org/smartfrog/functions.sf" + +sfConfig extends { + foo extends Constraint { + bar VAR "[1..3]" 3; + } +} \ No newline at end of file Added: trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn14.sf =================================================================== --- trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn14.sf (rev 0) +++ trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn14.sf 2008-07-17 22:15:48 UTC (rev 6821) @@ -0,0 +1,16 @@ +#include "/org/smartfrog/functions.sf" + +sfConfig extends { + foo1 extends Array { + sfArrayGenerator extends ArrayGenerator, Constraint { + help VAR "[0,1]" 1; + [sfConstraint] -- "(sfArrayIndex==0 -> help=0; true)"; + } + } + + foo2 extends Aggregator { + sfAggregatorPath "foo1:help"; + foo3 extends concat; + + } +} Added: trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn15.sf =================================================================== --- trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn15.sf (rev 0) +++ trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn15.sf 2008-07-17 22:15:48 UTC (rev 6821) @@ -0,0 +1,56 @@ +#include "/org/smartfrog/functions.sf" + +Host extends Constraint, ArrayGenerator { + [sfConstraintAutoVar] host_type VAR host_types; + host_types ["ht0", "ht1"]; + + [sfConstraintAutoVar] memory VAR memory_types; + memory_types [3, 4]; + + caps [memory]; + + //sfArrayIndex -- added in Array processing + + [sfConstraint] -- "sfArrayIndex eq 0 implies memory eq 4 and host_type eq ht0"; + [sfConstraint] -- "sfArrayIndex gt 0 implies memory eq 3 and host_type eq ht1"; +} + + +VM extends Constraint, ArrayGenerator { + [sfConstraintAutoVar] vm_type VAR vm_types; + vm_types ["vmt0", "vmt1"]; + + [sfConstraintAutoVar] memory VAR memory_types; + memory_types [2, 3]; + + reqs [memory]; + + allocated VAR; + + //sfArrayIndex -- added in Array processing + + [sfConstraint] -- "sfArrayIndex lt 2 implies memory eq 2 and vm_type eq vmt0"; + [sfConstraint] -- "sfArrayIndex gte 2 implies memory eq 3 and vm_type eq vmt1"; +} + +sfConfig extends ResourceAllocator { + providers_array "hosts"; + providers_attr "sfArrayTag"; + provider_caps_attr "caps"; + consumers_array "vms"; + consumers_attr "sfArrayTag"; + consumer_reqs_attr "reqs"; + allocation_attr "allocated"; + + hosts extends Array { + sfArrayExtent 3; + sfArrayGenerator extends Host; + sfArrayPrefix "host"; + } + + vms extends Array { + sfArrayExtent 4; + sfArrayGenerator extends VM; + sfArrayPrefix "vm"; + } +} Added: trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn16.sf =================================================================== --- trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn16.sf (rev 0) +++ trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn16.sf 2008-07-17 22:15:48 UTC (rev 6821) @@ -0,0 +1,39 @@ +#include "/org/smartfrog/functions.sf" + +alloc1 extends Constraint { + producers ["host0", "host1", "host2"]; + producer_caps [[4], [3], [3]]; + consumers ["vm0", "vm1", "vm2", "vm3"]; + consumer_caps [[2], [2], [3], [3]]; + allocation VAR; + //noncolocations [["vm0","vm1"]]; + [sfConstraint] -- "allocate(producers, producer_caps, consumers, consumer_caps, allocation, [], [], [])"; +} + + +alloc2 extends Constraint { + producers ["h0","h1","h2","h3","h4","h5"]; + producer_caps [[10], [10], [10], [10], [10], [10]]; + consumers ["v0","v1","v2","v3","v4","v5","v6","v7","v8","v9", + "v10","v11","v12","v13","v14","v15","v16","v17","v18","v19", + "v20","v21","v22","v23","v24","v25","v26","v27","v28","v29", + "v30","v31","v32","v33","v34","v35","v36","v37","v38","v39", + "v40","v41","v42","v43","v44","v45","v46","v47","v48","v49"]; + consumer_caps [[1], [1], [1], [1], [1], [1], [1], [1], [1], [1], + [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], + [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], + [1], [1], [1], [1], [1], [1], [1], [1], [1], [1], + [1], [1], [1], [1], [1], [1], [1], [1], [1], [1]]; + colocations [["v0","v10","v20","v30","v40"],["v1","v11","v21","v31","v41"], + ["v2","v12","v22","v32","v42"],["v3","v13","v23","v33","v43"], + ["v4","v14","v24","v34","v44"],["v5","v15","v25","v35","v45"], + ["v6","v16","v26","v36","v46"],["v7","v17","v27","v37","v47"], + ["v8","v18","v28","v38","v48"],["v9","v19","v29","v39","v49"]]; + allocation VAR; + hosted [["v0","h5"], ["v1", "h5"]]; + [sfConstraint] -- "allocate(producers, producer_caps, consumers, consumer_caps, allocation, colocations, [], hosted)"; +} + +sfConfig extends { + foo alloc1; +} Added: trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn17.sf =================================================================== --- trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn17.sf (rev 0) +++ trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn17.sf 2008-07-17 22:15:48 UTC (rev 6821) @@ -0,0 +1,8 @@ +#include "/org/smartfrog/functions.sf" + +sfConfig extends { + foo extends Constraint{ + test VAR; + [sfConstraint] -- "test = \"the the\""; + } +} Added: trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn18.sf =================================================================== --- trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn18.sf (rev 0) +++ trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn18.sf 2008-07-17 22:15:48 UTC (rev 6821) @@ -0,0 +1,8 @@ +#include "/org/smartfrog/functions.sf" + +sfConfig extends { + foo extends Constraint{ + test VAR "[1,2,3, 5..5000]"; + [sfConstraint] -- "test = 4"; + } +} Added: trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn19.sf =================================================================== --- trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn19.sf (rev 0) +++ trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn19.sf 2008-07-17 22:15:48 UTC (rev 6821) @@ -0,0 +1,37 @@ +#include "/org/smartfrog/functions.sf" + +sfConfig extends { + theList genList:theList; + + elements extends Array { + sfArrayPrefix "foo"; + sfArrayExtent 3; + sfArrayGenerator extends ArrayGenerator { + + element extends Constraint{ + val VAR theList; + } + + [sfTemp] -- diff; + + -- extends Constraint { + list theList; + el element:val; + [sfConstraint] -- "member(el, list)"; + } + + } + } + + diff extends Constraint { + [sfAggregatedConstraintSource] -- ["elements", "element:val", "element_vals"]; + [sfConstraint] -- "alldifferent(element_vals)"; + } + + genList extends Constraint { + theList ["one", VAR, "three", VAR]; + aList [VAR, "two", VAR, "four"]; + + [sfConstraint] -- "theList = aList"; + } +} Added: trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn2.sf =================================================================== --- trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn2.sf (rev 0) +++ trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn2.sf 2008-07-17 22:15:48 UTC (rev 6821) @@ -0,0 +1,28 @@ +#include "/org/smartfrog/functions.sf" + +ListElement extends Constraint { + list theList; + [sfConstraint] -- "member(el, list)"; +} + +sfConfig extends { + theList genList:theList; + + x extends ListElement { el elements:x; } + y extends ListElement { el elements:y; } + z extends ListElement { el elements:z; } + + elements extends Constraint { + x VAR theList; + y VAR theList; + z VAR theList; + [sfConstraint] -- "alldifferent([x,y,z])"; + } + + genList extends Constraint { + theList ["one", VAR, "three", VAR]; + aList [VAR, "two", VAR, "four"]; + + [sfConstraint] -- "theList = aList"; + } +} Added: trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn3.sf =================================================================== --- trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn3.sf (rev 0) +++ trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn3.sf 2008-07-17 22:15:48 UTC (rev 6821) @@ -0,0 +1,16 @@ +#include "/org/smartfrog/functions.sf" + +sfConfig extends { + foo extends Constraint{ + theList VAR; + [sfConstraint] -- "theList = [1,_,_]"; + } + foo2 extends Constraint { + theList foo:theList; + [sfConstraint] -- "theList = [_,2,_]"; + } + foo3 extends Constraint { + theList foo:theList; + [sfConstraint] -- "theList = [_,_,3]"; + } +} Added: trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn4.sf =================================================================== --- trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn4.sf (rev 0) +++ trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn4.sf 2008-07-17 22:15:48 UTC (rev 6821) @@ -0,0 +1,20 @@ +#include "/org/smartfrog/functions.sf" + +sfConfig extends { + foo1 extends Constraint { + foo2 extends { + bar "32"; + bar2 "33"; + } + foo3 extends foo2 { + bar2 "48"; + bar3 "51"; + } + foo4 extends { + bar4 "73"; + } + foo VAR "[foo3, foo4]"; + [sfConstraint] -- "foo subtype foo2, (foo = foo4; foo = foo3)"; + } +} + Added: trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn5.sf =================================================================== --- trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn5.sf (rev 0) +++ trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn5.sf 2008-07-17 22:15:48 UTC (rev 6821) @@ -0,0 +1,20 @@ +#include "/org/smartfrog/functions.sf" + +sfConfig extends { + foo1 extends Constraint { + foo2 extends { + bar "32"; + bar2 "33"; + } + foo3 extends foo2 { + bar2 "48"; + bar3 "51"; + } + foo4 extends { + bar4 "73"; + } + foo VAR "[foo3, foo4]"; + [sfConstraint] -- "foo = foo4; foo = foo3"; + } +} + Added: trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn6.sf =================================================================== --- trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn6.sf (rev 0) +++ trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn6.sf 2008-07-17 22:15:48 UTC (rev 6821) @@ -0,0 +1,20 @@ +#include "/org/smartfrog/functions.sf" + +sfConfig extends { + foo1 extends Constraint { + foo2 extends { + bar "32"; + bar2 "33"; + } + foo3 extends foo2 { + bar2 "48"; + bar3 "51"; + } + foo4 extends { + bar4 "73"; + } + [sfConstraintAutoVar] foo VAR "[foo4, foo3]"; + [sfConstraint] -- "foo subtype foo3"; + } +} + Added: trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn7.sf =================================================================== --- trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn7.sf (rev 0) +++ trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn7.sf 2008-07-17 22:15:48 UTC (rev 6821) @@ -0,0 +1,9 @@ +#include "/org/smartfrog/functions.sf" + +sfConfig extends { + foo1 extends Constraint { + y VAR range; + range "[one, two, three]"; + [sfConstraint] -- "y = one"; + } +} Added: trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn9.sf =================================================================== --- trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn9.sf (rev 0) +++ trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctn9.sf 2008-07-17 22:15:48 UTC (rev 6821) @@ -0,0 +1,12 @@ +#include "/org/smartfrog/functions.sf" + +sfConfig extends { + baz extends Array { + sfArrayGenerator extends { + bar "hello world"; + } + sfArrayExtent ["fred", "clive", "joe"]; + sfArrayPrefix "foo"; + } +} + Added: trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctnuv.sf =================================================================== --- trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctnuv.sf (rev 0) +++ trunk/core/testharness/testcases/org/smartfrog/test/system/constraints/ctnuv.sf 2008-07-17 22:15:48 UTC (rev 6821) @@ -0,0 +1,23 @@ +#include "/org/smartfrog/functions.sf" + +sfConfig extends { + theList genList:theList; + + x elements:x; + y elements:y; + z elements:z; + + elements extends Constraint { + [sfConstraintUserVar] x VAR theList; + [sfConstraintUserVar] y VAR theList; + [sfConstraintUserVar] z VAR theList; + [sfConstraint] -- "alldifferent([x,y,z])"; + } + + genList extends Constraint { + theList ["one", VAR, "three", VAR]; + aList [VAR, "two", VAR, "four"]; + + [sfConstraint] -- "theList = aList"; + } +} Modified: trunk/core/testharness/testcases/org/smartfrog/test/system/deadlock/DeadLockSystemTest.java =================================================================== --- trunk/core/testharness/testcases/org/smartfrog/test/system/deadlock/DeadLockSystemTest.java 2008-07-17 22:08:03 UTC (rev 6820) +++ trunk/core/testharness/testcases/org/smartfrog/test/system/deadlock/DeadLockSystemTest.java 2008-07-17 22:15:48 UTC (rev 6821) @@ -36,6 +36,11 @@ } + public void testCaseDummy() { + ; + } + + /** * test case * @throws Throwable on failure Modified: trunk/core/testharness/testcases/org/smartfrog/test/system/reference/CyclicReferenceTest.java =================================================================== --- trunk/core/testharness/testcases/org/smartfrog/test/system/reference/CyclicReferenceTest.java 2008-07-17 22:08:03 UTC (rev 6820) +++ trunk/core/testharness/testcases/org/smartfrog/test/system/reference/CyclicReferenceTest.java 2008-07-17 22:15:48 UTC (rev 6821) @@ -38,6 +38,11 @@ super(s); } + public void testCaseDummy() { + ; + } + + /** * test case * @throws Throwable on failure @@ -50,7 +55,7 @@ "Failed to resolve 'link link'.", EXCEPTION_LINKRESOLUTION, POSSIBLE_CAUSE_CYCLIC_REFERENCE); - } + } /** * test case @@ -63,35 +68,37 @@ "Failed to resolve 'link PARENT:sfConfig:link'.", EXCEPTION_LINKRESOLUTION, POSSIBLE_CAUSE_CYCLIC_REFERENCE); - } + } - /** - * test case - * @throws Throwable on failure - */ - public void testCaseTCN98() throws Throwable { + //Tests 98 and 99 -- no longer applicable since new link resolution... + //That is, new link resolution will not cause a stack overflow, rather will run out of heap space... + ///** + // * test case + // * @throws Throwable on failure + // */ + /*public void testCaseTCN98() throws Throwable { deployExpectingException(FILES + "tcn98.sf", "tcn98", EXCEPTION_DEPLOYMENT, "[unprintable cyclic value]", EXCEPTION_LINKRESOLUTION, POSSIBLE_CAUSE_CYCLIC_REFERENCE); - } - - /** - * test case - * @throws Throwable on failure - */ - public void testCaseTCN99() throws Throwable { + } + */ + ///** + // * test case + // * @throws Throwable on failure + // */ + /*public void testCaseTCN99() throws Throwable { deployExpectingException(FILES + "tcn99.sf", "tcn99", EXCEPTION_DEPLOYMENT, "", EXCEPTION_TYPERESOLUTION, POSSIBLE_CAUSE_CYCLIC_REFERENCE); - } + } + */ - /** * test case * @throws Throwable on failure @@ -103,5 +110,5 @@ "Failed to resolve 'attr ", EXCEPTION_LINKRESOLUTION, POSSIBLE_CAUSE_CYCLIC_REFERENCE); - } + } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |