@Test(expected=ImpossibleToLoginException.class) public void loginToGalleryTest__galleryDoesNotAnswerWithProperties__issue24() throws GalleryConnectionException { g2ConnectionUtils.loginToGallery("http: "g2android", "g2android"); }
public void loginToGallery(String galleryUrl, String user, String password) throws ImpossibleToLoginException { sessionCookies.clear(); sessionCookies.add(new BasicClientCookie("", "")); List<NameValuePair> sb = new ArrayList<NameValuePair>(); sb.add(LOGIN_CMD_NAME_VALUE_PAIR); sb.add(new BasicNameValuePair("g2_form[uname]", "" + user)); sb.add(new BasicNameValuePair("g2_form[password]", "" + password)); HashMap<String, String> properties; try { properties = sendCommandToGallery(galleryUrl, sb, null); } catch (GalleryConnectionException e) { throw new ImpossibleToLoginException(e); } authToken = null; if (properties.get("status") != null) { if (properties.get("status").equals(GR_STAT_SUCCESS)) { authToken = properties.get("auth_token"); } else { throw new ImpossibleToLoginException( properties.get("status_text")); } } if(properties.isEmpty()){ throw new ImpossibleToLoginException("The Gallery did not return login properties; check your gallery installation and/or your settings" ); } }
G2Client { public void loginToGallery(String galleryUrl, String user, String password) throws ImpossibleToLoginException { sessionCookies.clear(); sessionCookies.add(new BasicClientCookie("", "")); List<NameValuePair> sb = new ArrayList<NameValuePair>(); sb.add(LOGIN_CMD_NAME_VALUE_PAIR); sb.add(new BasicNameValuePair("g2_form[uname]", "" + user)); sb.add(new BasicNameValuePair("g2_form[password]", "" + password)); HashMap<String, String> properties; try { properties = sendCommandToGallery(galleryUrl, sb, null); } catch (GalleryConnectionException e) { throw new ImpossibleToLoginException(e); } authToken = null; if (properties.get("status") != null) { if (properties.get("status").equals(GR_STAT_SUCCESS)) { authToken = properties.get("auth_token"); } else { throw new ImpossibleToLoginException( properties.get("status_text")); } } if(properties.isEmpty()){ throw new ImpossibleToLoginException("The Gallery did not return login properties; check your gallery installation and/or your settings" ); } } }
G2Client { public void loginToGallery(String galleryUrl, String user, String password) throws ImpossibleToLoginException { sessionCookies.clear(); sessionCookies.add(new BasicClientCookie("", "")); List<NameValuePair> sb = new ArrayList<NameValuePair>(); sb.add(LOGIN_CMD_NAME_VALUE_PAIR); sb.add(new BasicNameValuePair("g2_form[uname]", "" + user)); sb.add(new BasicNameValuePair("g2_form[password]", "" + password)); HashMap<String, String> properties; try { properties = sendCommandToGallery(galleryUrl, sb, null); } catch (GalleryConnectionException e) { throw new ImpossibleToLoginException(e); } authToken = null; if (properties.get("status") != null) { if (properties.get("status").equals(GR_STAT_SUCCESS)) { authToken = properties.get("auth_token"); } else { throw new ImpossibleToLoginException( properties.get("status_text")); } } if(properties.isEmpty()){ throw new ImpossibleToLoginException("The Gallery did not return login properties; check your gallery installation and/or your settings" ); } } G2Client(String userAgent); }
G2Client { public void loginToGallery(String galleryUrl, String user, String password) throws ImpossibleToLoginException { sessionCookies.clear(); sessionCookies.add(new BasicClientCookie("", "")); List<NameValuePair> sb = new ArrayList<NameValuePair>(); sb.add(LOGIN_CMD_NAME_VALUE_PAIR); sb.add(new BasicNameValuePair("g2_form[uname]", "" + user)); sb.add(new BasicNameValuePair("g2_form[password]", "" + password)); HashMap<String, String> properties; try { properties = sendCommandToGallery(galleryUrl, sb, null); } catch (GalleryConnectionException e) { throw new ImpossibleToLoginException(e); } authToken = null; if (properties.get("status") != null) { if (properties.get("status").equals(GR_STAT_SUCCESS)) { authToken = properties.get("auth_token"); } else { throw new ImpossibleToLoginException( properties.get("status_text")); } } if(properties.isEmpty()){ throw new ImpossibleToLoginException("The Gallery did not return login properties; check your gallery installation and/or your settings" ); } } G2Client(String userAgent); HashMap<String, String> fetchImages(String galleryUrl, int albumName); HashMap<String, String> fetchAlbums(String galleryUrl); void loginToGallery(String galleryUrl, String user, String password); InputStream getInputStreamFromUrl(String url); int createNewAlbum(String galleryUrl, int parentAlbumName,
			String albumName, String albumTitle, String albumDescription); int sendImageToGallery(String galleryUrl, int albumName,
			File imageFile, String imageName, String summary, String description); String getAuthToken(); void setAuthToken(String authToken); List<Cookie> getSessionCookies(); Collection<G2Picture> extractG2PicturesFromProperties(
			HashMap<String, String> fetchImages); Map<Integer, Album> getAllAlbums(String galleryUrl); Map<Integer, G2Album> extractAlbumFromProperties(
			HashMap<String, String> albumsProperties); Album organizeAlbumsHierarchy(Map<Integer, G2Album> albums); void setRootAlbum(G2Album rootAlbum); G2Album getRootAlbum(); }
G2Client { public void loginToGallery(String galleryUrl, String user, String password) throws ImpossibleToLoginException { sessionCookies.clear(); sessionCookies.add(new BasicClientCookie("", "")); List<NameValuePair> sb = new ArrayList<NameValuePair>(); sb.add(LOGIN_CMD_NAME_VALUE_PAIR); sb.add(new BasicNameValuePair("g2_form[uname]", "" + user)); sb.add(new BasicNameValuePair("g2_form[password]", "" + password)); HashMap<String, String> properties; try { properties = sendCommandToGallery(galleryUrl, sb, null); } catch (GalleryConnectionException e) { throw new ImpossibleToLoginException(e); } authToken = null; if (properties.get("status") != null) { if (properties.get("status").equals(GR_STAT_SUCCESS)) { authToken = properties.get("auth_token"); } else { throw new ImpossibleToLoginException( properties.get("status_text")); } } if(properties.isEmpty()){ throw new ImpossibleToLoginException("The Gallery did not return login properties; check your gallery installation and/or your settings" ); } } G2Client(String userAgent); HashMap<String, String> fetchImages(String galleryUrl, int albumName); HashMap<String, String> fetchAlbums(String galleryUrl); void loginToGallery(String galleryUrl, String user, String password); InputStream getInputStreamFromUrl(String url); int createNewAlbum(String galleryUrl, int parentAlbumName,
			String albumName, String albumTitle, String albumDescription); int sendImageToGallery(String galleryUrl, int albumName,
			File imageFile, String imageName, String summary, String description); String getAuthToken(); void setAuthToken(String authToken); List<Cookie> getSessionCookies(); Collection<G2Picture> extractG2PicturesFromProperties(
			HashMap<String, String> fetchImages); Map<Integer, Album> getAllAlbums(String galleryUrl); Map<Integer, G2Album> extractAlbumFromProperties(
			HashMap<String, String> albumsProperties); Album organizeAlbumsHierarchy(Map<Integer, G2Album> albums); void setRootAlbum(G2Album rootAlbum); G2Album getRootAlbum();  }