@Test public void testRetryStopsOnNonRetryStatus() throws Exception { String projectId = "02a70003-e864-464e-b62c-e0ede97deb8c"; final int[] sentErrorCount = {0}; this.serverBootstrap.registerHandler( String.format("/%s/%s", projectId, "items/error"), (request, response, context) -> { response.setStatusCode(404); response.setEntity( new InputStreamEntity( this.getClass().getResourceAsStream("SampleKenticoError.json") ) ); sentErrorCount[0] = sentErrorCount[0] + 1; }); HttpHost httpHost = this.start(); String testServerUri = httpHost.toURI(); DeliveryOptions deliveryOptions = new DeliveryOptions(); deliveryOptions.setProjectId(projectId); deliveryOptions.setProductionEndpoint(testServerUri); deliveryOptions.setRetryAttempts(1); try { DeliveryClient client = new DeliveryClient(deliveryOptions); client.getItem("error") .toCompletableFuture() .get(); Assert.fail("Expected KenticoErrorException"); } catch (ExecutionException e) { Assert.assertTrue(e.getCause() instanceof KenticoErrorException); KenticoErrorException error = (KenticoErrorException) e.getCause(); Assert.assertEquals("The requested content item 'error' was not found.", error.getMessage()); Assert.assertEquals("The requested content item 'error' was not found.", error.getKenticoError().getMessage()); } Assert.assertEquals(1, sentErrorCount[0]); }
@SuppressWarnings("unused") public CompletionStage<ContentItemResponse> getItem(String contentItemCodename) { return getItem(contentItemCodename, Collections.emptyList()); }
DeliveryClient { @SuppressWarnings("unused") public CompletionStage<ContentItemResponse> getItem(String contentItemCodename) { return getItem(contentItemCodename, Collections.emptyList()); } }
DeliveryClient { @SuppressWarnings("unused") public CompletionStage<ContentItemResponse> getItem(String contentItemCodename) { return getItem(contentItemCodename, 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 { @SuppressWarnings("unused") public CompletionStage<ContentItemResponse> getItem(String contentItemCodename) { return getItem(contentItemCodename, 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 { @SuppressWarnings("unused") public CompletionStage<ContentItemResponse> getItem(String contentItemCodename) { return getItem(contentItemCodename, 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);  }