From: Christos KK Loverdos Date: Tue, 31 Jan 2012 14:39:03 +0000 (+0200) Subject: Merge branch 'master' into 1852_billing_period_calc X-Git-Url: https://code.grnet.gr/git/aquarium/commitdiff_plain/b875d52eaf520919dac4c0f00b8d15d9a5687c8d Merge branch 'master' into 1852_billing_period_calc Conflicts: src/main/scala/gr/grnet/aquarium/user/UserDataSnapshot.scala src/main/scala/gr/grnet/aquarium/user/UserStateComputations.scala src/main/scala/gr/grnet/aquarium/user/actor/UserActor.scala --- b875d52eaf520919dac4c0f00b8d15d9a5687c8d diff --cc src/main/scala/gr/grnet/aquarium/logic/accounting/Policy.scala index ac5322e,034eba8..bc3fdba --- a/src/main/scala/gr/grnet/aquarium/logic/accounting/Policy.scala +++ b/src/main/scala/gr/grnet/aquarium/logic/accounting/Policy.scala @@@ -66,15 -77,25 +77,25 @@@ object Policy extends DSL with Loggabl } } + /** + * Get the policies that are valid between the specified time instances + */ def policies(from: Date, to: Date): List[DSLPolicy] = { - policies.filter { + policies.get.filter { a => a._1.from.before(from) && a._1.to.after(to) - }.values.toList + }.valuesIterator.toList } - + + /** + * Get the policies that are valid throughout the specified + * [[gr.grnet.aquarium.logic.accounting.dsl.Timeslot]] + */ def policies(t: Timeslot): List[DSLPolicy] = policies(t.from, t.to) + /** + * Load and parse a policy from file. + */ def loadPolicyFromFile(pol: File): DSLPolicy = { val stream = pol.exists() match { diff --cc src/test/scala/gr/grnet/aquarium/user/UserActorTest.scala index 2a9e716,2a9e716..a2707ab --- a/src/test/scala/gr/grnet/aquarium/user/UserActorTest.scala +++ b/src/test/scala/gr/grnet/aquarium/user/UserActorTest.scala @@@ -21,7 -21,7 +21,7 @@@ class UserActorTest 0L, ActiveSuspendedSnapshot(true, now), CreditSnapshot(0, now), -- AgreementSnapshot("default", now), ++ AgreementSnapshot(Agreement("default", now, now) :: Nil, now), RolesSnapshot(Nil, now), PaymentOrdersSnapshot(Nil, now), OwnedGroupsSnapshot(Nil, now),