Package br.com.caelum.vraptor.events

Examples of br.com.caelum.vraptor.events.InterceptorsReady


  }

  @Override
  public void start() {
    ControllerMethod method = controllerMethod.get();
    interceptorsReadyEvent.fire(new InterceptorsReady(method));
    LinkedList<InterceptorHandler> handlers = cache.getInterceptorHandlers();
    internalStack.addFirst(handlers.iterator());
    this.next(method, controllerInstance.get().getController());
    internalStack.poll();
  }
View Full Code Here


    methodInfo.setControllerMethod(controllerMethod);
  }
 
  @Test
  public void shouldDeserializeWhenInstantiatorRunsBefore() throws Exception {
    instantiator.instantiate(new InterceptorsReady(controllerMethod));
    deserializing.deserializes(new InterceptorsReady(controllerMethod), request, methodInfo, status);
    assertEquals("123", methodInfo.getValuedParameters()[0].getValue());
    assertEquals("XMlValue", methodInfo.getValuedParameters()[1].getValue());
 
View Full Code Here

    assertEquals("XMlValue", methodInfo.getValuedParameters()[1].getValue());
 

  @Test
  public void shouldDeserializeWhenInstantiatorRunsAfter() throws Exception {
    deserializing.deserializes(new InterceptorsReady(controllerMethod), request, methodInfo, status);
    instantiator.instantiate(new InterceptorsReady(controllerMethod));
    assertEquals("123", methodInfo.getValuedParameters()[0].getValue());
    assertEquals("XMlValue", methodInfo.getValuedParameters()[1].getValue());
 
View Full Code Here

  @Test
  public void shouldNotAcceptIfMethodHasNoParameters() {
    methodInfo.setControllerMethod(method);

    verifyNoMoreInteractions(parametersProvider, validator, request, flash);
    instantiator.instantiate(new InterceptorsReady(method));
  }
View Full Code Here

    Object[] values = new Object[] { "bazinga" };
    methodInfo.setControllerMethod(otherMethod);

    when(parametersProvider.getParametersFor(otherMethod, errors)).thenReturn(values);

    instantiator.instantiate(new InterceptorsReady(otherMethod));

    verify(validator).addAll(Collections.<Message> emptyList());

    assertEquals("bazinga", methodInfo.getValuedParameters()[0].getValue());
  }
View Full Code Here

    when(request.getParameterNames()).thenReturn(enumeration(asList("someParam[].id", "unrelatedParam")));
    when(request.getParameterValues("someParam[].id")).thenReturn(new String[] {"one", "two", "three"});
    when(parametersProvider.getParametersFor(otherMethod, errors)).thenReturn(new Object[1]);

    methodInfo.setControllerMethod(otherMethod);
    instantiator.instantiate(new InterceptorsReady(otherMethod));

    verify(request).setParameter("someParam[0].id", "one");
    verify(request).setParameter("someParam[1].id", "two");
    verify(request).setParameter("someParam[2].id", "three");
  }
View Full Code Here

    methodInfo.setControllerMethod(otherMethod);

    when(request.getParameterNames()).thenReturn(enumeration(asList("someParam.class.id", "unrelatedParam")));
    when(request.getParameterValues("someParam.class.id")).thenReturn(new String[] {"whatever"});

    instantiator.instantiate(new InterceptorsReady(otherMethod));
  }
View Full Code Here

    Object[] values = new Object[] { "bazinga" };
    methodInfo.setControllerMethod(otherMethod);

    when(flash.consumeParameters(otherMethod)).thenReturn(values);

    instantiator.instantiate(new InterceptorsReady(otherMethod));

    verify(validator).addAll(Collections.<Message>emptyList());
    verify(parametersProvider, never()).getParametersFor(otherMethod, errors);

    assertEquals("bazinga", methodInfo.getValuedParameters()[0].getValue());
View Full Code Here

    methodInfo.setControllerMethod(otherMethod);

    when(parametersProvider.getParametersFor(otherMethod, errors))
      .thenAnswer(addErrorsToListAndReturn(new Object[] { 0 }, "error1"));

    instantiator.instantiate(new InterceptorsReady(otherMethod));

    verify(validator).addAll(errors);
    assertEquals(methodInfo.getValuedParameters()[0].getValue(), 0);
  }
View Full Code Here

    methodInfo.setControllerMethod(controllerMethod);

    when(request.getHeader("X-MyApp-Password")).thenReturn("123");
    when(parametersProvider.getParametersFor(controllerMethod, errors)).thenReturn(values);

    instantiator.instantiate(new InterceptorsReady(controllerMethod));

    verify(request).setParameter("password", "123");
    verify(validator).addAll(Collections.<Message> emptyList());
  }
View Full Code Here

TOP

Related Classes of br.com.caelum.vraptor.events.InterceptorsReady

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.