David’s Thesis Blog


YahooWebSearch Tester
August 28, 2008, 2:24 pm
Filed under: Uncategorized

The Yahoo Web Search tester class is completed. Below is an example output running on only 2 threads, also because I’m capped for the month the response times might seem a bit high.

Source code for class provided below aswell.

Output:

Microsoft Windows [Version 6.0.6001]
Copyright (c) 2006 Microsoft Corporation.  All rights reserved.


C:\PerfTester>ant test
Buildfile: build.xml

test:
     [java] test config fileName = C:\PerfTester\test.prop
     [java] Tester.init(C:\PerfTester\test.prop) called
     [java] — listing properties —
     [java] testName=Yahoo
     [java] testWarmup=5
     [java] testCooldown=5
     [java] testClassName=YahooTester
     [java] testThreadNmuber=2
     [java] testRuntime=10000
     [java] Tester.run() called
     [java] testThreadNmuber = 2
     [java] To instance a test driver
     [java]
     [java] Searching for: Devin
     [java] The number of query matches in the database: 33700000
     [java] The number of query matches returned: 10
     [java] The position of the first result in the overall search: 1
     [java] First Page title: MySpace.com – Devin the Dude – R.I.P. PIMP C, US –
 Rap / Hip Hop – www …
     [java] First Page url: http://www.myspace.com/devinthedude
     [java] First Page summary: MySpace music profile for Devin the Dude with to
ur dates, songs, videos, pictures, blogs, band information, downloads and more
     [java]
     [java] Searching for: Leticia
     [java] The number of query matches in the database: 11200000
     [java] The number of query matches returned: 10
     [java] The position of the first result in the overall search: 1
     [java] First Page title: Leticia, Colombia – Wikipedia, the free encycloped
ia
     [java] First Page url: http://en.wikipedia.org/wiki/Leticia,_Colombia
     [java] First Page summary: Leticia has long been Colombia’s shipping point
for tropical fishes for the aquarium trade. Leticia has approximately 37,000 inh
abitants on the left bank of the …
     [java]
     [java] Searching for: Tina
     [java] The number of query matches in the database: 155000000
     [java] The number of query matches returned: 10
     [java] The position of the first result in the overall search: 1
     [java] First Page title: Tina Pro
     [java] First Page url: http://www.tina.com/
     [java] First Page summary: Package for designing, analysing, and measuring
analog, digital, and mixed electronic circuits.
     [java]
     [java] Searching for: Kendall
     [java] The number of query matches in the database: 56100000
     [java] The number of query matches returned: 10
     [java] The position of the first result in the overall search: 1
     [java] First Page title: Home Page for Kendall Brands – Covidien
     [java] First Page url: http://www.kendallhq.com/
     [java] First Page summary: USA. Manufacturers of medical and consumer hygie
ne products. Converters … Kendall AMDÖ Wound Care Dressings COPAÖ Ultra-Soft F
oam Dressings KANGAROO ePUMPÖ …
     [java]
     [java] Searching for: Reid
     [java] The number of query matches in the database: 129000000
     [java] The number of query matches returned: 10
     [java] The position of the first result in the overall search: 1
     [java] First Page title: Senator Harry Reid
     [java] First Page url: http://reid.senate.gov/
     [java] First Page summary: Democratic senator from Nevada and Senate Majori
ty Leader.
     [java]
     [java] Searching for: Litzy
     [java] The number of query matches in the database: 149000
     [java] The number of query matches returned: 10
     [java] The position of the first result in the overall search: 1
     [java] First Page title: Litzy Dominguez – Wikipedia, the free encyclopedia

     [java] First Page url: http://en.wikipedia.org/wiki/Litzy
     [java] First Page summary: Litzy Online (in Spanish) Mas Transparente Litzy
 site (in Spanish) Litzy bio on Disco de Oro section at TVAzteca.com (in Spanish
) …
     [java]
     [java] Searching for: Saniya
     [java] The number of query matches in the database: 199000
     [java] The number of query matches returned: 10
     [java] The position of the first result in the overall search: 1
     [java] First Page title: Sania Mirza Wallpapers, Tennis Star Saniya Mirza’s
 Pics, Gallery and …
     [java] First Page url: http://www.saniyamirza.org/
     [java] First Page summary: Displays news, images and articles about the ten
nis player, including … Saniya Mirza l Wallpapers l Blog l Biography l Persona
l l The Player l Career l News …
     [java]
     [java] Searching for: Lydia
     [java] The number of query matches in the database: 50800000
     [java] The number of query matches returned: 10
     [java] The position of the first result in the overall search: 1
     [java] First Page title: Lydia – Wikipedia, the free encyclopedia
     [java] First Page url: http://en.wikipedia.org/wiki/Lydia
     [java] First Page summary: At its greatest extent, the Kingdom of Lydia cov
ered all of western Anatolia. … Since Ionia was between historical Lydia and t
he sea, the Lydians had no …
     [java] Thread-0 : exited
     [java] Thread-1 : exited
     [java]
     [java] Tester.report() called
     [java] testName = Yahoo
     [java] minValue = 3661
     [java] aveValue = 5900
     [java] maxValue = 10197
     [java] 3680        1
     [java] 3800        1
     [java] 5980        1
     [java] 10020       1

BUILD SUCCESSFUL
Total time: 24 seconds

Source Code:

/*
 * @(#) Client.java 10/06/04
 *
 * Copyright 2002 CSIRO, Australia. All rights reserved.
 * CSIRO PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 * This
 *
 * @author  Dr. Shiping Chen
 * @version 1.0 10/06/04
 *
 */
 
 /*
 *
 *  Yahoo Web Search Test Class
 * Copyright 28/08/2008 David Ma
 *
 */
import com.yahoo.search.*;

import java.io.IOException;
import java.util.Random;
import java.util.*;
import com.shiping.test.*;

// Import random line class
import com.david.*;

public class YahooTester implements IRunner
{
   private String ID;
   private Properties prop;
  
   // Declare random line class
   private Randomline rndline = new Randomline();

   public void init(Properties prop)
   {
      this.prop = prop;
      this.ID = Thread.currentThread().getName();
   }
 
   public void preRun() {}
 
   public void run() throws Exception
   { 
      try 
   {
   // Declare new searchclient
   SearchClient client = new SearchClient(“javasdktest”);
   
   // Get new query from random line class
   String query = rndline.getLine();
   
   // Create websearch request for given query
   WebSearchRequest request = new WebSearchRequest(query);
   
   // Get results from websearch request
   WebSearchResults results = client.webSearch(request);
   
   // Display results information
   System.out.println(” “);
   System.out.println(“Searching for: ” + query);
   System.out.println(“The number of query matches in the database: ” + results.getTotalResultsAvailable());
   System.out.println(“The number of query matches returned: ” + results.getTotalResultsReturned());
   System.out.println(“The position of the first result in the overall search: ” + results.getFirstResultPosition());
  
    //Get result’s first page
    WebSearchResult result = results.listResults()[0];
    
    // Display the details for the first page given
    System.out.println(“First Page title: ” + result.getTitle());
    System.out.println(“First Page url: ” + result.getUrl());
    System.out.println(“First Page summary: ” + result.getSummary());
     
      } catch(Exception e) {}
   }

   public void postRun() {}

   public void done() {}
}

Advertisements

Leave a Comment so far
Leave a comment



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s



%d bloggers like this: