Added getMovieChanges method

master
Stuart Boston 13 years ago
parent 608c0a9b05
commit 46cd35f908

@ -19,8 +19,6 @@
*/ */
package com.omertron.themoviedbapi; package com.omertron.themoviedbapi;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.omertron.themoviedbapi.MovieDbException.MovieDbExceptionType; import com.omertron.themoviedbapi.MovieDbException.MovieDbExceptionType;
import com.omertron.themoviedbapi.model.AlternativeTitle; import com.omertron.themoviedbapi.model.AlternativeTitle;
@ -30,6 +28,7 @@ import com.omertron.themoviedbapi.model.CollectionInfo;
import com.omertron.themoviedbapi.model.Company; import com.omertron.themoviedbapi.model.Company;
import com.omertron.themoviedbapi.model.Genre; import com.omertron.themoviedbapi.model.Genre;
import com.omertron.themoviedbapi.model.Keyword; import com.omertron.themoviedbapi.model.Keyword;
import com.omertron.themoviedbapi.model.MovieChanges;
import com.omertron.themoviedbapi.model.MovieDb; import com.omertron.themoviedbapi.model.MovieDb;
import com.omertron.themoviedbapi.model.MovieList; import com.omertron.themoviedbapi.model.MovieList;
import com.omertron.themoviedbapi.model.Person; import com.omertron.themoviedbapi.model.Person;
@ -48,6 +47,7 @@ import static com.omertron.themoviedbapi.tools.ApiUrl.*;
import com.omertron.themoviedbapi.tools.FilteringLayout; import com.omertron.themoviedbapi.tools.FilteringLayout;
import com.omertron.themoviedbapi.tools.WebBrowser; import com.omertron.themoviedbapi.tools.WebBrowser;
import com.omertron.themoviedbapi.wrapper.WrapperAlternativeTitles; import com.omertron.themoviedbapi.wrapper.WrapperAlternativeTitles;
import com.omertron.themoviedbapi.wrapper.WrapperChanges;
import com.omertron.themoviedbapi.wrapper.WrapperCompany; import com.omertron.themoviedbapi.wrapper.WrapperCompany;
import com.omertron.themoviedbapi.wrapper.WrapperCompanyMovies; import com.omertron.themoviedbapi.wrapper.WrapperCompanyMovies;
import com.omertron.themoviedbapi.wrapper.WrapperConfig; import com.omertron.themoviedbapi.wrapper.WrapperConfig;
@ -67,7 +67,6 @@ import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.logging.Level;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -700,7 +699,15 @@ public class TheMovieDbApi {
} }
} }
//lists /**
* Get the lists that the movie belongs to
*
* @param movieId
* @param language
* @param page
* @return
* @throws MovieDbException
*/
public List<MovieList> getMovieLists(int movieId, String language, int page) throws MovieDbException { public List<MovieList> getMovieLists(int movieId, String language, int page) throws MovieDbException {
ApiUrl apiUrl = new ApiUrl(this, BASE_MOVIE, "/lists"); ApiUrl apiUrl = new ApiUrl(this, BASE_MOVIE, "/lists");
apiUrl.addArgument(PARAM_ID, movieId); apiUrl.addArgument(PARAM_ID, movieId);
@ -725,8 +732,50 @@ public class TheMovieDbApi {
} }
} }
//changes /**
public void getMovieChanges() throws MovieDbException { * Get the changes for a specific movie id.
*
* Changes are grouped by key, and ordered by date in descending order.
*
* By default, only the last 24 hours of changes are returned.
*
* The maximum number of days that can be returned in a single request is
* 14.
*
* The language is present on fields that are translatable.
*
* TODO: DOES NOT WORK AT THE MOMENT. This is due to the "value" item
* changing type in the ChangeItem
*
* @param movieId
* @param startDate the start date of the changes, optional
* @param endDate the end date of the changes, optional
* @throws MovieDbException
*/
@Deprecated
public List<MovieChanges> getMovieChanges(int movieId, String startDate, String endDate) throws MovieDbException {
ApiUrl apiUrl = new ApiUrl(this, BASE_MOVIE, "/changes");
apiUrl.addArgument(PARAM_ID, movieId);
if (StringUtils.isNotBlank(startDate)) {
apiUrl.addArgument("start_date", startDate);
}
if (StringUtils.isNotBlank(endDate)) {
apiUrl.addArgument("end_date", endDate);
}
URL url = apiUrl.buildUrl();
String webpage = WebBrowser.request(url);
try {
WrapperChanges wrapper = mapper.readValue(webpage, WrapperChanges.class);
return wrapper.getChanges();
} catch (IOException ex) {
logger.warn("Failed to get movie changes: " + ex.getMessage());
throw new MovieDbException(MovieDbExceptionType.MAPPING_FAILED, webpage, ex);
}
} }
/** /**

@ -54,6 +54,8 @@ public class Artwork implements Serializable {
private float voteAverage; private float voteAverage;
@JsonProperty("vote_count") @JsonProperty("vote_count")
private int voteCount; private int voteCount;
@JsonProperty("flag")
private String flag;
private ArtworkType artworkType = ArtworkType.POSTER; private ArtworkType artworkType = ArtworkType.POSTER;
// <editor-fold defaultstate="collapsed" desc="Getter methods"> // <editor-fold defaultstate="collapsed" desc="Getter methods">
@ -88,6 +90,11 @@ public class Artwork implements Serializable {
public int getVoteCount() { public int getVoteCount() {
return voteCount; return voteCount;
} }
public String getFlag() {
return flag;
}
// </editor-fold> // </editor-fold>
// <editor-fold defaultstate="collapsed" desc="Setter methods"> // <editor-fold defaultstate="collapsed" desc="Setter methods">
@ -122,6 +129,11 @@ public class Artwork implements Serializable {
public void setVoteCount(int voteCount) { public void setVoteCount(int voteCount) {
this.voteCount = voteCount; this.voteCount = voteCount;
} }
public void setFlag(String flag) {
this.flag = flag;
}
// </editor-fold> // </editor-fold>
/** /**

@ -0,0 +1,121 @@
/*
* Copyright (c) 2004-2012 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.log4j.Logger;
public class ChangeItem {
private static final long serialVersionUID = 1L;
/*
* Logger
*/
private static final Logger logger = Logger.getLogger(MovieChanges.class);
/*
* Properties
*/
@JsonProperty("id")
private String id;
@JsonProperty("action")
private String action;
@JsonProperty("time")
private String time;
@JsonProperty("value")
private ChangeValue value;
@JsonProperty("original_value")
private ChangeValue originalValue;
@JsonProperty("iso_639_1")
private String language;
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
public String getId() {
return id;
}
public String getAction() {
return action;
}
public String getTime() {
return time;
}
public ChangeValue getValue() {
return value;
}
public ChangeValue getOriginalValue() {
return originalValue;
}
public String getLanguage() {
return language;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
public void setId(String id) {
this.id = id;
}
public void setAction(String action) {
this.action = action;
}
public void setTime(String time) {
this.time = time;
}
public void setValue(ChangeValue value) {
this.value = value;
}
public void setOriginalValue(ChangeValue originalValue) {
this.originalValue = originalValue;
}
public void setLanguage(String language) {
this.language = language;
}
//</editor-fold>
@Override
public String toString() {
return "ChangeItem{" + "id=" + id + ", action=" + action + ", time=" + time + ", value=" + value + '}';
}
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString());
}
}

@ -0,0 +1,127 @@
/*
* Copyright (c) 2004-2012 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.log4j.Logger;
public class ChangeValue {
private static final long serialVersionUID = 1L;
/*
* Logger
*/
private static final Logger logger = Logger.getLogger(MovieChanges.class);
/*
* Properties
*/
@JsonProperty("poster")
private Artwork poster;
@JsonProperty("backdrop")
private Artwork backdrop;
@JsonProperty("title")
private String title;
@JsonProperty("iso_3166_1")
private String language;
@JsonProperty("site")
private String site;
@JsonProperty("name")
private String name;
@JsonProperty("id")
private int id;
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
public Artwork getPoster() {
return poster;
}
public Artwork getBackdrop() {
return backdrop;
}
public String getTitle() {
return title;
}
public String getLanguage() {
return language;
}
public String getSite() {
return site;
}
public String getName() {
return name;
}
public int getId() {
return id;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
public void setPoster(Artwork poster) {
this.poster = poster;
}
public void setBackdrop(Artwork backdrop) {
this.backdrop = backdrop;
backdrop.setArtworkType(ArtworkType.BACKDROP);
}
public void setTitle(String title) {
this.title = title;
}
public void setLanguage(String language) {
this.language = language;
}
public void setSite(String site) {
this.site = site;
}
public void setName(String name) {
this.name = name;
}
public void setId(int id) {
this.id = id;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString());
}
}

@ -0,0 +1,81 @@
/*
* Copyright (c) 2004-2012 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import java.util.List;
import org.apache.log4j.Logger;
/**
*
* @author Stuart
*/
public class MovieChanges implements Serializable {
private static final long serialVersionUID = 1L;
/*
* Logger
*/
private static final Logger logger = Logger.getLogger(MovieChanges.class);
/*
* Properties
*/
@JsonProperty("key")
private String key;
@JsonProperty("items")
private List<ChangeItem> items;
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
public String getKey() {
return key;
}
public List<ChangeItem> getItems() {
return items;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
public void setKey(String key) {
this.key = key;
}
public void setItems(List<ChangeItem> items) {
this.items = items;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString());
}
}

@ -0,0 +1,69 @@
/*
* Copyright (c) 2004-2012 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.wrapper;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.MovieChanges;
import java.util.List;
import org.apache.log4j.Logger;
/**
*
* @author stuart.boston
*/
public class WrapperChanges {
/*
* Logger
*/
private static final Logger logger = Logger.getLogger(WrapperChanges.class);
/*
* Properties
*/
@JsonProperty("changes")
private List<MovieChanges> changes;
//<editor-fold defaultstate="collapsed" desc="Getter methods">
public List<MovieChanges> getChanges() {
return changes;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setChanges(List<MovieChanges> changes) {
this.changes = changes;
}
//</editor-fold>
/**
* Handle unknown properties and print a message
*
* @param key
* @param value
*/
@JsonAnySetter
public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'");
logger.trace(sb.toString());
}
}

@ -25,6 +25,7 @@ import com.omertron.themoviedbapi.model.CollectionInfo;
import com.omertron.themoviedbapi.model.Company; import com.omertron.themoviedbapi.model.Company;
import com.omertron.themoviedbapi.model.Genre; import com.omertron.themoviedbapi.model.Genre;
import com.omertron.themoviedbapi.model.Keyword; import com.omertron.themoviedbapi.model.Keyword;
import com.omertron.themoviedbapi.model.MovieChanges;
import com.omertron.themoviedbapi.model.MovieDb; import com.omertron.themoviedbapi.model.MovieDb;
import com.omertron.themoviedbapi.model.MovieList; import com.omertron.themoviedbapi.model.MovieList;
import com.omertron.themoviedbapi.model.Person; import com.omertron.themoviedbapi.model.Person;
@ -37,6 +38,7 @@ import com.omertron.themoviedbapi.model.Trailer;
import com.omertron.themoviedbapi.model.Translation; import com.omertron.themoviedbapi.model.Translation;
import com.omertron.themoviedbapi.tools.FilteringLayout; import com.omertron.themoviedbapi.tools.FilteringLayout;
import java.io.IOException; import java.io.IOException;
import java.util.Collections;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Level; import org.apache.log4j.Level;
@ -91,7 +93,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getConfiguration method, of class TheMovieDbApi. * Test of getConfiguration method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testConfiguration() throws IOException { public void testConfiguration() throws IOException {
logger.info("Test Configuration"); logger.info("Test Configuration");
@ -107,7 +109,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of searchMovie method, of class TheMovieDbApi. * Test of searchMovie method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testSearchMovie() throws MovieDbException { public void testSearchMovie() throws MovieDbException {
logger.info("searchMovie"); logger.info("searchMovie");
@ -128,7 +130,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getMovieInfo method, of class TheMovieDbApi. * Test of getMovieInfo method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetMovieInfo() throws MovieDbException { public void testGetMovieInfo() throws MovieDbException {
logger.info("getMovieInfo"); logger.info("getMovieInfo");
String language = "en"; String language = "en";
@ -139,7 +141,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getMovieAlternativeTitles method, of class TheMovieDbApi. * Test of getMovieAlternativeTitles method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetMovieAlternativeTitles() throws MovieDbException { public void testGetMovieAlternativeTitles() throws MovieDbException {
logger.info("getMovieAlternativeTitles"); logger.info("getMovieAlternativeTitles");
String country = ""; String country = "";
@ -155,7 +157,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getMovieCasts method, of class TheMovieDbApi. * Test of getMovieCasts method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetMovieCasts() throws MovieDbException { public void testGetMovieCasts() throws MovieDbException {
logger.info("getMovieCasts"); logger.info("getMovieCasts");
List<Person> people = tmdb.getMovieCasts(ID_MOVIE_BLADE_RUNNER); List<Person> people = tmdb.getMovieCasts(ID_MOVIE_BLADE_RUNNER);
@ -182,7 +184,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getMovieImages method, of class TheMovieDbApi. * Test of getMovieImages method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetMovieImages() throws MovieDbException { public void testGetMovieImages() throws MovieDbException {
logger.info("getMovieImages"); logger.info("getMovieImages");
String language = ""; String language = "";
@ -193,7 +195,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getMovieKeywords method, of class TheMovieDbApi. * Test of getMovieKeywords method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetMovieKeywords() throws MovieDbException { public void testGetMovieKeywords() throws MovieDbException {
logger.info("getMovieKeywords"); logger.info("getMovieKeywords");
List<Keyword> result = tmdb.getMovieKeywords(ID_MOVIE_BLADE_RUNNER); List<Keyword> result = tmdb.getMovieKeywords(ID_MOVIE_BLADE_RUNNER);
@ -203,7 +205,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getMovieReleaseInfo method, of class TheMovieDbApi. * Test of getMovieReleaseInfo method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetMovieReleaseInfo() throws MovieDbException { public void testGetMovieReleaseInfo() throws MovieDbException {
logger.info("getMovieReleaseInfo"); logger.info("getMovieReleaseInfo");
List<ReleaseInfo> result = tmdb.getMovieReleaseInfo(ID_MOVIE_BLADE_RUNNER, ""); List<ReleaseInfo> result = tmdb.getMovieReleaseInfo(ID_MOVIE_BLADE_RUNNER, "");
@ -213,7 +215,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getMovieTrailers method, of class TheMovieDbApi. * Test of getMovieTrailers method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetMovieTrailers() throws MovieDbException { public void testGetMovieTrailers() throws MovieDbException {
logger.info("getMovieTrailers"); logger.info("getMovieTrailers");
List<Trailer> result = tmdb.getMovieTrailers(ID_MOVIE_BLADE_RUNNER, ""); List<Trailer> result = tmdb.getMovieTrailers(ID_MOVIE_BLADE_RUNNER, "");
@ -223,7 +225,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getMovieTranslations method, of class TheMovieDbApi. * Test of getMovieTranslations method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetMovieTranslations() throws MovieDbException { public void testGetMovieTranslations() throws MovieDbException {
logger.info("getMovieTranslations"); logger.info("getMovieTranslations");
List<Translation> result = tmdb.getMovieTranslations(ID_MOVIE_BLADE_RUNNER); List<Translation> result = tmdb.getMovieTranslations(ID_MOVIE_BLADE_RUNNER);
@ -233,7 +235,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getCollectionInfo method, of class TheMovieDbApi. * Test of getCollectionInfo method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetCollectionInfo() throws MovieDbException { public void testGetCollectionInfo() throws MovieDbException {
logger.info("getCollectionInfo"); logger.info("getCollectionInfo");
String language = ""; String language = "";
@ -246,7 +248,7 @@ public class TheMovieDbApiTest {
* *
* @throws MovieDbException * @throws MovieDbException
*/ */
//@Test @Test
public void testCreateImageUrl() throws MovieDbException { public void testCreateImageUrl() throws MovieDbException {
logger.info("createImageUrl"); logger.info("createImageUrl");
MovieDb movie = tmdb.getMovieInfo(ID_MOVIE_BLADE_RUNNER, ""); MovieDb movie = tmdb.getMovieInfo(ID_MOVIE_BLADE_RUNNER, "");
@ -257,7 +259,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getMovieInfoImdb method, of class TheMovieDbApi. * Test of getMovieInfoImdb method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetMovieInfoImdb() throws MovieDbException { public void testGetMovieInfoImdb() throws MovieDbException {
logger.info("getMovieInfoImdb"); logger.info("getMovieInfoImdb");
MovieDb result = tmdb.getMovieInfoImdb("tt0076759", "en-US"); MovieDb result = tmdb.getMovieInfoImdb("tt0076759", "en-US");
@ -267,7 +269,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getApiKey method, of class TheMovieDbApi. * Test of getApiKey method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetApiKey() { public void testGetApiKey() {
// Not required // Not required
} }
@ -275,7 +277,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getApiBase method, of class TheMovieDbApi. * Test of getApiBase method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetApiBase() { public void testGetApiBase() {
// Not required // Not required
} }
@ -283,7 +285,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getConfiguration method, of class TheMovieDbApi. * Test of getConfiguration method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetConfiguration() { public void testGetConfiguration() {
// Not required // Not required
} }
@ -291,7 +293,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of searchPeople method, of class TheMovieDbApi. * Test of searchPeople method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testSearchPeople() throws MovieDbException { public void testSearchPeople() throws MovieDbException {
logger.info("searchPeople"); logger.info("searchPeople");
String personName = "Bruce Willis"; String personName = "Bruce Willis";
@ -303,7 +305,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getPersonInfo method, of class TheMovieDbApi. * Test of getPersonInfo method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetPersonInfo() throws MovieDbException { public void testGetPersonInfo() throws MovieDbException {
logger.info("getPersonInfo"); logger.info("getPersonInfo");
Person result = tmdb.getPersonInfo(ID_PERSON_BRUCE_WILLIS); Person result = tmdb.getPersonInfo(ID_PERSON_BRUCE_WILLIS);
@ -313,7 +315,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getPersonCredits method, of class TheMovieDbApi. * Test of getPersonCredits method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetPersonCredits() throws MovieDbException { public void testGetPersonCredits() throws MovieDbException {
logger.info("getPersonCredits"); logger.info("getPersonCredits");
@ -324,7 +326,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getPersonImages method, of class TheMovieDbApi. * Test of getPersonImages method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetPersonImages() throws MovieDbException { public void testGetPersonImages() throws MovieDbException {
logger.info("getPersonImages"); logger.info("getPersonImages");
@ -335,7 +337,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getLatestMovie method, of class TheMovieDbApi. * Test of getLatestMovie method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetLatestMovie() throws MovieDbException { public void testGetLatestMovie() throws MovieDbException {
logger.info("getLatestMovie"); logger.info("getLatestMovie");
MovieDb result = tmdb.getLatestMovie(); MovieDb result = tmdb.getLatestMovie();
@ -346,7 +348,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of compareMovies method, of class TheMovieDbApi. * Test of compareMovies method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testCompareMovies() { public void testCompareMovies() {
// Not required // Not required
} }
@ -354,7 +356,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of setProxy method, of class TheMovieDbApi. * Test of setProxy method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testSetProxy() { public void testSetProxy() {
// Not required // Not required
} }
@ -362,7 +364,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of setTimeout method, of class TheMovieDbApi. * Test of setTimeout method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testSetTimeout() { public void testSetTimeout() {
// Not required // Not required
} }
@ -370,37 +372,37 @@ public class TheMovieDbApiTest {
/** /**
* Test of getNowPlayingMovies method, of class TheMovieDbApi. * Test of getNowPlayingMovies method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetNowPlayingMovies() throws MovieDbException { public void testGetNowPlayingMovies() throws MovieDbException {
logger.info("getNowPlayingMovies"); logger.info("getNowPlayingMovies");
List<MovieDb> results = tmdb.getNowPlayingMovies("", true); List<MovieDb> results = tmdb.getNowPlayingMovies("", 0);
assertTrue("No now playing movies found", !results.isEmpty()); assertTrue("No now playing movies found", !results.isEmpty());
} }
/** /**
* Test of getPopularMovieList method, of class TheMovieDbApi. * Test of getPopularMovieList method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetPopularMovieList() throws MovieDbException { public void testGetPopularMovieList() throws MovieDbException {
logger.info("getPopularMovieList"); logger.info("getPopularMovieList");
List<MovieDb> results = tmdb.getPopularMovieList("", true); List<MovieDb> results = tmdb.getPopularMovieList("", 0);
assertTrue("No popular movies found", !results.isEmpty()); assertTrue("No popular movies found", !results.isEmpty());
} }
/** /**
* Test of getTopRatedMovies method, of class TheMovieDbApi. * Test of getTopRatedMovies method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetTopRatedMovies() throws MovieDbException { public void testGetTopRatedMovies() throws MovieDbException {
logger.info("getTopRatedMovies"); logger.info("getTopRatedMovies");
List<MovieDb> results = tmdb.getTopRatedMovies("", true); List<MovieDb> results = tmdb.getTopRatedMovies("", 0);
assertTrue("No top rated movies found", !results.isEmpty()); assertTrue("No top rated movies found", !results.isEmpty());
} }
/** /**
* Test of getCompanyInfo method, of class TheMovieDbApi. * Test of getCompanyInfo method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetCompanyInfo() throws MovieDbException { public void testGetCompanyInfo() throws MovieDbException {
logger.info("getCompanyInfo"); logger.info("getCompanyInfo");
Company company = tmdb.getCompanyInfo(ID_COMPANY_LUCASFILM); Company company = tmdb.getCompanyInfo(ID_COMPANY_LUCASFILM);
@ -410,7 +412,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getCompanyMovies method, of class TheMovieDbApi. * Test of getCompanyMovies method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetCompanyMovies() throws MovieDbException { public void testGetCompanyMovies() throws MovieDbException {
logger.info("getCompanyMovies"); logger.info("getCompanyMovies");
List<MovieDb> results = tmdb.getCompanyMovies(ID_COMPANY_LUCASFILM, "", true); List<MovieDb> results = tmdb.getCompanyMovies(ID_COMPANY_LUCASFILM, "", true);
@ -420,7 +422,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of searchCompanies method, of class TheMovieDbApi. * Test of searchCompanies method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testSearchCompanies() throws MovieDbException { public void testSearchCompanies() throws MovieDbException {
logger.info("searchCompanies"); logger.info("searchCompanies");
List<Company> results = tmdb.searchCompanies(COMPANY_NAME, "", true); List<Company> results = tmdb.searchCompanies(COMPANY_NAME, "", true);
@ -430,7 +432,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getSimilarMovies method, of class TheMovieDbApi. * Test of getSimilarMovies method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetSimilarMovies() throws MovieDbException { public void testGetSimilarMovies() throws MovieDbException {
logger.info("getSimilarMovies"); logger.info("getSimilarMovies");
List<MovieDb> results = tmdb.getSimilarMovies(ID_MOVIE_BLADE_RUNNER, "", true); List<MovieDb> results = tmdb.getSimilarMovies(ID_MOVIE_BLADE_RUNNER, "", true);
@ -440,7 +442,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getGenreList method, of class TheMovieDbApi. * Test of getGenreList method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetGenreList() throws MovieDbException { public void testGetGenreList() throws MovieDbException {
logger.info("getGenreList"); logger.info("getGenreList");
List<Genre> results = tmdb.getGenreList(""); List<Genre> results = tmdb.getGenreList("");
@ -450,7 +452,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getGenreMovies method, of class TheMovieDbApi. * Test of getGenreMovies method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetGenreMovies() throws MovieDbException { public void testGetGenreMovies() throws MovieDbException {
logger.info("getGenreMovies"); logger.info("getGenreMovies");
List<MovieDb> results = tmdb.getGenreMovies(ID_GENRE_ACTION, "", true); List<MovieDb> results = tmdb.getGenreMovies(ID_GENRE_ACTION, "", true);
@ -460,7 +462,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getUpcoming method, of class TheMovieDbApi. * Test of getUpcoming method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetUpcoming() throws Exception { public void testGetUpcoming() throws Exception {
logger.info("getUpcoming"); logger.info("getUpcoming");
List<MovieDb> results = tmdb.getUpcoming(""); List<MovieDb> results = tmdb.getUpcoming("");
@ -470,7 +472,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getCollectionImages method, of class TheMovieDbApi. * Test of getCollectionImages method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetCollectionImages() throws Exception { public void testGetCollectionImages() throws Exception {
logger.info("getCollectionImages"); logger.info("getCollectionImages");
String language = ""; String language = "";
@ -481,7 +483,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getAuthorisationToken method, of class TheMovieDbApi. * Test of getAuthorisationToken method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetAuthorisationToken() throws Exception { public void testGetAuthorisationToken() throws Exception {
logger.info("getAuthorisationToken"); logger.info("getAuthorisationToken");
TokenAuthorisation result = tmdb.getAuthorisationToken(); TokenAuthorisation result = tmdb.getAuthorisationToken();
@ -493,7 +495,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getSessionToken method, of class TheMovieDbApi. * Test of getSessionToken method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetSessionToken() throws Exception { public void testGetSessionToken() throws Exception {
logger.info("getSessionToken"); logger.info("getSessionToken");
TokenAuthorisation token = tmdb.getAuthorisationToken(); TokenAuthorisation token = tmdb.getAuthorisationToken();
@ -510,7 +512,7 @@ public class TheMovieDbApiTest {
/** /**
* Test of getGuestSessionToken method, of class TheMovieDbApi. * Test of getGuestSessionToken method, of class TheMovieDbApi.
*/ */
//@Test @Test
public void testGetGuestSessionToken() throws Exception { public void testGetGuestSessionToken() throws Exception {
logger.info("getGuestSessionToken"); logger.info("getGuestSessionToken");
TokenSession result = tmdb.getGuestSessionToken(); TokenSession result = tmdb.getGuestSessionToken();
@ -526,4 +528,24 @@ public class TheMovieDbApiTest {
assertNotNull("No results found", results); assertNotNull("No results found", results);
assertTrue("No results found", results.size() > 0); assertTrue("No results found", results.size() > 0);
} }
// Do not test this until it is fixed
// @Test
public void testGetMovieChanges() throws Exception {
logger.info("getMovieChanges");
String language = "";
String startDate = "";
String endDate = null;
List<MovieChanges> results = Collections.EMPTY_LIST;
List<MovieDb> movieList = tmdb.getPopularMovieList(language, 0);
for (MovieDb movie : movieList) {
results = tmdb.getMovieChanges(movie.getId(), startDate, endDate);
logger.info(movie.getTitle() + " has " + results.size() + " changes.");
}
assertNotNull("No results found", results);
assertTrue("No results found", results.size() > 0);
}
} }

Loading…
Cancel
Save