@Test public void testGetCategoryProducts() throws Exception { String query = getResource("graphql-queries/category-products.txt"); Utils.setupHttpResponse("magento-graphql-category-products.json", httpClient, HttpStatus.SC_OK, query); CategoryProducts categoryProducts = dataService.getCategoryProducts(MEN_COATS_CATEGORY_ID, 1, 10, null); assertEquals(5, categoryProducts.getTotalCount().intValue()); assertEquals(5, categoryProducts.getItems().size()); }
@Override public CategoryProducts getCategoryProducts(Integer categoryId, Integer currentPage, Integer pageSize, String storeView) { try { ArrayKey key = toCategoryCacheKey(categoryId, currentPage, pageSize, storeView); Callable<Optional<CategoryProducts>> loader = () -> getCategoryProductsImpl(categoryId, currentPage, pageSize, storeView); return categoryProductsCache.get(key, loader).orElse(null); } catch (ExecutionException e) { throw new RuntimeException(e); } }
GraphqlDataServiceImpl implements GraphqlDataService { @Override public CategoryProducts getCategoryProducts(Integer categoryId, Integer currentPage, Integer pageSize, String storeView) { try { ArrayKey key = toCategoryCacheKey(categoryId, currentPage, pageSize, storeView); Callable<Optional<CategoryProducts>> loader = () -> getCategoryProductsImpl(categoryId, currentPage, pageSize, storeView); return categoryProductsCache.get(key, loader).orElse(null); } catch (ExecutionException e) { throw new RuntimeException(e); } } }
GraphqlDataServiceImpl implements GraphqlDataService { @Override public CategoryProducts getCategoryProducts(Integer categoryId, Integer currentPage, Integer pageSize, String storeView) { try { ArrayKey key = toCategoryCacheKey(categoryId, currentPage, pageSize, storeView); Callable<Optional<CategoryProducts>> loader = () -> getCategoryProductsImpl(categoryId, currentPage, pageSize, storeView); return categoryProductsCache.get(key, loader).orElse(null); } catch (ExecutionException e) { throw new RuntimeException(e); } }  }
GraphqlDataServiceImpl implements GraphqlDataService { @Override public CategoryProducts getCategoryProducts(Integer categoryId, Integer currentPage, Integer pageSize, String storeView) { try { ArrayKey key = toCategoryCacheKey(categoryId, currentPage, pageSize, storeView); Callable<Optional<CategoryProducts>> loader = () -> getCategoryProductsImpl(categoryId, currentPage, pageSize, storeView); return categoryProductsCache.get(key, loader).orElse(null); } catch (ExecutionException e) { throw new RuntimeException(e); } }  @Activate void activate(GraphqlDataServiceConfiguration conf); @Override ProductInterface getProductBySku(String sku, String storeView); @Override CategoryTree getCategoryById(Integer id, String storeView); @Override CategoryTree getCategoryByPath(String urlPath, String storeView); @Override List<ProductInterface> searchProducts(String text, Integer categoryId, Integer currentPage, Integer pageSize, String storeView); @Override List<CategoryTree> searchCategories(String text, Integer categoryId, Integer currentPage, Integer pageSize, String storeView); @Override CategoryProducts getCategoryProducts(Integer categoryId, Integer currentPage, Integer pageSize, String storeView); @Override String getIdentifier(); }
GraphqlDataServiceImpl implements GraphqlDataService { @Override public CategoryProducts getCategoryProducts(Integer categoryId, Integer currentPage, Integer pageSize, String storeView) { try { ArrayKey key = toCategoryCacheKey(categoryId, currentPage, pageSize, storeView); Callable<Optional<CategoryProducts>> loader = () -> getCategoryProductsImpl(categoryId, currentPage, pageSize, storeView); return categoryProductsCache.get(key, loader).orElse(null); } catch (ExecutionException e) { throw new RuntimeException(e); } }  @Activate void activate(GraphqlDataServiceConfiguration conf); @Override ProductInterface getProductBySku(String sku, String storeView); @Override CategoryTree getCategoryById(Integer id, String storeView); @Override CategoryTree getCategoryByPath(String urlPath, String storeView); @Override List<ProductInterface> searchProducts(String text, Integer categoryId, Integer currentPage, Integer pageSize, String storeView); @Override List<CategoryTree> searchCategories(String text, Integer categoryId, Integer currentPage, Integer pageSize, String storeView); @Override CategoryProducts getCategoryProducts(Integer categoryId, Integer currentPage, Integer pageSize, String storeView); @Override String getIdentifier();  }