Package br.com.caelum.vraptor.controller

Examples of br.com.caelum.vraptor.controller.DefaultBeanClass


    assertThat(route.allowedMethods(), is(EnumSet.of(HttpMethod.POST)));
  }

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


    };
  }

  @Test
  public void addsAPrefixToMethodsWhenTheGetControllerAndTheMethodAreAnnotatedWithRelativePath() throws Exception {
    List<Route> routes = parser.rulesFor(new DefaultBeanClass(GetAnnotatedController.class));
    Route route = getRouteMatching(routes, "/prefix/relativePath");

    assertThat(route, canHandle(GetAnnotatedController.class, "withRelativePath"));
  }
View Full Code Here

    assertThat(route, canHandle(GetAnnotatedController.class, "withRelativePath"));
  }

  @Test
  public void priorityForGetAnnotationShouldBeDefault() throws Exception {
    List<Route> routes = parser.rulesFor(new DefaultBeanClass(GetAnnotatedController.class));
    Route route = getRouteMatching(routes, "/prefix/relativePath");

    assertThat(route.getPriority(), is(Path.DEFAULT));
  }
View Full Code Here

    assertThat(route.getPriority(), is(Path.DEFAULT));
  }

  @Test
  public void addsAPrefixToMethodsWhenTheGetControllerEndsWithSlashAndTheMethodAreAnnotatedWithRelativePath() throws Exception {
    List<Route> routes = parser.rulesFor(new DefaultBeanClass(EndSlashAnnotatedGetController.class));
    Route route = getRouteMatching(routes, "/endSlash/relativePath");

    assertThat(route, canHandle(EndSlashAnnotatedGetController.class, "withRelativePath"));
  }
View Full Code Here

  }


  @Test
  public void addsAPrefixToMethodsWhenTheGetControllerEndsWithSlashAndTheMethodAreAnnotatedWithAbsolutePath() throws Exception {
    List<Route> routes = parser.rulesFor(new DefaultBeanClass(EndSlashAnnotatedGetController.class));
    Route route = getRouteMatching(routes, "/endSlash/absolutePath");

    assertThat(route, canHandle(EndSlashAnnotatedGetController.class, "withAbsolutePath"));
  }
View Full Code Here

    assertThat(route, canHandle(EndSlashAnnotatedGetController.class, "withAbsolutePath"));
  }

  @Test
  public void addsAPrefixToMethodsWhenTheGetControllerAndTheMethodAreAnnotatedWithAbsolutePath() throws Exception {
    List<Route> routes = parser.rulesFor(new DefaultBeanClass(GetAnnotatedController.class));
    Route route = getRouteMatching(routes, "/prefix/absolutePath");

    assertThat(route, canHandle(GetAnnotatedController.class, "withAbsolutePath"));
  }
View Full Code Here

    assertThat(route, canHandle(GetAnnotatedController.class, "withAbsolutePath"));
  }

  @Test
  public void addsAPrefixToMethodsWhenTheGetControllerIsAnnotatedWithPath() throws Exception {
    List<Route> routes = parser.rulesFor(new DefaultBeanClass(GetAnnotatedController.class));
    Route route = getRouteMatching(routes, "/prefix/withoutPath");

    assertThat(route, canHandle(GetAnnotatedController.class, "withoutPath"));
  }
View Full Code Here

  @Test
  public void throwsExceptionWhenTheGetControllerHasAmbiguousDeclaration() throws Exception {
    exception.expect(IllegalArgumentException.class);
    exception.expectMessage("You should specify paths either in @Path(\"/path\") or @Get(\"/path\") (or @Post, @Put, @Delete), not both at");

    parser.rulesFor(new DefaultBeanClass(WrongGetAnnotatedController.class));
  }
View Full Code Here

      assertThat(e.getAllowedMethods(), is((Set<HttpMethod>)EnumSet.of(HttpMethod.GET)));
    }
  }

  private DefaultControllerMethod anyControllerMethod() throws NoSuchMethodException {
    return new DefaultControllerMethod(new DefaultBeanClass(MyController.class), MyController.class.getMethod("customizedPath"));
  }
View Full Code Here

  }

  private void registerRulesFor(Class<?> type) {
    RoutesParser parser = new PathAnnotationRoutesParser(router);

    BeanClass controllerClass = new DefaultBeanClass(type);
    List<Route> rules = parser.rulesFor(controllerClass);
    for (Route route : rules) {
      router.add(route);
    }
  }
View Full Code Here

TOP

Related Classes of br.com.caelum.vraptor.controller.DefaultBeanClass

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.