enable logging of EVENTS again

This commit is contained in:
Milos Kozak 2021-10-30 18:29:00 +02:00
parent da45219b98
commit c4765b42f0
25 changed files with 33 additions and 24 deletions

View file

@ -64,7 +64,7 @@ class OverviewPlugin @Inject constructor(
private var disposable: CompositeDisposable = CompositeDisposable()
override val overviewBus = RxBus(aapsSchedulers)
override val overviewBus = RxBus(aapsSchedulers, aapsLogger)
class DeviationDataPoint(x: Double, y: Double, var color: Int, scale: Scale) : ScaledDataPoint(x, y, scale)

View file

@ -32,7 +32,7 @@ open class TestBaseWithProfile : TestBase() {
@Mock lateinit var context: Context
lateinit var dateUtil: DateUtil
val rxBus = RxBus(aapsSchedulers)
val rxBus = RxBus(aapsSchedulers, aapsLogger)
val profileInjector = HasAndroidInjector { AndroidInjector { } }

View file

@ -28,7 +28,7 @@ import org.mockito.Mockito.`when`
class LoopPluginTest : TestBase() {
@Mock lateinit var sp: SP
private val rxBus: RxBus = RxBus(aapsSchedulers)
private val rxBus: RxBus = RxBus(aapsSchedulers, aapsLogger)
@Mock lateinit var constraintChecker: ConstraintChecker
@Mock lateinit var resourceHelper: ResourceHelper
@Mock lateinit var profileFunction: ProfileFunction

View file

@ -32,6 +32,6 @@ class ConfigBuilderPluginTest : TestBase() {
@Before
fun prepareMock() {
configBuilderPlugin = ConfigBuilderPlugin(injector, aapsLogger, resourceHelper, sp, RxBus(aapsSchedulers), activePlugin, uel, pumpSync)
configBuilderPlugin = ConfigBuilderPlugin(injector, aapsLogger, resourceHelper, sp, RxBus(aapsSchedulers, aapsLogger), activePlugin, uel, pumpSync)
}
}

View file

@ -29,7 +29,8 @@ class DstHelperPluginTest : TestBase() {
@Before
fun mock() {
plugin = DstHelperPlugin(injector, aapsLogger, RxBus(aapsSchedulers), resourceHelper, sp, activePlugin, loopPlugin)
plugin = DstHelperPlugin(injector, aapsLogger, RxBus(aapsSchedulers, aapsLogger), resourceHelper,
sp, activePlugin, loopPlugin)
}
@Test

View file

@ -16,7 +16,7 @@ class SignatureVerifierPluginTest : TestBase() {
@Mock lateinit var resourceHelper: ResourceHelper
@Mock lateinit var sp: SP
@Mock lateinit var context: Context
private val rxBus = RxBus(aapsSchedulers)
private val rxBus = RxBus(aapsSchedulers, aapsLogger)
val injector = HasAndroidInjector { AndroidInjector { } }

View file

@ -18,7 +18,7 @@ import org.mockito.Mockito.anyLong
class StorageConstraintPluginTest : TestBase() {
@Mock lateinit var resourceHelper: ResourceHelper
private val rxBusWrapper = RxBus(aapsSchedulers)
private val rxBusWrapper = RxBus(aapsSchedulers, aapsLogger)
private lateinit var storageConstraintPlugin: StorageConstraintPlugin

View file

@ -26,7 +26,7 @@ class NsClientReceiverDelegateTest : TestBase() {
@Mock lateinit var resourceHelper: ResourceHelper
lateinit var receiverStatusStore: ReceiverStatusStore
val rxBus = RxBus(aapsSchedulers)
val rxBus = RxBus(aapsSchedulers, aapsLogger)
private var sut: NsClientReceiverDelegate? = null

View file

@ -22,7 +22,7 @@ import org.mockito.Mockito.`when`
class VirtualPumpPluginUTest : TestBase() {
private val rxBus = RxBus(aapsSchedulers)
private val rxBus = RxBus(aapsSchedulers, aapsLogger)
@Mock lateinit var fabricPrivacy: FabricPrivacy
@Mock lateinit var resourceHelper: ResourceHelper
@Mock lateinit var sp: SP

View file

@ -8,6 +8,7 @@ import info.nightscout.androidaps.TestBaseWithProfile
import info.nightscout.androidaps.TestPumpPlugin
import info.nightscout.androidaps.core.R
import info.nightscout.androidaps.data.DetailedBolusInfo
import info.nightscout.androidaps.data.PumpEnactResult
import info.nightscout.androidaps.database.AppRepository
import info.nightscout.androidaps.database.ValueWrapper
import info.nightscout.androidaps.database.entities.Bolus
@ -92,6 +93,9 @@ class CommandQueueTest : TestBaseWithProfile() {
if (it is CommandLoadHistory) {
it.activePlugin = activePlugin
}
if (it is PumpEnactResult) {
it.resourceHelper = resourceHelper
}
}
}

View file

@ -43,7 +43,7 @@ class BolusWizardTest : TestBase() {
if (it is BolusWizard) {
it.aapsLogger = aapsLogger
it.resourceHelper = resourceHelper
it.rxBus = RxBus(aapsSchedulers)
it.rxBus = RxBus(aapsSchedulers, aapsLogger)
it.profileFunction = profileFunction
it.constraintChecker = constraintChecker
it.activePlugin = activePlugin

View file

@ -35,7 +35,7 @@ class AutomationEventTest : TestBase() {
it.loopPlugin = loopPlugin
it.resourceHelper = resourceHelper
it.configBuilder = configBuilder
it.rxBus = RxBus(aapsSchedulers)
it.rxBus = RxBus(aapsSchedulers, aapsLogger)
}
}
}

View file

@ -32,7 +32,7 @@ open class TestBaseWithProfile : TestBase() {
@Mock lateinit var config: Config
@Mock lateinit var repository: AppRepository
val rxBus = RxBus(aapsSchedulers)
val rxBus = RxBus(aapsSchedulers, aapsLogger)
val profileInjector = HasAndroidInjector {
AndroidInjector {

View file

@ -45,7 +45,7 @@ open class TriggerTestBase : TestBaseWithProfile() {
AndroidInjector {
if (it is Trigger) {
it.aapsLogger = aapsLogger
it.rxBus = RxBus(aapsSchedulers)
it.rxBus = RxBus(aapsSchedulers, aapsLogger)
it.resourceHelper = resourceHelper
it.profileFunction = profileFunction
it.sp = sp

View file

@ -43,7 +43,7 @@ class ComboPluginTest : TestBase() {
fun prepareMocks() {
`when`(resourceHelper.gs(R.string.novalidbasalrate)).thenReturn("No valid basal rate read from pump")
`when`(resourceHelper.gs(R.string.combo_pump_unsupported_operation)).thenReturn("Requested operation not supported by pump")
comboPlugin = ComboPlugin(injector, aapsLogger, RxBus(aapsSchedulers), resourceHelper, profileFunction, sp, commandQueue, context, pumpSync, dateUtil)
comboPlugin = ComboPlugin(injector, aapsLogger, RxBus(aapsSchedulers, aapsLogger), resourceHelper, profileFunction, sp, commandQueue, context, pumpSync, dateUtil)
}
@Test

View file

@ -2,6 +2,8 @@ package info.nightscout.androidaps.plugins.bus
import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.androidaps.events.Event
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import io.reactivex.Observable
import io.reactivex.subjects.PublishSubject
@ -11,12 +13,14 @@ import javax.inject.Singleton
@OpenForTesting
@Singleton
class RxBus @Inject constructor(
val aapsSchedulers: AapsSchedulers
val aapsSchedulers: AapsSchedulers,
val aapsLogger: AAPSLogger
) {
private val publisher = PublishSubject.create<Event>()
fun send(event: Event) {
aapsLogger.debug(LTag.EVENTS, "Sending $event")
publisher.onNext(event)
}

View file

@ -29,7 +29,7 @@ open class TestBaseWithProfile : TestBase() {
@Mock lateinit var dateUtil: DateUtil
@Mock lateinit var config: Config
val rxBus = RxBus(aapsSchedulers)
val rxBus = RxBus(aapsSchedulers, aapsLogger)
val profileInjector = HasAndroidInjector {
AndroidInjector {

View file

@ -59,7 +59,7 @@ class ProfileTest : TestBase() {
fun prepare() {
testPumpPlugin = TestPumpPlugin { AndroidInjector { } }
dateUtil = DateUtil(context)
rxBus = RxBus(TestAapsSchedulers())
rxBus = RxBus(TestAapsSchedulers(), aapsLogger)
hardLimits = HardLimits(aapsLogger, rxBus, sp, resourceHelper, context, repository)
`when`(activePluginProvider.activePump).thenReturn(testPumpPlugin)
`when`(resourceHelper.gs(R.string.profile_per_unit)).thenReturn("/U")

View file

@ -29,7 +29,7 @@ open class TestBaseWithProfile : TestBase() {
@Mock lateinit var dateUtil: DateUtil
@Mock lateinit var config: Config
val rxBus = RxBus(aapsSchedulers)
val rxBus = RxBus(aapsSchedulers, aapsLogger)
val profileInjector = HasAndroidInjector {
AndroidInjector {

View file

@ -29,7 +29,7 @@ open class TestBaseWithProfile : TestBase() {
@Mock lateinit var dateUtil: DateUtil
@Mock lateinit var config: Config
val rxBus = RxBus(aapsSchedulers)
val rxBus = RxBus(aapsSchedulers, aapsLogger)
val profileInjector = HasAndroidInjector {
AndroidInjector {

View file

@ -66,7 +66,7 @@ open class DanaRTestBase : TestBase() {
it.danaRPlugin = danaRPlugin
it.danaRKoreanPlugin = danaRKoreanPlugin
it.danaRv2Plugin = danaRv2Plugin
it.rxBus = RxBus(aapsSchedulers)
it.rxBus = RxBus(aapsSchedulers, aapsLogger)
it.resourceHelper = resourceHelper
it.activePlugin = activePlugin
it.configBuilder = configBuilder

View file

@ -29,7 +29,7 @@ open class TestBaseWithProfile : TestBase() {
@Mock lateinit var dateUtil: DateUtil
@Mock lateinit var config: Config
val rxBus = RxBus(aapsSchedulers)
val rxBus = RxBus(aapsSchedulers, aapsLogger)
val profileInjector = HasAndroidInjector {
AndroidInjector {

View file

@ -34,7 +34,7 @@ class MedtronicPumpHistoryDecoderUTest : TestBase() {
private var medtronicPumpStatus: MedtronicPumpStatus? = null
private var medtronicUtil: MedtronicUtil? = null
private var decoder: MedtronicPumpHistoryDecoder? = null
var rxBusWrapper = RxBus(TestAapsSchedulers())
var rxBusWrapper = RxBus(TestAapsSchedulers(), aapsLogger)
@Before fun setup() {
medtronicPumpStatus =
MedtronicPumpStatus(resourceHelper, sp, rxBusWrapper, rileyLinkUtil)

View file

@ -40,7 +40,7 @@ class OmnipodErosPumpPluginTest : TestBase() {
@Mock lateinit var rileyLinkUtil: RileyLinkUtil
@Mock lateinit var pumpSync: PumpSync
var rxBusWrapper = RxBus(TestAapsSchedulers())
var rxBusWrapper = RxBus(TestAapsSchedulers(), aapsLogger)
@Before fun prepare() {
`when`(resourceHelper.gs(ArgumentMatchers.anyInt(), ArgumentMatchers.anyLong()))

View file

@ -19,7 +19,7 @@ class AapsErosPodStateManagerTest : TestBase() {
@Mock lateinit var sp: SP
private val rxBus = RxBus(TestAapsSchedulers())
private val rxBus = RxBus(TestAapsSchedulers(), aapsLogger)
@Test fun times() {
val timeZone = DateTimeZone.UTC