logo       


cvs commit: jakarta-turbine-jcs/src/test/org/apache/jcs/access TestCacheAcc: msg#00144

Subject: cvs commit: jakarta-turbine-jcs/src/test/org/apache/jcs/access TestCacheAccess.java
asmuts      2004/07/22 06:15:16

  Modified:    src/test/org/apache/jcs/access TestCacheAccess.java
  Log:
  Better random test capability.
  
  Revision  Changes    Path
  1.12      +74 -36    
jakarta-turbine-jcs/src/test/org/apache/jcs/access/TestCacheAccess.java
  
  Index: TestCacheAccess.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-jcs/src/test/org/apache/jcs/access/TestCacheAccess.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TestCacheAccess.java      16 Jul 2004 03:21:11 -0000      1.11
  +++ TestCacheAccess.java      22 Jul 2004 13:15:16 -0000      1.12
  @@ -619,40 +619,68 @@
             }
             else
             if (message.startsWith("random"))
  -          {
  -            String numS = message.substring(message.indexOf(" ") + 1,
  -                                            message.length());
  -            //p( numS );
  -
  -            String numS2 = numS.substring(0, numS.indexOf(" "));
  -            //p( numS2 );
  -
  -            String numS3 = numS.substring(numS.indexOf(" ") + 1,
  -                                          numS.length());
  -            //p( numS3 );
  -
  -            int range = 0;
  -            int numOps = 0;
  -            try
  -            {
  -              range = Integer.parseInt(numS2.trim());
  -              numOps = Integer.parseInt(numS3.trim());
  -            }
  -            catch (Exception e)
  -            {
  -              p("usage: random range numOps");
  -              p("ex.  random 100 1000");
  -            }
  -            if (numS == null)
  -            {
  -              p("usage: random range numOps");
  -              p("ex.  random 100 1000");
  -            }
  -            else
  -            {
  -              random(range, numOps, true);
  -            }
  -          }
  +            if (message.startsWith("random"))
  +             {
  +               String rangeS = "";
  +               String numOpsS = "";
  +               boolean show = true;
  +
  +               StringTokenizer toke = new StringTokenizer(message);
  +               int tcnt = 0;
  +               while (toke.hasMoreElements())
  +               {
  +                 tcnt++;
  +                 String t = (String) toke.nextElement();
  +                 if (tcnt == 2)
  +                 {
  +                   rangeS = t.trim();
  +                 }
  +                 else
  +                 if (tcnt == 3)
  +                 {
  +                   numOpsS = t.trim();
  +                 }
  +                 else
  +                 if (tcnt == 4)
  +                 {
  +                   show = new Boolean(t).booleanValue();
  +                 }
  +               }
  +
  +               String numS = message.substring(message.indexOf(" ") + 1,
  +                                               message.length());
  +               //p( numS );
  +
  +               String numS2 = numS.substring(0, numS.indexOf(" "));
  +               //p( numS2 );
  +
  +               String numS3 = numS.substring(numS.indexOf(" ") + 1,
  +                                             numS.length());
  +               //p( numS3 );
  +
  +               int range = 0;
  +               int numOps = 0;
  +               try
  +               {
  +                 range = Integer.parseInt(rangeS.trim());
  +                 numOps = Integer.parseInt(numOpsS.trim());
  +               }
  +               catch (Exception e)
  +               {
  +                 p("usage: random range numOps show");
  +                 p("ex.  random 100 1000 false");
  +               }
  +               if (numS == null)
  +               {
  +                 p("usage: random range numOps show");
  +                 p("ex.  random 100 1000 false");
  +               }
  +               else
  +               {
  +                 random(range, numOps, show);
  +               }
  +             }
  +
           }
         }
         catch (Exception e)
  @@ -795,12 +823,16 @@
             cache_control.put(key,
                               "data" + i + " junk asdfffffffadfasdfasf " + kn +
                               ":" + n);
  -          p("put " + key);
  +          if ( show ) {
  +            p("put " + key);
  +          }
           }
           else if (n == 2)
           {
             cache_control.remove(key);
  -          p("removed " + key);
  +          if ( show ) {
  +            p("removed " + key);
  +          }
           }
           else
           {
  @@ -811,6 +843,11 @@
               p(obj.toString());
             }
           }
  +
  +        if ( i % 10000 == 0 ) {
  +          p( cache_control.getStats() );
  +        }
  +
         }
         p("Finished random cycle of " + numOps);
       }
  @@ -820,6 +857,7 @@
         e.printStackTrace(System.out);
       }
     }
  +
   
     /**
      * Sets the region to be used by test methods.


Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
Search:
Java, servers, webhosting, windows, cisco ...
more...
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
encryption.gpg....    ietf.rfc822/199...    freebsd.devel.i...    lang.haskell.li...    mail.squirrelma...    web.zope.plone....    yellowdog.gener...    text.xml.xalan....    recreation.phot...    kde.devel.educa...    hardware.bus.ca...    printing.ghosts...    voip.peering/20...    assembly/2006-0...    org.user-groups...    culture.interne...    network.i2p/200...    boot-loaders.ya...    xfree86.render/...    qnx.openqnx.dev...    jakarta.velocit...    user-groups.pal...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe