Package org.ocpsoft.rewrite.mock

Examples of org.ocpsoft.rewrite.mock.MockEvaluationContext


      Header header = Header.matches(".*Accept-Charset", "blah");

      ParameterStore parameters = new DefaultParameterStore();
      ParameterUtils.initialize(parameters, header);

      Assert.assertFalse(header.evaluate(rewrite, new MockEvaluationContext()));
   }
View Full Code Here


      Header header = Header.exists("Accept-Charset");

      ParameterStore parameters = new DefaultParameterStore();
      ParameterUtils.initialize(parameters, header);

      Assert.assertFalse(header.evaluate(new MockRewrite(), new MockEvaluationContext()));
   }
View Full Code Here

   }

   @Test
   public void testMatchesWithParameters()
   {
      MockEvaluationContext context = new MockEvaluationContext();
      URL url = URL.matches("http://domain.com:8080/context/application/{seg}?foo=bar&baz=bazaar");
      ParameterUtils.initialize(context, url);
      Assert.assertTrue(url.evaluate(rewrite, context));
   }
View Full Code Here

   @Test
   public void testUrlMatchesWithParameters()
   {
      URL url = URL.matches("{prefix}/application/{seg}{suffix}");

      MockEvaluationContext context = new MockEvaluationContext();
      ParameterUtils.initialize(context, url);

      ParameterStore store = DefaultParameterStore.getInstance(context);
      ((ParameterConfiguration<?>) store .get("prefix")).constrainedBy(new RegexConstraint(".*"));
      ((ParameterConfiguration<?>) store.get("suffix")).constrainedBy(new RegexConstraint("\\?.*"));
 
View Full Code Here

   @Test
   public void testCaptureMatches()
   {
      URL url = URL.captureIn("foo");

      MockEvaluationContext context = new MockEvaluationContext();
      ParameterUtils.initialize(context, url);

      Assert.assertTrue(url.evaluate(rewrite, context));
   }
View Full Code Here

   @Test
   public void testMatchesLiteral()
   {
      Assert.assertTrue(URL.matches("http://domain.com:8080/context/application/path?foo=bar&baz=bazaar").evaluate(
               rewrite, new MockEvaluationContext()));
   }
View Full Code Here

   @Test
   public void testCannotUseRegexWithoutParam()
   {
      Assert.assertFalse(URL.matches(".*/context/application/pa.*").evaluate(rewrite,
               new MockEvaluationContext()));
   }
View Full Code Here

   }

   @Test
   public void testDoesNotMatchNonHttpRewrites()
   {
      Assert.assertFalse(URL.matches("/blah").evaluate(new MockRewrite(), new MockEvaluationContext()));
   }
View Full Code Here

   @Test
   public void testRequestParameterExists()
   {
      RequestParameter parameter = RequestParameter.exists("foo");
      MockEvaluationContext context = new MockEvaluationContext();
      ParameterUtils.initialize(context, parameter);
      Assert.assertTrue(parameter.evaluate(rewrite, context));
   }
View Full Code Here

   @Test
   public void testRequestParameterExists2()
   {
      RequestParameter parameter = RequestParameter.exists("baz");
      MockEvaluationContext context = new MockEvaluationContext();
      ParameterUtils.initialize(context, parameter);
      Assert.assertTrue(parameter.evaluate(rewrite, context));
   }
View Full Code Here

TOP

Related Classes of org.ocpsoft.rewrite.mock.MockEvaluationContext

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.