sebb        2003/12/03 19:18:19

  Modified:    src/protocol/http/org/apache/jmeter/protocol/http/proxy
                        ProxyControl.java
  Log:
  Split test up; fixed pattern matcher to use parameter instead of excludes always
  
  Revision  Changes    Path
  1.45      +26 -13    
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
  
  Index: ProxyControl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- ProxyControl.java 3 Dec 2003 11:55:22 -0000       1.44
  +++ ProxyControl.java 4 Dec 2003 03:18:19 -0000       1.45
  @@ -638,7 +638,7 @@
   
       private boolean matchesPatterns(String url, CollectionProperty patterns)
       {
  -        PropertyIterator iter = getExcludePatterns().iterator();
  +        PropertyIterator iter = patterns.iterator();
           while (iter.hasNext())
           {
               String item = iter.next().getStringValue();
  @@ -761,24 +761,37 @@
   
       public static class Test extends TestCase
       {
  +     HTTPSampler sampler;
  +     ProxyControl control;
  +     
           public Test(String name)
           {
               super(name);
           }
  -        public void testFiltering() throws Exception
  +        public void setUp(){
  +                     control = new ProxyControl();
  +                     control.addIncludedPattern(".*\\.jsp");
  +                     control.addExcludedPattern(".*apache.org.*");
  +                     sampler = new HTTPSampler();
  +        }
  +        public void testFilter1() throws Exception
           {
  -            ProxyControl control = new ProxyControl();
  -            control.addIncludedPattern(".*\\.jsp");
  -            control.addExcludedPattern(".*apache.org.*");
  -            HTTPSampler sampler = new HTTPSampler();
               sampler.setDomain("jakarta.org");
               sampler.setPath("index.jsp");
  -            assertTrue(control.filterUrl(sampler));
  -            sampler.setDomain("www.apache.org");
  -            assertTrue(!control.filterUrl(sampler));
  -            sampler.setPath("header.gif");
  -            sampler.setDomain("jakarta.org");
  -            assertTrue(!control.filterUrl(sampler));
  +            assertTrue("Should find 
jakarta.org/index.jsp",control.filterUrl(sampler));
           }
  +             public void testFilter2() throws Exception
  +             {
  +                     sampler.setPath("index.jsp");
  +                     sampler.setDomain("www.apache.org");
  +                     assertFalse("Should not match 
www.apache.org",control.filterUrl(sampler));
  +             }
  +
  +             public void testFilter3() throws Exception
  +             {
  +                     sampler.setPath("header.gif");
  +                     sampler.setDomain("jakarta.org");
  +                     assertFalse("Should not match 
header.gif",control.filterUrl(sampler));
  +             }
       }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to