photoSetList = photosetsInterface.getList( auth.getUser().getId(), PHOTO_SETS_PER_PAGE, page, PHOTOSET_EXTRAS); } catch (FlickrException e) { return new ExportResult<>(e);
when(user.getId()).thenReturn("userId"); when(authInterface.checkToken(any(Token.class))).thenReturn(auth);
@Test public void exportAlbumInitial() throws FlickrException { when(user.getId()).thenReturn("userId"); when(authInterface.checkToken(any(Token.class))).thenReturn(auth); when(flickr.getPhotosetsInterface()).thenReturn(photosetsInterface);
@Test public void exportPhotosFromPhotoset() throws FlickrException { when(user.getId()).thenReturn("userId"); when(authInterface.checkToken(any(Token.class))).thenReturn(auth); when(flickr.getPhotosetsInterface()).thenReturn(photosetsInterface);
public void store(Auth token) throws IOException { this.auths.put(token.getUser().getId(), token); this.authsByUser.put(token.getUser().getUsername(), token); String filename = token.getUser().getId() + ".auth"; File outFile = new File(this.authStoreDir, filename); outFile.createNewFile(); ObjectOutputStream authStream = new ObjectOutputStream(new FileOutputStream(outFile)); authStream.writeObject(token); authStream.flush(); authStream.close(); }
public void store(Auth token) throws IOException { this.auths.put(token.getUser().getId(), token); this.authsByUser.put(token.getUser().getUsername(), token); String filename = token.getUser().getId() + ".auth"; File outFile = new File(this.authStoreDir, filename); outFile.createNewFile(); ObjectOutputStream authStream = new ObjectOutputStream(new FileOutputStream(outFile)); authStream.writeObject(token); authStream.flush(); authStream.close(); }
public String getUrl() { if (url == null) { StringBuffer sb = new StringBuffer(); sb.append("https://www.flickr.com/photos/"); sb.append(getOwner().getId()); sb.append("/sets/"); sb.append(getId()); sb.append("/"); return sb.toString(); } else { return url; } }
public String getUrl() { if (url == null) { StringBuffer sb = new StringBuffer(); sb.append("https://www.flickr.com/photos/"); sb.append(getOwner().getId()); sb.append("/sets/"); sb.append(getId()); sb.append("/"); return sb.toString(); } else { return url; } }
private void load() throws FlickrException { try { File[] authFiles = authStoreDir.listFiles(new AuthFilenameFilter()); for (int i = 0; i < authFiles.length; i++) { if (authFiles[i].isFile() && authFiles[i].canRead()) { ObjectInputStream authStream = new ObjectInputStream(new FileInputStream(authFiles[i])); Auth authInst = null; try { authInst = (Auth) authStream.readObject(); } catch (ClassCastException cce) { // ignore. Its not an auth, so we won't store it. simple as that :-); } catch (ClassNotFoundException e) { // yep, ignoring. LALALALALLALAL. I can't hear you :-) } if (authInst != null) { this.auths.put(authInst.getUser().getId(), authInst); // Also store by user-name since it is generally easier to remember. this.authsByUser.put(authInst.getUser().getUsername(), authInst); } authStream.close(); } } } catch (IOException e) { throw new FlickrException(e.getMessage(), e); } }
private void load() throws FlickrException { try { File[] authFiles = authStoreDir.listFiles(new AuthFilenameFilter()); for (int i = 0; i < authFiles.length; i++) { if (authFiles[i].isFile() && authFiles[i].canRead()) { ObjectInputStream authStream = new ObjectInputStream(new FileInputStream(authFiles[i])); Auth authInst = null; try { authInst = (Auth) authStream.readObject(); } catch (ClassCastException cce) { // ignore. Its not an auth, so we won't store it. simple as that :-); } catch (ClassNotFoundException e) { // yep, ignoring. LALALALALLALAL. I can't hear you :-) } if (authInst != null) { this.auths.put(authInst.getUser().getId(), authInst); // Also store by user-name since it is generally easier to remember. this.authsByUser.put(authInst.getUser().getUsername(), authInst); } authStream.close(); } } } catch (IOException e) { throw new FlickrException(e.getMessage(), e); } }
public static void main(String[] args) throws Exception { FileAuthStore fas = new FileAuthStore(new File(System.getProperty("user.home") + File.separatorChar + "flickrauth")); Auth a = new Auth(); User u = new User(); u.setId("THISISMYNSID"); a.setUser(u); fas.store(a); fas = null; fas = new FileAuthStore(new File(System.getProperty("user.home") + File.separatorChar + "flickrauth")); Auth a2 = fas.retrieve("THISISMYNSID"); System.out.println(a2.getUser().getId()); } }
public static void main(String[] args) throws Exception { FileAuthStore fas = new FileAuthStore(new File(System.getProperty("user.home") + File.separatorChar + "flickrauth")); Auth a = new Auth(); User u = new User(); u.setId("THISISMYNSID"); a.setUser(u); fas.store(a); fas = null; fas = new FileAuthStore(new File(System.getProperty("user.home") + File.separatorChar + "flickrauth")); Auth a2 = fas.retrieve("THISISMYNSID"); System.out.println(a2.getUser().getId()); } }
owner.setId(photoElement.getAttribute("owner")); photo.setOwner(owner); photo.setUrl("https://flickr.com/photos/" + owner.getId() + "/" + photo.getId()); photo.setServer(photoElement.getAttribute("server")); photo.setFarm(photoElement.getAttribute("farm"));
owner.setId(photoElement.getAttribute("owner")); photo.setOwner(owner); photo.setUrl("https://flickr.com/photos/" + owner.getId() + "/" + photo.getId()); photo.setServer(photoElement.getAttribute("server")); photo.setFarm(photoElement.getAttribute("farm"));
owner.setId(photoElement.getAttribute("owner")); photo.setOwner(owner); photo.setUrl("https://flickr.com/photos/" + owner.getId() + "/" + photo.getId()); photo.setServer(photoElement.getAttribute("server")); photo.setTitle(photoElement.getAttribute("title"));
owner.setId(photoElement.getAttribute("owner")); photo.setOwner(owner); photo.setUrl("https://flickr.com/photos/" + owner.getId() + "/" + photo.getId()); photo.setServer(photoElement.getAttribute("server")); photo.setFarm(photoElement.getAttribute("farm"));
owner.setId(photoElement.getAttribute("owner")); photo.setOwner(owner); photo.setUrl("https://flickr.com/photos/" + owner.getId() + "/" + photo.getId()); photo.setServer(photoElement.getAttribute("server")); photo.setTitle(photoElement.getAttribute("title"));
owner.setId(photoElement.getAttribute("owner")); photo.setOwner(owner); photo.setUrl("https://flickr.com/photos/" + owner.getId() + "/" + photo.getId()); photo.setServer(photoElement.getAttribute("server")); photo.setFarm(photoElement.getAttribute("farm"));
owner.setUsername(getAttribute("ownername", photoElement, defaultElement)); photo.setOwner(owner); photo.setUrl("https://flickr.com/photos/" + owner.getId() + "/" + photo.getId()); } else { User owner = new User(); owner.setLocation(ownerElement.getAttribute("location")); photo.setOwner(owner); photo.setUrl("https://flickr.com/photos/" + owner.getId() + "/" + photo.getId()); owner.setUsername(photoElement.getAttribute("ownername")); photo.setOwner(owner); photo.setUrl("https://flickr.com/photos/" + owner.getId() + "/" + photo.getId());
owner.setUsername(getAttribute("ownername", photoElement, defaultElement)); photo.setOwner(owner); photo.setUrl("https://flickr.com/photos/" + owner.getId() + "/" + photo.getId()); } else { User owner = new User(); owner.setLocation(ownerElement.getAttribute("location")); photo.setOwner(owner); photo.setUrl("https://flickr.com/photos/" + owner.getId() + "/" + photo.getId()); owner.setUsername(photoElement.getAttribute("ownername")); photo.setOwner(owner); photo.setUrl("https://flickr.com/photos/" + owner.getId() + "/" + photo.getId());