Add HttpTools class

Add POST and DELETE commands
This commit is contained in:
Stuart Boston
2015-02-12 15:54:09 +00:00
parent ba0c8bc564
commit 6eda79830e
7 changed files with 244 additions and 486 deletions
@@ -19,21 +19,54 @@
*/
package com.omertron.themoviedbapi;
import com.omertron.themoviedbapi.model.*;
import com.omertron.themoviedbapi.model.Account;
import com.omertron.themoviedbapi.model.AlternativeTitle;
import com.omertron.themoviedbapi.model.Artwork;
import com.omertron.themoviedbapi.model.ChangedItem;
import com.omertron.themoviedbapi.model.ChangedMovie;
import com.omertron.themoviedbapi.model.Collection;
import com.omertron.themoviedbapi.model.CollectionInfo;
import com.omertron.themoviedbapi.model.Company;
import com.omertron.themoviedbapi.model.Discover;
import com.omertron.themoviedbapi.model.Genre;
import com.omertron.themoviedbapi.model.JobDepartment;
import com.omertron.themoviedbapi.model.Keyword;
import com.omertron.themoviedbapi.model.KeywordMovie;
import com.omertron.themoviedbapi.model.MovieDb;
import com.omertron.themoviedbapi.model.MovieDbList;
import com.omertron.themoviedbapi.model.MovieList;
import com.omertron.themoviedbapi.model.Person;
import com.omertron.themoviedbapi.model.PersonCredit;
import com.omertron.themoviedbapi.model.ReleaseInfo;
import com.omertron.themoviedbapi.model.Reviews;
import com.omertron.themoviedbapi.model.StatusCode;
import com.omertron.themoviedbapi.model.TmdbConfiguration;
import com.omertron.themoviedbapi.model.TokenAuthorisation;
import com.omertron.themoviedbapi.model.TokenSession;
import com.omertron.themoviedbapi.model.Translation;
import com.omertron.themoviedbapi.model.Video;
import com.omertron.themoviedbapi.results.TmdbResultsList;
import com.omertron.themoviedbapi.results.TmdbResultsMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.junit.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.List;
import java.util.Properties;
import java.util.Random;
import static org.junit.Assert.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
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;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Test cases for TheMovieDbApi API
@@ -296,7 +329,7 @@ public class TheMovieDbApiTest {
@Test
public void testGetMovieTrailers() throws MovieDbException {
LOG.info("getMovieTrailers");
TmdbResultsList<Trailer> result = tmdb.getMovieTrailers(ID_MOVIE_BLADE_RUNNER, "");
TmdbResultsList<Video> result = tmdb.getMovieTrailers(ID_MOVIE_BLADE_RUNNER, "");
assertFalse("Movie trailers missing", result.getResults().isEmpty());
}
@@ -619,7 +652,8 @@ public class TheMovieDbApiTest {
/**
* Test of getSessionToken method, of class TheMovieDbApi.
*
* TODO: Cannot be tested without a HTTP authorisation: http://help.themoviedb.org/kb/api/user-authentication
* TODO: Cannot be tested without a HTTP authorisation:
* http://help.themoviedb.org/kb/api/user-authentication
*
* @throws MovieDbException
*/
@@ -650,7 +684,6 @@ public class TheMovieDbApiTest {
assertTrue("Failed to get guest session", result.getSuccess());
}
@Test
public void testGetMovieLists() throws Exception {
LOG.info("getMovieLists");
TmdbResultsList<MovieList> result = tmdb.getMovieLists(ID_MOVIE_BLADE_RUNNER, LANGUAGE_ENGLISH, 0);
@@ -740,7 +773,8 @@ public class TheMovieDbApiTest {
/**
* Test of postMovieRating method, of class TheMovieDbApi.
*
* TODO: Cannot be tested without a HTTP authorisation: http://help.themoviedb.org/kb/api/user-authentication
* TODO: Cannot be tested without a HTTP authorisation:
* http://help.themoviedb.org/kb/api/user-authentication
*
* @throws MovieDbException
*/