Package com.oltpbenchmark.benchmarks.auctionmark.util

Examples of com.oltpbenchmark.benchmarks.auctionmark.util.ItemId


        }
        @Override
        protected int populateRow(UserId seller_id, Object[] row, short remaining) {
            int col = 0;
           
            ItemId itemId = new ItemId(seller_id, remaining);
            Timestamp endDate = this.getRandomEndTimestamp();
            Timestamp startDate = this.getRandomStartTimestamp(endDate);
            if (LOG.isTraceEnabled())
                LOG.trace("endDate = " + endDate + " : startDate = " + startDate);
           
View Full Code Here


     * @see NewPurchase
     */
    @SuppressWarnings("unused")
    public ItemId processItemRecord(Object row[]) {
        int col = 0;
        ItemId i_id = new ItemId(SQLUtil.getLong(row[col++]))// i_id
        long i_u_id = SQLUtil.getLong(row[col++]);              // i_u_id
        String i_name = (String)row[col++];                     // i_name
        double i_current_price = SQLUtil.getDouble(row[col++]); // i_current_price
        long i_num_bids = SQLUtil.getLong(row[col++]);          // i_num_bids
        Timestamp i_end_date = SQLUtil.getTimestamp(row[col++]);// i_end_date
        if (i_end_date == null) throw new RuntimeException("DJELLEL IS THE MAN! --> " + row[col-1] + " / " + row[col-1].getClass());
       
        Integer temp = SQLUtil.getInteger(row[col++]);
        if (temp == null) throw new RuntimeException("DJELLEL IS STILL THE MAN! --> " + row[col-1] + " / " + row[col-1].getClass());
        ItemStatus i_status = ItemStatus.get(temp); // i_status
       
        ItemInfo itemInfo = new ItemInfo(i_id, i_current_price, i_end_date, (int)i_num_bids);
        itemInfo.status = i_status;
       
        UserId sellerId = new UserId(i_u_id);
        assert (i_id.getSellerId().equals(sellerId));
        
        ItemStatus qtype = profile.addItemToProperQueue(itemInfo, false);
   
        return (i_id);
    }
View Full Code Here

        List<Object[]> results = proc.run(conn, benchmarkTimes, startTime, endTime);
        conn.commit();
       
        assert(null != results);
        for (Object row[] : results) {
            ItemId itemId = this.processItemRecord(row);
            assert(itemId != null);
        } // WHILE
        profile.updateItemQueues();
       
        if (LOG.isDebugEnabled())
View Full Code Here

                                                            itemInfo.getSellerId().encode());
        conn.commit();
       
        // The first row will have our item data that we want
        // We don't care about the user information...
        ItemId itemId = this.processItemRecord(results[0]);
        assert(itemId != null);
       
        return (true);
    }
View Full Code Here

        // ITEM Result Tables
        for ( ; idx < results.length; idx++) {
            vt = results[idx];
            if (vt == null) continue;
            for (Object row[] : vt) {
                ItemId itemId = this.processItemRecord(row);
                assert(itemId != null);
            } // FOR
        } // FOR
       
        return (true);
View Full Code Here

                                                          buyerId.encode(),
                                                          maxBid,
                                                          itemInfo.endDate);
        conn.commit();
       
        ItemId itemId = this.processItemRecord(results);
        assert(itemId != null);
   
        return (true);
    }
View Full Code Here

        int idx = profile.rng.nextInt(profile.pending_commentResponses.size());
        ItemCommentResponse cr = profile.pending_commentResponses.remove(idx);
        assert(cr != null);
       
        long commentId = cr.commentId.longValue();;
        ItemId itemId = new ItemId(cr.itemId.longValue());
        UserId sellerId = itemId.getSellerId();
        assert(sellerId.encode() == cr.sellerId);
        String response = profile.rng.astring(AuctionMarkConstants.ITEM_COMMENT_LENGTH_MIN,
                                              AuctionMarkConstants.ITEM_COMMENT_LENGTH_MAX);

        proc.run(conn, benchmarkTimes, itemId.encode(),
                                       sellerId.encode(),
                                       commentId,
                                       response);
        conn.commit();
       
View Full Code Here

    // ----------------------------------------------------------------

    protected boolean executeNewItem(NewItem proc) throws SQLException {
        Timestamp benchmarkTimes[] = this.getTimestampParameterArray();
        UserId sellerId = profile.getRandomSellerId(this.getId());
        ItemId itemId = profile.getNextItemId(sellerId);

        String name = profile.rng.astring(6, 32);
        String description = profile.rng.astring(50, 255);
        long categoryId = profile.getRandomCategoryId();

        Double initial_price = (double) profile.randomInitialPrice.nextInt();
        String attributes = profile.rng.astring(50, 255);

        int numAttributes = profile.randomNumAttributes.nextInt();
        List<GlobalAttributeValueId> gavList = new ArrayList<GlobalAttributeValueId>(numAttributes);
        for (int i = 0; i < numAttributes; i++) {
            GlobalAttributeValueId gav_id = profile.getRandomGlobalAttributeValue();
            if (!gavList.contains(gav_id)) gavList.add(gav_id);
        } // FOR

        long[] gag_ids = new long[gavList.size()];
        long[] gav_ids = new long[gavList.size()];
        for (int i = 0, cnt = gag_ids.length; i < cnt; i++) {
            GlobalAttributeValueId gav_id = gavList.get(i);
            gag_ids[i] = gav_id.getGlobalAttributeGroup().encode();
            gav_ids[i] = gav_id.encode();
        } // FOR

        int numImages = profile.randomNumImages.nextInt();
        String[] images = new String[numImages];
        for (int i = 0; i < numImages; i++) {
            images[i] = profile.rng.astring(20, 100);
        } // FOR

        long duration = profile.randomDuration.nextInt();

        Object results[] = null;
        try {
            long itemIdEncoded = itemId.encode();
            results = proc.run(conn, benchmarkTimes, itemIdEncoded, sellerId.encode(),
                                                     categoryId, name, description,
                                                     duration, initial_price, attributes,
                                                     gag_ids, gav_ids, images);
        } catch (DuplicateItemIdException ex) {
View Full Code Here

                                                          sellerId.encode(),
                                                          ip_id,
                                                          buyer_credit);
        conn.commit();
       
        ItemId itemId = this.processItemRecord(results);
        assert(itemId != null);
       
        return (true);
    }
View Full Code Here

   
    private static final void loadItems(AuctionMarkProfile profile, ResultSet vt) throws SQLException {
        int ctr = 0;
        while (vt.next()) {
            int col = 1;
            ItemId i_id = new ItemId(vt.getLong(col++));
            double i_current_price = vt.getDouble(col++);
            Timestamp i_end_date = vt.getTimestamp(col++);
            int i_num_bids = (int)vt.getLong(col++);
           
            // IMPORTANT: Do not set the status here so that we make sure that
View Full Code Here

TOP

Related Classes of com.oltpbenchmark.benchmarks.auctionmark.util.ItemId

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.