Esempio n. 1
0
 @Test
 public void testGetBooksWithCustomProvider() throws Exception {
   String endpointAddress = "http://localhost:" + PORT + "/bookstore/bookstore4/books/feed";
   Feed feed = getFeed(endpointAddress, null);
   assertEquals(
       "http://localhost:" + PORT + "/bookstore/bookstore4/books/feed",
       feed.getBaseUri().toString());
   assertEquals("Collection of Books", feed.getTitle());
 }
Esempio n. 2
0
  @Test
  public void testGetBooks() throws Exception {
    String endpointAddress = "http://localhost:" + PORT + "/bookstore/bookstore/books/feed";
    Feed feed = getFeed(endpointAddress, null);
    assertEquals(
        "http://localhost:" + PORT + "/bookstore/bookstore/books/feed",
        feed.getBaseUri().toString());
    assertEquals("Collection of Books", feed.getTitle());

    getAndCompareJson(
        "http://localhost:" + PORT + "/bookstore/bookstore/books/feed",
        "resources/expected_atom_books_json.txt",
        "application/json");

    getAndCompareJson(
        "http://localhost:" + PORT + "/bookstore/bookstore/books/jsonfeed",
        "resources/expected_atom_books_jsonfeed.txt",
        "application/json, text/html, application/xml;q=0.9,"
            + " application/xhtml+xml, image/png, image/jpeg, image/gif,"
            + " image/x-xbitmap, */*;q=0.1");

    Entry entry = addEntry(endpointAddress);
    entry = addEntry(endpointAddress + "/relative");

    endpointAddress = "http://localhost:" + PORT + "/bookstore/bookstore/books/subresources/123";
    entry = getEntry(endpointAddress, null);
    assertEquals("CXF in Action", entry.getTitle());

    getAndCompareJson(
        "http://localhost:" + PORT + "/bookstore/bookstore/books/entries/123",
        "resources/expected_atom_book_json.txt",
        "application/json");

    getAndCompareJson(
        "http://localhost:"
            + PORT
            + "/bookstore/bookstore/books/entries/123?_type="
            + "application/json",
        "resources/expected_atom_book_json.txt",
        "*/*");
    getAndCompareJson(
        "http://localhost:" + PORT + "/bookstore/bookstore/books/entries/123?_type=" + "json",
        "resources/expected_atom_book_json.txt",
        "*/*");

    // do the same using extension mappings
    getAndCompareJson(
        "http://localhost:" + PORT + "/bookstore/bookstore/books/entries/123.json",
        "resources/expected_atom_book_json.txt",
        "*/*");
    // do the same using extension mappings & matrix parameters
    getAndCompareJson(
        "http://localhost:" + PORT + "/bookstore/bookstore/books/entries/123.json;a=b",
        "resources/expected_atom_book_json_matrix.txt",
        "*/*");
  }
Esempio n. 3
0
  @Test
  public void testGetBooks2() throws Exception {
    String endpointAddress = "http://localhost:" + PORT + "/bookstore/sub/";
    Feed feed = getFeed(endpointAddress, null);
    assertEquals("http://localhost:" + PORT + "/bookstore/sub/", feed.getBaseUri().toString());
    assertEquals("Collection of Books", feed.getTitle());

    getAndCompareJson(
        "http://localhost:" + PORT + "/bookstore/sub/books/entries/123.json",
        "resources/expected_atom_book_json2.txt",
        "*/*");
  }