Package org.apache.ambari.server.api.predicate

Examples of org.apache.ambari.server.api.predicate.PredicateCompiler


  @Test
  public void testParseRenderer_minimalResponse() throws Exception {

    String uriString = "http://localhost.com:8080/api/v1/clusters/c1";
    URI uri = new URI(URLEncoder.encode(uriString, "UTF-8"));
    PredicateCompiler compiler = createStrictMock(PredicateCompiler.class);
    UriInfo uriInfo = createMock(UriInfo.class);
    @SuppressWarnings("unchecked")
    MultivaluedMap<String, String> queryParams = createMock(MultivaluedMap.class);

    RequestHandler handler = createStrictMock(RequestHandler.class);
View Full Code Here


  @Test
  public void testParseRenderer_formatSpecified() throws Exception {

    String uriString = "http://localhost.com:8080/api/v1/clusters/c1";
    URI uri = new URI(URLEncoder.encode(uriString, "UTF-8"));
    PredicateCompiler compiler = createStrictMock(PredicateCompiler.class);
    UriInfo uriInfo = createMock(UriInfo.class);
    @SuppressWarnings("unchecked")
    MultivaluedMap<String, String> queryParams = createMock(MultivaluedMap.class);

    RequestHandler handler = createStrictMock(RequestHandler.class);
View Full Code Here

   * a predicate.
   *
   * @return the predicate compiler
   */
  protected PredicateCompiler getPredicateCompiler() {
    return new PredicateCompiler();
  }
View Full Code Here

  protected RequestBodyParser getHttpBodyParser() {
    return new JsonPropertyParser();
  }

  protected PredicateCompiler getPredicateCompiler() {
    return new PredicateCompiler();
  }
View Full Code Here

* Base tests for service requests.
*/
public abstract class BaseRequestTest {

  public void testGetQueryPredicate(String uriString) throws Exception {
    PredicateCompiler compiler = createStrictMock(PredicateCompiler.class);
    Predicate p = createMock(Predicate.class);
    UriInfo uriInfo = createMock(UriInfo.class);
    URI uri = new URI(URLEncoder.encode(uriString, "UTF-8"));

    expect(uriInfo.getRequestUri()).andReturn(uri);
    expect(compiler.compile(uriString.substring(uriString.indexOf("?") + 1))).andReturn(p);

    replay(uriInfo, compiler, p);

    Request request = getTestRequest(null, null, uriInfo, compiler);

View Full Code Here

  }

  @Test
  public void testGetQueryPredicate_noQueryString() throws Exception {
    String uriString = "http://localhost.com:8080/api/v1/clusters";
    PredicateCompiler compiler = createStrictMock(PredicateCompiler.class);
    UriInfo uriInfo = createMock(UriInfo.class);
    URI uri = new URI(URLEncoder.encode(uriString, "UTF-8"));

    expect(uriInfo.getRequestUri()).andReturn(uri);
View Full Code Here

  }

  @Test
  public void testGetQueryPredicate_invalidQuery() throws Exception {
    String uriString = "http://localhost.com:8080/api/v1/clusters?&foo|";
    PredicateCompiler compiler = createStrictMock(PredicateCompiler.class);
    UriInfo uriInfo = createMock(UriInfo.class);
    URI uri = new URI(URLEncoder.encode(uriString, "UTF-8"));

    expect(uriInfo.getRequestUri()).andReturn(uri);
    expect(compiler.compile(uriString.substring(uriString.indexOf("?") + 1))).
        andThrow(new InvalidQueryException("test"));
    replay(uriInfo, compiler);

    Request request = getTestRequest(null, null, uriInfo, compiler);
View Full Code Here

   * a predicate.
   *
   * @return the predicate compiler
   */
  protected PredicateCompiler getPredicateCompiler() {
    return new PredicateCompiler();
  }
View Full Code Here

   * a predicate.
   *
   * @return the predicate compiler
   */
  protected PredicateCompiler getPredicateCompiler() {
    return new PredicateCompiler();
  }
View Full Code Here

  @Test
  public void testProcess_noBody() throws Exception {
    String uriString = "http://localhost.com:8080/api/v1/clusters/c1";
    URI uri = new URI(URLEncoder.encode(uriString, "UTF-8"));
    PredicateCompiler compiler = createStrictMock(PredicateCompiler.class);
    UriInfo uriInfo = createMock(UriInfo.class);
    RequestHandler handler = createStrictMock(RequestHandler.class);
    Result result = createMock(Result.class);
    ResultStatus resultStatus = createMock(ResultStatus.class);
    ResultPostProcessor processor = createStrictMock(ResultPostProcessor.class);
View Full Code Here

TOP

Related Classes of org.apache.ambari.server.api.predicate.PredicateCompiler

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.