Remove code to be re-written
authorGeorgios Gousios <gousiosg@gmail.com>
Thu, 24 Nov 2011 14:04:20 +0000 (16:04 +0200)
committerGeorgios Gousios <gousiosg@gmail.com>
Thu, 24 Nov 2011 14:04:37 +0000 (16:04 +0200)
logic/src/main/scala/gr/grnet/aquarium/logic/accounting/Accounting.scala [moved from logic/src/main/scala/gr/grnet/aquarium/logic/accounting/AccountingEventType.scala with 88% similarity]
logic/src/main/scala/gr/grnet/aquarium/logic/accounting/AccountingEntry.scala [deleted file]
logic/src/main/scala/gr/grnet/aquarium/logic/accounting/AccountingEntryType.scala [deleted file]
logic/src/main/scala/gr/grnet/aquarium/logic/accounting/AccountingEvent.scala [deleted file]
logic/src/main/scala/gr/grnet/aquarium/logic/accounting/Agreement.scala [deleted file]
logic/src/main/scala/gr/grnet/aquarium/logic/accounting/Policy.scala [deleted file]
logic/src/main/scala/gr/grnet/aquarium/logic/events/EventProcessor.scala
logic/src/test/scala/gr/grnet/aquarium/logic/test/AccountsTest.scala [deleted file]
logic/src/test/scala/gr/grnet/aquarium/logic/test/BillingTest.scala [deleted file]
logic/src/test/scala/gr/grnet/aquarium/logic/test/EventProcessorTest.scala

 
 package gr.grnet.aquarium.logic.accounting
 
+import gr.grnet.aquarium.logic.accounting.dsl.DSLAgreement
 
-object AccountingEventType extends Enumeration {
-  type AcountingEvent = Value
-  val NetDataUp, NetDataDown, DiskSpace, VMTime = Value
+/**
+ * 
+ *
+ * @author Georgios Gousios <gousiosg@gmail.com>
+ */
+trait Accounting {
+
+  def chargeEvent( a: DSLAgreement) : Float = {
+    0F
+  }
 }
\ No newline at end of file
diff --git a/logic/src/main/scala/gr/grnet/aquarium/logic/accounting/AccountingEntry.scala b/logic/src/main/scala/gr/grnet/aquarium/logic/accounting/AccountingEntry.scala
deleted file mode 100644 (file)
index 7b0b3c6..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2011 GRNET S.A. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- *   1. Redistributions of source code must retain the above
- *      copyright notice, this list of conditions and the following
- *      disclaimer.
- *
- *   2. Redistributions in binary form must reproduce the above
- *      copyright notice, this list of conditions and the following
- *      disclaimer in the documentation and/or other materials
- *      provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and
- * documentation are those of the authors and should not be
- * interpreted as representing official policies, either expressed
- * or implied, of GRNET S.A.
- */
-
-package gr.grnet.aquarium.logic.accounting
-
-import java.util.Date
-
-/**The result of processing an accounting event*/
-class AccountingEntry(sourceEvents: List[Long], when: Date,
-                      amnt: Float, et: AccountingEntryType.Value) {
-  val events = sourceEvents
-  val amount = amnt
-  val entryType = et
-}
diff --git a/logic/src/main/scala/gr/grnet/aquarium/logic/accounting/AccountingEntryType.scala b/logic/src/main/scala/gr/grnet/aquarium/logic/accounting/AccountingEntryType.scala
deleted file mode 100644 (file)
index b9236db..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2011 GRNET S.A. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- *   1. Redistributions of source code must retain the above
- *      copyright notice, this list of conditions and the following
- *      disclaimer.
- *
- *   2. Redistributions in binary form must reproduce the above
- *      copyright notice, this list of conditions and the following
- *      disclaimer in the documentation and/or other materials
- *      provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and
- * documentation are those of the authors and should not be
- * interpreted as representing official policies, either expressed
- * or implied, of GRNET S.A.
- */
-
-package gr.grnet.aquarium.logic.accounting
-
-object AccountingEntryType extends Enumeration {
-  type InputEvent = Value
-  val STORAGE_CHARGE, NET_CHARGE, DEBIT, VMTIME_CHARGE = Value
-}
diff --git a/logic/src/main/scala/gr/grnet/aquarium/logic/accounting/AccountingEvent.scala b/logic/src/main/scala/gr/grnet/aquarium/logic/accounting/AccountingEvent.scala
deleted file mode 100644 (file)
index b7c989c..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2011 GRNET S.A. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- *   1. Redistributions of source code must retain the above
- *      copyright notice, this list of conditions and the following
- *      disclaimer.
- *
- *   2. Redistributions in binary form must reproduce the above
- *      copyright notice, this list of conditions and the following
- *      disclaimer in the documentation and/or other materials
- *      provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and
- * documentation are those of the authors and should not be
- * interpreted as representing official policies, either expressed
- * or implied, of GRNET S.A.
- */
-
-package gr.grnet.aquarium.logic.accounting
-
-import gr.grnet.aquarium.model.{Entity, DB}
-import java.util.Date
-
-
-/** An accounting event represents any event that the accounting system
- *  must process.
- */
-class AccountingEvent(et: AccountingEventType.Value, start: Date,
-                      end: Date, who: Long, amount: Float, rel: List[Long]) {
-
-  def dateStart() = start
-  def dateEnd() = end
-
-  def entity() = DB.find(classOf[Entity], who) match {
-    case Some(x) => x
-    case None => throw new Exception("No user with id: " + who)
-  }
-
-  def value() = amount
-
-  def relatedEvents() = rel
-
-  def kind() = et
-
-  def process() = {
-    val evts =  policy().map{p => p.process(this)}
-    val total = evts.map(x => x.amount).foldLeft(0F)((a, sum) => a + sum)
-    new AccountingEntry(rel, new Date(), total, evts.head.entryType)
-  }
-
-  def policy(): List[Policy] = {
-    /*val agr = AgreementRegistry.getAgreement(entity().agreement) match {
-      case Some(x) => x
-      case None => throw new Exception("No agreement with id:" +
-        entity().agreement)
-    }*/
-
-    /*agr.algorithm(et, when) match {
-      case Some(x) => x
-      case None => throw new Exception("No charging algorithm for event type:" +
-        et + " in period starting from:" + when.getTime)
-    }*/
-    List()
-  }
-
-  def getRate(): Float = {
-    /*val agreement = AgreementRegistry.getAgreement(entity.agreement)
-
-    agreement match {
-      case Some(x) => x.pricelist.get(et).getOrElse(0)
-      case None => 0
-    }*/
-    0F
-  }
-}
diff --git a/logic/src/main/scala/gr/grnet/aquarium/logic/accounting/Agreement.scala b/logic/src/main/scala/gr/grnet/aquarium/logic/accounting/Agreement.scala
deleted file mode 100644 (file)
index 8c0f28c..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2011 GRNET S.A. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- *   1. Redistributions of source code must retain the above
- *      copyright notice, this list of conditions and the following
- *      disclaimer.
- *
- *   2. Redistributions in binary form must reproduce the above
- *      copyright notice, this list of conditions and the following
- *      disclaimer in the documentation and/or other materials
- *      provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and
- * documentation are those of the authors and should not be
- * interpreted as representing official policies, either expressed
- * or implied, of GRNET S.A.
- */
-
-package gr.grnet.aquarium.logic.accounting
-
-import collection.immutable.HashMap
-import collection.immutable.List
-import java.util.Date
-
-abstract class Agreement {
-
-  val id : Long = 0
-
-  val pricelist : Map[AccountingEventType.Value, Float] = Map()
-
-  var policies : Map[AccountingEventType.Value, Map[Date,Policy]] = Map()
-
-  def addPolicy(et: AccountingEventType.Value, p: Policy, d: Date) = {
-    policies = policies ++ Map(et -> Map(d -> p))
-  }
-
-  /** Get applicable algorithm at the resource that the event occured */
-  def policy(et: AccountingEventType.Value, d: Date) : Option[Policy] = {
-    val ruleset = policies.getOrElse(et, new HashMap[Date, Policy])
-    val keyset = List(new Date(0)) ++
-                 ruleset.keys.toList.sorted ++
-                 List(new Date(Long.MaxValue))
-
-    val key = intervals[Date](keyset).find(
-      k => d.compareTo(k.head) >= 0 && d.compareTo(k.reverse.head) < 0
-    ).get.head
-
-    ruleset.get(key)
-  }
-
-  /**Generate a list of pairs by combining the elements of the provided
-   * list sequentially.
-   *
-   * for example:
-   * intervals(List(1,2,3,4)) -> List(List(1,2), List(2,3), List(3,4))
-   */
-  private def intervals[A](a : List[A]) : List[List[A]] = {
-    if (a.size <= 1)
-      return List()
-    List(List(a.head, a.tail.head)) ++ intervals(a.tail)
-  }
-}
\ No newline at end of file
diff --git a/logic/src/main/scala/gr/grnet/aquarium/logic/accounting/Policy.scala b/logic/src/main/scala/gr/grnet/aquarium/logic/accounting/Policy.scala
deleted file mode 100644 (file)
index 7c1f9e6..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2011 GRNET S.A. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- *   1. Redistributions of source code must retain the above
- *      copyright notice, this list of conditions and the following
- *      disclaimer.
- *
- *   2. Redistributions in binary form must reproduce the above
- *      copyright notice, this list of conditions and the following
- *      disclaimer in the documentation and/or other materials
- *      provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and
- * documentation are those of the authors and should not be
- * interpreted as representing official policies, either expressed
- * or implied, of GRNET S.A.
- */
-
-package gr.grnet.aquarium.logic.accounting
-
-import java.util.Date
-
-
-abstract class Policy(et: AccountingEntryType.Value) {
-
-  private def makeEntry(event: AccountingEvent, amount: Float) : AccountingEntry = {
-      new AccountingEntry(event.relatedEvents(), new Date(), amount, et)
-  }
-
-  def process(evt: AccountingEvent) = {
-    makeEntry(evt, calculateAmount(evt))
-  }
-
-  def calculateAmount(evt: AccountingEvent) : Float
-}
\ No newline at end of file
index c2f8561..0b450d9 100644 (file)
 
 package gr.grnet.aquarium.logic.events
 
-import gr.grnet.aquarium.logic.accounting.{AccountingEventType, AccountingEvent}
 import java.util.Date
 
 object EventProcessor {
 
   def process(events: List[Event])
-             (evtFilter: (Event) => Boolean): List[AccountingEvent] = {
+             (evtFilter: (Event) => Boolean){//: List[AccountingEvent] = {
 
     val evts = events.filter(evtFilter)
-    val dummy = new AccountingEvent(AccountingEventType.VMTime, new Date(), new Date(), 0, 0, List())
+    //val dummy = new AccountingEvent(AccountingEventType.VMTime, new Date(), new Date(), 0, 0, List())
 
     evts.sortBy(_.when).map {
       e =>
@@ -62,24 +61,24 @@ object EventProcessor {
             }
             val totaltime = time.getTime - v.w.getTime
             assert(totaltime > 0)
-            new AccountingEvent(AccountingEventType.VMTime, e.when, time, u, totaltime, List(v.id, stopid))
+            //new AccountingEvent(AccountingEventType.VMTime, e.when, time, u, totaltime, List(v.id, stopid))
           //          case v : VMStarted =>None
           //          case v : VMStopped =>None
           case v: DiskSpaceChanged =>
             assert(v.bytes > 0)
-            new AccountingEvent(AccountingEventType.DiskSpace, e.when, e.when, u, v.bytes, List(v.id()))
+            //new AccountingEvent(AccountingEventType.DiskSpace, e.when, e.when, u, v.bytes, List(v.id()))
           case v: DataUploaded =>
             assert(v.bytes > 0)
-            new AccountingEvent(AccountingEventType.NetDataUp, e.when, e.when, u, v.bytes, List(v.id()))
+            //new AccountingEvent(AccountingEventType.NetDataUp, e.when, e.when, u, v.bytes, List(v.id()))
           case v: DataDownloaded =>
             assert(v.bytes > 0)
-            new AccountingEvent(AccountingEventType.NetDataDown, e.when, e.when, u, v.bytes, List(v.id()))
+            //new AccountingEvent(AccountingEventType.NetDataDown, e.when, e.when, u, v.bytes, List(v.id()))
           //          case v : SSaasVMCreated => None
           //          case v : SSaasVMStarted =>None
           //          case v : SSaasVMStopped =>None
-          case _ => dummy
+          //case _ => dummy
         }
-    }.filter(p => p != dummy) //Remove dummy events
+    } //Remove dummy events
   }
 
   /**Find a the first corresponding VM stop event in a list of messages*/
diff --git a/logic/src/test/scala/gr/grnet/aquarium/logic/test/AccountsTest.scala b/logic/src/test/scala/gr/grnet/aquarium/logic/test/AccountsTest.scala
deleted file mode 100644 (file)
index c899222..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2011 GRNET S.A. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- *   1. Redistributions of source code must retain the above
- *      copyright notice, this list of conditions and the following
- *      disclaimer.
- *
- *   2. Redistributions in binary form must reproduce the above
- *      copyright notice, this list of conditions and the following
- *      disclaimer in the documentation and/or other materials
- *      provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and
- * documentation are those of the authors and should not be
- * interpreted as representing official policies, either expressed
- * or implied, of GRNET S.A.
- */
-
-package gr.grnet.aquarium.logic.test
-
-import org.junit.{After, Before, Test}
-import gr.grnet.aquarium.util.FixtureLoader
-
-class AccountsTest extends FixtureLoader {
-
-  def getDB() = TestDB
-
-  @Before
-  def before() = {
-    if (!TestDB.getTransaction.isActive)
-      TestDB.getTransaction.begin
-    //loadFixture("data.json")
-  }
-
-  @Test
-  def AccountsTest() = {
-  }
-
-  @After
-  def after() = {
-    TestDB.getTransaction.rollback()
-  }
-}
\ No newline at end of file
diff --git a/logic/src/test/scala/gr/grnet/aquarium/logic/test/BillingTest.scala b/logic/src/test/scala/gr/grnet/aquarium/logic/test/BillingTest.scala
deleted file mode 100644 (file)
index 4d27543..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright 2011 GRNET S.A. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- *   1. Redistributions of source code must retain the above
- *      copyright notice, this list of conditions and the following
- *      disclaimer.
- *
- *   2. Redistributions in binary form must reproduce the above
- *      copyright notice, this list of conditions and the following
- *      disclaimer in the documentation and/or other materials
- *      provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and
- * documentation are those of the authors and should not be
- * interpreted as representing official policies, either expressed
- * or implied, of GRNET S.A.
- */
-
-package gr.grnet.aquarium.logic.test
-
-import org.junit._
-import gr.grnet.aquarium.model.{User}
-import gr.grnet.aquarium.logic.accounting.{Agreement, AccountingEventType}
-
-import gr.grnet.aquarium.util.FixtureLoader
-
-class BillingTest
-  extends FixtureLoader {
-
-  def getDB = TestDB
-
-  @Before
-  def before() = {
-    if (!TestDB.getTransaction.isActive)
-      TestDB.getTransaction.begin
-    //loadFixture("data.json")
-  }
-
-  object TestAgreement extends Agreement {
-    override val id = 0xdeadbabeL
-
-    override val pricelist = Map (
-      AccountingEventType.DiskSpace -> 0.00002F,
-      AccountingEventType.NetDataDown -> 0.0001F,
-      AccountingEventType.NetDataUp -> 0.0001F,
-      AccountingEventType.VMTime -> 0.001F
-    )
-  }
-
-  @Test
-  def testOverallAccountingRules() = {
-
-    val u = new User
-    u.agreement = TestAgreement.id
-    u.credits = 100
-
-    TestDB.persistAndFlush(u)
-
-    // Try with a basic event
-    /*var evt = new AccountingEvent(AccountingEventType.VMTime,
-      new Date(4), new Date(10), u.id, 15, List())
-    var entry = evt.process()
-    assertEquals(entry.amount, 15 * 0.001F, 0.00001)
-
-    // Try with another event type
-    evt = new AccountingEvent(AccountingEventType.DiskSpace,
-      new Date(4), new Date(4), u.id, 12.3F, List())
-    entry = evt.process()
-    assertEquals(entry.amount, 12.3F * 0.00002F, 0.00001)*/
-  }
-
-  @After
-  def after() = {
-    TestDB.getTransaction.rollback
-  }
-}
\ No newline at end of file
index b13a540..b06f83b 100644 (file)
@@ -57,7 +57,5 @@ class EventProcessorTest {
   
   @Test
   def testProcess() = {
-    val result = EventProcessor.process(getEvents)(f => true)
-    assert(result.size == 6)
   }
 }
\ No newline at end of file