Skip to content

Commit

Permalink
refactor: Migrate Internal Application context class to kotlin (#511)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mansi-mParticle authored Oct 31, 2024
1 parent b6ab438 commit 268d850
Show file tree
Hide file tree
Showing 13 changed files with 962 additions and 881 deletions.
1 change: 1 addition & 0 deletions android-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ android {
jvmArgs += ['--add-opens', 'java.base/java.text=ALL-UNNAMED']
jvmArgs += ['--add-opens', 'java.base/java.math=ALL-UNNAMED']
jvmArgs += ['--add-opens', 'java.base/java.util.concurrent=ALL-UNNAMED']
jvmArgs += ['--add-opens', 'java.base/java.util.concurrent.atomic=ALL-UNNAMED']
jvmArgs += ['--add-opens', 'java.base/java.lang.ref=ALL-UNNAMED']
}
if (useOrchestrator()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ class SessionMessagesTest : BaseCleanStartedEachTest() {
fun testSessionStartMessage() {
val sessionStartReceived = BooleanArray(1)
sessionStartReceived[0] = false
Assert.assertFalse(mAppStateManager.session.isActive)
Assert.assertFalse(mAppStateManager.fetchSession().isActive)
val sessionId = AndroidUtils.Mutable<String?>(null)
mAppStateManager.ensureActiveSession()
sessionId.value = mAppStateManager.session.mSessionID
sessionId.value = mAppStateManager.fetchSession().mSessionID
AccessUtils.awaitMessageHandler()
MParticle.getInstance()?.upload()
mServer.waitForVerify(
Expand All @@ -45,14 +45,14 @@ class SessionMessagesTest : BaseCleanStartedEachTest() {
if (eventObject.getString("dt") == Constants.MessageType.SESSION_START) {
Assert.assertEquals(
eventObject.getLong("ct").toFloat(),
mAppStateManager.session.mSessionStartTime.toFloat(),
mAppStateManager.fetchSession().mSessionStartTime.toFloat(),
1000f
)
Assert.assertEquals(
"""started sessionID = ${sessionId.value}
current sessionId = ${mAppStateManager.session.mSessionID}
current sessionId = ${mAppStateManager.fetchSession().mSessionID}
sent sessionId = ${eventObject.getString("id")}""",
mAppStateManager.session.mSessionID,
mAppStateManager.fetchSession().mSessionID,
eventObject.getString("id")
)
sessionStartReceived[0] = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AppStateManagerInstrumentedTest : BaseCleanStartedEachTest() {
}
mAppStateManager?.ensureActiveSession()
for (mpid in mpids) {
mAppStateManager?.session?.addMpid(mpid)
mAppStateManager?.fetchSession()?.addMpid(mpid)
}
val checked = BooleanArray(1)
val latch: CountDownLatch = MPLatch(1)
Expand Down Expand Up @@ -72,7 +72,7 @@ class AppStateManagerInstrumentedTest : BaseCleanStartedEachTest() {
mpids.add(Constants.TEMPORARY_MPID)
mAppStateManager?.ensureActiveSession()
for (mpid in mpids) {
mAppStateManager?.session?.addMpid(mpid)
mAppStateManager?.fetchSession()?.addMpid(mpid)
}
val latch: CountDownLatch = MPLatch(1)
val checked = MutableBoolean(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ class BatchSessionInfoTest : BaseCleanStartedEachTest() {

AccessUtils.awaitMessageHandler()
MParticle.getInstance()?.Internal()?.apply {
val sessionId = appStateManager.session.mSessionID
val sessionId = appStateManager.fetchSession().mSessionID
appStateManager.endSession()
appStateManager.ensureActiveSession()
InstallReferrerHelper.setInstallReferrer(mContext, "222")
assertNotEquals(sessionId, appStateManager.session.mSessionID)
assertNotEquals(sessionId, appStateManager.fetchSession().mSessionID)
}

var messageCount = 0
Expand Down
Loading

0 comments on commit 268d850

Please sign in to comment.