@Test public void testGetItems() throws Exception { String projectId = "02a70003-e864-464e-b62c-e0ede97deb8c"; this.serverBootstrap.registerHandler( String.format("/%s/%s", projectId, "items"), (request, response, context) -> { String uri = String.format("http: List<NameValuePair> nameValuePairs = URLEncodedUtils.parse(URI.create(uri), Charset.defaultCharset()); Map<String, String> params = convertNameValuePairsToMap(nameValuePairs); Assert.assertEquals(1, params.size()); Assert.assertEquals("/path1/path2/test-article", params.get("elements.url_pattern")); response.setEntity( new InputStreamEntity( this.getClass().getResourceAsStream("SampleContentItemList.json") ) ); }); HttpHost httpHost = this.start(); String testServerUri = httpHost.toURI(); DeliveryOptions deliveryOptions = new DeliveryOptions(); deliveryOptions.setProjectId(projectId); deliveryOptions.setProductionEndpoint(testServerUri); DeliveryClient client = new DeliveryClient(deliveryOptions, null); client.setContentLinkUrlResolver(Link::getUrlSlug); client.setBrokenLinkUrlResolver(() -> "/404"); client.addRichTextElementResolver(content -> String.format("%s%s", "<p>test</p>", content)); List<kentico.kontent.delivery.NameValuePair> urlPattern = DeliveryParameterBuilder.params().filterEquals("elements.url_pattern", "/path1/path2/test-article").build(); ContentItemsListingResponse items = client.getItems(urlPattern) .toCompletableFuture() .get(); Assert.assertNotNull(items); Assert.assertTrue(((RichTextElement) items.getItems().get(1).getElements().get("description")).getValue().contains("href=\"/on roasts\"")); Assert.assertTrue(((RichTextElement) items.getItems().get(1).getElements().get("description")).getValue().contains("<p>test</p>")); }
public CompletionStage<ContentItemsListingResponse> getItems() { return getItems(Collections.emptyList()); }
DeliveryClient { public CompletionStage<ContentItemsListingResponse> getItems() { return getItems(Collections.emptyList()); } }
DeliveryClient { public CompletionStage<ContentItemsListingResponse> getItems() { return getItems(Collections.emptyList()); } @SuppressWarnings("WeakerAccess")  DeliveryClient(DeliveryOptions deliveryOptions); @SuppressWarnings({"ResultOfMethodCallIgnored", "WeakerAccess"})  DeliveryClient(DeliveryOptions deliveryOptions, TemplateEngineConfig templateEngineConfig); @SuppressWarnings("unused")  DeliveryClient(String projectId); @SuppressWarnings("unused")  DeliveryClient(String projectId, String previewApiKey); }
DeliveryClient { public CompletionStage<ContentItemsListingResponse> getItems() { return getItems(Collections.emptyList()); } @SuppressWarnings("WeakerAccess")  DeliveryClient(DeliveryOptions deliveryOptions); @SuppressWarnings({"ResultOfMethodCallIgnored", "WeakerAccess"})  DeliveryClient(DeliveryOptions deliveryOptions, TemplateEngineConfig templateEngineConfig); @SuppressWarnings("unused")  DeliveryClient(String projectId); @SuppressWarnings("unused")  DeliveryClient(String projectId, String previewApiKey); CompletionStage<ContentItemsListingResponse> getItems(); @SuppressWarnings("WeakerAccess") CompletionStage<ContentItemsListingResponse> getItems(List<NameValuePair> params); @SuppressWarnings("WeakerAccess") CompletionStage<List<T>> getItems(Class<T> tClass, List<NameValuePair> params); @SuppressWarnings("unused") CompletionStage<ContentItemResponse> getItem(String contentItemCodename); @SuppressWarnings("unused") CompletionStage<List<T>> getItems(Class<T> tClass); @SuppressWarnings("WeakerAccess") CompletionStage<Page<T>> getPageOfItems(Class<T> tClass, List<NameValuePair> params); @SuppressWarnings("WeakerAccess") CompletionStage<Page<T>> getNextPage(Page<T> currentPage); @SuppressWarnings("unused") CompletionStage<T> getItem(String contentItemCodename, Class<T> tClass); @SuppressWarnings("WeakerAccess") CompletionStage<ContentItemResponse> getItem(String contentItemCodename, List<NameValuePair> params); @SuppressWarnings("WeakerAccess") CompletionStage<T> getItem(String contentItemCodename, Class<T> tClass, List<NameValuePair> params); CompletionStage<ContentTypesListingResponse> getTypes(); @SuppressWarnings("WeakerAccess") CompletionStage<ContentTypesListingResponse> getTypes(List<NameValuePair> params); CompletionStage<ContentType> getType(String contentTypeCodeName); @SuppressWarnings("unused") CompletionStage<Element> getContentTypeElement(String contentTypeCodeName, String elementCodeName); @SuppressWarnings("WeakerAccess") CompletionStage<Element> getContentTypeElement(
            String contentTypeCodeName, String elementCodeName, List<NameValuePair> params); @SuppressWarnings("unused") CompletionStage<TaxonomyGroupListingResponse> getTaxonomyGroups(); @SuppressWarnings("WeakerAccess") CompletionStage<TaxonomyGroupListingResponse> getTaxonomyGroups(List<NameValuePair> params); @SuppressWarnings("unused") CompletionStage<TaxonomyGroup> getTaxonomyGroup(String taxonomyGroupCodename); @SuppressWarnings("WeakerAccess") CompletionStage<TaxonomyGroup> getTaxonomyGroup(String taxonomyGroupCodename, List<NameValuePair> params); @SuppressWarnings("WeakerAccess") ContentLinkUrlResolver getContentLinkUrlResolver(); @SuppressWarnings("WeakerAccess") void setContentLinkUrlResolver(ContentLinkUrlResolver contentLinkUrlResolver); @SuppressWarnings("WeakerAccess") BrokenLinkUrlResolver getBrokenLinkUrlResolver(); @SuppressWarnings("WeakerAccess") void setBrokenLinkUrlResolver(BrokenLinkUrlResolver brokenLinkUrlResolver); @SuppressWarnings("WeakerAccess") RichTextElementResolver getRichTextElementResolver(); @SuppressWarnings("WeakerAccess") void setRichTextElementResolver(RichTextElementResolver richTextElementResolver); @SuppressWarnings("WeakerAccess") void addRichTextElementResolver(RichTextElementResolver richTextElementResolver); @SuppressWarnings("WeakerAccess") void registerType(String contentType, Class<?> clazz); @SuppressWarnings("WeakerAccess") void registerType(Class<?> clazz); @SuppressWarnings("WeakerAccess") void registerInlineContentItemsResolver(InlineContentItemsResolver resolver); @SuppressWarnings("WeakerAccess") void scanClasspathForMappings(String basePackage); @SuppressWarnings("WeakerAccess") void setCacheManager(AsyncCacheManager cacheManager); void setCacheManager(final CacheManager cacheManager); }
DeliveryClient { public CompletionStage<ContentItemsListingResponse> getItems() { return getItems(Collections.emptyList()); } @SuppressWarnings("WeakerAccess")  DeliveryClient(DeliveryOptions deliveryOptions); @SuppressWarnings({"ResultOfMethodCallIgnored", "WeakerAccess"})  DeliveryClient(DeliveryOptions deliveryOptions, TemplateEngineConfig templateEngineConfig); @SuppressWarnings("unused")  DeliveryClient(String projectId); @SuppressWarnings("unused")  DeliveryClient(String projectId, String previewApiKey); CompletionStage<ContentItemsListingResponse> getItems(); @SuppressWarnings("WeakerAccess") CompletionStage<ContentItemsListingResponse> getItems(List<NameValuePair> params); @SuppressWarnings("WeakerAccess") CompletionStage<List<T>> getItems(Class<T> tClass, List<NameValuePair> params); @SuppressWarnings("unused") CompletionStage<ContentItemResponse> getItem(String contentItemCodename); @SuppressWarnings("unused") CompletionStage<List<T>> getItems(Class<T> tClass); @SuppressWarnings("WeakerAccess") CompletionStage<Page<T>> getPageOfItems(Class<T> tClass, List<NameValuePair> params); @SuppressWarnings("WeakerAccess") CompletionStage<Page<T>> getNextPage(Page<T> currentPage); @SuppressWarnings("unused") CompletionStage<T> getItem(String contentItemCodename, Class<T> tClass); @SuppressWarnings("WeakerAccess") CompletionStage<ContentItemResponse> getItem(String contentItemCodename, List<NameValuePair> params); @SuppressWarnings("WeakerAccess") CompletionStage<T> getItem(String contentItemCodename, Class<T> tClass, List<NameValuePair> params); CompletionStage<ContentTypesListingResponse> getTypes(); @SuppressWarnings("WeakerAccess") CompletionStage<ContentTypesListingResponse> getTypes(List<NameValuePair> params); CompletionStage<ContentType> getType(String contentTypeCodeName); @SuppressWarnings("unused") CompletionStage<Element> getContentTypeElement(String contentTypeCodeName, String elementCodeName); @SuppressWarnings("WeakerAccess") CompletionStage<Element> getContentTypeElement(
            String contentTypeCodeName, String elementCodeName, List<NameValuePair> params); @SuppressWarnings("unused") CompletionStage<TaxonomyGroupListingResponse> getTaxonomyGroups(); @SuppressWarnings("WeakerAccess") CompletionStage<TaxonomyGroupListingResponse> getTaxonomyGroups(List<NameValuePair> params); @SuppressWarnings("unused") CompletionStage<TaxonomyGroup> getTaxonomyGroup(String taxonomyGroupCodename); @SuppressWarnings("WeakerAccess") CompletionStage<TaxonomyGroup> getTaxonomyGroup(String taxonomyGroupCodename, List<NameValuePair> params); @SuppressWarnings("WeakerAccess") ContentLinkUrlResolver getContentLinkUrlResolver(); @SuppressWarnings("WeakerAccess") void setContentLinkUrlResolver(ContentLinkUrlResolver contentLinkUrlResolver); @SuppressWarnings("WeakerAccess") BrokenLinkUrlResolver getBrokenLinkUrlResolver(); @SuppressWarnings("WeakerAccess") void setBrokenLinkUrlResolver(BrokenLinkUrlResolver brokenLinkUrlResolver); @SuppressWarnings("WeakerAccess") RichTextElementResolver getRichTextElementResolver(); @SuppressWarnings("WeakerAccess") void setRichTextElementResolver(RichTextElementResolver richTextElementResolver); @SuppressWarnings("WeakerAccess") void addRichTextElementResolver(RichTextElementResolver richTextElementResolver); @SuppressWarnings("WeakerAccess") void registerType(String contentType, Class<?> clazz); @SuppressWarnings("WeakerAccess") void registerType(Class<?> clazz); @SuppressWarnings("WeakerAccess") void registerInlineContentItemsResolver(InlineContentItemsResolver resolver); @SuppressWarnings("WeakerAccess") void scanClasspathForMappings(String basePackage); @SuppressWarnings("WeakerAccess") void setCacheManager(AsyncCacheManager cacheManager); void setCacheManager(final CacheManager cacheManager);  }