def generate(number, self=None): entities = [] reader = MockDataReader() for i in range(0, number): row = reader.getRow() entities.append( Actor(actor_id=IdGenerator.getId(), first_name=row[reader.first_name], last_name=row[reader.last_name], last_update="2006-02-15 09:45:30")) return entities
def generate(number=1, self=None): entities = [] reader = MockDataReader() random = RandomNumberGenerator() for i in range(0, number): row = reader.getRow() entities.append( City(city_id=IdGenerator.getId(), city=row[reader.city], country_id=random.getGaussianRand(108) + 1, last_update="2006-02-15 09:45:30")) return entities
def generate(addresses, managers, self=None): entities = [] reader = MockDataReader() random = RandomNumberGenerator() for i in range(0, len(managers)): row = reader.getRow() manager = managers[i] storeId = IdGenerator.getId() manager.store_id = storeId managerId = manager.staff_id entities.append( Store(store_id=storeId, manager_staff_id=managerId, address_id=addresses[i].address_id, last_update="2006-02-15 09:45:30")) return entities
def generate(cities, number, self=None): entities = [] reader = MockDataReader() for i in range(0, number): row = reader.getRow() cityId = cities[RandomNumberGenerator().getGaussianListRand( cities)].city_id entities.append( Address(address_id=IdGenerator.getId(), address=row[reader.address], district=row[reader.state], city_id=cityId, postal_code="mockPostalCode", address2="", phone=row[reader.phone], last_update="2006-02-15 09:45:30")) return entities
def generate(addresses, stores, number, self=None): entities = [] reader = MockDataReader() random = RandomNumberGenerator() for i in range(0, number): row = reader.getRow() isActive = random.flagRandom(0.95) store_id = stores[random.getGaussianListRand(stores)].store_id entities.append(Customer(customer_id=IdGenerator.getId(), store_id=store_id, first_name=row[reader.first_name], last_name=row[reader.last_name], address_id=addresses[random.getListRandom(addresses)].address_id, email=row[reader.email], active=Customer.isActiveBoolean(isActive), last_update="2006-02-15 09:45:30", activebool=isActive, create_date="2006-02-15 09:45:30") ) return entities
def generate(inventories, customers, staffs, number, self=None): entities = [] random = RandomNumberGenerator() reader = MockDataReader() for i in range(0, number): row = reader.getRow() inventory_id = inventories[random.getGaussianListRand( inventories)].inventory_id customer_id = customers[random.getGaussianListRand( customers)].customer_id staff_id = staffs[random.getGaussianListRand(staffs)].staff_id entities.append( Rental(rental_id=IdGenerator.getId(), rental_date=row[reader.date] + " " + row[reader.time], inventory_id=inventory_id, customer_id=customer_id, return_date="2005-05-24 22:54:33", staff_id=staff_id, last_update="2005-05-24 22:54:33")) return entities
def generate(number, self=None): entities = [] reader = MockDataReader() random = RandomNumberGenerator() for i in range(0, number): row = reader.getRow() entities.append( Film(film_id=IdGenerator.getId(), title=row[reader.login], description=row[reader.first_name] + row[reader.password], release_year=row[reader.year], language_id=random.getintRandom(5) + 1, rental_duration=random.getintRandom(10) + 1, rental_rate=random.getintRandom(5) + 1, length=random.getintRandom(200) + 1, replacement_cost=random.getintRandom(50) + 1, rating="NC-17", last_update='2013-05-26 14:50:58.951', special_features="{Trailers}", fulltext=row[reader.password] + row[reader.login])) return entities
def generate(addresses, stores, number, self=None): entities = [] reader = MockDataReader() random = RandomNumberGenerator() for i in range(0, number): row = reader.getRow() storeId = 0 if stores is not None: storeId = stores[random.getGaussianListRand(stores)].store_id isActive = random.flagRandom(0.95) entities.append( Staff(staff_id=IdGenerator.getId(), first_name=row[reader.first_name], last_name=row[reader.last_name], address_id=addresses[random.getListRandom( addresses)].address_id, email=row[reader.email], store_id=storeId, active=isActive, last_update="2006-02-15 09:45:30", password="******", picture=row[reader.password], username="******")) return entities
def getReader(self): if self.reader is None: self.reader = MockDataReader() return self.reader