1 package gr.grnet.aquarium.util
4 * Copyright 2011 GRNET S.A. All rights reserved.
6 * Redistribution and use in source and binary forms, with or
7 * without modification, are permitted provided that the following
10 * 1. Redistributions of source code must retain the above
11 * copyright notice, this list of conditions and the following
14 * 2. Redistributions in binary form must reproduce the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer in the documentation and/or other materials
17 * provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
20 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
32 * The views and conclusions contained in the software and
33 * documentation are those of the authors and should not be
34 * interpreted as representing official policies, either expressed
35 * or implied, of GRNET S.A.
39 import gr.grnet.aquarium.logic.events.ResourceEvent
42 * Generates random resource events to use as input for testing and
43 * injects them to the specified queue.
45 * @author Georgios Gousios <gousiosg@gmail.com>
47 trait RandomEventGenerator {
49 val userIds = 1 to 100
50 val clientIds = 1 to 4
51 val resources = List("bandwidthup", "bandwidthdown", "vmtime", "diskspace")
52 val dateFrom = new Date(1293840000000L) //1/1/2011 0:00:00 GMT
53 val dateTo = new Date(1325376000000L) //1/1/2012 0:00:00 GMT
54 val eventVersion = 1 to 4
57 * Get a next random message
59 def nextResourceEvent() : ResourceEvent = {
62 ResourceEvent(0,0,"",0L,0,Map())
66 * Generate messages and add them to the queue
68 def genAdd(num: Int) = {