@Test public void testbuildAuthRequest() throws Exception { String consumerCredential = "someCredential"; HttpRequest httpRequest = OpenPatentWebServiceFacade.buildAuthRequest(consumerCredential, authUriRoot); assertNotNull(httpRequest); assertEquals(authUriRoot, httpRequest.getRequestLine().getUri()); assertEquals("Basic " + consumerCredential, httpRequest.getLastHeader("Authorization").getValue()); assertTrue(httpRequest instanceof HttpPost); HttpPost postRequest = (HttpPost) httpRequest; assertNotNull(postRequest.getEntity()); assertTrue(postRequest.getEntity() instanceof UrlEncodedFormEntity); String content = IOUtils.toString(((UrlEncodedFormEntity)postRequest.getEntity()).getContent(), StandardCharsets.UTF_8); assertNotNull(content); assertEquals("grant_type=client_credentials", content); }
protected static HttpRequest buildAuthRequest(String consumerCredential, String uriRoot) { HttpPost httpRequest = new HttpPost(uriRoot); httpRequest.addHeader("Authorization", "Basic " + consumerCredential); BasicNameValuePair grantType = new BasicNameValuePair("grant_type", "client_credentials"); httpRequest.setEntity(new UrlEncodedFormEntity(Collections.singletonList(grantType), DEFAULT_CHARSET)); return httpRequest; }
OpenPatentWebServiceFacade implements PatentServiceFacade { protected static HttpRequest buildAuthRequest(String consumerCredential, String uriRoot) { HttpPost httpRequest = new HttpPost(uriRoot); httpRequest.addHeader("Authorization", "Basic " + consumerCredential); BasicNameValuePair grantType = new BasicNameValuePair("grant_type", "client_credentials"); httpRequest.setEntity(new UrlEncodedFormEntity(Collections.singletonList(grantType), DEFAULT_CHARSET)); return httpRequest; } }
OpenPatentWebServiceFacade implements PatentServiceFacade { protected static HttpRequest buildAuthRequest(String consumerCredential, String uriRoot) { HttpPost httpRequest = new HttpPost(uriRoot); httpRequest.addHeader("Authorization", "Basic " + consumerCredential); BasicNameValuePair grantType = new BasicNameValuePair("grant_type", "client_credentials"); httpRequest.setEntity(new UrlEncodedFormEntity(Collections.singletonList(grantType), DEFAULT_CHARSET)); return httpRequest; } OpenPatentWebServiceFacade(ConnectionDetails connDetails); protected  OpenPatentWebServiceFacade(CloseableHttpClient httpClient, HttpHost authHost, String authUriRoot, HttpHost opsHost,
            String opsUriRoot, String consumerCredential, long throttleSleepTime, int maxRetriesCount,
            JsonParser jsonParser); }
OpenPatentWebServiceFacade implements PatentServiceFacade { protected static HttpRequest buildAuthRequest(String consumerCredential, String uriRoot) { HttpPost httpRequest = new HttpPost(uriRoot); httpRequest.addHeader("Authorization", "Basic " + consumerCredential); BasicNameValuePair grantType = new BasicNameValuePair("grant_type", "client_credentials"); httpRequest.setEntity(new UrlEncodedFormEntity(Collections.singletonList(grantType), DEFAULT_CHARSET)); return httpRequest; } OpenPatentWebServiceFacade(ConnectionDetails connDetails); protected  OpenPatentWebServiceFacade(CloseableHttpClient httpClient, HttpHost authHost, String authUriRoot, HttpHost opsHost,
            String opsUriRoot, String consumerCredential, long throttleSleepTime, int maxRetriesCount,
            JsonParser jsonParser); @Override String getPatentMetadata(ImportedPatent patent); }
OpenPatentWebServiceFacade implements PatentServiceFacade { protected static HttpRequest buildAuthRequest(String consumerCredential, String uriRoot) { HttpPost httpRequest = new HttpPost(uriRoot); httpRequest.addHeader("Authorization", "Basic " + consumerCredential); BasicNameValuePair grantType = new BasicNameValuePair("grant_type", "client_credentials"); httpRequest.setEntity(new UrlEncodedFormEntity(Collections.singletonList(grantType), DEFAULT_CHARSET)); return httpRequest; } OpenPatentWebServiceFacade(ConnectionDetails connDetails); protected  OpenPatentWebServiceFacade(CloseableHttpClient httpClient, HttpHost authHost, String authUriRoot, HttpHost opsHost,
            String opsUriRoot, String consumerCredential, long throttleSleepTime, int maxRetriesCount,
            JsonParser jsonParser); @Override String getPatentMetadata(ImportedPatent patent);  }