Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): Update kotlin to 1.9.21 #723

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[*.{kt,kts}]
indent_style=space
indent_size=4
continuation_indent_size=4
insert_final_newline=true
disabled_rules=import-ordering
indent_style = space
indent_size = 4
continuation_indent_size = 4
insert_final_newline = true
import_ordering = disabled
max_line_length = 100
8 changes: 5 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
}
dependencies {
classpath 'com.github.triplet.gradle:play-publisher:3.5.0'
classpath 'com.diffplug.spotless:spotless-plugin-gradle:5.14.1'
classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.23.0'
classpath 'de.mannodermaus.gradle.plugins:android-junit5:1.8.2.1'
}
ext {
Expand Down Expand Up @@ -174,7 +174,7 @@ dependencies {
testImplementation "io.ktor:ktor-test-dispatcher:$ktorVersion"

// ORM
def room_version = '2.6.0-rc01'
def room_version = '2.6.0'
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-ktx:$room_version"
Expand Down Expand Up @@ -221,7 +221,9 @@ dependencies {

spotless {
kotlin {
ktlint('0.37.2').userData(['disabled_rules': 'import-ordering', 'max_line_length': '100'])
ktlint('1.0.1').editorConfigOverride([
'ktlint_standard_property-naming': 'disabled'
])
target '**/*.kt'
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import javax.inject.Singleton

@Module
class TestAppModule(
app: TestApp
app: TestApp,
) : AppModule(app) {

@Provides
Expand All @@ -22,7 +22,7 @@ class TestAppModule(

@Provides
fun mockedConnectStateObserver(
connectionStateFlow: MutableStateFlow<ConnectionState>
connectionStateFlow: MutableStateFlow<ConnectionState>,
): ConnectionStateObserver {
val mock = mock<ConnectionStateObserver>()
whenever(mock.observe()).thenReturn(connectionStateFlow)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class EndpointPreRegistrationServiceTest {
fun requestPreRegistration() = runBlocking(coroutineContext) {
val serviceIntent = Intent(
getApplicationContext<Context>(),
EndpointPreRegistrationService::class.java
EndpointPreRegistrationService::class.java,
)
val binder = serviceRule.bindService(serviceIntent)

Expand All @@ -79,7 +79,7 @@ class EndpointPreRegistrationServiceTest {
}
assertEquals(
EndpointPreRegistrationService.REGISTRATION_AUTHORIZATION,
resultMessage!!.what
resultMessage!!.what,
)

// Check we got a valid authorization
Expand All @@ -88,19 +88,19 @@ class EndpointPreRegistrationServiceTest {
val gatewayCert = localConfig.getIdentityCertificate()
val authorization = PrivateNodeRegistrationAuthorization.deserialize(
resultData.getByteArray("auth")!!,
gatewayCert.subjectPublicKey
gatewayCert.subjectPublicKey,
)
assertEquals(
getApplicationContext<Context>().packageName,
authorization.gatewayData.toString(Charset.defaultCharset())
authorization.gatewayData.toString(Charset.defaultCharset()),
)
}

@Test
fun invalidRequestIsIgnored() {
val serviceIntent = Intent(
getApplicationContext<Context>(),
EndpointPreRegistrationService::class.java
EndpointPreRegistrationService::class.java,
)
val binder = serviceRule.bindService(serviceIntent)

Expand All @@ -116,7 +116,7 @@ class EndpointPreRegistrationServiceTest {

val serviceIntent = Intent(
getApplicationContext<Context>(),
EndpointPreRegistrationService::class.java
EndpointPreRegistrationService::class.java,
)
val binder = serviceRule.bindService(serviceIntent)

Expand All @@ -138,7 +138,7 @@ class EndpointPreRegistrationServiceTest {
}
assertEquals(
EndpointPreRegistrationService.GATEWAY_NOT_REGISTERED,
resultMessage!!.what
resultMessage!!.what,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ class GatewaySyncServiceParcelCollectionTest {
serviceRule.bindService(
Intent(
getApplicationContext<Context>(),
GatewaySyncService::class.java
)
GatewaySyncService::class.java,
),
)
}

Expand All @@ -66,15 +66,15 @@ class GatewaySyncServiceParcelCollectionTest {
arrayOf(
Signer(
PDACertPath.PRIVATE_ENDPOINT,
KeyPairSet.PRIVATE_ENDPOINT.private
)
KeyPairSet.PRIVATE_ENDPOINT.private,
),
),
StreamingMode.KeepAlive
StreamingMode.KeepAlive,
).take(1).first()

assertEquals(
Parcel.deserialize(parcel).id,
Parcel.deserialize(parcelCollection.parcelSerialized).id
Parcel.deserialize(parcelCollection.parcelSerialized).id,
)
}

Expand All @@ -89,10 +89,11 @@ class GatewaySyncServiceParcelCollectionTest {
arrayOf(
Signer(
PDACertPath.PRIVATE_ENDPOINT,
KeyPairSet.INTERNET_GW.private // Invalid key to trigger invalid handshake
)
// Invalid key to trigger invalid handshake
KeyPairSet.INTERNET_GW.private,
),
),
StreamingMode.CloseUponCompletion
StreamingMode.CloseUponCompletion,
)
.collect()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import tech.relaycorp.relaynet.bindings.pdc.RejectedParcelException
import tech.relaycorp.relaynet.bindings.pdc.Signer
import tech.relaycorp.relaynet.messages.Parcel
import tech.relaycorp.relaynet.messages.Recipient
import tech.relaycorp.relaynet.testing.pki.PDACertPath
import tech.relaycorp.relaynet.testing.pki.KeyPairSet
import tech.relaycorp.relaynet.testing.pki.PDACertPath
import tech.relaycorp.relaynet.wrappers.x509.Certificate
import java.time.ZonedDateTime
import javax.inject.Inject
Expand All @@ -47,8 +47,8 @@ class GatewaySyncServiceParcelDeliveryTest {
serviceRule.bindService(
Intent(
getApplicationContext<Context>(),
GatewaySyncService::class.java
)
GatewaySyncService::class.java,
),
)
}

Expand All @@ -63,14 +63,14 @@ class GatewaySyncServiceParcelDeliveryTest {
recipient,
ByteArray(0),
PDACertPath.PRIVATE_ENDPOINT,
senderCertificateChain = setOf(PDACertPath.PRIVATE_GW)
senderCertificateChain = setOf(PDACertPath.PRIVATE_GW),
).serialize(KeyPairSet.PRIVATE_ENDPOINT.private)

PoWebClient.initLocal(PDCServer.PORT).deliverParcel(parcel, endpointSigner)

val storedParcels = storedParcelDao.listForRecipients(
listOf(MessageAddress.of(recipientId)),
RecipientLocation.ExternalGateway
RecipientLocation.ExternalGateway,
).first()
assertEquals(1, storedParcels.size)
}
Expand All @@ -87,7 +87,7 @@ class GatewaySyncServiceParcelDeliveryTest {
ByteArray(0),
PDACertPath.PRIVATE_ENDPOINT,
creationDate = fiveMinutesAgo,
ttl = 1
ttl = 1,
).serialize(KeyPairSet.PRIVATE_ENDPOINT.private)

PoWebClient.initLocal(PDCServer.PORT).deliverParcel(parcel, endpointSigner)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ class ParcelCollectionDaoTest {
runBlocking {
val element = ParcelCollectionFactory.build()
assertFalse(
dao.exists(element.recipientAddress, element.senderAddress, element.messageId)
dao.exists(element.recipientAddress, element.senderAddress, element.messageId),
)

dao.insert(element)
assertTrue(
dao.exists(element.recipientAddress, element.senderAddress, element.messageId)
dao.exists(element.recipientAddress, element.senderAddress, element.messageId),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ class StoredParcelDaoTest {
StoredParcelFactory.build()
.copy(
recipientLocation = RecipientLocation.ExternalGateway,
expirationTimeUtc = nowInUtc().minusMinutes(5)
expirationTimeUtc = nowInUtc().minusMinutes(5),
)
.also { dao.insert(it) }
val parcelUnexpired = StoredParcelFactory.build()
.copy(
recipientLocation = RecipientLocation.ExternalGateway,
expirationTimeUtc = nowInUtc().plusMinutes(5)
expirationTimeUtc = nowInUtc().plusMinutes(5),
)
.also { dao.insert(it) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class FileStoreTest {
val readData = store.read(fileName)
assertEquals(
message,
readData!!.toString(Charset.defaultCharset())
readData!!.toString(Charset.defaultCharset()),
)
}
}
Expand All @@ -55,7 +55,7 @@ class FileStoreTest {
val readData = store.read(fileName)
assertEquals(
message2,
readData!!.toString(Charset.defaultCharset())
readData!!.toString(Charset.defaultCharset()),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ class NotifyEndpointsTest {

notifyEndpoints.notify(
listOf(endpoint1, endpoint2),
NotificationType.IncomingParcel
NotificationType.IncomingParcel,
)

verify(context, times(2)).sendBroadcast(
check {
assertTrue(
listOf(endpoint1.applicationId, endpoint2.applicationId)
.contains(it.component?.packageName)
.contains(it.component?.packageName),
)
assertEquals(".Receiver", it.component?.className)
}
},
)
verifyNoMoreInteractions(context)
}
Expand All @@ -69,14 +69,14 @@ class NotifyEndpointsTest {

notifyEndpoints.notify(
listOf(endpoint, endpoint),
NotificationType.IncomingParcel
NotificationType.IncomingParcel,
)

verify(context, times(1)).sendBroadcast(
check {
assertEquals(appId, it.component?.packageName)
assertEquals(".Receiver", it.component?.className)
}
},
)
verifyNoMoreInteractions(context)
}
Expand All @@ -95,7 +95,7 @@ class NotifyEndpointsTest {
check {
assertEquals(endpoint.applicationId, it.component?.packageName)
assertEquals(receiverName, it.component?.className)
}
},
)
}
}
Expand All @@ -114,7 +114,7 @@ class NotifyEndpointsTest {
whenever(getEndpointReceiver.get(any(), any())).thenReturn(null)
notifyEndpoints.notify(
LocalEndpointFactory.build(),
NotificationType.IncomingParcel
NotificationType.IncomingParcel,
)
verify(context, never()).sendBroadcast(any(), any())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import kotlin.reflect.KClass

class BaseActivityTestRule<T : Activity>(
activityClass: KClass<T>,
launchActivity: Boolean = true
launchActivity: Boolean = true,
) : TestRule {

private val clearPreferencesRule: ClearPreferencesRule = ClearPreferencesRule()
Expand All @@ -22,7 +22,7 @@ class BaseActivityTestRule<T : Activity>(
private val activityTestRule: ActivityTestRule<T> = ActivityTestRule(
activityClass.java,
true,
launchActivity
launchActivity,
)

override fun apply(base: Statement, description: Description): Statement {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ class ClearTestDatabaseRule : TestRule {
@Inject
lateinit var database: AppDatabase

override fun apply(base: Statement, description: Description?) =
object : Statement() {
override fun evaluate() {
component.inject(this@ClearTestDatabaseRule)
database.clearAllTables()
base.evaluate()
database.clearAllTables()
}
override fun apply(base: Statement, description: Description?) = object : Statement() {
override fun evaluate() {
component.inject(this@ClearTestDatabaseRule)
database.clearAllTables()
base.evaluate()
database.clearAllTables()
}
}
}
Loading
Loading