@Test public void createNewAlbumTest() throws GalleryConnectionException { g2ConnectionUtils.loginToGallery(galleryUrl, user, password); Random random = new Random(); int randomInt = random.nextInt(); String albumName = "UnitTestAlbumNumber" + randomInt; String albumTitle = "Unit Test Album"; String albumDescription = "Yet another Unit Test Album !"; int newAlbumName = g2ConnectionUtils.createNewAlbum(galleryUrl, 174, albumName, albumTitle, albumDescription); assertTrue(newAlbumName != 0); }
public int createNewAlbum(String galleryUrl, int parentAlbumName, String albumName, String albumTitle, String albumDescription) throws GalleryConnectionException { int newAlbumName = 0; List<NameValuePair> nameValuePairsFetchImages = new ArrayList<NameValuePair>(); nameValuePairsFetchImages.add(CREATE_ALBUM_CMD_NAME_VALUE_PAIR); nameValuePairsFetchImages.add(new BasicNameValuePair( "g2_form[set_albumName]", "" + parentAlbumName)); nameValuePairsFetchImages.add(new BasicNameValuePair( "g2_form[newAlbumName]", albumName)); nameValuePairsFetchImages.add(new BasicNameValuePair( "g2_form[newAlbumTitle]", albumTitle)); nameValuePairsFetchImages.add(new BasicNameValuePair( "g2_form[newAlbumDesc]", albumDescription)); HashMap<String, String> properties = sendCommandToGallery(galleryUrl, nameValuePairsFetchImages, null); for (Entry<String, String> entry : properties.entrySet()) { if (entry.getKey().equals(ALBUM_NAME)) { newAlbumName = new Integer(entry.getValue()).intValue(); } } return newAlbumName; }
G2Client { public int createNewAlbum(String galleryUrl, int parentAlbumName, String albumName, String albumTitle, String albumDescription) throws GalleryConnectionException { int newAlbumName = 0; List<NameValuePair> nameValuePairsFetchImages = new ArrayList<NameValuePair>(); nameValuePairsFetchImages.add(CREATE_ALBUM_CMD_NAME_VALUE_PAIR); nameValuePairsFetchImages.add(new BasicNameValuePair( "g2_form[set_albumName]", "" + parentAlbumName)); nameValuePairsFetchImages.add(new BasicNameValuePair( "g2_form[newAlbumName]", albumName)); nameValuePairsFetchImages.add(new BasicNameValuePair( "g2_form[newAlbumTitle]", albumTitle)); nameValuePairsFetchImages.add(new BasicNameValuePair( "g2_form[newAlbumDesc]", albumDescription)); HashMap<String, String> properties = sendCommandToGallery(galleryUrl, nameValuePairsFetchImages, null); for (Entry<String, String> entry : properties.entrySet()) { if (entry.getKey().equals(ALBUM_NAME)) { newAlbumName = new Integer(entry.getValue()).intValue(); } } return newAlbumName; } }
G2Client { public int createNewAlbum(String galleryUrl, int parentAlbumName, String albumName, String albumTitle, String albumDescription) throws GalleryConnectionException { int newAlbumName = 0; List<NameValuePair> nameValuePairsFetchImages = new ArrayList<NameValuePair>(); nameValuePairsFetchImages.add(CREATE_ALBUM_CMD_NAME_VALUE_PAIR); nameValuePairsFetchImages.add(new BasicNameValuePair( "g2_form[set_albumName]", "" + parentAlbumName)); nameValuePairsFetchImages.add(new BasicNameValuePair( "g2_form[newAlbumName]", albumName)); nameValuePairsFetchImages.add(new BasicNameValuePair( "g2_form[newAlbumTitle]", albumTitle)); nameValuePairsFetchImages.add(new BasicNameValuePair( "g2_form[newAlbumDesc]", albumDescription)); HashMap<String, String> properties = sendCommandToGallery(galleryUrl, nameValuePairsFetchImages, null); for (Entry<String, String> entry : properties.entrySet()) { if (entry.getKey().equals(ALBUM_NAME)) { newAlbumName = new Integer(entry.getValue()).intValue(); } } return newAlbumName; } G2Client(String userAgent); }
G2Client { public int createNewAlbum(String galleryUrl, int parentAlbumName, String albumName, String albumTitle, String albumDescription) throws GalleryConnectionException { int newAlbumName = 0; List<NameValuePair> nameValuePairsFetchImages = new ArrayList<NameValuePair>(); nameValuePairsFetchImages.add(CREATE_ALBUM_CMD_NAME_VALUE_PAIR); nameValuePairsFetchImages.add(new BasicNameValuePair( "g2_form[set_albumName]", "" + parentAlbumName)); nameValuePairsFetchImages.add(new BasicNameValuePair( "g2_form[newAlbumName]", albumName)); nameValuePairsFetchImages.add(new BasicNameValuePair( "g2_form[newAlbumTitle]", albumTitle)); nameValuePairsFetchImages.add(new BasicNameValuePair( "g2_form[newAlbumDesc]", albumDescription)); HashMap<String, String> properties = sendCommandToGallery(galleryUrl, nameValuePairsFetchImages, null); for (Entry<String, String> entry : properties.entrySet()) { if (entry.getKey().equals(ALBUM_NAME)) { newAlbumName = new Integer(entry.getValue()).intValue(); } } return newAlbumName; } 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 int createNewAlbum(String galleryUrl, int parentAlbumName, String albumName, String albumTitle, String albumDescription) throws GalleryConnectionException { int newAlbumName = 0; List<NameValuePair> nameValuePairsFetchImages = new ArrayList<NameValuePair>(); nameValuePairsFetchImages.add(CREATE_ALBUM_CMD_NAME_VALUE_PAIR); nameValuePairsFetchImages.add(new BasicNameValuePair( "g2_form[set_albumName]", "" + parentAlbumName)); nameValuePairsFetchImages.add(new BasicNameValuePair( "g2_form[newAlbumName]", albumName)); nameValuePairsFetchImages.add(new BasicNameValuePair( "g2_form[newAlbumTitle]", albumTitle)); nameValuePairsFetchImages.add(new BasicNameValuePair( "g2_form[newAlbumDesc]", albumDescription)); HashMap<String, String> properties = sendCommandToGallery(galleryUrl, nameValuePairsFetchImages, null); for (Entry<String, String> entry : properties.entrySet()) { if (entry.getKey().equals(ALBUM_NAME)) { newAlbumName = new Integer(entry.getValue()).intValue(); } } return newAlbumName; } 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();  }