Updated gradle and compile and target SDK version (#640)

Had to upgrade robolectric as well as old version didn't
seem to cooperate with new gradle version.
This commit is contained in:
Martijn Brekhof 2019-06-03 11:50:31 +02:00 committed by Synced Synapse
parent c68235fcfc
commit e5ab122b1d
15 changed files with 110 additions and 111 deletions

View File

@ -4,17 +4,17 @@ sudo: false
env:
matrix:
- ANDROID_TARGET=android-26
- ANDROID_TARGET=android-28
global:
- GRADLE_OPTS="-Xms128m"
android:
components:
# needed build tools
- build-tools-27.0.3
- build-tools-28.0.3
# The SDK version used to compile your project
- android-26
- android-28
# extra needed components
- extra-android-m2repository

View File

@ -11,13 +11,13 @@ def getVersionName = { ->
android {
compileSdkVersion 26
buildToolsVersion "27.0.3"
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "org.xbmc.kore"
minSdkVersion 15
targetSdkVersion 26
targetSdkVersion 28
versionCode 25
versionName = getVersionName()
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@ -39,19 +39,11 @@ android {
}
}
// sourceSets {
// test {
// java.srcDirs += 'src/testUtils/java'
// assets.srcDirs += 'src/testUtils/assets'
// }
// androidTest {
// java.srcDirs += 'src/testUtils/java'
// assets.srcDirs += 'src/testUtils/assets'
// }
// }
testOptions {
execution 'ANDROID_TEST_ORCHESTRATOR'
unitTests {
includeAndroidResources = true
}
}
buildTypes {
@ -92,7 +84,7 @@ android {
}
ext {
supportLibVersion = '26.1.0'
supportLibVersion = '28.0.0'
}
dependencies {
@ -116,16 +108,18 @@ dependencies {
implementation 'com.sothree.slidinguppanel:library:3.3.1'
implementation 'com.simplecityapps:recyclerview-fastscroll:1.0.20'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test:rules:1.0.1'
androidTestUtil 'com.android.support.test:orchestrator:1.0.1'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestUtil 'com.android.support.test:orchestrator:1.0.2'
androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.2'
androidTestImplementation "com.android.support:support-v13:${supportLibVersion}"
androidTestImplementation 'junit:junit:4.12'
testImplementation 'org.robolectric:robolectric:3.1.1'
testImplementation 'org.robolectric:robolectric:4.3'
testImplementation "androidx.test:core:1.2.0"
testImplementation "androidx.test.ext:junit:1.1.1"
debugImplementation 'junit:junit:4.12'
implementation fileTree(dir: 'libs', include: ['*.jar'])
}

View File

@ -18,9 +18,9 @@ package org.xbmc.kore.tests.ui.movies;
import android.content.Context;
import android.support.test.espresso.Espresso;
import android.support.test.filters.LargeTest;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;
import org.junit.Rule;
import org.junit.Test;

View File

@ -19,9 +19,9 @@ package org.xbmc.kore.tests.ui.music;
import android.app.Activity;
import android.content.Context;
import android.support.test.espresso.Espresso;
import android.support.test.filters.LargeTest;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;
import org.junit.Rule;
import org.junit.Test;

View File

@ -73,8 +73,8 @@
android:layout_below="@id/title"
android:layout_toRightOf="@id/art"
android:layout_toEndOf="@id/art"
android:layout_toLeftOf="@id/meta_info"
android:layout_toStartOf="@id/size_duration"
android:layout_toLeftOf="@id/list_context_menu"
android:layout_toStartOf="@id/list_context_menu"
style="@style/TextAppearance.Playlist.Details"/>
</RelativeLayout>
</android.support.v7.widget.CardView>

View File

@ -53,6 +53,9 @@
<dimen name="tab_strip_height">48dp</dimen>
<dimen name="view_pager_indicator_height">12dp</dimen>
<dimen name="remote_icon_size">67dp</dimen>
<dimen name="remote_size">202dp</dimen>
<dimen name="remote_page_indicator_height">24dp</dimen>
<dimen name="remote_content_hmargin">8dp</dimen>

View File

@ -17,39 +17,42 @@
package org.xbmc.kore.provider.mediaprovider;
import android.content.ContentProviderClient;
import android.content.ContentResolver;
import android.content.pm.ProviderInfo;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.Shadows;
import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowContentResolver;
import org.xbmc.kore.BuildConfig;
import org.robolectric.Robolectric;
import org.xbmc.kore.host.HostInfo;
import org.xbmc.kore.provider.MediaProvider;
import org.xbmc.kore.testutils.Database;
@RunWith(RobolectricTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 23)
@RunWith(AndroidJUnit4.class)
@Ignore
public class AbstractTestClass {
protected static HostInfo hostInfo;
protected static ShadowContentResolver shadowContentResolver;
private static ContentResolver contentResolver = ApplicationProvider.getApplicationContext().getContentResolver();
private static final String AUTHORITY = "org.xbmc.kore.provider";
ContentProviderClient client;
@Before
public void setUp() throws Exception {
MediaProvider provider = new MediaProvider();
ContentResolver contentResolver = RuntimeEnvironment.application.getContentResolver();
provider.onCreate();
shadowContentResolver = Shadows.shadowOf(contentResolver);
ShadowContentResolver.registerProvider("org.xbmc.kore.provider", provider);
provider.onCreate();
hostInfo = Database.addHost(RuntimeEnvironment.application);
ProviderInfo info = new ProviderInfo();
info.authority = AUTHORITY;
Robolectric.buildContentProvider(MediaProvider.class).create(info);
Database.fill(hostInfo, RuntimeEnvironment.application, contentResolver);
client = contentResolver.acquireContentProviderClient(AUTHORITY);
hostInfo = Database.addHost(ApplicationProvider.getApplicationContext());
Database.fill(hostInfo, ApplicationProvider.getApplicationContext(), contentResolver);
}
}

View File

@ -31,10 +31,10 @@ import static org.junit.Assert.assertTrue;
public class AlbumsTest extends AbstractTestClass {
@Test
public void queryAllAlbumsTest() {
public void queryAllAlbumsTest() throws Exception {
Uri uri = MediaContract.Albums.buildAlbumsListUri(hostInfo.getId());
Cursor cursor = shadowContentResolver.query(uri, TestValues.Album.PROJECTION, null, null, null);
Cursor cursor = client.query(uri, TestValues.Album.PROJECTION, null, null, null);
assertNotNull(cursor);
assertEquals("cursor size ", 235, cursor.getCount());
@ -45,10 +45,10 @@ public class AlbumsTest extends AbstractTestClass {
}
@Test
public void queryAlbumTest() {
public void queryAlbumTest() throws Exception {
Uri uri = MediaContract.Albums.buildAlbumUri(hostInfo.getId(), TestValues.Album.albumId);
Cursor cursor = shadowContentResolver.query(uri, TestValues.Album.PROJECTION, null, null, null);
Cursor cursor = client.query(uri, TestValues.Album.PROJECTION, null, null, null);
assertNotNull(cursor);
assertEquals("cursor size ", 1, cursor.getCount());
@ -57,11 +57,11 @@ public class AlbumsTest extends AbstractTestClass {
}
@Test
public void queryAlbumsForArtistTest() {
public void queryAlbumsForArtistTest() throws Exception {
Uri uri = MediaContract.AlbumArtists.buildAlbumsForArtistListUri(hostInfo.getId(),
TestValues.Artist.artistId);
Cursor cursor = shadowContentResolver.query(uri, TestValues.Album.PROJECTION, null, null, null);
Cursor cursor = client.query(uri, TestValues.Album.PROJECTION, null, null, null);
assertNotNull(cursor);
assertEquals("cursor size ", 1, cursor.getCount());
@ -70,11 +70,11 @@ public class AlbumsTest extends AbstractTestClass {
}
@Test
public void queryAlbumsForArtistWithVariousArtistsTest() {
public void queryAlbumsForArtistWithVariousArtistsTest() throws Exception {
Uri uri = MediaContract.AlbumArtists.buildAlbumsForArtistListUri(hostInfo.getId(),
TestValues.AlbumWithVariousArtists.artistId);
Cursor cursor = shadowContentResolver.query(uri, TestValues.AlbumWithVariousArtists.PROJECTION, null, null, null);
Cursor cursor = client.query(uri, TestValues.AlbumWithVariousArtists.PROJECTION, null, null, null);
assertNotNull(cursor);
assertEquals("cursor size ", 2, cursor.getCount());
@ -92,11 +92,11 @@ public class AlbumsTest extends AbstractTestClass {
}
@Test
public void queryAlbumWithoutArtist() {
public void queryAlbumWithoutArtist() throws Exception {
Uri uri = MediaContract.Albums.buildAlbumUri(hostInfo.getId(),
TestValues.AlbumWithoutArtist.albumId);
Cursor cursor = shadowContentResolver.query(uri, TestValues.AlbumWithoutArtist.PROJECTION, null, null, null);
Cursor cursor = client.query(uri, TestValues.AlbumWithoutArtist.PROJECTION, null, null, null);
assertNotNull(cursor);
assertEquals("cursor size ", 1, cursor.getCount());
@ -105,11 +105,11 @@ public class AlbumsTest extends AbstractTestClass {
}
@Test
public void queryAlbumWithMultipleArtists() {
public void queryAlbumWithMultipleArtists() throws Exception {
Uri uri = MediaContract.Albums.buildAlbumUri(hostInfo.getId(),
TestValues.AlbumWithMultipleArtists.albumId);
Cursor cursor = shadowContentResolver.query(uri, TestValues.AlbumWithMultipleArtists.PROJECTION,
Cursor cursor = client.query(uri, TestValues.AlbumWithMultipleArtists.PROJECTION,
null, null, null);
assertNotNull(cursor);

View File

@ -31,10 +31,10 @@ import static org.junit.Assert.assertTrue;
public class ArtistsTest extends AbstractTestClass {
@Test
public void queryAllArtistsTest() {
public void queryAllArtistsTest() throws Exception {
Uri uri = MediaContract.Artists.buildArtistsListUri(hostInfo.getId());
Cursor cursor = shadowContentResolver.query(uri, TestValues.Artist.PROJECTION, null, null, null);
Cursor cursor = client.query(uri, TestValues.Artist.PROJECTION, null, null, null);
assertNotNull(cursor);
assertEquals("cursor size ", 229, cursor.getCount());
@ -46,10 +46,10 @@ public class ArtistsTest extends AbstractTestClass {
}
@Test
public void queryArtistTest() {
public void queryArtistTest() throws Exception {
Uri uri = MediaContract.Artists.buildArtistUri(hostInfo.getId(), TestValues.Artist.artistId);
Cursor cursor = shadowContentResolver.query(uri, TestValues.Artist.PROJECTION, null, null, null);
Cursor cursor = client.query(uri, TestValues.Artist.PROJECTION, null, null, null);
assertNotNull(cursor);
assertEquals("cursor size ", 1, cursor.getCount());

View File

@ -28,12 +28,12 @@ import static org.junit.Assert.assertNotNull;
public class GenresTest extends AbstractTestClass {
@Test
public void queryAllGenresTest() {
public void queryAllGenresTest() throws Exception {
Uri uri = MediaContract.AudioGenres.buildAudioGenresListUri(hostInfo.getId());
Cursor cursor = shadowContentResolver.query(uri,
new String[] {MediaContract.AudioGenresColumns.GENREID},
null, null, null);
Cursor cursor = client.query(uri,
new String[] {MediaContract.AudioGenresColumns.GENREID},
null, null, null);
assertNotNull(cursor);
assertEquals("cursor size ", 39, cursor.getCount());
@ -43,11 +43,11 @@ public class GenresTest extends AbstractTestClass {
}
@Test
public void queryAlbumsForGenreTest() {
public void queryAlbumsForGenreTest() throws Exception {
int genreId = 13;
Uri uri = MediaContract.AlbumGenres.buildAlbumsForGenreListUri(hostInfo.getId(), genreId);
Cursor cursor = shadowContentResolver.query(uri, TestValues.Album.PROJECTION, null, null, null);
Cursor cursor = client.query(uri, TestValues.Album.PROJECTION, null, null, null);
assertNotNull(cursor);
assertEquals("cursor size ", 31, cursor.getCount());

View File

@ -31,10 +31,10 @@ import static org.junit.Assert.assertTrue;
public class SongsTest extends AbstractTestClass {
@Test
public void queryAlbumSongsTest() {
public void queryAlbumSongsTest() throws Exception {
Uri uri = MediaContract.Songs.buildAlbumSongsListUri(hostInfo.getId(), TestValues.Album.albumId);
Cursor cursor = shadowContentResolver.query(uri, new String[] {MediaProvider.Qualified.SONGS_SONGID}, null, null, null);
Cursor cursor = client.query(uri, new String[] {MediaProvider.Qualified.SONGS_SONGID}, null, null, null);
assertNotNull(cursor);
assertEquals("cursor size ", 17, cursor.getCount());
@ -43,10 +43,10 @@ public class SongsTest extends AbstractTestClass {
}
@Test
public void queryArtistSongsTest() {
public void queryArtistSongsTest() throws Exception {
Uri uri = MediaContract.Songs.buildArtistSongsListUri(hostInfo.getId(), TestValues.ArtistSong.artistId);
Cursor cursor = shadowContentResolver.query(uri, TestValues.ArtistSong.PROJECTION, null, null, null);
Cursor cursor = client.query(uri, TestValues.ArtistSong.PROJECTION, null, null, null);
assertNotNull(cursor);
assertEquals("cursor size ", 17, cursor.getCount());
@ -65,12 +65,12 @@ public class SongsTest extends AbstractTestClass {
}
@Test
public void queryArtistsSongWithArtistWithoutAlbumTest() {
public void queryArtistsSongWithArtistWithoutAlbumTest() throws Exception {
Uri uri = MediaContract.Songs.buildArtistSongsListUri(hostInfo.getId(),
TestValues.SongWithArtistWithoutAlbum.artistId);
Cursor cursor = shadowContentResolver.query(uri, TestValues.SongWithArtistWithoutAlbum.PROJECTION,
null, null, null);
Cursor cursor = client.query(uri, TestValues.SongWithArtistWithoutAlbum.PROJECTION,
null, null, null);
assertNotNull(cursor);
assertEquals("cursor size ", 1, cursor.getCount());
@ -79,30 +79,30 @@ public class SongsTest extends AbstractTestClass {
}
@Test
public void queryFirstArtistSongWithMultipleArtistsTest() {
public void queryFirstArtistSongWithMultipleArtistsTest()throws Exception {
testMultipleArtistInArtistSongsList(TestValues.SongWithMultipleArtists.firstArtistId,
TestValues.SongWithMultipleArtists.songId);
}
@Test
public void querySecondArtistSongWithMultipleArtistsTest() {
public void querySecondArtistSongWithMultipleArtistsTest() throws Exception {
testMultipleArtistInArtistSongsList(TestValues.SongWithMultipleArtists.secondArtistId,
TestValues.SongWithMultipleArtists.songId);
}
@Test
public void queryThirdArtistSongWithMultipleArtistsTest() {
public void queryThirdArtistSongWithMultipleArtistsTest() throws Exception {
testMultipleArtistInArtistSongsList(TestValues.SongWithMultipleArtists.thirdArtistId,
TestValues.SongWithMultipleArtists.songId);
}
@Test
public void queryAllSongsTest() {
public void queryAllSongsTest() throws Exception {
Uri uri = MediaContract.Songs.buildSongsListUri(hostInfo.getId());
Cursor cursor = shadowContentResolver.query(uri,
TestValues.ArtistSong.PROJECTION,
null, null, null);
Cursor cursor = client.query(uri,
TestValues.ArtistSong.PROJECTION,
null, null, null);
assertNotNull(cursor);
assertEquals("cursor size ", 1817, cursor.getCount());
@ -111,12 +111,12 @@ public class SongsTest extends AbstractTestClass {
}
@Test
public void queryAllSongsSongWithAlbumAndArtistTest() {
public void queryAllSongsSongWithAlbumAndArtistTest() throws Exception {
Uri uri = MediaContract.Songs.buildSongsListUri(hostInfo.getId());
Cursor cursor = shadowContentResolver.query(uri,
TestValues.ArtistSong.PROJECTION,
null, null, null);
Cursor cursor = client.query(uri,
TestValues.ArtistSong.PROJECTION,
null, null, null);
assertTrue(CursorUtils.moveCursorToFirstOccurrence(cursor, cursor.getColumnIndex(MediaContract.Songs.SONGID),
TestValues.SongWithAlbumAndArtist.songId));
@ -124,12 +124,12 @@ public class SongsTest extends AbstractTestClass {
}
@Test
public void queryAllSongsSongWithArtistWithoutAlbumTest() {
public void queryAllSongsSongWithArtistWithoutAlbumTest() throws Exception {
Uri uri = MediaContract.Songs.buildSongsListUri(hostInfo.getId());
Cursor cursor = shadowContentResolver.query(uri,
TestValues.ArtistSong.PROJECTION,
null, null, null);
Cursor cursor = client.query(uri,
TestValues.ArtistSong.PROJECTION,
null, null, null);
assertTrue(CursorUtils.moveCursorToFirstOccurrence(cursor, cursor.getColumnIndex(MediaContract.Songs.SONGID),
TestValues.SongWithArtistWithoutAlbum.songId));
@ -137,12 +137,12 @@ public class SongsTest extends AbstractTestClass {
}
@Test
public void queryAllSongsSongWithAlbumWithoutArtistTest() {
public void queryAllSongsSongWithAlbumWithoutArtistTest() throws Exception {
Uri uri = MediaContract.Songs.buildSongsListUri(hostInfo.getId());
Cursor cursor = shadowContentResolver.query(uri,
TestValues.ArtistSong.PROJECTION,
null, null, null);
Cursor cursor = client.query(uri,
TestValues.ArtistSong.PROJECTION,
null, null, null);
assertTrue(CursorUtils.moveCursorToFirstOccurrence(cursor, cursor.getColumnIndex(MediaContract.Songs.SONGID),
TestValues.SongWithAlbumWithoutArtist.songId));
@ -150,12 +150,12 @@ public class SongsTest extends AbstractTestClass {
}
@Test
public void queryAllSongsSongWithMultipleArtistsTest() {
public void queryAllSongsSongWithMultipleArtistsTest() throws Exception {
Uri uri = MediaContract.Songs.buildSongsListUri(hostInfo.getId());
Cursor cursor = shadowContentResolver.query(uri,
TestValues.ArtistSong.PROJECTION,
null, null, null);
Cursor cursor = client.query(uri,
TestValues.ArtistSong.PROJECTION,
null, null, null);
assertTrue(CursorUtils.moveCursorToFirstOccurrence(cursor, cursor.getColumnIndex(MediaContract.Songs.SONGID),
TestValues.SongWithMultipleArtists.songId));
@ -164,12 +164,12 @@ public class SongsTest extends AbstractTestClass {
@Test
public void queryMultidiscAlbumSongsTest() {
public void queryMultidiscAlbumSongsTest() throws Exception {
Uri uri = MediaContract.Songs.buildAlbumSongsListUri(hostInfo.getId(),
TestValues.MultidiscAlbumSongs.albumId);
Cursor cursor = shadowContentResolver.query(uri, TestValues.MultidiscAlbumSongs.PROJECTION,
null, null, null);
Cursor cursor = client.query(uri, TestValues.MultidiscAlbumSongs.PROJECTION,
null, null, null);
assertNotNull(cursor);
assertEquals("cursor size ", 7, cursor.getCount());
@ -177,12 +177,12 @@ public class SongsTest extends AbstractTestClass {
1811, 1817);
}
private void testMultipleArtistInArtistSongsList(int artistId, int songId) {
private void testMultipleArtistInArtistSongsList(int artistId, int songId) throws Exception {
Uri uri = MediaContract.Songs.buildArtistSongsListUri(hostInfo.getId(),
artistId);
Cursor cursor = shadowContentResolver.query(uri, TestValues.SongWithMultipleArtists.PROJECTION,
null, null, null);
Cursor cursor = client.query(uri, TestValues.SongWithMultipleArtists.PROJECTION,
null, null, null);
assertNotNull(cursor);
assertEquals("cursor size ", 2, cursor.getCount());

View File

@ -18,13 +18,14 @@ package org.xbmc.kore.tests.jsonrpc.method;
import android.os.Handler;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.xbmc.kore.BuildConfig;
import org.xbmc.kore.host.HostInfo;
import org.xbmc.kore.jsonrpc.ApiCallback;
import org.xbmc.kore.jsonrpc.HostConnection;
@ -35,13 +36,11 @@ import org.xbmc.kore.testutils.tcpserver.handlers.ApplicationHandler;
import org.xbmc.kore.testutils.tcpserver.handlers.JSONConnectionHandlerManager;
import org.xbmc.kore.utils.RoboThreadRunner;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@RunWith(RobolectricTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 23)
@RunWith(AndroidJUnit4.class)
public class ApplicationTest {
private HostConnection hostConnection;

View File

@ -18,6 +18,8 @@ package org.xbmc.kore.tests.jsonrpc.notifications;
import android.os.Handler;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@ -25,7 +27,6 @@ import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowLog;
import org.xbmc.kore.BuildConfig;
import org.xbmc.kore.host.HostInfo;
import org.xbmc.kore.jsonrpc.ApiCallback;
import org.xbmc.kore.jsonrpc.HostConnection;
@ -39,8 +40,7 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@RunWith(RobolectricTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 23)
@RunWith(AndroidJUnit4.class)
public class ApplicationTest {
private HostConnection hostConnection;

View File

@ -6,7 +6,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.android.tools.build:gradle:3.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View File

@ -1,6 +1,6 @@
#Thu Apr 19 08:59:44 CEST 2018
#Thu May 16 19:46:49 CEST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip