Refils resource for handling credit refils
authorGeorgios Gousios <gousiosg@gmail.com>
Thu, 15 Mar 2012 14:14:29 +0000 (16:14 +0200)
committerGeorgios Gousios <gousiosg@gmail.com>
Fri, 16 Mar 2012 16:12:01 +0000 (18:12 +0200)
dist/policy.yaml
src/main/resources/policy.yaml
src/test/resources/policy.yaml
src/test/scala/gr/grnet/aquarium/logic/test/DSLTest.scala

index 6719659..f909b1a 100644 (file)
@@ -20,7 +20,12 @@ aquariumpolicy:
       unit: MB/hr
       complex: false
       costpolicy: continuous
-   
+    - resource:
+      name: refills
+      unit: credits
+      complex: false
+      costpolicy: once
+
   implicitvars:
     - price
     - volume
@@ -33,6 +38,7 @@ aquariumpolicy:
       vmtime: $price times $volume
       diskspace: $price times $volume
       bookpages: $price times $volume
+      refills: $price times $volume
       effective:
         from: 0
   
@@ -44,6 +50,7 @@ aquariumpolicy:
       vmtime: 0.1
       diskspace: 0.05
       bookpages: 0.1
+      refills: 1
       effective:
         from: 0
   
index 0f0a2d9..d0a948d 100644 (file)
@@ -21,6 +21,11 @@ aquariumpolicy:
       unit: MB/hr
       complex: false
       costpolicy: continuous
+    - resource:
+      name: refills
+      unit: credits
+      complex: false
+      costpolicy: once
 
   algorithms:
     - algorithm:
@@ -29,6 +34,7 @@ aquariumpolicy:
       bnddown: $price times $volume
       vmtime: $price times $volume
       dsksp: $price times $volume
+      refills: $price times $volume
       effective:
         from: 0
 
@@ -39,6 +45,7 @@ aquariumpolicy:
       bnddown: 0.02
       vmtime: 0.1
       dsksp: 0.05
+      refills: 1
       effective:
         from: 0
 
index d2ab230..2c1a435 100644 (file)
@@ -26,6 +26,11 @@ aquariumpolicy:
       unit: pages
       complex: false
       costpolicy: discrete
+    - resource:
+      name: refills
+      unit: credits
+      complex: false
+      costpolicy: once
 
   implicitvars:
     - price
@@ -39,6 +44,7 @@ aquariumpolicy:
       vmtime: $price times $volume
       diskspace: $price times $volume
       bookpages: $price times $volume
+      refills: $price times $volume
       effective:
         from: 0
     - algorithm:
@@ -62,6 +68,7 @@ aquariumpolicy:
       vmtime: 0.1
       diskspace: 0.05
       bookpages: 0.1
+      refills: 1
       effective:
         from: 0
     - pricelist: 
index c8452ea..51f8933 100644 (file)
@@ -82,7 +82,7 @@ class DSLTest extends DSLTestBase with TestMethods {
   @Test
   def testParseResources = {
     before
-    assertEquals(5, dsl.resources.size)
+    assertEquals(6, dsl.resources.size)
     assertNotNone(dsl.findResource("vmtime"))
     assertTrue(dsl.findResource("vmtime").get.isComplex)
     assertEquals("vmid", dsl.findResource("vmtime").get.descriminatorField)