-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #569 from CleverTap/develop
Updating master correctly for core release 610
- Loading branch information
Showing
145 changed files
with
2,612 additions
and
2,277 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup JDK 11 | ||
- name: Setup JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
java-version: '17' | ||
distribution: 'temurin' | ||
# cache: gradle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
clevertap-core/src/androidTest/kotlin/CTPushAmpWorkerInstrumentationTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import android.content.Context | ||
import android.util.Log | ||
import androidx.test.core.app.ApplicationProvider | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.work.Configuration | ||
import androidx.work.Constraints.Builder | ||
import androidx.work.NetworkType.CONNECTED | ||
import androidx.work.PeriodicWorkRequest | ||
import androidx.work.WorkInfo | ||
import androidx.work.WorkManager | ||
import androidx.work.testing.SynchronousExecutor | ||
import androidx.work.testing.WorkManagerTestInitHelper | ||
import com.clevertap.android.sdk.CleverTapAPI | ||
import com.clevertap.android.sdk.CleverTapAPI.LogLevel.VERBOSE | ||
import com.clevertap.android.sdk.pushnotification.amp.CTPushAmpWorker | ||
import org.hamcrest.CoreMatchers.* | ||
import org.hamcrest.MatcherAssert.* | ||
import org.junit.* | ||
import org.junit.runner.* | ||
import java.util.concurrent.TimeUnit.MINUTES | ||
|
||
@RunWith(AndroidJUnit4::class) | ||
class CTPushAmpWorkerInstrumentationTest { | ||
@Before | ||
fun setup() { | ||
val context = InstrumentationRegistry.getInstrumentation().targetContext | ||
val config = Configuration.Builder() | ||
.setMinimumLoggingLevel(Log.VERBOSE) | ||
.setExecutor(SynchronousExecutor()) | ||
.build() | ||
|
||
// Initialize WorkManager for instrumentation tests. | ||
WorkManagerTestInitHelper.initializeTestWorkManager(context, config) | ||
} | ||
|
||
@Test | ||
fun testWork(){ | ||
CleverTapAPI.setDebugLevel(VERBOSE) | ||
val myContext = ApplicationProvider.getApplicationContext<Context>() | ||
|
||
val constraints = Builder() | ||
.setRequiredNetworkType(CONNECTED) | ||
.setRequiresCharging(false) | ||
.setRequiresBatteryNotLow(true) | ||
.build() | ||
|
||
val request = | ||
PeriodicWorkRequest.Builder(CTPushAmpWorker::class.java, 15, MINUTES, 5, MINUTES) | ||
.setConstraints(constraints).build() | ||
|
||
val workManager = WorkManager.getInstance(myContext) | ||
val testDriver = WorkManagerTestInitHelper.getTestDriver(myContext)!! | ||
// Enqueue | ||
workManager.enqueue(request).result.get() | ||
testDriver.setAllConstraintsMet(request.id) | ||
testDriver.setPeriodDelayMet(request.id) | ||
val workInfo = workManager.getWorkInfoById(request.id).get() | ||
println("workInfo = $workInfo") | ||
// Assert | ||
assertThat(workInfo.state, `is`(WorkInfo.State.ENQUEUED)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.