Update dependencies
This commit is contained in:
parent
70274ceaf7
commit
f1f2e17822
10 changed files with 126 additions and 90 deletions
|
@ -4,37 +4,37 @@ jobs:
|
|||
test:
|
||||
working_directory: ~/sdk
|
||||
docker:
|
||||
- image: circleci/openjdk:8-jdk-stretch
|
||||
- image: circleci/openjdk:8-jdk-stretch
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- checkout
|
||||
|
||||
- restore_cache:
|
||||
key: cache-{{ checksum "build.gradle" }}
|
||||
- restore_cache:
|
||||
key: cache-{{ checksum "build.gradle" }}
|
||||
|
||||
- run: ./gradlew build -x check --no-daemon --stacktrace --console=plain -PdisablePreDex
|
||||
- run: ./gradlew build -x check --no-daemon --stacktrace --console=plain -PdisablePreDex
|
||||
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/.gradle
|
||||
key: cache-{{ checksum "build.gradle" }}
|
||||
- run: ./gradlew check jacocoTestReport --no-daemon --stacktrace --console=plain -PdisablePreDex
|
||||
|
||||
- run: ./gradlew check jacocoTestReport --no-daemon --stacktrace --console=plain -PdisablePreDex
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/.gradle
|
||||
key: cache-{{ checksum "build.gradle" }}
|
||||
|
||||
- run: bash <(curl -s https://codecov.io/bash)
|
||||
- run: bash <(curl -s https://codecov.io/bash)
|
||||
|
||||
- store_test_results:
|
||||
path: ./build/test-results
|
||||
- store_test_results:
|
||||
path: ./build/test-results
|
||||
|
||||
- store_artifacts:
|
||||
path: ./build/reports/jacoco/test
|
||||
- store_artifacts:
|
||||
path: ./build/reports/jacoco/test
|
||||
|
||||
- store_artifacts:
|
||||
path: ./build/libs/sdk-0.1.0-SNAPSHOT.jar
|
||||
- store_artifacts:
|
||||
path: ./build/libs/sdk-0.1.0-SNAPSHOT.jar
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
|
||||
test:
|
||||
jobs:
|
||||
- test
|
||||
- test
|
||||
|
|
30
.gitignore
vendored
30
.gitignore
vendored
|
@ -1,5 +1,32 @@
|
|||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
.idea/
|
||||
|
||||
.gradle
|
||||
/build/
|
||||
/out/
|
||||
|
||||
# Ignore Gradle GUI config
|
||||
gradle-app.setting
|
||||
|
@ -13,5 +40,4 @@ gradle-app.setting
|
|||
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
|
||||
# gradle/wrapper/gradle-wrapper.properties
|
||||
|
||||
.idea/
|
||||
out/
|
||||
*iml
|
||||
|
|
59
build.gradle
59
build.gradle
|
@ -1,24 +1,12 @@
|
|||
buildscript {
|
||||
ext.kotlin_version = '1.2.51'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.2.61'
|
||||
id 'jacoco'
|
||||
}
|
||||
|
||||
group 'io.github.wulkanowy'
|
||||
version '0.1.0-SNAPSHOT'
|
||||
|
||||
apply plugin: 'kotlin'
|
||||
apply plugin: 'jacoco'
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
|
||||
repositories {
|
||||
|
@ -27,21 +15,25 @@ repositories {
|
|||
maven { url "https://jitpack.io" }
|
||||
}
|
||||
|
||||
ext {
|
||||
okhttp3 = "3.11.0"
|
||||
retrofit = "2.4.0"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
||||
|
||||
implementation 'com.github.VLO-GDA:uonet-sdk:master-SNAPSHOT'
|
||||
|
||||
implementation 'com.google.code.gson:gson:2.8.2'
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
|
||||
implementation 'com.google.code.gson:gson:2.8.5'
|
||||
implementation "com.squareup.retrofit2:retrofit:$retrofit"
|
||||
implementation "com.squareup.retrofit2:converter-gson:$retrofit"
|
||||
|
||||
implementation 'io.reactivex:rxjava:1.1.6'
|
||||
implementation 'io.reactivex:rxandroid:1.2.1'
|
||||
implementation 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
|
||||
implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'
|
||||
implementation "com.squareup.retrofit2:retrofit:$retrofit"
|
||||
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofit"
|
||||
implementation "com.squareup.okhttp3:logging-interceptor:$okhttp3"
|
||||
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
|
||||
testImplementation group: 'junit', name: 'junit', version: '4.12'
|
||||
testImplementation "junit:junit:4.12"
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
|
@ -54,6 +46,23 @@ compileTestKotlin {
|
|||
jacocoTestReport {
|
||||
reports {
|
||||
xml.enabled true
|
||||
html.enabled true
|
||||
}
|
||||
}
|
||||
test {
|
||||
testLogging.showStandardStreams = true
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||
classifier = 'sources'
|
||||
from sourceSets.main.allSource
|
||||
}
|
||||
|
||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||
classifier = 'javadoc'
|
||||
from javadoc.destinationDir
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
archives javadocJar
|
||||
}
|
||||
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
#Tue Jun 26 18:52:30 CEST 2018
|
||||
#Fri Aug 17 17:01:44 CEST 2018
|
||||
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-4.8-all.zip
|
||||
|
|
|
@ -16,9 +16,9 @@ import io.github.wulkanowy.sdk.notes.Note
|
|||
import io.github.wulkanowy.sdk.notes.NotesRequest
|
||||
import io.github.wulkanowy.sdk.timetable.Lesson
|
||||
import io.github.wulkanowy.sdk.timetable.TimetableRequest
|
||||
import io.reactivex.Observable
|
||||
import retrofit2.http.Body
|
||||
import retrofit2.http.POST
|
||||
import rx.Observable
|
||||
|
||||
interface MobileApi {
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@ import io.github.wulkanowy.sdk.base.ApiResponse
|
|||
import io.github.wulkanowy.sdk.register.CertificateRequest
|
||||
import io.github.wulkanowy.sdk.register.CertificateResponse
|
||||
import io.github.wulkanowy.sdk.register.Student
|
||||
import io.reactivex.Observable
|
||||
import retrofit2.http.Body
|
||||
import retrofit2.http.Headers
|
||||
import retrofit2.http.POST
|
||||
import rx.Observable
|
||||
|
||||
interface RegisterApi {
|
||||
|
||||
|
|
|
@ -18,12 +18,12 @@ import io.github.wulkanowy.sdk.notes.Note
|
|||
import io.github.wulkanowy.sdk.notes.NotesRequest
|
||||
import io.github.wulkanowy.sdk.timetable.Lesson
|
||||
import io.github.wulkanowy.sdk.timetable.TimetableRequest
|
||||
import io.reactivex.Observable
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.logging.HttpLoggingInterceptor
|
||||
import retrofit2.Retrofit
|
||||
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory
|
||||
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
|
||||
import retrofit2.converter.gson.GsonConverterFactory
|
||||
import rx.Observable
|
||||
|
||||
class MobileRepository(private val host: String, private val symbol: String, private val signature: String,
|
||||
private val certificate: String, private val reportingUnitSymbol: String) {
|
||||
|
@ -62,7 +62,7 @@ class MobileRepository(private val host: String, private val symbol: String, pri
|
|||
private fun getMobileApi(): MobileApi {
|
||||
return Retrofit.Builder()
|
||||
.baseUrl("$host/$symbol/$reportingUnitSymbol/mobile-api/Uczen.v3.Uczen/")
|
||||
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
|
||||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.client(OkHttpClient().newBuilder()
|
||||
.addInterceptor(HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY))
|
||||
|
|
|
@ -7,12 +7,12 @@ import io.github.wulkanowy.sdk.interfaces.RegisterApi
|
|||
import io.github.wulkanowy.sdk.register.CertificateRequest
|
||||
import io.github.wulkanowy.sdk.register.CertificateResponse
|
||||
import io.github.wulkanowy.sdk.register.Student
|
||||
import io.reactivex.Observable
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.logging.HttpLoggingInterceptor
|
||||
import retrofit2.Retrofit
|
||||
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory
|
||||
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
|
||||
import retrofit2.converter.gson.GsonConverterFactory
|
||||
import rx.Observable
|
||||
|
||||
class RegisterRepository(private val host: String, private val symbol: String, var signature: String = "", var certificate: String = "") {
|
||||
|
||||
|
@ -25,7 +25,7 @@ class RegisterRepository(private val host: String, private val symbol: String, v
|
|||
private fun getRegisterApi(): RegisterApi {
|
||||
return Retrofit.Builder()
|
||||
.baseUrl("$host/$symbol/mobile-api/Uczen.v3.UczenStart/")
|
||||
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
|
||||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.client(OkHttpClient().newBuilder()
|
||||
.addInterceptor(HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY))
|
||||
|
|
|
@ -12,9 +12,9 @@ import io.github.wulkanowy.sdk.register.Student
|
|||
import io.github.wulkanowy.sdk.repository.MobileRepository
|
||||
import io.github.wulkanowy.sdk.repository.RegisterRepository
|
||||
import io.github.wulkanowy.sdk.timetable.Lesson
|
||||
import io.reactivex.observers.TestObserver
|
||||
import junit.framework.TestCase.assertEquals
|
||||
import org.junit.Test
|
||||
import rx.observers.TestSubscriber
|
||||
|
||||
const val DEVICE_NAME = "Wulkanowy#client"
|
||||
const val HOST = "https://api.fakelog.cf"
|
||||
|
@ -29,85 +29,86 @@ class UonetTest {
|
|||
val register = RegisterRepository(HOST, SYMBOL)
|
||||
|
||||
val certificate = register.getCertificate(TOKEN, PIN, DEVICE_NAME)
|
||||
val certSubscriber = TestSubscriber<CertificateResponse>()
|
||||
val certSubscriber = TestObserver<CertificateResponse>()
|
||||
certificate.subscribe(certSubscriber)
|
||||
certSubscriber.assertCompleted()
|
||||
certSubscriber.assertComplete()
|
||||
certSubscriber.assertNoErrors()
|
||||
assertEquals(false, certSubscriber.onNextEvents[0].isError)
|
||||
|
||||
val tokenCrt = certSubscriber.onNextEvents[0].tokenCert
|
||||
assertEquals(false, certSubscriber.values()[0].isError)
|
||||
|
||||
val tokenCrt = certSubscriber.values()[0].tokenCert
|
||||
|
||||
register.signature = tokenCrt.certificatePfx
|
||||
register.certificate = tokenCrt.certificateKey
|
||||
|
||||
val pupils = register.getPupils()
|
||||
val pupilSubscriber = TestSubscriber<ApiResponse<List<Student>>>()
|
||||
val pupilSubscriber = TestObserver<ApiResponse<List<Student>>>()
|
||||
pupils.subscribe(pupilSubscriber)
|
||||
pupilSubscriber.assertCompleted()
|
||||
pupilSubscriber.assertComplete()
|
||||
pupilSubscriber.assertNoErrors()
|
||||
assertEquals("Ok", pupilSubscriber.onNextEvents[0].status)
|
||||
assertEquals(1, pupilSubscriber.onNextEvents[0].data!!.size)
|
||||
assertEquals("Ok", pupilSubscriber.values()[0].status)
|
||||
assertEquals(1, pupilSubscriber.values()[0].data!!.size)
|
||||
|
||||
val student = pupilSubscriber.onNextEvents[0].data!![0]
|
||||
val student = pupilSubscriber.values()[0].data!![0]
|
||||
|
||||
// MobileRepository
|
||||
val mobile = MobileRepository(HOST, SYMBOL, register.signature, register.certificate, student.reportingUnitSymbol)
|
||||
|
||||
val start = mobile.logStart()
|
||||
val startSubscriber = TestSubscriber<ApiResponse<String>>()
|
||||
val startSubscriber = TestObserver<ApiResponse<String>>()
|
||||
start.subscribe(startSubscriber)
|
||||
startSubscriber.assertCompleted()
|
||||
startSubscriber.assertComplete()
|
||||
startSubscriber.assertNoErrors()
|
||||
assertEquals("Ok", startSubscriber.onNextEvents[0].status)
|
||||
assertEquals("Ok", startSubscriber.values()[0].status)
|
||||
|
||||
val dictionaries = mobile.getDictionaries(student.userLoginId, student.classificationPeriodId, student.classId)
|
||||
val dictionariesSubscriber = TestSubscriber<ApiResponse<Dictionaries>>()
|
||||
val dictionariesSubscriber = TestObserver<ApiResponse<Dictionaries>>()
|
||||
dictionaries.subscribe(dictionariesSubscriber)
|
||||
dictionariesSubscriber.assertCompleted()
|
||||
dictionariesSubscriber.assertComplete()
|
||||
dictionariesSubscriber.assertNoErrors()
|
||||
assertEquals("Ok", dictionariesSubscriber.onNextEvents[0].status)
|
||||
assertEquals("Ok", dictionariesSubscriber.values()[0].status)
|
||||
|
||||
val lessons = mobile.getTimetable("2018-04-23", "2018-04-24", student.classId, student.classificationPeriodId, student.id)
|
||||
val lessonsSubscriber = TestSubscriber<ApiResponse<List<Lesson>>>()
|
||||
val lessonsSubscriber = TestObserver<ApiResponse<List<Lesson>>>()
|
||||
lessons.subscribe(lessonsSubscriber)
|
||||
lessonsSubscriber.assertCompleted()
|
||||
lessonsSubscriber.assertComplete()
|
||||
lessonsSubscriber.assertNoErrors()
|
||||
assertEquals("Ok", lessonsSubscriber.onNextEvents[0].status)
|
||||
assertEquals("Ok", lessonsSubscriber.values()[0].status)
|
||||
|
||||
val grades = mobile.getGrades(student.classId, student.classificationPeriodId, student.id)
|
||||
val gradesSubscriber = TestSubscriber<ApiResponse<List<Grade>>>()
|
||||
val gradesSubscriber = TestObserver<ApiResponse<List<Grade>>>()
|
||||
grades.subscribe(gradesSubscriber)
|
||||
gradesSubscriber.assertCompleted()
|
||||
gradesSubscriber.assertComplete()
|
||||
gradesSubscriber.assertNoErrors()
|
||||
assertEquals("Ok", gradesSubscriber.onNextEvents[0].status)
|
||||
assertEquals("Ok", gradesSubscriber.values()[0].status)
|
||||
|
||||
val exams = mobile.getExams("2018-05-28", "2018-06-03", student.classId, student.classificationPeriodId, student.id)
|
||||
val examsSubscriber = TestSubscriber<ApiResponse<List<Exam>>>()
|
||||
val examsSubscriber = TestObserver<ApiResponse<List<Exam>>>()
|
||||
exams.subscribe(examsSubscriber)
|
||||
examsSubscriber.assertCompleted()
|
||||
examsSubscriber.assertComplete()
|
||||
examsSubscriber.assertNoErrors()
|
||||
assertEquals("Ok", examsSubscriber.onNextEvents[0].status)
|
||||
assertEquals("Ok", examsSubscriber.values()[0].status)
|
||||
|
||||
val notes = mobile.getNotes(student.classificationPeriodId, student.id)
|
||||
val notesSubscriber = TestSubscriber<ApiResponse<List<Note>>>()
|
||||
val notesSubscriber = TestObserver<ApiResponse<List<Note>>>()
|
||||
notes.subscribe(notesSubscriber)
|
||||
notesSubscriber.assertCompleted()
|
||||
notesSubscriber.assertComplete()
|
||||
notesSubscriber.assertNoErrors()
|
||||
assertEquals("Ok", notesSubscriber.onNextEvents[0].status)
|
||||
assertEquals("Ok", notesSubscriber.values()[0].status)
|
||||
|
||||
val attendance = mobile.getAttendance("2018-04-23", "2018-04-24", student.classId, student.classificationPeriodId, student.id)
|
||||
val attendanceSubscriber = TestSubscriber<ApiResponse<AttendanceResponse>>()
|
||||
val attendanceSubscriber = TestObserver<ApiResponse<AttendanceResponse>>()
|
||||
attendance.subscribe(attendanceSubscriber)
|
||||
attendanceSubscriber.assertCompleted()
|
||||
attendanceSubscriber.assertComplete()
|
||||
attendanceSubscriber.assertNoErrors()
|
||||
assertEquals("Ok", attendanceSubscriber.onNextEvents[0].status)
|
||||
assertEquals("2018-04-23", attendanceSubscriber.onNextEvents[0].data!!.dateStartText)
|
||||
assertEquals("Ok", attendanceSubscriber.values()[0].status)
|
||||
assertEquals("2018-04-23", attendanceSubscriber.values()[0].data!!.dateStartText)
|
||||
|
||||
val homework = mobile.getHomework("2017-10-23", "2017-10-27", student.classId, student.classificationPeriodId, student.id)
|
||||
val homeworkSubscriber = TestSubscriber<ApiResponse<List<Homework>>>()
|
||||
val homeworkSubscriber = TestObserver<ApiResponse<List<Homework>>>()
|
||||
homework.subscribe(homeworkSubscriber)
|
||||
homeworkSubscriber.assertCompleted()
|
||||
homeworkSubscriber.assertComplete()
|
||||
homeworkSubscriber.assertNoErrors()
|
||||
assertEquals("Ok", homeworkSubscriber.onNextEvents[0].status)
|
||||
assertEquals("Ok", homeworkSubscriber.values()[0].status)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue