Skip to content

Commit

Permalink
Merge pull request #48 from yshrsmz/dependency-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
yshrsmz authored Jul 20, 2022
2 parents df3aeaf + 9b257b1 commit 8dfab14
Show file tree
Hide file tree
Showing 27 changed files with 402 additions and 308 deletions.
19 changes: 14 additions & 5 deletions bucketeer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ def properties = new Properties()
properties.load(rootProject.file('local.properties').newDataInputStream())

android {
defaultPublishConfig "release"
namespace = "jp.bucketeer.sdk"

compileSdkVersion project.findProperty("android.compileSdkVersion") as int
defaultConfig {
def isTest = !gradle.startParameter.taskNames.findAll { it.contains("Test") }.isEmpty()
Expand Down Expand Up @@ -66,6 +67,8 @@ dependencies {
compileOnly "javax.annotation:javax.annotation-api:$versions.JAVAX_ANNOTATION"
// This provides the protobuf.Duration for event.proto
compileOnly "com.google.api.grpc:proto-google-common-protos:$versions.COMMON_PROTOS"
implementation "com.squareup.okhttp:okhttp:2.7.5"
implementation "com.google.protobuf:protobuf-javalite:$versions.PROTO_JAVALITE"

// Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$versions.KOTLIN"
Expand All @@ -77,20 +80,26 @@ dependencies {
testImplementation "junit:junit:$versions.JUNIT"
testImplementation "org.robolectric:robolectric:$versions.ROBOLECTRIC"
testImplementation "org.mockito:mockito-core:$versions.MOCKITO_ANDROID"
testImplementation "com.nhaarman:mockito-kotlin:$versions.MOCKITO_KOTLIN"
testImplementation "org.mockito.kotlin:mockito-kotlin:$versions.MOCKITO_KOTLIN"
testImplementation "org.amshove.kluent:kluent-android:$versions.KLUENT"
testImplementation "androidx.test:core:$versions.ANDROIDX_TEST"
androidTestImplementation "androidx.test.espresso:espresso-core:$versions.ANDROIDX_TEST_ESPRESSO"
androidTestImplementation "androidx.test.espresso:espresso-contrib:$versions.ANDROIDX_TEST_ESPRESSO"
androidTestImplementation("androidx.test.espresso:espresso-contrib:$versions.ANDROIDX_TEST_ESPRESSO") {
exclude group: 'com.google.protobuf', module: 'protobuf-lite'
}
// Explicitly depending on accessibility-test-framework to solve duplicate class error
// https://github.com/android/android-test/issues/861
androidTestImplementation("com.google.android.apps.common.testing.accessibility.framework:accessibility-test-framework:4.0.0")
androidTestImplementation "androidx.test:rules:$versions.ANDROIDX_TEST"
androidTestImplementation "androidx.test.ext:junit:$versions.ANDROIDX_TEST_EXT"
androidTestImplementation "org.mockito:mockito-android:$versions.MOCKITO_ANDROID"
androidTestImplementation("com.nhaarman:mockito-kotlin:$versions.MOCKITO_KOTLIN") {
androidTestImplementation("org.mockito.kotlin:mockito-kotlin:$versions.MOCKITO_KOTLIN") {
exclude group: 'org.mockito', module: 'mockito-core'
}
androidTestImplementation("org.amshove.kluent:kluent-android:$versions.KLUENT") {
exclude group: 'org.mockito', module: 'mockito-core'
}
androidTestUtil "androidx.test:orchestrator:$versions.ANDROIDX_TEST"
androidTestUtil "androidx.test:orchestrator:$versions.ANDROIDX_TEST_ORCHESTRATOR"
}

protobuf {
Expand Down
19 changes: 13 additions & 6 deletions bucketeer/publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,27 @@ ext['signing.secretKeyRingFile'] = properties.getProperty('signing.secretKeyRing
group = sdkGroupId
version = sdkVersion

// https://developer.android.com/studio/publish-library/configure-pub-variants
android {
publishing {
singleVariant("release") {
withSourcesJar()
}
}
}

task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs
}

dokka {
outputFormat = 'html'
outputDirectory = "${project.buildDir}/dokka"
dokkaHtml {
outputDirectory.set(file("${project.buildDir}/dokka"))
}

task javadocJar(type: Jar, dependsOn: dokka) {
task javadocJar(type: Jar, dependsOn: dokkaHtml) {
archiveClassifier.set('javadoc')
from dokka.outputDirectory
from dokkaHtml.outputDirectory
}

artifacts {
Expand Down Expand Up @@ -111,7 +119,6 @@ afterEvaluate {
}

// List all "compile" dependencies (for old Gradle)
configurations.compile.getAllDependencies().each { dep -> addDependency(dep, 'compile') }
// List all "api" dependencies (for new Gradle) as "compile" dependencies
configurations.api.getAllDependencies().each { dep -> addDependency(dep, 'compile') }
// List all "implementation" dependencies (for new Gradle) as "runtime" dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ import bucketeer.feature.EvaluationOuterClass
import bucketeer.feature.ReasonOuterClass
import bucketeer.gateway.Service
import bucketeer.user.UserOuterClass
import com.nhaarman.mockito_kotlin.any
import com.nhaarman.mockito_kotlin.argumentCaptor
import com.nhaarman.mockito_kotlin.atLeastOnce
import com.nhaarman.mockito_kotlin.doReturn
import com.nhaarman.mockito_kotlin.mock
import com.nhaarman.mockito_kotlin.spy
import com.nhaarman.mockito_kotlin.times
import com.nhaarman.mockito_kotlin.verify
import com.nhaarman.mockito_kotlin.whenever
import jp.bucketeer.sdk.Api
import jp.bucketeer.sdk.Bucketeer
import jp.bucketeer.sdk.BucketeerConfig
Expand Down Expand Up @@ -49,6 +40,15 @@ import org.junit.Assert.fail
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.kotlin.any
import org.mockito.kotlin.argumentCaptor
import org.mockito.kotlin.atLeastOnce
import org.mockito.kotlin.doReturn
import org.mockito.kotlin.mock
import org.mockito.kotlin.spy
import org.mockito.kotlin.times
import org.mockito.kotlin.verify
import org.mockito.kotlin.whenever
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import android.content.Context
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.MediumTest
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
import com.nhaarman.mockito_kotlin.mock
import jp.bucketeer.sdk.Constants
import jp.bucketeer.sdk.dispatcher.Dispatcher
import jp.bucketeer.sdk.evaluation.LatestEvaluationActionCreator
Expand All @@ -13,6 +12,7 @@ import org.amshove.kluent.shouldBe
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.kotlin.mock

@RunWith(AndroidJUnit4::class)
@MediumTest
Expand Down
5 changes: 1 addition & 4 deletions bucketeer/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="jp.bucketeer.sdk"
android:versionCode="1"
android:versionName="1.0" >
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ inline fun <reified T : Any> EvaluationOuterClass.Evaluation?.getVariationValue(
Long::class -> value.toLongOrNull()
Float::class -> value.toFloatOrNull()
Double::class -> value.toDoubleOrNull()
Boolean::class -> when (value.toLowerCase(Locale.ENGLISH)) {
Boolean::class -> when (value.lowercase(Locale.ENGLISH)) {
"true" -> true
"false" -> false
else -> null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package jp.bucketeer.sdk

import bucketeer.feature.EvaluationOuterClass
import bucketeer.feature.VariationOuterClass
import jp.bucketeer.sdk.ext.getVariationValue
import org.amshove.kluent.shouldBeEqualTo
import org.json.JSONObject
Expand Down
14 changes: 7 additions & 7 deletions bucketeer/src/test/java/jp/bucketeer/sdk/ClientInteractorTest.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
package jp.bucketeer.sdk

import com.nhaarman.mockito_kotlin.doNothing
import com.nhaarman.mockito_kotlin.doReturn
import com.nhaarman.mockito_kotlin.mock
import com.nhaarman.mockito_kotlin.spy
import com.nhaarman.mockito_kotlin.verify
import com.nhaarman.mockito_kotlin.whenever
import jp.bucketeer.sdk.evaluation.ClientInteractorActionCreator
import jp.bucketeer.sdk.evaluation.CurrentStore
import jp.bucketeer.sdk.evaluation.LatestEvaluationActionCreator
Expand All @@ -14,11 +8,17 @@ import jp.bucketeer.sdk.evaluation.dto.RefreshManuallyStateChangedAction
import jp.bucketeer.sdk.events.EventActionCreator
import jp.bucketeer.sdk.user.UserHolder
import jp.bucketeer.sdk.util.ObservableField
import org.junit.Assert.assertEquals
import org.amshove.kluent.shouldBeEqualTo
import org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.kotlin.doNothing
import org.mockito.kotlin.doReturn
import org.mockito.kotlin.mock
import org.mockito.kotlin.spy
import org.mockito.kotlin.verify
import org.mockito.kotlin.whenever
import org.robolectric.RobolectricTestRunner
import org.robolectric.shadows.ShadowLooper
import java.util.Date
Expand Down
22 changes: 11 additions & 11 deletions bucketeer/src/test/java/jp/bucketeer/sdk/EventSenderTest.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
package jp.bucketeer.sdk

import bucketeer.event.client.EventOuterClass
import com.nhaarman.mockito_kotlin.any
import com.nhaarman.mockito_kotlin.doReturn
import com.nhaarman.mockito_kotlin.mock
import com.nhaarman.mockito_kotlin.never
import com.nhaarman.mockito_kotlin.times
import com.nhaarman.mockito_kotlin.verify
import com.nhaarman.mockito_kotlin.whenever
import jp.bucketeer.sdk.events.EventActionCreator
import jp.bucketeer.sdk.events.EventStore
import jp.bucketeer.sdk.events.toEvent
Expand All @@ -16,6 +9,13 @@ import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.kotlin.any
import org.mockito.kotlin.doReturn
import org.mockito.kotlin.mock
import org.mockito.kotlin.never
import org.mockito.kotlin.times
import org.mockito.kotlin.verify
import org.mockito.kotlin.whenever
import org.robolectric.RobolectricTestRunner
import java.util.concurrent.CountDownLatch
import java.util.concurrent.Executors
Expand All @@ -32,14 +32,14 @@ class EventSenderTest {
private val eventActionCreator = mock<EventActionCreator>().also {
whenever(it.send(any(), any())).then {
val nextEvents = eventObservableField.value.toMutableList()
val it = nextEvents.iterator()
val iterator = nextEvents.iterator()
var index = 0
while (it.hasNext()) {
it.next()
while (iterator.hasNext()) {
iterator.next()
if (index >= QUEUE_COUNT) {
break
}
it.remove()
iterator.remove()
index++
}
eventObservableField.value = nextEvents
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package jp.bucketeer.sdk

import com.nhaarman.mockito_kotlin.mock
import com.nhaarman.mockito_kotlin.timeout
import com.nhaarman.mockito_kotlin.verify
import jp.bucketeer.sdk.evaluation.LatestEvaluationActionCreator
import jp.bucketeer.sdk.user.UserHolder
import org.junit.Test
import org.mockito.kotlin.mock
import org.mockito.kotlin.timeout
import org.mockito.kotlin.verify
import java.util.concurrent.Executors

class LatestEvaluationUpdaterTest {
Expand Down
10 changes: 5 additions & 5 deletions bucketeer/src/test/java/jp/bucketeer/sdk/MockitoKotlinExample.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package jp.bucketeer.sdk

import com.nhaarman.mockito_kotlin.any
import com.nhaarman.mockito_kotlin.doReturn
import com.nhaarman.mockito_kotlin.mock
import com.nhaarman.mockito_kotlin.never
import com.nhaarman.mockito_kotlin.verify
import org.junit.Test
import org.mockito.kotlin.any
import org.mockito.kotlin.doReturn
import org.mockito.kotlin.mock
import org.mockito.kotlin.never
import org.mockito.kotlin.verify

class MockitoKotlinExample {
@Test fun doAction_doesSomething() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package jp.bucketeer.sdk.evaluation

import bucketeer.feature.EvaluationOuterClass
import com.nhaarman.mockito_kotlin.verify
import com.nhaarman.mockito_kotlin.verifyNoMoreInteractions
import jp.bucketeer.sdk.dispatcher.Dispatcher
import jp.bucketeer.sdk.evaluation.dto.CurrentEvaluationListDataChangedAction
import jp.bucketeer.sdk.user1
import jp.bucketeer.sdk.user1Evaluations
import org.amshove.kluent.mock
import org.amshove.kluent.shouldBeEqualTo
import org.junit.Test
import org.mockito.kotlin.mock
import org.mockito.kotlin.verify
import org.mockito.kotlin.verifyNoMoreInteractions

class CurrentStoreTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
package jp.bucketeer.sdk.evaluation

import android.content.SharedPreferences
import com.nhaarman.mockito_kotlin.any
import com.nhaarman.mockito_kotlin.doNothing
import com.nhaarman.mockito_kotlin.doReturn
import com.nhaarman.mockito_kotlin.mock
import com.nhaarman.mockito_kotlin.never
import com.nhaarman.mockito_kotlin.spy
import com.nhaarman.mockito_kotlin.verify
import com.nhaarman.mockito_kotlin.verifyNoMoreInteractions
import com.nhaarman.mockito_kotlin.whenever
import jp.bucketeer.sdk.Api
import jp.bucketeer.sdk.dispatcher.Dispatcher
import jp.bucketeer.sdk.evaluation.db.CurrentEvaluationDao
Expand All @@ -26,6 +17,15 @@ import jp.bucketeer.sdk.userEvaluationsId1
import jp.bucketeer.sdk.userEvaluationsId2
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.kotlin.any
import org.mockito.kotlin.doNothing
import org.mockito.kotlin.doReturn
import org.mockito.kotlin.mock
import org.mockito.kotlin.never
import org.mockito.kotlin.spy
import org.mockito.kotlin.verify
import org.mockito.kotlin.verifyNoMoreInteractions
import org.mockito.kotlin.whenever
import org.robolectric.RobolectricTestRunner

@RunWith(RobolectricTestRunner::class)
Expand Down Expand Up @@ -112,7 +112,7 @@ class LatestEvaluationActionCreatorTest {
whenever(api.fetchEvaluation(user1, userEvaluationsId2)).doReturn(
Api.Result.Success(responseFull))
whenever(currentEvaluationActionCreator.getEvaluations(user1.id))
.doReturn(listOf(user1Evaluations.evaluationsList))
.doReturn(user1Evaluations.evaluationsList)

evaluationActionCreator.refreshLatestEvaluationFromApi(user1)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package jp.bucketeer.sdk.evaluation

import bucketeer.feature.EvaluationOuterClass
import com.nhaarman.mockito_kotlin.mock
import com.nhaarman.mockito_kotlin.verify
import com.nhaarman.mockito_kotlin.verifyNoMoreInteractions
import jp.bucketeer.sdk.dispatcher.Dispatcher
import jp.bucketeer.sdk.evaluation.dto.LatestEvaluationChangedAction
import jp.bucketeer.sdk.user1
import jp.bucketeer.sdk.user1Evaluations
import org.junit.Test
import org.mockito.kotlin.mock
import org.mockito.kotlin.verify
import org.mockito.kotlin.verifyNoMoreInteractions

class LatestEvaluationStoreTest {
@Test fun latestEvaluation_observe() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package jp.bucketeer.sdk.evaluation.db

import androidx.test.core.app.ApplicationProvider
import bucketeer.feature.EvaluationOuterClass
import jp.bucketeer.sdk.database.DatabaseOpenHelper
import jp.bucketeer.sdk.evaluation1
Expand All @@ -14,15 +15,14 @@ import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.robolectric.RuntimeEnvironment

@RunWith(RobolectricTestRunner::class)
class CurrentEvaluationDaoImplTest {
private lateinit var currentEvaluationDao: CurrentEvaluationDaoImpl
private lateinit var openHelper: DatabaseOpenHelper

@Before fun setUp() {
openHelper = DatabaseOpenHelper(RuntimeEnvironment.application, null)
openHelper = DatabaseOpenHelper(ApplicationProvider.getApplicationContext(), null)
currentEvaluationDao = CurrentEvaluationDaoImpl(openHelper)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import jp.bucketeer.sdk.ext.getString
import jp.bucketeer.sdk.user1
import jp.bucketeer.sdk.user1Evaluations
import jp.bucketeer.sdk.user2
import org.junit.Assert.assertEquals
import org.amshove.kluent.shouldBeEqualTo
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
Expand Down
Loading

0 comments on commit 8dfab14

Please sign in to comment.