Пример #1
0
    def generateItem(self, id, original):
        i_id = id
        i_im_id = rand.number(constants.MIN_IM, constants.MAX_IM)
        i_name = rand.astring(constants.MIN_I_NAME, constants.MAX_I_NAME)
        i_price = rand.fixedPoint(constants.MONEY_DECIMALS, constants.MIN_PRICE, constants.MAX_PRICE)
        i_data = rand.astring(constants.MIN_I_DATA, constants.MAX_I_DATA)
        if original: i_data = self.fillOriginal(i_data)

        return [i_id, i_im_id, i_name, i_price, i_data]
Пример #2
0
    def generateItem(self, id, original):
        i_id = id
        i_im_id = rand.number(constants.MIN_IM, constants.MAX_IM)
        i_name = rand.astring(constants.MIN_I_NAME, constants.MAX_I_NAME)
        i_price = rand.fixedPoint(constants.MONEY_DECIMALS,
                                  constants.MIN_PRICE, constants.MAX_PRICE)
        i_data = rand.astring(constants.MIN_I_DATA, constants.MAX_I_DATA)
        if original: i_data = self.fillOriginal(i_data)

        return [i_id, i_im_id, i_name, i_price, i_data]
Пример #3
0
    def generateStreetAddress(self):
        """
            Returns a list for a street address
            Used for warehouses, districts and customers.
        """
        street1 = rand.astring(constants.MIN_STREET, constants.MAX_STREET)
        street2 = rand.astring(constants.MIN_STREET, constants.MAX_STREET)
        city = rand.astring(constants.MIN_CITY, constants.MAX_CITY)
        state = rand.astring(constants.STATE, constants.STATE)
        zip = self.generateZip()

        return [street1, street2, city, state, zip]
Пример #4
0
    def generateStreetAddress(self):
        """
            Returns a list for a street address
            Used for warehouses, districts and customers.
        """
        street1 = rand.astring(constants.MIN_STREET, constants.MAX_STREET)
        street2 = rand.astring(constants.MIN_STREET, constants.MAX_STREET)
        city = rand.astring(constants.MIN_CITY, constants.MAX_CITY)
        state = rand.astring(constants.STATE, constants.STATE)
        zip = self.generateZip()

        return [ street1, street2, city, state, zip ]
Пример #5
0
 def generateAddress(self):
     """
         Returns a name and a street address 
         Used by both generateWarehouse and generateDistrict.
     """
     name = rand.astring(constants.MIN_NAME, constants.MAX_NAME)
     return [name] + self.generateStreetAddress()
Пример #6
0
 def generateAddress(self):
     """
         Returns a name and a street address 
         Used by both generateWarehouse and generateDistrict.
     """
     name = rand.astring(constants.MIN_NAME, constants.MAX_NAME)
     return [ name ] + self.generateStreetAddress()
Пример #7
0
 def generateHistory(self, h_c_w_id, h_c_d_id, h_c_id):
     h_w_id = h_c_w_id
     h_d_id = h_c_d_id
     h_date = datetime.now()
     h_amount = constants.INITIAL_AMOUNT
     h_data = rand.astring(constants.MIN_DATA, constants.MAX_DATA)
     return [ h_c_id, h_c_d_id, h_c_w_id, h_d_id, h_w_id, h_date, h_amount, h_data ]
Пример #8
0
    def generateStock(self, s_w_id, s_i_id, original):
        s_quantity = rand.number(constants.MIN_QUANTITY, constants.MAX_QUANTITY);
        s_ytd = 0;
        s_order_cnt = 0;
        s_remote_cnt = 0;

        s_data = rand.astring(constants.MIN_I_DATA, constants.MAX_I_DATA);
        if original: self.fillOriginal(s_data)

        s_dists = [ ]
        for i in range(0, constants.DISTRICTS_PER_WAREHOUSE):
            s_dists.append(rand.astring(constants.DIST, constants.DIST))
        
        return [ s_i_id, s_w_id, s_quantity ] + \
               s_dists + \
               [ s_ytd, s_order_cnt, s_remote_cnt, s_data ]
Пример #9
0
    def generateStock(self, s_w_id, s_i_id, original):
        s_quantity = rand.number(constants.MIN_QUANTITY,
                                 constants.MAX_QUANTITY)
        s_ytd = 0
        s_order_cnt = 0
        s_remote_cnt = 0

        s_data = rand.astring(constants.MIN_I_DATA, constants.MAX_I_DATA)
        if original: self.fillOriginal(s_data)

        s_dists = []
        for i in range(0, constants.DISTRICTS_PER_WAREHOUSE):
            s_dists.append(rand.astring(constants.DIST, constants.DIST))

        return [ s_i_id, s_w_id, s_quantity ] + \
               s_dists + \
               [ s_ytd, s_order_cnt, s_remote_cnt, s_data ]
Пример #10
0
 def generateHistory(self, h_c_w_id, h_c_d_id, h_c_id):
     h_w_id = h_c_w_id
     h_d_id = h_c_d_id
     h_date = datetime.now()
     h_amount = constants.INITIAL_AMOUNT
     h_data = rand.astring(constants.MIN_DATA, constants.MAX_DATA)
     return [
         h_c_id, h_c_d_id, h_c_w_id, h_d_id, h_w_id, h_date, h_amount,
         h_data
     ]
Пример #11
0
    def generateCustomer(self, c_w_id, c_d_id, c_id, badCredit,
                         doesReplicateName):
        c_first = rand.astring(constants.MIN_FIRST, constants.MAX_FIRST)
        c_middle = constants.MIDDLE

        assert 1 <= c_id and c_id <= constants.CUSTOMERS_PER_DISTRICT
        if c_id <= 1000:
            c_last = rand.makeLastName(c_id - 1)
        else:
            c_last = rand.makeRandomLastName(constants.CUSTOMERS_PER_DISTRICT)

        c_phone = rand.nstring(constants.PHONE, constants.PHONE)
        c_since = datetime.now()
        c_credit = constants.BAD_CREDIT if badCredit else constants.GOOD_CREDIT
        c_credit_lim = constants.INITIAL_CREDIT_LIM
        c_discount = rand.fixedPoint(constants.DISCOUNT_DECIMALS,
                                     constants.MIN_DISCOUNT,
                                     constants.MAX_DISCOUNT)
        c_balance = constants.INITIAL_BALANCE
        c_ytd_payment = constants.INITIAL_YTD_PAYMENT
        c_payment_cnt = constants.INITIAL_PAYMENT_CNT
        c_delivery_cnt = constants.INITIAL_DELIVERY_CNT
        c_data = rand.astring(constants.MIN_C_DATA, constants.MAX_C_DATA)

        c_street1 = rand.astring(constants.MIN_STREET, constants.MAX_STREET)
        c_street2 = rand.astring(constants.MIN_STREET, constants.MAX_STREET)
        c_city = rand.astring(constants.MIN_CITY, constants.MAX_CITY)
        c_state = rand.astring(constants.STATE, constants.STATE)
        c_zip = self.generateZip()

        return [ c_id, c_d_id, c_w_id, c_first, c_middle, c_last, \
                c_street1, c_street2, c_city, c_state, c_zip, \
                c_phone, c_since, c_credit, c_credit_lim, c_discount, c_balance, \
                c_ytd_payment, c_payment_cnt, c_delivery_cnt, c_data ]
Пример #12
0
    def generateCustomer(self, c_w_id, c_d_id, c_id, badCredit, doesReplicateName):
        c_first = rand.astring(constants.MIN_FIRST, constants.MAX_FIRST)
        c_middle = constants.MIDDLE

        assert 1 <= c_id and c_id <= constants.CUSTOMERS_PER_DISTRICT
        if c_id <= 1000:
            c_last = rand.makeLastName(c_id - 1)
        else:
            c_last = rand.makeRandomLastName(constants.CUSTOMERS_PER_DISTRICT)

        c_phone = rand.nstring(constants.PHONE, constants.PHONE)
        c_since = datetime.now()
        c_credit = constants.BAD_CREDIT if badCredit else constants.GOOD_CREDIT
        c_credit_lim = constants.INITIAL_CREDIT_LIM
        c_discount = rand.fixedPoint(constants.DISCOUNT_DECIMALS, constants.MIN_DISCOUNT, constants.MAX_DISCOUNT)
        c_balance = constants.INITIAL_BALANCE
        c_ytd_payment = constants.INITIAL_YTD_PAYMENT
        c_payment_cnt = constants.INITIAL_PAYMENT_CNT
        c_delivery_cnt = constants.INITIAL_DELIVERY_CNT
        c_data = rand.astring(constants.MIN_C_DATA, constants.MAX_C_DATA)

        c_street1 = rand.astring(constants.MIN_STREET, constants.MAX_STREET)
        c_street2 = rand.astring(constants.MIN_STREET, constants.MAX_STREET)
        c_city = rand.astring(constants.MIN_CITY, constants.MAX_CITY)
        c_state = rand.astring(constants.STATE, constants.STATE)
        c_zip = self.generateZip()

        return [ c_id, c_d_id, c_w_id, c_first, c_middle, c_last, \
                c_street1, c_street2, c_city, c_state, c_zip, \
                c_phone, c_since, c_credit, c_credit_lim, c_discount, c_balance, \
                c_ytd_payment, c_payment_cnt, c_delivery_cnt, c_data ]
Пример #13
0
    def generateOrderLine(self, ol_w_id, ol_d_id, ol_o_id, ol_number, max_items, newOrder):
        ol_i_id = rand.number(1, max_items)
        ol_supply_w_id = ol_w_id
        ol_delivery_d = datetime.now()
        ol_quantity = constants.INITIAL_QUANTITY

        if newOrder == False:
            ol_amount = 0.00
        else:
            ol_amount = rand.fixedPoint(constants.MONEY_DECIMALS, constants.MIN_AMOUNT, constants.MAX_PRICE * constants.MAX_OL_QUANTITY)
            ol_delivery_d = None
        ol_dist_info = rand.astring(constants.DIST, constants.DIST)

        return [ ol_o_id, ol_d_id, ol_w_id, ol_number, ol_i_id, ol_supply_w_id, ol_delivery_d, ol_quantity, ol_amount, ol_dist_info ]
Пример #14
0
    def generateOrderLine(self, ol_w_id, ol_d_id, ol_o_id, ol_number,
                          max_items, newOrder):
        ol_i_id = rand.number(1, max_items)
        ol_supply_w_id = ol_w_id
        ol_delivery_d = datetime.now()
        ol_quantity = constants.INITIAL_QUANTITY

        if newOrder == False:
            ol_amount = 0.00
        else:
            ol_amount = rand.fixedPoint(
                constants.MONEY_DECIMALS, constants.MIN_AMOUNT,
                constants.MAX_PRICE * constants.MAX_OL_QUANTITY)
            ol_delivery_d = None
        ol_dist_info = rand.astring(constants.DIST, constants.DIST)

        return [
            ol_o_id, ol_d_id, ol_w_id, ol_number, ol_i_id, ol_supply_w_id,
            ol_delivery_d, ol_quantity, ol_amount, ol_dist_info
        ]