Skip to content

Commit

Permalink
Commit with unresolved merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamadJaara authored and github-actions[bot] committed Jan 7, 2025
1 parent 70b8394 commit 63bc50b
Show file tree
Hide file tree
Showing 5 changed files with 203 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class CustomServerConfigRepositoryTest {
.storeConfig(arrangement.expectedServerConfig.links, arrangement.expectedServerConfig.metaData)
.shouldSucceed { assertEquals(arrangement.expectedServerConfig, it) }

<<<<<<< HEAD
coVerify {
arrangement.serverConfigurationDAO.configByLinks(any())
}.wasInvoked(exactly = once)
Expand All @@ -86,6 +87,28 @@ class CustomServerConfigRepositoryTest {
verify {
arrangement.serverConfigurationDAO.configById(any())
}.wasInvoked(exactly = once)
=======
verify(arrangement.serverConfigurationDAO)
.suspendFunction(arrangement.serverConfigurationDAO::configByLinks)
.with(any())
.wasInvoked(exactly = once)
verify(arrangement.serverConfigurationDAO)
.suspendFunction(arrangement.serverConfigurationDAO::insert)
.with(any())
.wasNotInvoked()
verify(arrangement.serverConfigurationDAO)
.suspendFunction(arrangement.serverConfigurationDAO::updateServerMetaData)
.with(any(), any(), any())
.wasInvoked(exactly = once)
verify(arrangement.serverConfigurationDAO)
.suspendFunction(arrangement.serverConfigurationDAO::setFederationToTrue)
.with(any())
.wasInvoked(exactly = once)
verify(arrangement.serverConfigurationDAO)
.function(arrangement.serverConfigurationDAO::configById)
.with(any())
.wasInvoked(exactly = once)
>>>>>>> f8e4329102 (fix: update federation flag when fetching server config [WPB-14728] (#3143) (#3189))
}

@Test
Expand All @@ -99,6 +122,7 @@ class CustomServerConfigRepositoryTest {
.storeConfig(expected.links, expected.metaData)
.shouldSucceed { assertEquals(it, expected) }

<<<<<<< HEAD
coVerify {
arrangement.serverConfigurationDAO.configByLinks(any())
}.wasInvoked(exactly = once)
Expand All @@ -114,6 +138,28 @@ class CustomServerConfigRepositoryTest {
verify {
arrangement.serverConfigurationDAO.configById(any())
}.wasInvoked(exactly = once)
=======
verify(arrangement.serverConfigurationDAO)
.suspendFunction(arrangement.serverConfigurationDAO::configByLinks)
.with(any())
.wasInvoked(exactly = once)
verify(arrangement.serverConfigurationDAO)
.suspendFunction(arrangement.serverConfigurationDAO::insert)
.with(any())
.wasInvoked(exactly = once)
verify(arrangement.serverConfigurationDAO)
.suspendFunction(arrangement.serverConfigurationDAO::updateServerMetaData)
.with(any(), any(), any())
.wasNotInvoked()
verify(arrangement.serverConfigurationDAO)
.suspendFunction(arrangement.serverConfigurationDAO::setFederationToTrue)
.with(any())
.wasNotInvoked()
verify(arrangement.serverConfigurationDAO)
.function(arrangement.serverConfigurationDAO::configById)
.with(any())
.wasInvoked(exactly = once)
>>>>>>> f8e4329102 (fix: update federation flag when fetching server config [WPB-14728] (#3143) (#3189))
}

@Test
Expand All @@ -135,6 +181,7 @@ class CustomServerConfigRepositoryTest {
.storeConfig(expectedServerConfig.links, expectedVersionInfo)
.shouldSucceed { assertEquals(it, expectedServerConfig) }

<<<<<<< HEAD
verify {
arrangement.backendMetaDataUtil.calculateApiVersion(any(), any(), any(), any())
}.wasInvoked(exactly = once)
Expand All @@ -153,6 +200,32 @@ class CustomServerConfigRepositoryTest {
verify {
arrangement.serverConfigurationDAO.configById(any())
}.wasInvoked(exactly = once)
=======
verify(arrangement.backendMetaDataUtil)
.function(arrangement.backendMetaDataUtil::calculateApiVersion)
.with(any(), any(), any(), any())
.wasInvoked(exactly = once)
verify(arrangement.serverConfigurationDAO)
.suspendFunction(arrangement.serverConfigurationDAO::configByLinks)
.with(any())
.wasInvoked(exactly = once)
verify(arrangement.serverConfigurationDAO)
.suspendFunction(arrangement.serverConfigurationDAO::insert)
.with(any())
.wasInvoked(exactly = once)
verify(arrangement.serverConfigurationDAO)
.suspendFunction(arrangement.serverConfigurationDAO::updateServerMetaData)
.with(any(), any(), any())
.wasNotInvoked()
verify(arrangement.serverConfigurationDAO)
.suspendFunction(arrangement.serverConfigurationDAO::setFederationToTrue)
.with(any())
.wasNotInvoked()
verify(arrangement.serverConfigurationDAO)
.function(arrangement.serverConfigurationDAO::configById)
.with(any())
.wasInvoked(exactly = once)
>>>>>>> f8e4329102 (fix: update federation flag when fetching server config [WPB-14728] (#3143) (#3189))
}

private class Arrangement {
Expand All @@ -161,19 +234,31 @@ class CustomServerConfigRepositoryTest {
val SERVER_CONFIG = newServerConfig(1)

@Mock
<<<<<<< HEAD
val serverConfigApi = mock(ServerConfigApi::class)
=======
val serverConfigApi = mock(classOf<ServerConfigApi>())
>>>>>>> f8e4329102 (fix: update federation flag when fetching server config [WPB-14728] (#3143) (#3189))

var developmentApiEnabled by Delegates.notNull<Boolean>()

@Mock
<<<<<<< HEAD
val serverConfigurationDAO = mock(ServerConfigurationDAO::class)
=======
val serverConfigurationDAO = mock(classOf<ServerConfigurationDAO>())
>>>>>>> f8e4329102 (fix: update federation flag when fetching server config [WPB-14728] (#3143) (#3189))

init {
developmentApiEnabled = false
}

@Mock
<<<<<<< HEAD
val backendMetaDataUtil = mock(BackendMetaDataUtil::class)
=======
val backendMetaDataUtil = mock(classOf<BackendMetaDataUtil>())
>>>>>>> f8e4329102 (fix: update federation flag when fetching server config [WPB-14728] (#3143) (#3189))

private var customServerConfigRepository: CustomServerConfigRepository =
CustomServerConfigDataSource(serverConfigApi, developmentApiEnabled, serverConfigurationDAO, backendMetaDataUtil)
Expand All @@ -186,6 +271,10 @@ class CustomServerConfigRepositoryTest {
domain = serverConfigEntity.metaData.domain
)
)
<<<<<<< HEAD
=======

>>>>>>> f8e4329102 (fix: update federation flag when fetching server config [WPB-14728] (#3143) (#3189))

suspend fun withConfigForNewRequest(serverConfigEntity: ServerConfigEntity): Arrangement {
every {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ class ServerConfigRepositoryTest {
.storeConfig(arrangement.expectedServerConfig.links, arrangement.expectedServerConfig.metaData)
.shouldSucceed { assertEquals(arrangement.expectedServerConfig, it) }

<<<<<<< HEAD
coVerify {
arrangement.serverConfigDAO.configByLinks(any())
}.wasInvoked(exactly = once)
Expand All @@ -139,6 +140,28 @@ class ServerConfigRepositoryTest {
verify {
arrangement.serverConfigDAO.configById(any())
}.wasInvoked(exactly = once)
=======
verify(arrangement.serverConfigDAO)
.suspendFunction(arrangement.serverConfigDAO::configByLinks)
.with(any())
.wasInvoked(exactly = once)
verify(arrangement.serverConfigDAO)
.suspendFunction(arrangement.serverConfigDAO::insert)
.with(any())
.wasNotInvoked()
verify(arrangement.serverConfigDAO)
.suspendFunction(arrangement.serverConfigDAO::updateServerMetaData)
.with(any(), any(), any())
.wasInvoked(exactly = once)
verify(arrangement.serverConfigDAO)
.suspendFunction(arrangement.serverConfigDAO::setFederationToTrue)
.with(any())
.wasInvoked(exactly = once)
verify(arrangement.serverConfigDAO)
.function(arrangement.serverConfigDAO::configById)
.with(any())
.wasInvoked(exactly = once)
>>>>>>> f8e4329102 (fix: update federation flag when fetching server config [WPB-14728] (#3143) (#3189))
}

@Test
Expand All @@ -152,6 +175,7 @@ class ServerConfigRepositoryTest {
.storeConfig(expected.links, expected.metaData)
.shouldSucceed { assertEquals(it, expected) }

<<<<<<< HEAD
coVerify {
arrangement.serverConfigDAO.configByLinks(any())
}.wasInvoked(exactly = once)
Expand All @@ -167,6 +191,28 @@ class ServerConfigRepositoryTest {
verify {
arrangement.serverConfigDAO.configById(any())
}.wasInvoked(exactly = once)
=======
verify(arrangement.serverConfigDAO)
.suspendFunction(arrangement.serverConfigDAO::configByLinks)
.with(any())
.wasInvoked(exactly = once)
verify(arrangement.serverConfigDAO)
.suspendFunction(arrangement.serverConfigDAO::insert)
.with(any())
.wasInvoked(exactly = once)
verify(arrangement.serverConfigDAO)
.suspendFunction(arrangement.serverConfigDAO::updateServerMetaData)
.with(any(), any(), any())
.wasNotInvoked()
verify(arrangement.serverConfigDAO)
.suspendFunction(arrangement.serverConfigDAO::setFederationToTrue)
.with(any())
.wasNotInvoked()
verify(arrangement.serverConfigDAO)
.function(arrangement.serverConfigDAO::configById)
.with(any())
.wasInvoked(exactly = once)
>>>>>>> f8e4329102 (fix: update federation flag when fetching server config [WPB-14728] (#3143) (#3189))
}

private class Arrangement(private val dispatcher: KaliumDispatcher) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,17 @@ class UpdateApiVersionUseCaseTest {
arrangement.tokenStorage.proxyCredentials(any<UserIDEntity>())
}.wasNotInvoked()

<<<<<<< HEAD
coVerify {
arrangement.serverConfigRepository1.updateConfigMetaData(eq(serverConfig1))
}.wasInvoked(exactly = once)
=======

verify(arrangement.serverConfigRepository1)
.suspendFunction(arrangement.serverConfigRepository1::updateConfigMetaData)
.with(eq(serverConfig1))
.wasInvoked(exactly = once)
>>>>>>> f8e4329102 (fix: update federation flag when fetching server config [WPB-14728] (#3143) (#3189))
}

@Test
Expand Down Expand Up @@ -121,9 +129,17 @@ class UpdateApiVersionUseCaseTest {
arrangement.tokenStorage.proxyCredentials(any<UserIDEntity>())
}.wasNotInvoked()

<<<<<<< HEAD
coVerify {
arrangement.serverConfigRepository1.updateConfigMetaData(any())
}.wasInvoked(exactly = once)
=======

verify(arrangement.serverConfigRepository1)
.suspendFunction(arrangement.serverConfigRepository1::updateConfigMetaData)
.with(any())
.wasInvoked(exactly = once)
>>>>>>> f8e4329102 (fix: update federation flag when fetching server config [WPB-14728] (#3143) (#3189))
}

@Test
Expand Down Expand Up @@ -157,9 +173,16 @@ class UpdateApiVersionUseCaseTest {
arrangement.tokenStorage.proxyCredentials(any<UserIDEntity>())
}.wasInvoked(exactly = once)

<<<<<<< HEAD
coVerify {
arrangement.serverConfigRepository1.updateConfigMetaData(any())
}.wasInvoked(exactly = once)
=======
verify(arrangement.serverConfigRepository1)
.suspendFunction(arrangement.serverConfigRepository1::updateConfigMetaData)
.with(any())
.wasInvoked(exactly = once)
>>>>>>> f8e4329102 (fix: update federation flag when fetching server config [WPB-14728] (#3143) (#3189))
}

@Test
Expand Down Expand Up @@ -207,13 +230,25 @@ class UpdateApiVersionUseCaseTest {
arrangement.tokenStorage.proxyCredentials(eq(userId1.toDao()))
}.wasNotInvoked()

<<<<<<< HEAD
coVerify {
arrangement.serverConfigRepository1.updateConfigMetaData(any())
}.wasInvoked(exactly = once)

coVerify {
arrangement.serverConfigRepository2.updateConfigMetaData(any())
}.wasInvoked(exactly = once)
=======
verify(arrangement.serverConfigRepository1)
.suspendFunction(arrangement.serverConfigRepository1::updateConfigMetaData)
.with(any())
.wasInvoked(exactly = once)

verify(arrangement.serverConfigRepository2)
.suspendFunction(arrangement.serverConfigRepository2::updateConfigMetaData)
.with(any())
.wasInvoked(exactly = once)
>>>>>>> f8e4329102 (fix: update federation flag when fetching server config [WPB-14728] (#3143) (#3189))

}

Expand Down Expand Up @@ -249,17 +284,33 @@ class UpdateApiVersionUseCaseTest {
}.returns(result)
}

<<<<<<< HEAD
suspend fun withUpdateConfigMetaData(
=======
fun withUpdateConfigMetaData(
>>>>>>> f8e4329102 (fix: update federation flag when fetching server config [WPB-14728] (#3143) (#3189))
serverConfig: ServerConfig,
result: Either<CoreFailure, Unit>
) {
when (serverConfig.id) {
<<<<<<< HEAD
serverConfig1.id ->
coEvery { serverConfigRepository1.updateConfigMetaData(any()) }
.returns(result)

serverConfig2.id -> coEvery { serverConfigRepository2.updateConfigMetaData(any()) }
.returns(result)
=======
serverConfig1.id -> given(serverConfigRepository1)
.suspendFunction(serverConfigRepository1::updateConfigMetaData)
.whenInvokedWith(any())
.then { result }

serverConfig2.id -> given(serverConfigRepository2)
.suspendFunction(serverConfigRepository2::updateConfigMetaData)
.whenInvokedWith(any())
.then { result }
>>>>>>> f8e4329102 (fix: update federation flag when fetching server config [WPB-14728] (#3143) (#3189))

else -> throw IllegalArgumentException("Unexpected server config: $serverConfig")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ interface ServerConfigurationDAO {
suspend fun allConfig(): List<ServerConfigEntity>
fun configById(id: String): ServerConfigEntity?
suspend fun configByLinks(links: ServerConfigEntity.Links): ServerConfigEntity?
<<<<<<< HEAD
suspend fun getCommonApiVersion(domain: String): Int
=======
>>>>>>> f8e4329102 (fix: update federation flag when fetching server config [WPB-14728] (#3143) (#3189))
suspend fun updateServerMetaData(id: String, federation: Boolean, commonApiVersion: Int)
suspend fun updateApiVersionAndDomain(id: String, domain: String, commonApiVersion: Int)
suspend fun configForUser(userId: UserIDEntity): ServerConfigEntity?
Expand Down Expand Up @@ -217,10 +220,13 @@ internal class ServerConfigurationDAOImpl internal constructor(
withContext(queriesContext) {
queries.updateServerMetaData(federation, commonApiVersion, id)
}
<<<<<<< HEAD
}

override suspend fun getCommonApiVersion(domain: String): Int = withContext(queriesContext) {
queries.getCommonApiVersionByDomain(domain).executeAsOne()
=======
>>>>>>> f8e4329102 (fix: update federation flag when fetching server config [WPB-14728] (#3143) (#3189))
}

override suspend fun updateApiVersionAndDomain(id: String, domain: String, commonApiVersion: Int) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,26 @@ class ServerConfigurationDAOTest : GlobalDBBaseTest() {
val expected = oldConfig.copy(metaData = newVersion)

insertConfig(oldConfig)
<<<<<<< HEAD
globalDatabaseBuilder.serverConfigurationDAO.updateServerMetaData(
=======
db.serverConfigurationDAO.updateServerMetaData(
>>>>>>> f8e4329102 (fix: update federation flag when fetching server config [WPB-14728] (#3143) (#3189))
id = oldConfig.id,
federation = true,
commonApiVersion = 2
)
<<<<<<< HEAD
globalDatabaseBuilder.serverConfigurationDAO.configById(oldConfig.id)
.also { actual ->
assertEquals(expected.metaData.federation, actual!!.metaData.federation)
assertEquals(expected.metaData.apiVersion, actual!!.metaData.apiVersion)
=======
db.serverConfigurationDAO.configById(oldConfig.id)
.also { actual ->
assertEquals(expected.metaData.federation, actual!!.metaData.federation)
assertEquals(expected.metaData.apiVersion, actual.metaData.apiVersion)
>>>>>>> f8e4329102 (fix: update federation flag when fetching server config [WPB-14728] (#3143) (#3189))
}
}

Expand Down

0 comments on commit 63bc50b

Please sign in to comment.