Package org.ocpsoft.rewrite.param

Examples of org.ocpsoft.rewrite.param.DefaultParameter


   @Test
   public void testEnqueueSubmissionsExecutesEvaluationEagerly() throws Exception
   {
      MockEvaluationContext context = new MockEvaluationContext();

      DefaultParameter parameter = new DefaultParameter("lincoln");
      Assert.assertTrue(ParameterUtils.enqueueSubmission(rewrite, context,
               parameter.bindsTo(Evaluation.property("lincoln")), "baxter"));
      Assert.assertEquals("baxter", Evaluation.property("lincoln").retrieve(rewrite, context));
   }
View Full Code Here


            return "baxter III".equals(value);
         }
      };

      Assert.assertFalse(ParameterUtils.enqueueSubmission(rewrite, context,
               new DefaultParameter("lincoln").bindsTo(Evaluation.property("lincoln")).validatedBy(validator), "baxter"));
   }
View Full Code Here

                              throwRedefinitionError(rule, name);
                        }
                     }

                     for (String name : names) {
                        Parameter<?> parameter = store.get(name, new DefaultParameter(name));
                        if (parameter instanceof ConfigurableParameter<?>)
                           ((ConfigurableParameter<?>) parameter).bindsTo(Evaluation.property(name));
                     }
                     parameterized.setParameterStore(store);
                  }
View Full Code Here

   {
      if (parameterized instanceof Parameterized)
      {
         Set<String> names = ((Parameterized) parameterized).getRequiredParameterNames();
         for (String name : names) {
            store.get(name, new DefaultParameter(name));
         }
         ((Parameterized) parameterized).setParameterStore(store);
      }
   }
View Full Code Here

   }

   public ConfigurableParameter<?> where(String name)
   {
      assertParameterExists(name);
      Parameter<?> result = getParameterStore().get(name, new DefaultParameter(name));
      if (result instanceof ConfigurableParameter)
         return (ConfigurableParameter<?>) result;
      throw new RewriteException("Cannot configure read-only parameter [" + name + "].");
   }
View Full Code Here

   }

   @Test
   public void testQueryStringMatchesPattern()
   {
      store.get("t", new DefaultParameter("t"));
      Query query = Query.matches("foo=bar{t}");
      query.setParameterStore(store);
      Assert.assertTrue(query.evaluate(rewrite, context));
   }
View Full Code Here

   @Test
   public void testQueryStringParameterExists()
   {
      Query query = Query.parameterExists("foo");
      query.setParameterStore(store);
      store.get("foo", new DefaultParameter("foo"));
      Assert.assertTrue(query.evaluate(rewrite, context));
   }
View Full Code Here

   @Test
   public void testQueryStringUnvaluedParameterExists()
   {
      Query query = Query.parameterExists("ee");
      query.setParameterStore(store);
      store.get("ee", new DefaultParameter("ee"));
      Assert.assertTrue(query.evaluate(rewrite, context));
   }
View Full Code Here

   @Test
   public void testQueryStringValueExists()
   {
      Query query = Query.valueExists("{b}ar");
      query.setParameterStore(store);
      store.get("b", new DefaultParameter("b"));
      Assert.assertTrue(query.evaluate(rewrite, context));
   }
View Full Code Here

   }

   @Test
   public void testQueryStringMatchesWithParameters()
   {
      store.get("my cat", new DefaultParameter("my cat"));
      Assert.assertTrue(Query.parameterExists("my cat").evaluate(rewrite, context));
   }
View Full Code Here

TOP

Related Classes of org.ocpsoft.rewrite.param.DefaultParameter

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.