Person
This commit is contained in:
@@ -50,7 +50,6 @@ import com.omertron.themoviedbapi.model.MovieList;
|
||||
import com.omertron.themoviedbapi.model.ReleaseInfo;
|
||||
import com.omertron.themoviedbapi.model.Translation;
|
||||
import com.omertron.themoviedbapi.model.Video;
|
||||
import com.omertron.themoviedbapi.model.change.ChangedMedia;
|
||||
import com.omertron.themoviedbapi.model.keyword.Keyword;
|
||||
import com.omertron.themoviedbapi.model.keyword.KeywordMovie;
|
||||
import com.omertron.themoviedbapi.model.person.Person;
|
||||
@@ -60,6 +59,7 @@ import com.omertron.themoviedbapi.model2.account.Account;
|
||||
import com.omertron.themoviedbapi.model2.artwork.Artwork;
|
||||
import com.omertron.themoviedbapi.model2.authentication.TokenAuthorisation;
|
||||
import com.omertron.themoviedbapi.model2.authentication.TokenSession;
|
||||
import com.omertron.themoviedbapi.model2.change.ChangeListItem;
|
||||
import com.omertron.themoviedbapi.model2.collection.Collection;
|
||||
import com.omertron.themoviedbapi.model2.collection.CollectionInfo;
|
||||
import com.omertron.themoviedbapi.model2.company.Company;
|
||||
@@ -529,7 +529,7 @@ public class TheMovieDbApi {
|
||||
* @return List of changed movie
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public TmdbResultsList<ChangedMedia> getMovieChangeList(int page, String startDate, String endDate) throws MovieDbException {
|
||||
public List<ChangeListItem> getMovieChangeList(int page, String startDate, String endDate) throws MovieDbException {
|
||||
return tmdbChanges.getChangeList(MethodBase.MOVIE, page, startDate, endDate);
|
||||
}
|
||||
|
||||
@@ -544,7 +544,7 @@ public class TheMovieDbApi {
|
||||
* @return List of changed movie
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public TmdbResultsList<ChangedMedia> getTvChangeList(int page, String startDate, String endDate) throws MovieDbException {
|
||||
public List<ChangeListItem> getTvChangeList(int page, String startDate, String endDate) throws MovieDbException {
|
||||
return tmdbChanges.getChangeList(MethodBase.TV, page, startDate, endDate);
|
||||
}
|
||||
|
||||
@@ -559,7 +559,7 @@ public class TheMovieDbApi {
|
||||
* @return List of changed movie
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public TmdbResultsList<ChangedMedia> getPersonChangeList(int page, String startDate, String endDate) throws MovieDbException {
|
||||
public List<ChangeListItem> getPersonChangeList(int page, String startDate, String endDate) throws MovieDbException {
|
||||
return tmdbChanges.getChangeList(MethodBase.PERSON, page, startDate, endDate);
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
@@ -19,19 +19,18 @@
|
||||
*/
|
||||
package com.omertron.themoviedbapi.methods;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.model.change.ChangedMedia;
|
||||
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
||||
import com.omertron.themoviedbapi.model2.change.ChangeListItem;
|
||||
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||
import com.omertron.themoviedbapi.tools.MethodSub;
|
||||
import com.omertron.themoviedbapi.tools.Param;
|
||||
import com.omertron.themoviedbapi.tools.TmdbParameters;
|
||||
import com.omertron.themoviedbapi.wrapper.WrapperMediaChanges;
|
||||
import java.io.IOException;
|
||||
import com.omertron.themoviedbapi.wrapper.WrapperGenericList;
|
||||
import java.net.URL;
|
||||
import org.yamj.api.common.exception.ApiExceptionType;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Class to hold the Change Methods
|
||||
@@ -53,7 +52,8 @@ public class TmdbChanges extends AbstractMethod {
|
||||
/**
|
||||
* Get a list of Media IDs that have been edited.
|
||||
*
|
||||
* You can then use the movie/TV/person changes API to get the actual data that has been changed.
|
||||
* You can then use the movie/TV/person changes API to get the actual data
|
||||
* that has been changed.
|
||||
*
|
||||
* @param method The method base to get
|
||||
* @param page
|
||||
@@ -62,7 +62,7 @@ public class TmdbChanges extends AbstractMethod {
|
||||
* @return List of changed movie
|
||||
* @throws MovieDbException
|
||||
*/
|
||||
public TmdbResultsList<ChangedMedia> getChangeList(MethodBase method, Integer page, String startDate, String endDate) throws MovieDbException {
|
||||
public List<ChangeListItem> getChangeList(MethodBase method, Integer page, String startDate, String endDate) throws MovieDbException {
|
||||
TmdbParameters params = new TmdbParameters();
|
||||
params.add(Param.PAGE, page);
|
||||
params.add(Param.START_DATE, startDate);
|
||||
@@ -71,15 +71,10 @@ public class TmdbChanges extends AbstractMethod {
|
||||
URL url = new ApiUrl(apiKey, method).setSubMethod(MethodSub.CHANGES).buildUrl(params);
|
||||
String webpage = httpTools.getRequest(url);
|
||||
|
||||
try {
|
||||
WrapperMediaChanges wrapper = MAPPER.readValue(webpage, WrapperMediaChanges.class);
|
||||
TypeReference tr = new TypeReference<WrapperGenericList<ChangeListItem>>() {
|
||||
};
|
||||
|
||||
TmdbResultsList<ChangedMedia> results = new TmdbResultsList<ChangedMedia>(wrapper.getResults());
|
||||
results.copyWrapper(wrapper);
|
||||
return results;
|
||||
} catch (IOException ex) {
|
||||
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get changes", url, ex);
|
||||
}
|
||||
return processWrapperList(tr, url, "changes");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ package com.omertron.themoviedbapi.methods;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.model2.artwork.Artwork;
|
||||
import com.omertron.themoviedbapi.enumeration.ArtworkType;
|
||||
import com.omertron.themoviedbapi.model2.artwork.Artwork;
|
||||
import com.omertron.themoviedbapi.model2.artwork.ArtworkMedia;
|
||||
import com.omertron.themoviedbapi.model2.person.CreditMovieBasic;
|
||||
import com.omertron.themoviedbapi.model2.person.CreditTVBasic;
|
||||
@@ -37,6 +37,7 @@ import com.omertron.themoviedbapi.tools.MethodBase;
|
||||
import com.omertron.themoviedbapi.tools.MethodSub;
|
||||
import com.omertron.themoviedbapi.tools.Param;
|
||||
import com.omertron.themoviedbapi.tools.TmdbParameters;
|
||||
import com.omertron.themoviedbapi.wrapper.WrapperChanges;
|
||||
import com.omertron.themoviedbapi.wrapper.WrapperGenericList;
|
||||
import com.omertron.themoviedbapi.wrapper.WrapperImages;
|
||||
import java.io.IOException;
|
||||
@@ -112,9 +113,11 @@ public class TmdbPeople extends AbstractMethod {
|
||||
/**
|
||||
* Get the TV credits for a specific person id.
|
||||
*
|
||||
* To get the expanded details for each record, call the /credit method with the provided credit_id.
|
||||
* To get the expanded details for each record, call the /credit method with
|
||||
* the provided credit_id.
|
||||
*
|
||||
* This will provide details about which episode and/or season the credit is for.
|
||||
* This will provide details about which episode and/or season the credit is
|
||||
* for.
|
||||
*
|
||||
* @param personId
|
||||
* @param language
|
||||
@@ -142,9 +145,11 @@ public class TmdbPeople extends AbstractMethod {
|
||||
/**
|
||||
* Get the combined (movie and TV) credits for a specific person id.
|
||||
*
|
||||
* To get the expanded details for each TV record, call the /credit method with the provided credit_id.
|
||||
* To get the expanded details for each TV record, call the /credit method
|
||||
* with the provided credit_id.
|
||||
*
|
||||
* This will provide details about which episode and/or season the credit is for.
|
||||
* This will provide details about which episode and/or season the credit is
|
||||
* for.
|
||||
*
|
||||
* @param personId
|
||||
* @param language
|
||||
@@ -217,7 +222,8 @@ public class TmdbPeople extends AbstractMethod {
|
||||
/**
|
||||
* Get the images that have been tagged with a specific person id.
|
||||
*
|
||||
* We return all of the image results with a media object mapped for each image.
|
||||
* We return all of the image results with a media object mapped for each
|
||||
* image.
|
||||
*
|
||||
* @param personId
|
||||
* @param page
|
||||
@@ -254,18 +260,31 @@ public class TmdbPeople extends AbstractMethod {
|
||||
*
|
||||
* 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 maximum number of days that can be returned in a single request is
|
||||
* 14.
|
||||
*
|
||||
* The language is present on fields that are translatable.
|
||||
*
|
||||
* @param persondId
|
||||
* @param personId
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
* @return
|
||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||
*/
|
||||
public TmdbResultsList<Person> getPersonChanges(int persondId, String startDate, String endDate) throws MovieDbException {
|
||||
throw new MovieDbException(ApiExceptionType.UNKNOWN_CAUSE, "Not done");
|
||||
public WrapperChanges getPersonChanges(int personId, String startDate, String endDate) throws MovieDbException {
|
||||
TmdbParameters parameters = new TmdbParameters();
|
||||
parameters.add(Param.ID, personId);
|
||||
parameters.add(Param.START_DATE, startDate);
|
||||
parameters.add(Param.END_DATE, endDate);
|
||||
|
||||
URL url = new ApiUrl(apiKey, MethodBase.PERSON).setSubMethod(MethodSub.CHANGES).buildUrl(parameters);
|
||||
String webpage = httpTools.getRequest(url);
|
||||
|
||||
try {
|
||||
return MAPPER.readValue(webpage, WrapperChanges.class);
|
||||
} catch (IOException ex) {
|
||||
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person changes", url, ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2015 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.model2.change;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model2.AbstractJsonMapping;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ChangeKeyItem extends AbstractJsonMapping {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@JsonProperty("key")
|
||||
private String key;
|
||||
@JsonProperty("items")
|
||||
private List<ChangedItem> changedItems = new ArrayList<ChangedItem>();
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public List<ChangedItem> getChangedItems() {
|
||||
return changedItems;
|
||||
}
|
||||
|
||||
public void setChangedItems(List<ChangedItem> changes) {
|
||||
this.changedItems = changes;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2015 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.model2.change;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model2.AbstractJsonMapping;
|
||||
|
||||
public class ChangeListItem extends AbstractJsonMapping {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("adult")
|
||||
private boolean adult;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public boolean isAdult() {
|
||||
return adult;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setAdult(boolean adult) {
|
||||
this.adult = adult;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2015 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.model2.change;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model2.AbstractJsonMapping;
|
||||
|
||||
public class ChangedItem extends AbstractJsonMapping {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@JsonProperty("id")
|
||||
private String id;
|
||||
@JsonProperty("action")
|
||||
private String action;
|
||||
@JsonProperty("time")
|
||||
private String time;
|
||||
@JsonProperty("iso_639_1")
|
||||
private String language;
|
||||
@JsonProperty("value")
|
||||
private Object value;
|
||||
@JsonProperty("original_value")
|
||||
private Object originalValue;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(Object value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Object getOriginalValue() {
|
||||
return originalValue;
|
||||
}
|
||||
|
||||
public void setOriginalValue(Object originalValue) {
|
||||
this.originalValue = originalValue;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,22 +19,17 @@
|
||||
*/
|
||||
package com.omertron.themoviedbapi.wrapper;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnyGetter;
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.omertron.themoviedbapi.model.change.ChangeKeyItem;
|
||||
import com.omertron.themoviedbapi.model2.change.ChangeKeyItem;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
public class WrapperChanges {
|
||||
public class WrapperChanges extends AbstractWrapper{
|
||||
|
||||
@JsonProperty("changes")
|
||||
private List<ChangeKeyItem> changedItems = new ArrayList<ChangeKeyItem>();
|
||||
private final Map<String, Object> newItems = new HashMap<String, Object>();
|
||||
|
||||
public List<ChangeKeyItem> getChangedItems() {
|
||||
return changedItems;
|
||||
@@ -44,16 +39,6 @@ public class WrapperChanges {
|
||||
this.changedItems = changes;
|
||||
}
|
||||
|
||||
@JsonAnyGetter
|
||||
public Map<String, Object> getNewItems() {
|
||||
return this.newItems;
|
||||
}
|
||||
|
||||
@JsonAnySetter
|
||||
public void setNewItems(String name, Object value) {
|
||||
this.newItems.put(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
|
||||
|
||||
@@ -21,9 +21,9 @@ package com.omertron.themoviedbapi.methods;
|
||||
|
||||
import com.omertron.themoviedbapi.AbstractTests;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.model.change.ChangedMedia;
|
||||
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
||||
import com.omertron.themoviedbapi.model2.change.ChangeListItem;
|
||||
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||
import java.util.List;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import org.junit.BeforeClass;
|
||||
@@ -60,8 +60,8 @@ public class TmdbChangesTest extends AbstractTests {
|
||||
@Test
|
||||
public void testGetMovieChangesList() throws MovieDbException {
|
||||
LOG.info("getMovieChangesList");
|
||||
TmdbResultsList<ChangedMedia> result = instance.getChangeList(MethodBase.MOVIE, null, null, null);
|
||||
assertFalse("No movie changes.", result.getResults().isEmpty());
|
||||
List<ChangeListItem> result = instance.getChangeList(MethodBase.MOVIE, null, null, null);
|
||||
assertFalse("No movie changes.", result.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,8 +72,8 @@ public class TmdbChangesTest extends AbstractTests {
|
||||
@Ignore("Not ready yet")
|
||||
public void testGetPersonChangesList() throws MovieDbException {
|
||||
LOG.info("getPersonChangesList");
|
||||
TmdbResultsList<ChangedMedia> result = instance.getChangeList(MethodBase.PERSON, null, null, null);
|
||||
assertFalse("No Person changes.", result.getResults().isEmpty());
|
||||
List<ChangeListItem> result = instance.getChangeList(MethodBase.PERSON, null, null, null);
|
||||
assertFalse("No Person changes.", result.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,7 +84,7 @@ public class TmdbChangesTest extends AbstractTests {
|
||||
@Ignore("Not ready yet")
|
||||
public void testGetTVChangesList() throws MovieDbException {
|
||||
LOG.info("getPersonChangesList");
|
||||
TmdbResultsList<ChangedMedia> result = instance.getChangeList(MethodBase.PERSON, null, null, null);
|
||||
assertFalse("No TV changes.", result.getResults().isEmpty());
|
||||
List<ChangeListItem> result = instance.getChangeList(MethodBase.PERSON, null, null, null);
|
||||
assertFalse("No TV changes.", result.isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,9 +23,10 @@ import com.omertron.themoviedbapi.AbstractTests;
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TestID;
|
||||
import com.omertron.themoviedbapi.enumeration.ArtworkType;
|
||||
import com.omertron.themoviedbapi.model2.MediaBasic;
|
||||
import com.omertron.themoviedbapi.model2.artwork.Artwork;
|
||||
import com.omertron.themoviedbapi.model2.artwork.ArtworkMedia;
|
||||
import com.omertron.themoviedbapi.model2.change.ChangeKeyItem;
|
||||
import com.omertron.themoviedbapi.model2.change.ChangeListItem;
|
||||
import com.omertron.themoviedbapi.model2.person.CreditMovieBasic;
|
||||
import com.omertron.themoviedbapi.model2.person.CreditTVBasic;
|
||||
import com.omertron.themoviedbapi.model2.person.ExternalID;
|
||||
@@ -33,15 +34,19 @@ import com.omertron.themoviedbapi.model2.person.Person;
|
||||
import com.omertron.themoviedbapi.model2.person.PersonCredits;
|
||||
import com.omertron.themoviedbapi.model2.person.PersonFind;
|
||||
import com.omertron.themoviedbapi.results.TmdbResultsList;
|
||||
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||
import com.omertron.themoviedbapi.wrapper.WrapperChanges;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import org.junit.Before;
|
||||
@@ -55,7 +60,6 @@ import org.junit.Test;
|
||||
public class TmdbPeopleTest extends AbstractTests {
|
||||
|
||||
private static TmdbPeople instance;
|
||||
private static final int ID_DICK_WOLF = 117443;
|
||||
private static final List<TestID> testIDs = new ArrayList<TestID>();
|
||||
|
||||
public TmdbPeopleTest() {
|
||||
@@ -210,8 +214,10 @@ public class TmdbPeopleTest extends AbstractTests {
|
||||
|
||||
for (TestID test : testIDs) {
|
||||
TmdbResultsList<ArtworkMedia> result = instance.getPersonTaggedImages(test.getTmdb(), page, language);
|
||||
assertFalse("No images", result.isEmpty());
|
||||
for (ArtworkMedia am : result.getResults()) {
|
||||
LOG.info("{}", ToStringBuilder.reflectionToString(am, ToStringStyle.DEFAULT_STYLE));
|
||||
assertTrue("No ID", StringUtils.isNotBlank(am.getId()));
|
||||
assertTrue("No file path", StringUtils.isNotBlank(am.getFilePath()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -221,18 +227,30 @@ public class TmdbPeopleTest extends AbstractTests {
|
||||
*
|
||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||
*/
|
||||
//@Test
|
||||
@Test
|
||||
public void testGetPersonChanges() throws MovieDbException {
|
||||
LOG.info("getPersonChanges");
|
||||
int persondId = 0;
|
||||
String startDate = "";
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String startDate = sdf.format(DateUtils.addDays(new Date(), -14));
|
||||
String endDate = "";
|
||||
int maxCheck = 5;
|
||||
|
||||
TmdbResultsList<Person> expResult = null;
|
||||
TmdbResultsList<Person> result = instance.getPersonChanges(persondId, startDate, endDate);
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
TmdbChanges chgs = new TmdbChanges(getApiKey(), getHttpTools());
|
||||
List<ChangeListItem> changeList = chgs.getChangeList(MethodBase.PERSON, null, null, null);
|
||||
LOG.info("Found {} person changes to check", changeList.size());
|
||||
|
||||
int count = 1;
|
||||
WrapperChanges result;
|
||||
for (ChangeListItem item : changeList) {
|
||||
result = instance.getPersonChanges(item.getId(), startDate, endDate);
|
||||
for (ChangeKeyItem ci : result.getChangedItems()) {
|
||||
assertNotNull("Null changes",ci);
|
||||
}
|
||||
|
||||
if (count++ > maxCheck) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -240,7 +258,7 @@ public class TmdbPeopleTest extends AbstractTests {
|
||||
*
|
||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||
*/
|
||||
@Test
|
||||
// @Test
|
||||
public void testGetPersonPopular() throws MovieDbException {
|
||||
LOG.info("getPersonPopular");
|
||||
Integer page = null;
|
||||
@@ -248,10 +266,8 @@ public class TmdbPeopleTest extends AbstractTests {
|
||||
assertFalse("No results", result.isEmpty());
|
||||
assertTrue("No results", result.getResults().size() > 0);
|
||||
for (PersonFind p : result.getResults()) {
|
||||
assertFalse("No known for entries", p.getKnownFor().isEmpty());
|
||||
LOG.info("{} ({}) = {}", p.getName(), p.getId(), p.getKnownFor().size());
|
||||
for (MediaBasic k : p.getKnownFor()) {
|
||||
LOG.info(" {}", k.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,11 +280,9 @@ public class TmdbPeopleTest extends AbstractTests {
|
||||
public void testGetPersonLatest() throws MovieDbException {
|
||||
LOG.info("getPersonLatest");
|
||||
|
||||
Person expResult = null;
|
||||
Person result = instance.getPersonLatest();
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
assertTrue("No ID", result.getId() > 0);
|
||||
assertTrue("No name!", StringUtils.isNotBlank(result.getName()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user