Skip to content

Commit

Permalink
Merge pull request #1668 from DataDog/xgouchet/RUM-392/3_shared_core_…
Browse files Browse the repository at this point in the history
…fixtures

(3/3) RUM-392 let all modules use the shared fixtures
  • Loading branch information
xgouchet authored Oct 16, 2023
2 parents 72ae0d1 + a470a07 commit cbdf622
Show file tree
Hide file tree
Showing 35 changed files with 53 additions and 795 deletions.
5 changes: 5 additions & 0 deletions dd-sdk-android-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ android {
)
}
}

sourceSets.named("test") {
// Required because AGP doesn't support kotlin test fixtures :/
java.srcDir("${project.rootDir.path}/dd-sdk-android-core/src/testFixtures/kotlin")
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

package com.datadog.android.utils.forge

import com.datadog.android.tests.elmyr.useCoreFactories
import com.datadog.tools.unit.forge.BaseConfigurator
import fr.xgouchet.elmyr.Forge
import fr.xgouchet.elmyr.jvm.useJvmFactories
Expand All @@ -14,14 +15,13 @@ internal class Configurator :
BaseConfigurator() {
override fun configure(forge: Forge) {
super.configure(forge)
forge.useCoreFactories()

// Datadog Core
forge.addFactory(CustomAttributesForgeryFactory())
forge.addFactory(ConfigurationForgeryFactory())
forge.addFactory(ConfigurationCoreForgeryFactory())
forge.addFactory(ConfigurationForgeryFactory())
forge.addFactory(NetworkInfoForgeryFactory())
forge.addFactory(UserInfoForgeryFactory())
forge.addFactory(FilePersistenceConfigForgeryFactory())
forge.addFactory(AndroidInfoProviderForgeryFactory())
forge.addFactory(FeatureStorageConfigurationForgeryFactory())
Expand All @@ -39,10 +39,6 @@ internal class Configurator :
forge.addFactory(CharsetForgeryFactory())

// Datadog SDK v2
forge.addFactory(TimeInfoForgeryFactory())
forge.addFactory(ProcessInfoForgeryFactory())
forge.addFactory(DeviceInfoForgeryFactory())
forge.addFactory(DatadogContextForgeryFactory())
forge.addFactory(DataUploadConfigurationForgeryFactory())

// UploadStatus
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import fr.xgouchet.elmyr.ForgeryFactory

class NetworkInfoForgeryFactory : ForgeryFactory<NetworkInfo> {

@Suppress("MagicNumber")
override fun getForgery(forge: Forge): NetworkInfo {
return NetworkInfo(
connectivity = forge.aValueFrom(NetworkInfo.Connectivity::class.java),
Expand Down
6 changes: 6 additions & 0 deletions features/dd-sdk-android-logs/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ android {
}

namespace = "com.datadog.android.log"

sourceSets.named("test") {
// Required because AGP doesn't support kotlin test fixtures :/
java.srcDir("${project.rootDir.path}/dd-sdk-android-core/src/testFixtures/kotlin")
}
}

dependencies {
Expand All @@ -63,6 +68,7 @@ dependencies {
)
}
}
testImplementation(testFixtures(project(":dd-sdk-android-core")))
testImplementation(libs.bundles.jUnit5)
testImplementation(libs.bundles.testTools)
unmock(libs.robolectric)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

package com.datadog.android.utils.forge

import com.datadog.android.tests.elmyr.useCoreFactories
import com.datadog.tools.unit.forge.BaseConfigurator
import fr.xgouchet.elmyr.Forge
import fr.xgouchet.elmyr.jvm.useJvmFactories
Expand All @@ -15,11 +16,9 @@ internal class Configurator : BaseConfigurator() {
override fun configure(forge: Forge) {
super.configure(forge)

forge.addFactory(DatadogContextForgeryFactory())
forge.addFactory(LogEventForgeryFactory())
forge.addFactory(UserInfoForgeryFactory())
forge.addFactory(NetworkInfoForgeryFactory())
forge.useCoreFactories()

forge.addFactory(LogEventForgeryFactory())
forge.addFactory(LogsConfigurationForgeryFactory())

forge.useJvmFactories()
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit cbdf622

Please sign in to comment.