@Test @Ignore public void sendImageToGalleryTest() throws GalleryConnectionException { g2ConnectionUtils.loginToGallery(galleryUrl, user, password); File imageFile = new File("image.png"); int newItemId = g2ConnectionUtils.sendImageToGallery(galleryUrl, 174, imageFile, "plouf", "Summary from test", "Description from test"); assertTrue(newItemId != 0); }
public int sendImageToGallery(String galleryUrl, int albumName, File imageFile, String imageName, String summary, String description) throws GalleryConnectionException { int imageCreatedName = 0; MultipartEntity multiPartEntity = createMultiPartEntityForSendImageToGallery( albumName, imageFile, imageName, summary, description); HashMap<String, String> properties = sendCommandToGallery(galleryUrl, null, multiPartEntity); for (Entry<String, String> entry : properties.entrySet()) { if (entry.getKey().equals(ITEM_NAME)) { imageCreatedName = new Integer(entry.getValue()).intValue(); break; } if (entry.getValue().contains(FAILED)) { throw new GalleryConnectionException(UPLOAD_FAILED); } } return imageCreatedName; }
G2Client { public int sendImageToGallery(String galleryUrl, int albumName, File imageFile, String imageName, String summary, String description) throws GalleryConnectionException { int imageCreatedName = 0; MultipartEntity multiPartEntity = createMultiPartEntityForSendImageToGallery( albumName, imageFile, imageName, summary, description); HashMap<String, String> properties = sendCommandToGallery(galleryUrl, null, multiPartEntity); for (Entry<String, String> entry : properties.entrySet()) { if (entry.getKey().equals(ITEM_NAME)) { imageCreatedName = new Integer(entry.getValue()).intValue(); break; } if (entry.getValue().contains(FAILED)) { throw new GalleryConnectionException(UPLOAD_FAILED); } } return imageCreatedName; } }
G2Client { public int sendImageToGallery(String galleryUrl, int albumName, File imageFile, String imageName, String summary, String description) throws GalleryConnectionException { int imageCreatedName = 0; MultipartEntity multiPartEntity = createMultiPartEntityForSendImageToGallery( albumName, imageFile, imageName, summary, description); HashMap<String, String> properties = sendCommandToGallery(galleryUrl, null, multiPartEntity); for (Entry<String, String> entry : properties.entrySet()) { if (entry.getKey().equals(ITEM_NAME)) { imageCreatedName = new Integer(entry.getValue()).intValue(); break; } if (entry.getValue().contains(FAILED)) { throw new GalleryConnectionException(UPLOAD_FAILED); } } return imageCreatedName; } G2Client(String userAgent); }
G2Client { public int sendImageToGallery(String galleryUrl, int albumName, File imageFile, String imageName, String summary, String description) throws GalleryConnectionException { int imageCreatedName = 0; MultipartEntity multiPartEntity = createMultiPartEntityForSendImageToGallery( albumName, imageFile, imageName, summary, description); HashMap<String, String> properties = sendCommandToGallery(galleryUrl, null, multiPartEntity); for (Entry<String, String> entry : properties.entrySet()) { if (entry.getKey().equals(ITEM_NAME)) { imageCreatedName = new Integer(entry.getValue()).intValue(); break; } if (entry.getValue().contains(FAILED)) { throw new GalleryConnectionException(UPLOAD_FAILED); } } return imageCreatedName; } 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 sendImageToGallery(String galleryUrl, int albumName, File imageFile, String imageName, String summary, String description) throws GalleryConnectionException { int imageCreatedName = 0; MultipartEntity multiPartEntity = createMultiPartEntityForSendImageToGallery( albumName, imageFile, imageName, summary, description); HashMap<String, String> properties = sendCommandToGallery(galleryUrl, null, multiPartEntity); for (Entry<String, String> entry : properties.entrySet()) { if (entry.getKey().equals(ITEM_NAME)) { imageCreatedName = new Integer(entry.getValue()).intValue(); break; } if (entry.getValue().contains(FAILED)) { throw new GalleryConnectionException(UPLOAD_FAILED); } } return imageCreatedName; } 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();  }