@Test public void testQueryLanguageProvider() throws IOException { Utils.setupHttpResponse("magento-graphql-categorylist-coats.json", httpClient, HttpStatus.SC_OK, "{categoryList(filters:{url_key:{eq:\"coats\""); Utils.setupHttpResponse("magento-graphql-products-search.json", httpClient, HttpStatus.SC_OK, "{product"); String jsonRequest = IOUtils.toString(this.getClass().getClassLoader().getResourceAsStream( "commerce-products-omni-search-request.json"), StandardCharsets.UTF_8); QueryLanguageProvider queryLanguageProvider = provider.getQueryLanguageProvider(); assertTrue(ArrayUtils.contains(queryLanguageProvider.getSupportedLanguages(null), VIRTUAL_PRODUCT_QUERY_LANGUAGE)); Iterator<Resource> resources = queryLanguageProvider.findResources(resolveContext, jsonRequest, VIRTUAL_PRODUCT_QUERY_LANGUAGE); Resource resource = resources.next(); assertEquals(PRODUCT_PATH, resource.getPath()); ValueMap valueMap = resource.getValueMap(); assertEquals(SKU, valueMap.get("sku", String.class)); assertEquals(PRODUCT, valueMap.get(CommerceConstants.PN_COMMERCE_TYPE, String.class)); assertEquals(MAGENTO_GRAPHQL_PROVIDER, valueMap.get(CommerceConstants.PN_COMMERCE_PROVIDER, String.class)); }
@Override public GraphqlQueryLanguageProvider getQueryLanguageProvider() { return queryLanguageProvider; }
GraphqlResourceProvider extends ResourceProvider<Object> { @Override public GraphqlQueryLanguageProvider getQueryLanguageProvider() { return queryLanguageProvider; } }
GraphqlResourceProvider extends ResourceProvider<Object> { @Override public GraphqlQueryLanguageProvider getQueryLanguageProvider() { return queryLanguageProvider; } GraphqlResourceProvider(String root, GraphqlDataService graphqlDataService, Map<String, String> properties); }
GraphqlResourceProvider extends ResourceProvider<Object> { @Override public GraphqlQueryLanguageProvider getQueryLanguageProvider() { return queryLanguageProvider; } GraphqlResourceProvider(String root, GraphqlDataService graphqlDataService, Map<String, String> properties); @Override Resource getResource(ResolveContext<Object> ctx, String path, ResourceContext resourceContext, Resource parent); @Override Iterator<Resource> listChildren(ResolveContext<Object> ctx, Resource parent); @Override GraphqlQueryLanguageProvider getQueryLanguageProvider(); }
GraphqlResourceProvider extends ResourceProvider<Object> { @Override public GraphqlQueryLanguageProvider getQueryLanguageProvider() { return queryLanguageProvider; } GraphqlResourceProvider(String root, GraphqlDataService graphqlDataService, Map<String, String> properties); @Override Resource getResource(ResolveContext<Object> ctx, String path, ResourceContext resourceContext, Resource parent); @Override Iterator<Resource> listChildren(ResolveContext<Object> ctx, Resource parent); @Override GraphqlQueryLanguageProvider getQueryLanguageProvider();  }