@Test public void testUpdateApp() throws RemoteApiException, AppRepositoryClientException { Map<String, String> headers = getRequiredHeaders(); String path = APP_REPOSITORY_APPS + "/" + MOCK_APP_ID; AppStoreWrapper wrapper = new AppStoreWrapper(); wrapper.setId(MOCK_APP_ID); repository.updateApp(wrapper, DEFAULT_USER_ID); verify(client, times(1)).doPost(eq(path), eq(headers), eq(Collections.<String, String>emptyMap()), any(Envelope.class), eq(Envelope.class)); }
public void updateApp(AppStoreWrapper appStoreApp, String userId) throws AppRepositoryClientException { Map<String, String> headers = null; String id = null; if (appStoreApp.getId() != null) { headers = getRequiredHeaders(userId); id = appStoreApp.getId(); } else { headers = getRequiredHeader(userId); id = appStoreApp.getAppGroupId(); } String path = String.format(APP_REPOSITORY_APP_UPDATE, id); Envelope<AppStoreWrapper> envelope = new Envelope<>(appStoreApp); try { client.doPost(path, headers, Collections.<String, String>emptyMap(), envelope, Envelope.class); } catch (RemoteApiException e) { throw new AppRepositoryClientException( "Failed to update the application " + id + " due to an error calling the server: " + e.getCode() + " " + e.getMessage()); } }
AppRepositoryClient { public void updateApp(AppStoreWrapper appStoreApp, String userId) throws AppRepositoryClientException { Map<String, String> headers = null; String id = null; if (appStoreApp.getId() != null) { headers = getRequiredHeaders(userId); id = appStoreApp.getId(); } else { headers = getRequiredHeader(userId); id = appStoreApp.getAppGroupId(); } String path = String.format(APP_REPOSITORY_APP_UPDATE, id); Envelope<AppStoreWrapper> envelope = new Envelope<>(appStoreApp); try { client.doPost(path, headers, Collections.<String, String>emptyMap(), envelope, Envelope.class); } catch (RemoteApiException e) { throw new AppRepositoryClientException( "Failed to update the application " + id + " due to an error calling the server: " + e.getCode() + " " + e.getMessage()); } } }
AppRepositoryClient { public void updateApp(AppStoreWrapper appStoreApp, String userId) throws AppRepositoryClientException { Map<String, String> headers = null; String id = null; if (appStoreApp.getId() != null) { headers = getRequiredHeaders(userId); id = appStoreApp.getId(); } else { headers = getRequiredHeader(userId); id = appStoreApp.getAppGroupId(); } String path = String.format(APP_REPOSITORY_APP_UPDATE, id); Envelope<AppStoreWrapper> envelope = new Envelope<>(appStoreApp); try { client.doPost(path, headers, Collections.<String, String>emptyMap(), envelope, Envelope.class); } catch (RemoteApiException e) { throw new AppRepositoryClientException( "Failed to update the application " + id + " due to an error calling the server: " + e.getCode() + " " + e.getMessage()); } }  }
AppRepositoryClient { public void updateApp(AppStoreWrapper appStoreApp, String userId) throws AppRepositoryClientException { Map<String, String> headers = null; String id = null; if (appStoreApp.getId() != null) { headers = getRequiredHeaders(userId); id = appStoreApp.getId(); } else { headers = getRequiredHeader(userId); id = appStoreApp.getAppGroupId(); } String path = String.format(APP_REPOSITORY_APP_UPDATE, id); Envelope<AppStoreWrapper> envelope = new Envelope<>(appStoreApp); try { client.doPost(path, headers, Collections.<String, String>emptyMap(), envelope, Envelope.class); } catch (RemoteApiException e) { throw new AppRepositoryClientException( "Failed to update the application " + id + " due to an error calling the server: " + e.getCode() + " " + e.getMessage()); } }  List getAppsAvailable(String userId); Map<String, Object> getAppByAppGroupId(String appGroupId, String userId); void createNewApp(AppStoreWrapper appStoreApp, String userId); void updateApp(AppStoreWrapper appStoreApp, String userId); }
AppRepositoryClient { public void updateApp(AppStoreWrapper appStoreApp, String userId) throws AppRepositoryClientException { Map<String, String> headers = null; String id = null; if (appStoreApp.getId() != null) { headers = getRequiredHeaders(userId); id = appStoreApp.getId(); } else { headers = getRequiredHeader(userId); id = appStoreApp.getAppGroupId(); } String path = String.format(APP_REPOSITORY_APP_UPDATE, id); Envelope<AppStoreWrapper> envelope = new Envelope<>(appStoreApp); try { client.doPost(path, headers, Collections.<String, String>emptyMap(), envelope, Envelope.class); } catch (RemoteApiException e) { throw new AppRepositoryClientException( "Failed to update the application " + id + " due to an error calling the server: " + e.getCode() + " " + e.getMessage()); } }  List getAppsAvailable(String userId); Map<String, Object> getAppByAppGroupId(String appGroupId, String userId); void createNewApp(AppStoreWrapper appStoreApp, String userId); void updateApp(AppStoreWrapper appStoreApp, String userId);  }