Examples of DefaultResourceClass


Examples of br.com.caelum.vraptor.resource.DefaultResourceClass

    public void overridden() {}
  }

  @Test
  public void supportTypeHttpMethodAnnotation() throws SecurityException, NoSuchMethodException {
    List<Route> routes = parser.rulesFor(new DefaultResourceClass(AnnotatedController.class));
    Route route = getRouteMatching(routes, "/annotated/test");
    assertThat(route.allowedMethods(), is(EnumSet.of(HttpMethod.POST)));
  }
View Full Code Here

Examples of br.com.caelum.vraptor.resource.DefaultResourceClass

  public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);

    when(provider.parameterNamesFor(any(Method.class))).thenReturn(new String[] { "abc", "def", "ghi" });

    method = new DefaultResourceMethod(new DefaultResourceClass(MyResource.class), MyResource.class.getMethod(
        "method", String.class, Integer.class, BigDecimal.class));

    proxifier = new JavassistProxifier(new ObjenesisInstanceCreator());

    typeFinder = new DefaultTypeFinder(provider);
View Full Code Here

Examples of br.com.caelum.vraptor.resource.DefaultResourceClass

  public void shouldUseContainerForNewComponent() throws InterceptionException, IOException {
  final DogController myDog = new DogController();
  InstanceContainer container = new InstanceContainer(myDog);
  InstantiateInterceptor interceptor = new InstantiateInterceptor(container);
 
  when(method.getResource()).thenReturn(new DefaultResourceClass(DogController.class));
 
  interceptor.intercept(stack, method, null);
  assertTrue(container.isEmpty());
 
  verify(stack).next(method, myDog);
View Full Code Here

Examples of br.com.caelum.vraptor.resource.DefaultResourceClass

    extractor = new DefaultTypeNameExtractor();
   
  deserializer = new JsonDeserializer(provider, extractor, XStreamBuilderImpl.cleanInstance());
 
    ResourceClass resourceClass = new DefaultResourceClass(CatController.class);

    meow = new DefaultResourceMethod(resourceClass, CatController.class.getDeclaredMethod("meow"));
    roll = new DefaultResourceMethod(resourceClass, CatController.class.getDeclaredMethod("roll", Cat.class));
    jump = new DefaultResourceMethod(resourceClass, CatController.class.getDeclaredMethod("jump", Cat.class, Integer.class));
    sleep = new DefaultResourceMethod(resourceClass, CatController.class.getDeclaredMethod("sleep", Integer.class, Cat.class));
View Full Code Here

Examples of br.com.caelum.vraptor.resource.DefaultResourceClass

  @Before
  public void setUp() throws Exception {
    provider = mock(ParameterNameProvider.class);

    deserializer = new XStreamXMLDeserializer(provider, XStreamBuilderImpl.cleanInstance());
    DefaultResourceClass resourceClass = new DefaultResourceClass(DogController.class);
    DefaultResourceClass resourcePersonClass = new DefaultResourceClass(PersonController.class);

    woof = new DefaultResourceMethod(resourceClass, DogController.class.getDeclaredMethod("woof"));
    bark = new DefaultResourceMethod(resourceClass, DogController.class.getDeclaredMethod("bark", Dog.class));
    jump = new DefaultResourceMethod(resourceClass, DogController.class.getDeclaredMethod("jump", Dog.class, Integer.class));
    dropDead = new DefaultResourceMethod(resourceClass, DogController.class.getDeclaredMethod("dropDead", Integer.class, Dog.class));
View Full Code Here

Examples of br.com.caelum.vraptor.resource.DefaultResourceClass

    List<JsonDeserializer> deserializers = new ArrayList<JsonDeserializer>();
    CalendarDeserializer calendarDeserializer = new CalendarDeserializer(localization);
    deserializers.add(calendarDeserializer);
    deserializer = new GsonDeserialization(provider, new DefaultJsonDeserializers(deserializers), request);
    DefaultResourceClass resourceClass = new DefaultResourceClass(DogController.class);

    woof = new DefaultResourceMethod(resourceClass, DogController.class.getDeclaredMethod("woof"));
    bark = new DefaultResourceMethod(resourceClass, DogController.class.getDeclaredMethod("bark", Dog.class));
    jump = new DefaultResourceMethod(resourceClass, DogController.class.getDeclaredMethod("jump", Dog.class,
        Integer.class));
View Full Code Here

Examples of br.com.caelum.vraptor.resource.DefaultResourceClass

  @Test
  public void shouldDeserializeFromGenericTypeOneParam() {
    InputStream stream = new ByteArrayInputStream(
        "{'entity':{'name':'Brutus','age':7,'birthday':'06/01/1987'}}".getBytes());
    ResourceClass resourceClass = new DefaultResourceClass(ExtGenericController.class);
    Method method = new Mirror().on(GenericController.class).reflect().method("method").withAnyArgs();
    ResourceMethod resource = new DefaultResourceMethod(resourceClass, method);
    when(provider.parameterNamesFor(resource.getMethod())).thenReturn(new String[] { "entity" });

    Object[] deserialized = deserializer.deserialize(stream, resource);
View Full Code Here

Examples of br.com.caelum.vraptor.resource.DefaultResourceClass

  @Test
  public void shouldDeserializeFromGenericTypeTwoParams() {
    InputStream stream = new ByteArrayInputStream(
        "{'entity':{'name':'Brutus','age':7,'birthday':'06/01/1987'}, 'param': 'test'}".getBytes());
    ResourceClass resourceClass = new DefaultResourceClass(ExtGenericController.class);
    Method method = new Mirror().on(GenericController.class).reflect().method("anotherMethod").withAnyArgs();
    ResourceMethod resource = new DefaultResourceMethod(resourceClass, method);
    when(provider.parameterNamesFor(resource.getMethod())).thenReturn(new String[] { "entity", "param" });

    Object[] deserialized = deserializer.deserialize(stream, resource);
View Full Code Here

Examples of br.com.caelum.vraptor.resource.DefaultResourceClass

  @Test
  public void shouldDeserializeWithoutGenericType() {
    InputStream stream = new ByteArrayInputStream(
        "{'param': 'test'}".getBytes());
    ResourceClass resourceClass = new DefaultResourceClass(ExtGenericController.class);
    Method method = new Mirror().on(GenericController.class).reflect().method("methodWithoutGenericType").withArgs(String.class);
    ResourceMethod resource = new DefaultResourceMethod(resourceClass, method);
    when(provider.parameterNamesFor(resource.getMethod())).thenReturn(new String[] { "param" });

    Object[] deserialized = deserializer.deserialize(stream, resource);
View Full Code Here

Examples of br.com.caelum.vraptor.resource.DefaultResourceClass

    this.router = router;
  }

  public void handle(Class<?> annotatedType) {
    logger.debug("Found resource: " + annotatedType);
    router.register(new DefaultResourceClass(annotatedType));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.