@Test public void testFindAllProducts() throws SdcException { String jsonProducts = ProductReleaseSdcDaoImplTest.jsonProducts; Response response = mock(Response.class); when(builder.get()).thenReturn(response); when(response.readEntity(String.class)).thenReturn(jsonProducts); List<String> products = productReleaseSdcDaoImpl.findAllProducts("token", "tenant"); assertNotNull(products); }
public List<String> findAllProducts(String token, String tenant) throws SdcException { Response response = null; try { String url = sDCUtil.getSdcUtil() + "/catalog/product"; log.debug("url: " + url); Invocation.Builder builder = createWebResource(url, token, tenant); builder = builder.accept(MediaType.APPLICATION_JSON); response = builder.get(); String responseJSON = response.readEntity(String.class); return fromSDCToProductNames(responseJSON); } catch (Exception e) { String message = "Error calling SDC to obtain the all product list " + e.getMessage(); ; log.error(message); throw new SdcException(message); } finally { if (response != null) { response.close(); } } }
ProductReleaseSdcDaoImpl implements ProductReleaseSdcDao { public List<String> findAllProducts(String token, String tenant) throws SdcException { Response response = null; try { String url = sDCUtil.getSdcUtil() + "/catalog/product"; log.debug("url: " + url); Invocation.Builder builder = createWebResource(url, token, tenant); builder = builder.accept(MediaType.APPLICATION_JSON); response = builder.get(); String responseJSON = response.readEntity(String.class); return fromSDCToProductNames(responseJSON); } catch (Exception e) { String message = "Error calling SDC to obtain the all product list " + e.getMessage(); ; log.error(message); throw new SdcException(message); } finally { if (response != null) { response.close(); } } } }
ProductReleaseSdcDaoImpl implements ProductReleaseSdcDao { public List<String> findAllProducts(String token, String tenant) throws SdcException { Response response = null; try { String url = sDCUtil.getSdcUtil() + "/catalog/product"; log.debug("url: " + url); Invocation.Builder builder = createWebResource(url, token, tenant); builder = builder.accept(MediaType.APPLICATION_JSON); response = builder.get(); String responseJSON = response.readEntity(String.class); return fromSDCToProductNames(responseJSON); } catch (Exception e) { String message = "Error calling SDC to obtain the all product list " + e.getMessage(); ; log.error(message); throw new SdcException(message); } finally { if (response != null) { response.close(); } } } ProductReleaseSdcDaoImpl(); }
ProductReleaseSdcDaoImpl implements ProductReleaseSdcDao { public List<String> findAllProducts(String token, String tenant) throws SdcException { Response response = null; try { String url = sDCUtil.getSdcUtil() + "/catalog/product"; log.debug("url: " + url); Invocation.Builder builder = createWebResource(url, token, tenant); builder = builder.accept(MediaType.APPLICATION_JSON); response = builder.get(); String responseJSON = response.readEntity(String.class); return fromSDCToProductNames(responseJSON); } catch (Exception e) { String message = "Error calling SDC to obtain the all product list " + e.getMessage(); ; log.error(message); throw new SdcException(message); } finally { if (response != null) { response.close(); } } } ProductReleaseSdcDaoImpl(); HttpClientConnectionManager getHttpConnectionManager(); void setHttpConnectionManager(HttpClientConnectionManager httpConnectionManager); ProductRelease load(String product, String version, ClaudiaData data); List<String> findAllProducts(String token, String tenant); List<ProductRelease> fromStringToProductReleases(String sdcproductReleases); void setClient(Client client); Client getClient(); void setSDCUtil(SDCUtil sDCUtil); void setSDCClient(SDCClient sDCClient); }
ProductReleaseSdcDaoImpl implements ProductReleaseSdcDao { public List<String> findAllProducts(String token, String tenant) throws SdcException { Response response = null; try { String url = sDCUtil.getSdcUtil() + "/catalog/product"; log.debug("url: " + url); Invocation.Builder builder = createWebResource(url, token, tenant); builder = builder.accept(MediaType.APPLICATION_JSON); response = builder.get(); String responseJSON = response.readEntity(String.class); return fromSDCToProductNames(responseJSON); } catch (Exception e) { String message = "Error calling SDC to obtain the all product list " + e.getMessage(); ; log.error(message); throw new SdcException(message); } finally { if (response != null) { response.close(); } } } ProductReleaseSdcDaoImpl(); HttpClientConnectionManager getHttpConnectionManager(); void setHttpConnectionManager(HttpClientConnectionManager httpConnectionManager); ProductRelease load(String product, String version, ClaudiaData data); List<String> findAllProducts(String token, String tenant); List<ProductRelease> fromStringToProductReleases(String sdcproductReleases); void setClient(Client client); Client getClient(); void setSDCUtil(SDCUtil sDCUtil); void setSDCClient(SDCClient sDCClient);  }