RandomGenerator { public Map<Integer,List<List<Object>>> initialize(Long seed) { int dbNo = 0; Random random = new Random(seed); for (int i=1;i<=prims.length;i++){ List<Object[]> availableDBs = dbExist.get(i-1); if (availableDBs!=null) dbExist.put(i, new LinkedList<Object[]>(availableDBs)); else availableDBs = new LinkedList<Object[]>(); int metaOperations = random.nextInt(MAX_META_OPERATIONS_PER_VIEWID-MIN_META_OPERATIONS_PER_VIEWID)+MIN_META_OPERATIONS_PER_VIEWID; List<List<Object>> opsAtView = new LinkedList<List<Object>>(); for (int y=0;y<metaOperations;y++){ availableDBs = dbExist.get(i); if (availableDBs==null) availableDBs = new LinkedList<Object[]>(); List<Object> operation; if (availableDBs.size()<=1) { operation = createOperation(random, dbNo, i); dbNo++; } else { Operation op = Operation.values()[random.nextInt(Operation.values().length)]; switch (op) { case create: operation = createOperation(random, dbNo, i); dbNo++; break; case copy: operation = copyOperation(random, dbNo, i); dbNo++; break; case delete: operation = deleteOperation(random, i); break; default: throw new UnsupportedOperationException ("for "+op.toString()); } } opsAtView.add(operation); } operationsScenario.put(i, opsAtView); } Logging.logMessage(Logging.LEVEL_DEBUG, Category.babudb, this, "%s", this.toString()); return operationsScenario; }  Map<Integer,List<List<Object>>> initialize(Long seed); InsertGroup getInsertGroup(LSN lsn); void reset(); LookupGroup getLookupGroup(LSN lsn); static long getRandomSeed(); @Override String toString(); final static int MAX_INSERTS_PER_GROUP; final static int MIN_INSERTS_PER_GROUP; final static int MAX_DELETES_PER_GROUP; final static int MIN_DELETES_PER_GROUP; final static int MAX_META_OPERATIONS_PER_VIEWID; final static int MIN_META_OPERATIONS_PER_VIEWID; final static int MAX_INDICES; final static int MIN_INDICES; final static int MAX_KEY_LENGTH; final static int MIN_KEY_LENGTH; final static int MAX_VALUE_LENGTH; final static int MIN_VALUE_LENGTH; final static int MAX_VIEWID; final static long MAX_SEQUENCENO; final static long MIN_SEQUENCENO; final Map<Integer,List<List<Object>>> operationsScenario; }
@Test public void testInitialize() { for (int i = 0; i < NO_TESTS_PER_CASE; i++) { long testSeed = RandomGenerator.getRandomSeed(); assertEquals(new RandomGenerator().initialize(testSeed).toString(), new RandomGenerator().initialize(testSeed).toString()); } }