Package com.google.sitebricks

Examples of com.google.sitebricks.Evaluator


//    @Test(dataProvider = EXPRS_AND_OBJECTS)
    public final void repeatNumberOfTimesWithVars(String expression, Object page, int should, final String exp) throws ExpressionCompileException {
        OptimizerFactory.setDefaultOptimizer(OptimizerFactory.SAFE_REFLECTIVE);
        final int[] times = new int[1];
        final Evaluator evaluator = new DynTypedMvelEvaluatorCompiler(null).compile(exp);
        final WidgetChain mockChain = new ProceedingWidgetChain() {
            @Override
            public void render(final Object bound, Respond respond) {
                times[0]++;

                final Object thing = evaluator.evaluate(exp, bound);
                assert thing instanceof Thing : "Contextual (current) var not set: " + thing;
                assert A_NAME.equals(((Thing)thing).getName());
            }
        };
View Full Code Here


    public DynTypedMvelEvaluatorCompiler(Map<String, Class<?>> map) {
    }

    public Evaluator compile(final String expression) throws ExpressionCompileException {
        return new Evaluator() {
            private final ConcurrentMap<String, Serializable> map = new ConcurrentHashMap<String, Serializable>();

            @Nullable
            public Object evaluate(String ___expr, Object bean) {
                Serializable serializable = map.get(expression);
View Full Code Here

    };
  }

  @Test(dataProvider = ANNOTATION_EXPRESSIONS)
  public final void readAWidgetWithVariousExpressions(String expression) {
    final Evaluator evaluator = new MvelEvaluator();

    final WidgetRegistry registry = injector.getInstance(WidgetRegistry.class);

    String templateValue = String.format("<html><#if %s><p>hello</p></#if></html>", expression);
View Full Code Here

      protected void configure() {
        bind(HttpServletRequest.class).toProvider(mockRequestProviderForContext());
      }
    });

    final Evaluator evaluator = new MvelEvaluator();

    final WidgetRegistry registry = injector.getInstance(WidgetRegistry.class);


    Renderable widget =
View Full Code Here

  public Evaluator compile(String expression) throws ExpressionCompileException {

    //do *not* inline
    final CompiledExpression compiled = compileExpression(expression);

    return new Evaluator() {
      @Nullable
      public Object evaluate(String expr, Object bean) {
        return MVEL.executeExpression(compiled, bean);
      }

View Full Code Here

    replay(request);

    final AnObject o = new AnObject();

    final Evaluator evaluator = Guice.createInjector()
        .getInstance(Evaluator.class);

    new MvelRequestBinder(evaluator, new Provider<FlashCache>() {
      public FlashCache get() {
        return new HttpSessionFlashCache();
View Full Code Here

    replay(request);

    final AnObject o = new AnObject();

    final Evaluator evaluator = Guice.createInjector()
        .getInstance(Evaluator.class);

    new MvelRequestBinder(evaluator, new Provider<FlashCache>() {
      public FlashCache get() {
        return cache;
View Full Code Here

    replay(request);

    final AnObject o = new AnObject();

    final Evaluator evaluator = Guice.createInjector()
        .getInstance(Evaluator.class);

    new MvelRequestBinder(evaluator, new Provider<FlashCache>() {
      public FlashCache get() {
        return new HttpSessionFlashCache();
View Full Code Here

    final AnObject o = new AnObject();
    final AnObject expected = new AnObject();
    expected.setId(12L);

    final Evaluator evaluator = Guice.createInjector()
        .getInstance(Evaluator.class);

    new MvelRequestBinder(evaluator, new Provider<FlashCache>() {
      public FlashCache get() {
        return new HttpSessionFlashCache();
View Full Code Here

    replay(request);

    final AnObject o = new AnObject();

    final Evaluator evaluator = Guice.createInjector()
        .getInstance(Evaluator.class);

    new MvelRequestBinder(evaluator, new Provider<FlashCache>() {
      public FlashCache get() {
        return new HttpSessionFlashCache();
View Full Code Here

TOP

Related Classes of com.google.sitebricks.Evaluator

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.