forked from github/wulkanowy-mirror
Merge branch 'hotfix/1.8.2' into develop
This commit is contained in:
commit
09c968f273
6
.github/workflows/test.yml
vendored
6
.github/workflows/test.yml
vendored
@ -2,10 +2,12 @@ name: Tests
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ master, develop ]
|
branches:
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
- 'hotfix/**'
|
||||||
tags: [ '*' ]
|
tags: [ '*' ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master, develop ]
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Wulkanowy
|
# Wulkanowy
|
||||||
|
|
||||||
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/wulkanowy/wulkanowy/Tests/develop?style=flat-square)](https://github.com/wulkanowy/wulkanowy/actions)
|
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/wulkanowy/wulkanowy/test.yml?branch=develop&style=flat-square)](https://github.com/wulkanowy/wulkanowy/actions)
|
||||||
[![Codecov](https://img.shields.io/codecov/c/github/wulkanowy/wulkanowy/master.svg?style=flat-square)](https://codecov.io/gh/wulkanowy/wulkanowy)
|
[![Codecov](https://img.shields.io/codecov/c/github/wulkanowy/wulkanowy/master.svg?style=flat-square)](https://codecov.io/gh/wulkanowy/wulkanowy)
|
||||||
[![Discord](https://img.shields.io/discord/390889354199040011.svg?style=flat-square)](https://discord.gg/vccAQBr)
|
[![Discord](https://img.shields.io/discord/390889354199040011.svg?style=flat-square)](https://discord.gg/vccAQBr)
|
||||||
[![F-Droid](https://img.shields.io/f-droid/v/io.github.wulkanowy.svg?style=flat-square)](https://f-droid.org/packages/io.github.wulkanowy/)
|
[![F-Droid](https://img.shields.io/f-droid/v/io.github.wulkanowy.svg?style=flat-square)](https://f-droid.org/packages/io.github.wulkanowy/)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Wulkanowy
|
# Wulkanowy
|
||||||
|
|
||||||
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/wulkanowy/wulkanowy/Tests/develop?style=flat-square)](https://github.com/wulkanowy/wulkanowy/actions)
|
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/wulkanowy/wulkanowy/test.yml?branch=develop&style=flat-square)](https://github.com/wulkanowy/wulkanowy/actions)
|
||||||
[![Codecov](https://img.shields.io/codecov/c/github/wulkanowy/wulkanowy/master.svg?style=flat-square)](https://codecov.io/gh/wulkanowy/wulkanowy)
|
[![Codecov](https://img.shields.io/codecov/c/github/wulkanowy/wulkanowy/master.svg?style=flat-square)](https://codecov.io/gh/wulkanowy/wulkanowy)
|
||||||
[![Discord](https://img.shields.io/discord/390889354199040011.svg?style=flat-square)](https://discord.gg/vccAQBr)
|
[![Discord](https://img.shields.io/discord/390889354199040011.svg?style=flat-square)](https://discord.gg/vccAQBr)
|
||||||
[![F-Droid](https://img.shields.io/f-droid/v/io.github.wulkanowy.svg?style=flat-square)](https://f-droid.org/packages/io.github.wulkanowy/)
|
[![F-Droid](https://img.shields.io/f-droid/v/io.github.wulkanowy.svg?style=flat-square)](https://f-droid.org/packages/io.github.wulkanowy/)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Wulkanowy
|
# Wulkanowy
|
||||||
|
|
||||||
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/wulkanowy/wulkanowy/Tests/develop?style=flat-square)](https://github.com/wulkanowy/wulkanowy/actions)
|
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/wulkanowy/wulkanowy/test.yml?branch=develop&style=flat-square)](https://github.com/wulkanowy/wulkanowy/actions)
|
||||||
[![Codecov](https://img.shields.io/codecov/c/github/wulkanowy/wulkanowy/master.svg?style=flat-square)](https://codecov.io/gh/wulkanowy/wulkanowy)
|
[![Codecov](https://img.shields.io/codecov/c/github/wulkanowy/wulkanowy/master.svg?style=flat-square)](https://codecov.io/gh/wulkanowy/wulkanowy)
|
||||||
[![Discord](https://img.shields.io/discord/390889354199040011.svg?style=flat-square)](https://discord.gg/vccAQBr)
|
[![Discord](https://img.shields.io/discord/390889354199040011.svg?style=flat-square)](https://discord.gg/vccAQBr)
|
||||||
[![F-Droid](https://img.shields.io/f-droid/v/io.github.wulkanowy.svg?style=flat-square)](https://f-droid.org/packages/io.github.wulkanowy/)
|
[![F-Droid](https://img.shields.io/f-droid/v/io.github.wulkanowy.svg?style=flat-square)](https://f-droid.org/packages/io.github.wulkanowy/)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Wulkanowy
|
# Wulkanowy
|
||||||
|
|
||||||
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/wulkanowy/wulkanowy/Tests/develop?style=flat-square)](https://github.com/wulkanowy/wulkanowy/actions)
|
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/wulkanowy/wulkanowy/test.yml?branch=develop&style=flat-square)](https://github.com/wulkanowy/wulkanowy/actions)
|
||||||
[![Codecov](https://img.shields.io/codecov/c/github/wulkanowy/wulkanowy/master.svg?style=flat-square)](https://codecov.io/gh/wulkanowy/wulkanowy)
|
[![Codecov](https://img.shields.io/codecov/c/github/wulkanowy/wulkanowy/master.svg?style=flat-square)](https://codecov.io/gh/wulkanowy/wulkanowy)
|
||||||
[![Discord](https://img.shields.io/discord/390889354199040011.svg?style=flat-square)](https://discord.gg/vccAQBr)
|
[![Discord](https://img.shields.io/discord/390889354199040011.svg?style=flat-square)](https://discord.gg/vccAQBr)
|
||||||
[![F-Droid](https://img.shields.io/f-droid/v/io.github.wulkanowy.svg?style=flat-square)](https://f-droid.org/packages/io.github.wulkanowy/)
|
[![F-Droid](https://img.shields.io/f-droid/v/io.github.wulkanowy.svg?style=flat-square)](https://f-droid.org/packages/io.github.wulkanowy/)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Wulkanowy
|
# Wulkanowy
|
||||||
|
|
||||||
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/wulkanowy/wulkanowy/Tests/develop?style=flat-square)](https://github.com/wulkanowy/wulkanowy/actions)
|
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/wulkanowy/wulkanowy/test.yml?branch=develop&style=flat-square)](https://github.com/wulkanowy/wulkanowy/actions)
|
||||||
[![Codecov](https://img.shields.io/codecov/c/github/wulkanowy/wulkanowy/master.svg?style=flat-square)](https://codecov.io/gh/wulkanowy/wulkanowy)
|
[![Codecov](https://img.shields.io/codecov/c/github/wulkanowy/wulkanowy/master.svg?style=flat-square)](https://codecov.io/gh/wulkanowy/wulkanowy)
|
||||||
[![Discord](https://img.shields.io/discord/390889354199040011.svg?style=flat-square)](https://discord.gg/vccAQBr)
|
[![Discord](https://img.shields.io/discord/390889354199040011.svg?style=flat-square)](https://discord.gg/vccAQBr)
|
||||||
[![F-Droid](https://img.shields.io/f-droid/v/io.github.wulkanowy.svg?style=flat-square)](https://f-droid.org/packages/io.github.wulkanowy/)
|
[![F-Droid](https://img.shields.io/f-droid/v/io.github.wulkanowy.svg?style=flat-square)](https://f-droid.org/packages/io.github.wulkanowy/)
|
||||||
|
@ -23,8 +23,8 @@ android {
|
|||||||
testApplicationId "io.github.tests.wulkanowy"
|
testApplicationId "io.github.tests.wulkanowy"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 33
|
targetSdkVersion 33
|
||||||
versionCode 116
|
versionCode 117
|
||||||
versionName "1.8.1"
|
versionName "1.8.2"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
resValue "string", "app_name", "Wulkanowy"
|
resValue "string", "app_name", "Wulkanowy"
|
||||||
@ -162,7 +162,7 @@ play {
|
|||||||
track = 'production'
|
track = 'production'
|
||||||
releaseStatus = com.github.triplet.gradle.androidpublisher.ReleaseStatus.IN_PROGRESS
|
releaseStatus = com.github.triplet.gradle.androidpublisher.ReleaseStatus.IN_PROGRESS
|
||||||
userFraction = 0.10d
|
userFraction = 0.10d
|
||||||
updatePriority = 4
|
updatePriority = 5
|
||||||
enabled.set(false)
|
enabled.set(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ ext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "io.github.wulkanowy:sdk:1.8.1"
|
implementation "io.github.wulkanowy:sdk:1.8.2"
|
||||||
|
|
||||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.8'
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.8'
|
||||||
|
|
||||||
|
2439
app/schemas/io.github.wulkanowy.data.db.AppDatabase/54.json
Normal file
2439
app/schemas/io.github.wulkanowy.data.db.AppDatabase/54.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -56,7 +56,7 @@ import javax.inject.Singleton
|
|||||||
abstract class AppDatabase : RoomDatabase() {
|
abstract class AppDatabase : RoomDatabase() {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val VERSION_SCHEMA = 53
|
const val VERSION_SCHEMA = 54
|
||||||
|
|
||||||
fun getMigrations(sharedPrefProvider: SharedPrefProvider, appInfo: AppInfo) = arrayOf(
|
fun getMigrations(sharedPrefProvider: SharedPrefProvider, appInfo: AppInfo) = arrayOf(
|
||||||
Migration2(),
|
Migration2(),
|
||||||
@ -107,6 +107,7 @@ abstract class AppDatabase : RoomDatabase() {
|
|||||||
Migration50(),
|
Migration50(),
|
||||||
Migration51(),
|
Migration51(),
|
||||||
Migration53(),
|
Migration53(),
|
||||||
|
Migration54(),
|
||||||
)
|
)
|
||||||
|
|
||||||
fun newInstance(
|
fun newInstance(
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
package io.github.wulkanowy.data.db.migrations
|
||||||
|
|
||||||
|
import androidx.room.migration.Migration
|
||||||
|
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||||
|
|
||||||
|
class Migration54 : Migration(53, 54) {
|
||||||
|
|
||||||
|
override fun migrate(database: SupportSQLiteDatabase) {
|
||||||
|
migrateResman(database)
|
||||||
|
removeTomaszowMazowieckiStudents(database)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun migrateResman(database: SupportSQLiteDatabase) {
|
||||||
|
database.execSQL("""
|
||||||
|
UPDATE Students SET
|
||||||
|
scrapper_base_url = 'https://vulcan.net.pl',
|
||||||
|
login_type = 'ADFSLightScoped',
|
||||||
|
symbol = 'rzeszowprojekt'
|
||||||
|
WHERE scrapper_base_url = 'https://resman.pl'
|
||||||
|
""".trimIndent())
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun removeTomaszowMazowieckiStudents(database: SupportSQLiteDatabase) {
|
||||||
|
database.execSQL("DELETE FROM Students WHERE symbol = 'tomaszowmazowiecki'")
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,7 @@
|
|||||||
Wersja 1.8.1
|
Wersja 1.8.2
|
||||||
|
|
||||||
- naprawiliśmy liczenie średniej ucznia w ocenach klasy dla wykresu "Wszystkie"
|
- naprawiliśmy logowanie dla użytkowników systemu Resman Rzeszów
|
||||||
- zmieniliśmy kolejność przycisków akcji w podglądzie wiadomości
|
- dodaliśmy wsparcie dla nowej platformy z Tomaszowa Mazowieckiego
|
||||||
- ulepszyliśmy oznaczenie nieodczytanych wiadomości
|
- naprawiliśmy literówkę w tytule wiadomości z szablonem usprawiedliwienia
|
||||||
- naprawiliśmy pokazywanie informacji o odczytanej wiadomości w wysłanych
|
|
||||||
- dodaliśmy opcję ręcznego wybierania skrzynki pocztowej
|
|
||||||
|
|
||||||
Pełna lista zmian: https://github.com/wulkanowy/wulkanowy/releases
|
Pełna lista zmian: https://github.com/wulkanowy/wulkanowy/releases
|
||||||
|
@ -6,8 +6,9 @@
|
|||||||
<item>Gdańska Platforma Edukacyjna</item>
|
<item>Gdańska Platforma Edukacyjna</item>
|
||||||
<item>Lubelski Portal Oświatowy</item>
|
<item>Lubelski Portal Oświatowy</item>
|
||||||
<item>EduNet Miasta Tarnowa</item>
|
<item>EduNet Miasta Tarnowa</item>
|
||||||
<item>ResMan Rzeszów</item>
|
|
||||||
<item>Platforma Edukacyjna Koszalina</item>
|
<item>Platforma Edukacyjna Koszalina</item>
|
||||||
|
<item>Gmina-miasto Tomaszów Mazowiecki - System zarządzania oświatą</item>
|
||||||
|
<item>ResMan Rzeszów</item>
|
||||||
<item>Rawa Mazowiecka - Platforma vEdukacja</item>
|
<item>Rawa Mazowiecka - Platforma vEdukacja</item>
|
||||||
<item>Zduńska Wola - e-Urząd</item>
|
<item>Zduńska Wola - e-Urząd</item>
|
||||||
<item>Sieradz - Portal oświatowy</item>
|
<item>Sieradz - Portal oświatowy</item>
|
||||||
@ -27,7 +28,6 @@
|
|||||||
<item>https://edu.gdansk.pl</item>
|
<item>https://edu.gdansk.pl</item>
|
||||||
<item>https://edu.lublin.eu</item>
|
<item>https://edu.lublin.eu</item>
|
||||||
<item>https://umt.tarnow.pl</item>
|
<item>https://umt.tarnow.pl</item>
|
||||||
<item>https://resman.pl</item>
|
|
||||||
<item>https://eduportal.koszalin.pl</item>
|
<item>https://eduportal.koszalin.pl</item>
|
||||||
<item>https://vulcan.net.pl/?login</item>
|
<item>https://vulcan.net.pl/?login</item>
|
||||||
<item>https://vulcan.net.pl/?login</item>
|
<item>https://vulcan.net.pl/?login</item>
|
||||||
@ -40,6 +40,8 @@
|
|||||||
<item>https://vulcan.net.pl/?login</item>
|
<item>https://vulcan.net.pl/?login</item>
|
||||||
<item>https://vulcan.net.pl/?login</item>
|
<item>https://vulcan.net.pl/?login</item>
|
||||||
<item>https://vulcan.net.pl/?login</item>
|
<item>https://vulcan.net.pl/?login</item>
|
||||||
|
<item>https://vulcan.net.pl/?login</item>
|
||||||
|
<item>https://vulcan.net.pl/?login</item>
|
||||||
<item>https://fakelog.cf/?email</item>
|
<item>https://fakelog.cf/?email</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="hosts_symbols">
|
<string-array name="hosts_symbols">
|
||||||
@ -48,8 +50,9 @@
|
|||||||
<item>gdansk</item>
|
<item>gdansk</item>
|
||||||
<item>lublin</item>
|
<item>lublin</item>
|
||||||
<item>tarnow</item>
|
<item>tarnow</item>
|
||||||
<item>rzeszow</item>
|
|
||||||
<item>koszalin</item>
|
<item>koszalin</item>
|
||||||
|
<item>tomaszowmazowieckiprojekt</item>
|
||||||
|
<item>rzeszowprojekt</item>
|
||||||
<item>rawamazowiecka</item>
|
<item>rawamazowiecka</item>
|
||||||
<item>zdunskawola</item>
|
<item>zdunskawola</item>
|
||||||
<item>sieradz</item>
|
<item>sieradz</item>
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,7 @@ package io.github.wulkanowy.data.db.migrations
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import androidx.room.Room
|
import androidx.room.Room
|
||||||
|
import androidx.room.migration.Migration
|
||||||
import androidx.room.testing.MigrationTestHelper
|
import androidx.room.testing.MigrationTestHelper
|
||||||
import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory
|
import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory
|
||||||
import androidx.test.core.app.ApplicationProvider
|
import androidx.test.core.app.ApplicationProvider
|
||||||
@ -16,7 +17,7 @@ abstract class AbstractMigrationTest {
|
|||||||
|
|
||||||
val dbName = "migration-test"
|
val dbName = "migration-test"
|
||||||
|
|
||||||
val context: Context get() = ApplicationProvider.getApplicationContext()
|
private val context: Context get() = ApplicationProvider.getApplicationContext()
|
||||||
|
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val helper: MigrationTestHelper = MigrationTestHelper(
|
val helper: MigrationTestHelper = MigrationTestHelper(
|
||||||
@ -25,6 +26,10 @@ abstract class AbstractMigrationTest {
|
|||||||
FrameworkSQLiteOpenHelperFactory()
|
FrameworkSQLiteOpenHelperFactory()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fun runMigrationsAndValidate(migration: Migration) {
|
||||||
|
helper.runMigrationsAndValidate(dbName, migration.endVersion, true, migration).close()
|
||||||
|
}
|
||||||
|
|
||||||
fun getMigratedRoomDatabase(): AppDatabase {
|
fun getMigratedRoomDatabase(): AppDatabase {
|
||||||
val database = Room.databaseBuilder(
|
val database = Room.databaseBuilder(
|
||||||
ApplicationProvider.getApplicationContext(),
|
ApplicationProvider.getApplicationContext(),
|
||||||
|
@ -33,7 +33,7 @@ class Migration12Test : AbstractMigrationTest() {
|
|||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
|
|
||||||
helper.runMigrationsAndValidate(dbName, 12, true, Migration12())
|
runMigrationsAndValidate(Migration12())
|
||||||
|
|
||||||
val db = getMigratedRoomDatabase()
|
val db = getMigratedRoomDatabase()
|
||||||
val students = runBlocking { db.studentDao.loadAll() }
|
val students = runBlocking { db.studentDao.loadAll() }
|
||||||
@ -49,6 +49,7 @@ class Migration12Test : AbstractMigrationTest() {
|
|||||||
assertEquals(2, studentId)
|
assertEquals(2, studentId)
|
||||||
assertEquals(6, classId)
|
assertEquals(6, classId)
|
||||||
}
|
}
|
||||||
|
db.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -62,7 +63,7 @@ class Migration12Test : AbstractMigrationTest() {
|
|||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
|
|
||||||
helper.runMigrationsAndValidate(dbName, 12, true, Migration12())
|
runMigrationsAndValidate(Migration12())
|
||||||
|
|
||||||
val db = getMigratedRoomDatabase()
|
val db = getMigratedRoomDatabase()
|
||||||
val students = runBlocking { db.studentDao.loadAll() }
|
val students = runBlocking { db.studentDao.loadAll() }
|
||||||
@ -73,6 +74,7 @@ class Migration12Test : AbstractMigrationTest() {
|
|||||||
assertEquals(2, studentId)
|
assertEquals(2, studentId)
|
||||||
assertEquals(1, classId)
|
assertEquals(1, classId)
|
||||||
}
|
}
|
||||||
|
db.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -88,7 +90,7 @@ class Migration12Test : AbstractMigrationTest() {
|
|||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
|
|
||||||
helper.runMigrationsAndValidate(dbName, 12, true, Migration12())
|
runMigrationsAndValidate(Migration12())
|
||||||
|
|
||||||
val db = getMigratedRoomDatabase()
|
val db = getMigratedRoomDatabase()
|
||||||
val students = runBlocking { db.studentDao.loadAll() }
|
val students = runBlocking { db.studentDao.loadAll() }
|
||||||
@ -107,6 +109,7 @@ class Migration12Test : AbstractMigrationTest() {
|
|||||||
assertEquals(studentId, 3)
|
assertEquals(studentId, 3)
|
||||||
assertEquals(true, isCurrent)
|
assertEquals(true, isCurrent)
|
||||||
}
|
}
|
||||||
|
db.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createStudent(db: SupportSQLiteDatabase, studentId: Int, isCurrent: Boolean) {
|
private fun createStudent(db: SupportSQLiteDatabase, studentId: Int, isCurrent: Boolean) {
|
||||||
|
@ -57,6 +57,8 @@ class Migration13Test : AbstractMigrationTest() {
|
|||||||
assertEquals("C", className)
|
assertEquals("C", className)
|
||||||
assertEquals("Publiczna szkoła Wulkanowego-fejka nr 2 w fakelog.cf", schoolName)
|
assertEquals("Publiczna szkoła Wulkanowego-fejka nr 2 w fakelog.cf", schoolName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
db.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -85,6 +87,8 @@ class Migration13Test : AbstractMigrationTest() {
|
|||||||
assertEquals("", className)
|
assertEquals("", className)
|
||||||
assertEquals("Publiczna szkoła Wulkanowego-fejka nr 1 w fakelog.cf", schoolName)
|
assertEquals("Publiczna szkoła Wulkanowego-fejka nr 1 w fakelog.cf", schoolName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
db.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -148,6 +152,7 @@ class Migration13Test : AbstractMigrationTest() {
|
|||||||
assertFalse(semesters[2].second)
|
assertFalse(semesters[2].second)
|
||||||
assertTrue(semesters[3].second)
|
assertTrue(semesters[3].second)
|
||||||
}
|
}
|
||||||
|
db.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getSemesters(db: SupportSQLiteDatabase, query: String): List<Pair<Semester, Boolean>> {
|
private fun getSemesters(db: SupportSQLiteDatabase, query: String): List<Pair<Semester, Boolean>> {
|
||||||
|
@ -27,7 +27,7 @@ class Migration27Test : AbstractMigrationTest() {
|
|||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
|
|
||||||
helper.runMigrationsAndValidate(dbName, 27, true, Migration27())
|
runMigrationsAndValidate(Migration27())
|
||||||
|
|
||||||
val db = getMigratedRoomDatabase()
|
val db = getMigratedRoomDatabase()
|
||||||
val students = runBlocking { db.studentDao.loadAll() }
|
val students = runBlocking { db.studentDao.loadAll() }
|
||||||
@ -39,6 +39,8 @@ class Migration27Test : AbstractMigrationTest() {
|
|||||||
assertEquals(123, userLoginId)
|
assertEquals(123, userLoginId)
|
||||||
assertEquals("Student Jan", userName)
|
assertEquals("Student Jan", userName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
db.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -49,7 +51,7 @@ class Migration27Test : AbstractMigrationTest() {
|
|||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
|
|
||||||
helper.runMigrationsAndValidate(dbName, 27, true, Migration27())
|
runMigrationsAndValidate(Migration27())
|
||||||
|
|
||||||
val db = getMigratedRoomDatabase()
|
val db = getMigratedRoomDatabase()
|
||||||
val students = runBlocking { db.studentDao.loadAll() }
|
val students = runBlocking { db.studentDao.loadAll() }
|
||||||
@ -61,6 +63,8 @@ class Migration27Test : AbstractMigrationTest() {
|
|||||||
assertEquals(2, userLoginId)
|
assertEquals(2, userLoginId)
|
||||||
assertEquals("Unit Jan", userName)
|
assertEquals("Unit Jan", userName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
db.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -73,7 +77,7 @@ class Migration27Test : AbstractMigrationTest() {
|
|||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
|
|
||||||
helper.runMigrationsAndValidate(dbName, 27, true, Migration27())
|
runMigrationsAndValidate(Migration27())
|
||||||
|
|
||||||
val db = getMigratedRoomDatabase()
|
val db = getMigratedRoomDatabase()
|
||||||
val students = runBlocking { db.studentDao.loadAll() }
|
val students = runBlocking { db.studentDao.loadAll() }
|
||||||
@ -90,6 +94,8 @@ class Migration27Test : AbstractMigrationTest() {
|
|||||||
assertEquals(333, userLoginId)
|
assertEquals(333, userLoginId)
|
||||||
assertEquals("Unit Tomasz", userName)
|
assertEquals("Unit Tomasz", userName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
db.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createStudent(db: SupportSQLiteDatabase, id: Long, userLoginId: Int, studentName: String) {
|
private fun createStudent(db: SupportSQLiteDatabase, id: Long, userLoginId: Int, studentName: String) {
|
||||||
|
@ -29,7 +29,7 @@ class Migration35Test : AbstractMigrationTest() {
|
|||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
|
|
||||||
helper.runMigrationsAndValidate(dbName, 35, true, Migration35(AppInfo()))
|
runMigrationsAndValidate(Migration35(AppInfo()))
|
||||||
|
|
||||||
val db = getMigratedRoomDatabase()
|
val db = getMigratedRoomDatabase()
|
||||||
val students = runBlocking { db.studentDao.loadAll() }
|
val students = runBlocking { db.studentDao.loadAll() }
|
||||||
@ -38,6 +38,8 @@ class Migration35Test : AbstractMigrationTest() {
|
|||||||
|
|
||||||
assertTrue { students[0].avatarColor in AppInfo().defaultColorsForAvatar }
|
assertTrue { students[0].avatarColor in AppInfo().defaultColorsForAvatar }
|
||||||
assertTrue { students[1].avatarColor in AppInfo().defaultColorsForAvatar }
|
assertTrue { students[1].avatarColor in AppInfo().defaultColorsForAvatar }
|
||||||
|
|
||||||
|
db.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createStudent(db: SupportSQLiteDatabase, id: Long) {
|
private fun createStudent(db: SupportSQLiteDatabase, id: Long) {
|
||||||
|
@ -0,0 +1,130 @@
|
|||||||
|
package io.github.wulkanowy.data.db.migrations
|
||||||
|
|
||||||
|
import android.content.ContentValues
|
||||||
|
import android.database.sqlite.SQLiteDatabase
|
||||||
|
import android.os.Build
|
||||||
|
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||||
|
import dagger.hilt.android.testing.HiltAndroidTest
|
||||||
|
import dagger.hilt.android.testing.HiltTestApplication
|
||||||
|
import io.github.wulkanowy.sdk.Sdk
|
||||||
|
import io.github.wulkanowy.sdk.Sdk.ScrapperLoginType.*
|
||||||
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
|
import kotlinx.coroutines.test.runTest
|
||||||
|
import org.junit.Test
|
||||||
|
import org.junit.runner.RunWith
|
||||||
|
import org.robolectric.RobolectricTestRunner
|
||||||
|
import org.robolectric.annotation.Config
|
||||||
|
import kotlin.random.Random
|
||||||
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
|
@HiltAndroidTest
|
||||||
|
@RunWith(RobolectricTestRunner::class)
|
||||||
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
|
@Config(sdk = [Build.VERSION_CODES.O_MR1], application = HiltTestApplication::class)
|
||||||
|
class Migration54Test : AbstractMigrationTest() {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `don't touch unrelated students`() = runTest {
|
||||||
|
with(helper.createDatabase(dbName, 53)) {
|
||||||
|
createStudent(1, STANDARD, "vulcan.net.pl", "rzeszow", "Jan Michniewicz")
|
||||||
|
createStudent(2, ADFSLight, "umt.tarnow.pl", "tarnow", "Joanna Marcinkiewicz")
|
||||||
|
close()
|
||||||
|
}
|
||||||
|
|
||||||
|
runMigrationsAndValidate(Migration54())
|
||||||
|
val db = getMigratedRoomDatabase()
|
||||||
|
val students = db.studentDao.loadAll()
|
||||||
|
|
||||||
|
assertEquals(2, students.size)
|
||||||
|
with(students[0]) {
|
||||||
|
assertEquals(STANDARD.name, loginType)
|
||||||
|
assertEquals("https://vulcan.net.pl", scrapperBaseUrl)
|
||||||
|
assertEquals("rzeszow", symbol)
|
||||||
|
}
|
||||||
|
with(students[1]) {
|
||||||
|
assertEquals(ADFSLight.name, loginType)
|
||||||
|
assertEquals("https://umt.tarnow.pl", scrapperBaseUrl)
|
||||||
|
assertEquals("tarnow", symbol)
|
||||||
|
}
|
||||||
|
db.close()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `remove tomaszow mazowiecki students`() = runTest {
|
||||||
|
with(helper.createDatabase(dbName, 53)) {
|
||||||
|
createStudent(1, STANDARD, "vulcan.net.pl", "rzeszow", "Jan Michniewicz")
|
||||||
|
createStudent(2, STANDARD, "vulcan.net.pl", "tomaszowmazowiecki", "Joanna Stec")
|
||||||
|
createStudent(3, STANDARD, "vulcan.net.pl", "tomaszowmazowiecki", "Kacper Morawiecki")
|
||||||
|
close()
|
||||||
|
}
|
||||||
|
|
||||||
|
runMigrationsAndValidate(Migration54())
|
||||||
|
val db = getMigratedRoomDatabase()
|
||||||
|
val students = db.studentDao.loadAll()
|
||||||
|
assertEquals(1, students.size)
|
||||||
|
with(students[0]) {
|
||||||
|
assertEquals("rzeszow", symbol)
|
||||||
|
}
|
||||||
|
db.close()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `migrate resman students`() = runTest {
|
||||||
|
with(helper.createDatabase(dbName, 53)) {
|
||||||
|
createStudent(1, ADFSLight, "resman.pl", "rzeszow", "Joanna Stec")
|
||||||
|
createStudent(2, ADFSLight, "resman.pl", "rzeszow", "Kacper Morawiecki")
|
||||||
|
createStudent(3, STANDARD, "vulcan.net.pl", "rzeszow", "Jan Michniewicz")
|
||||||
|
close()
|
||||||
|
}
|
||||||
|
runMigrationsAndValidate(Migration54())
|
||||||
|
val db = getMigratedRoomDatabase()
|
||||||
|
val students = db.studentDao.loadAll()
|
||||||
|
assertEquals(3, students.size)
|
||||||
|
with(students[0]) {
|
||||||
|
assertEquals(ADFSLightScoped.name, loginType)
|
||||||
|
assertEquals("https://vulcan.net.pl", scrapperBaseUrl)
|
||||||
|
assertEquals("rzeszowprojekt", symbol)
|
||||||
|
}
|
||||||
|
with(students[1]) {
|
||||||
|
assertEquals(ADFSLightScoped.name, loginType)
|
||||||
|
assertEquals("https://vulcan.net.pl", scrapperBaseUrl)
|
||||||
|
assertEquals("rzeszowprojekt", symbol)
|
||||||
|
}
|
||||||
|
db.close()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun SupportSQLiteDatabase.createStudent(
|
||||||
|
id: Long,
|
||||||
|
loginType: Sdk.ScrapperLoginType,
|
||||||
|
host: String,
|
||||||
|
symbol: String,
|
||||||
|
studentName: String,
|
||||||
|
) {
|
||||||
|
insert("Students", SQLiteDatabase.CONFLICT_FAIL, ContentValues().apply {
|
||||||
|
put("scrapper_base_url", "https://$host")
|
||||||
|
put("mobile_base_url", "")
|
||||||
|
put("login_type", loginType.name)
|
||||||
|
put("login_mode", "SCRAPPER")
|
||||||
|
put("certificate_key", "")
|
||||||
|
put("private_key", "")
|
||||||
|
put("is_parent", false)
|
||||||
|
put("email", "jan@fakelog.cf")
|
||||||
|
put("password", "******")
|
||||||
|
put("symbol", symbol)
|
||||||
|
put("student_id", Random.nextInt())
|
||||||
|
put("user_login_id", id)
|
||||||
|
put("user_name", studentName)
|
||||||
|
put("student_name", studentName)
|
||||||
|
put("school_id", "123")
|
||||||
|
put("school_short", "")
|
||||||
|
put("school_name", "")
|
||||||
|
put("class_name", "")
|
||||||
|
put("class_id", Random.nextInt())
|
||||||
|
put("is_current", false)
|
||||||
|
put("registration_date", "0")
|
||||||
|
put("id", id)
|
||||||
|
put("nick", "")
|
||||||
|
put("avatar_color", "")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
@ -31,6 +31,7 @@ allprojects {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
google()
|
google()
|
||||||
maven { url "https://jitpack.io" }
|
maven { url "https://jitpack.io" }
|
||||||
|
maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" }
|
||||||
maven { url "https://developer.huawei.com/repo/" }
|
maven { url "https://developer.huawei.com/repo/" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user