From 81eeacb02a6d112792ed376be3ee3cc99e289b6c Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 17 Mar 2020 19:50:20 +0100 Subject: [PATCH] cleanup --- .../nightscout/androidaps/MainActivity.java | 2 +- .../historyBrowser/HistoryBrowseActivity.java | 2 +- .../constraints/safety/SafetyPlugin.java | 2 +- .../general/actions/ActionsFragment.kt | 2 +- .../general/maintenance/MaintenancePlugin.kt | 2 +- .../general/overview/OverviewFragment.java | 2 +- .../iobCobCalculator/IobCobOref1Thread.java | 2 +- .../iob/iobCobCalculator/IobCobThread.java | 2 +- .../plugins/source/RandomBgPlugin.kt | 2 +- .../androidaps/queue/CommandQueue.kt | 2 +- .../utils/buildHelper/BuildHelper.kt | 31 +++++++++++++++++++ .../interfaces/ConstraintsCheckerTest.kt | 6 ++-- .../plugins/pump/combo/ComboPluginTest.kt | 3 +- ...t_Bolus_Get_Calculation_InformationTest.kt | 2 -- ...arbohydrate_Calculation_InformationTest.kt | 2 -- ...olus_Get_Extended_Menu_Option_StateTest.kt | 2 -- ...naRS_Packet_Bolus_Get_Initial_BolusTest.kt | 4 --- ...et_Bolus_Get_Step_Bolus_InformationTest.kt | 2 -- ...ket_Bolus_Set_Extended_Bolus_CancelTest.kt | 5 --- .../DanaRS_Packet_Etc_Keep_ConnectionTest.kt | 2 -- ...naRS_Packet_General_Delivery_StatusTest.kt | 3 -- ...Packet_General_Get_More_InformationTest.kt | 5 +-- .../DanaRS_Packet_General_Get_PasswordTest.kt | 7 +---- ...anaRS_Packet_General_Get_Pump_CheckTest.kt | 7 +---- ...et_General_Get_Shipping_InformationTest.kt | 6 +--- ...et_General_Get_Today_Delivery_TotalTest.kt | 5 +-- ...t_General_Get_User_Time_Change_FlagTest.kt | 5 +-- ..._General_Initial_Screen_InformationTest.kt | 5 +-- .../androidaps/queue/CommandQueueTest.kt | 2 +- 29 files changed, 54 insertions(+), 70 deletions(-) create mode 100644 app/src/main/java/info/nightscout/androidaps/utils/buildHelper/BuildHelper.kt diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.java b/app/src/main/java/info/nightscout/androidaps/MainActivity.java index 19d4dd7534..d115654832 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.java @@ -62,7 +62,7 @@ import info.nightscout.androidaps.utils.FabricPrivacy; import info.nightscout.androidaps.utils.LocaleHelper; import info.nightscout.androidaps.utils.OKDialog; import info.nightscout.androidaps.utils.PasswordProtection; -import info.nightscout.androidaps.utils.build.BuildHelper; +import info.nightscout.androidaps.utils.buildHelper.BuildHelper; import info.nightscout.androidaps.utils.resources.ResourceHelper; import info.nightscout.androidaps.utils.sharedPreferences.SP; import io.reactivex.android.schedulers.AndroidSchedulers; diff --git a/app/src/main/java/info/nightscout/androidaps/historyBrowser/HistoryBrowseActivity.java b/app/src/main/java/info/nightscout/androidaps/historyBrowser/HistoryBrowseActivity.java index 46a638ee2c..ad8a25678a 100644 --- a/app/src/main/java/info/nightscout/androidaps/historyBrowser/HistoryBrowseActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/historyBrowser/HistoryBrowseActivity.java @@ -41,7 +41,7 @@ import info.nightscout.androidaps.utils.DateUtil; import info.nightscout.androidaps.utils.DefaultValueHelper; import info.nightscout.androidaps.utils.FabricPrivacy; import info.nightscout.androidaps.utils.T; -import info.nightscout.androidaps.utils.build.BuildHelper; +import info.nightscout.androidaps.utils.buildHelper.BuildHelper; import info.nightscout.androidaps.utils.resources.ResourceHelper; import info.nightscout.androidaps.utils.sharedPreferences.SP; import io.reactivex.android.schedulers.AndroidSchedulers; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.java index 1ac0460d0b..a344d8b56a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.java @@ -31,7 +31,7 @@ import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; import info.nightscout.androidaps.utils.DecimalFormatter; import info.nightscout.androidaps.utils.HardLimits; import info.nightscout.androidaps.utils.Round; -import info.nightscout.androidaps.utils.build.BuildHelper; +import info.nightscout.androidaps.utils.buildHelper.BuildHelper; import info.nightscout.androidaps.utils.resources.ResourceHelper; import info.nightscout.androidaps.utils.sharedPreferences.SP; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt index b3923cbc85..aa2b83546d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt @@ -27,7 +27,7 @@ import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.OKDialog import info.nightscout.androidaps.utils.SingleClickButton -import info.nightscout.androidaps.utils.build.BuildHelper +import info.nightscout.androidaps.utils.buildHelper.BuildHelper import info.nightscout.androidaps.utils.extensions.plusAssign import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.sharedPreferences.SP diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.kt index 470c4c1947..91ec7c539e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.kt @@ -13,7 +13,7 @@ import info.nightscout.androidaps.interfaces.PluginDescription import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus -import info.nightscout.androidaps.utils.build.BuildHelper +import info.nightscout.androidaps.utils.buildHelper.BuildHelper import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.sharedPreferences.SP import java.io.* diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.java index b6c71c73a4..9e9a931eba 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.java @@ -116,7 +116,7 @@ import info.nightscout.androidaps.utils.Profiler; import info.nightscout.androidaps.utils.SingleClickButton; import info.nightscout.androidaps.utils.T; import info.nightscout.androidaps.utils.ToastUtils; -import info.nightscout.androidaps.utils.build.BuildHelper; +import info.nightscout.androidaps.utils.buildHelper.BuildHelper; import info.nightscout.androidaps.utils.resources.ResourceHelper; import info.nightscout.androidaps.utils.sharedPreferences.SP; import info.nightscout.androidaps.utils.wizard.BolusWizard; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Thread.java b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Thread.java index 6bf0de5f9f..c3d6685538 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Thread.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Thread.java @@ -41,7 +41,7 @@ import info.nightscout.androidaps.utils.FabricPrivacy; import info.nightscout.androidaps.utils.MidnightTime; import info.nightscout.androidaps.utils.Profiler; import info.nightscout.androidaps.utils.T; -import info.nightscout.androidaps.utils.build.BuildHelper; +import info.nightscout.androidaps.utils.buildHelper.BuildHelper; import info.nightscout.androidaps.utils.resources.ResourceHelper; import info.nightscout.androidaps.utils.sharedPreferences.SP; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobThread.java b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobThread.java index 5e47c3809b..950add8cbe 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobThread.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobThread.java @@ -39,7 +39,7 @@ import info.nightscout.androidaps.utils.FabricPrivacy; import info.nightscout.androidaps.utils.MidnightTime; import info.nightscout.androidaps.utils.Profiler; import info.nightscout.androidaps.utils.T; -import info.nightscout.androidaps.utils.build.BuildHelper; +import info.nightscout.androidaps.utils.buildHelper.BuildHelper; import info.nightscout.androidaps.utils.resources.ResourceHelper; import info.nightscout.androidaps.utils.sharedPreferences.SP; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/RandomBgPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/RandomBgPlugin.kt index 2c8b946b08..27f3fd4b4c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/RandomBgPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/RandomBgPlugin.kt @@ -15,7 +15,7 @@ import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.T -import info.nightscout.androidaps.utils.build.BuildHelper +import info.nightscout.androidaps.utils.buildHelper.BuildHelper import info.nightscout.androidaps.utils.extensions.isRunningTest import info.nightscout.androidaps.utils.resources.ResourceHelper import java.util.* diff --git a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.kt b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.kt index 8ae083c61e..fd93f772aa 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.kt @@ -33,7 +33,7 @@ import info.nightscout.androidaps.queue.commands.* import info.nightscout.androidaps.queue.commands.Command.CommandType import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.HtmlHelper -import info.nightscout.androidaps.utils.build.BuildHelper +import info.nightscout.androidaps.utils.buildHelper.BuildHelper import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.sharedPreferences.SP import io.reactivex.disposables.CompositeDisposable diff --git a/app/src/main/java/info/nightscout/androidaps/utils/buildHelper/BuildHelper.kt b/app/src/main/java/info/nightscout/androidaps/utils/buildHelper/BuildHelper.kt new file mode 100644 index 0000000000..f1cec2109f --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/utils/buildHelper/BuildHelper.kt @@ -0,0 +1,31 @@ +package info.nightscout.androidaps.utils.buildHelper + +import info.nightscout.androidaps.BuildConfig +import info.nightscout.androidaps.Config +import info.nightscout.androidaps.plugins.general.maintenance.LoggerUtils +import java.io.File +import javax.inject.Inject +import javax.inject.Singleton + +@Singleton +class BuildHelper @Inject constructor() { + + private var devBranch = false + private var engineeringMode = false + + init { + val extFilesDir = LoggerUtils.getLogDirectory() + val engineeringModeSemaphore = File(extFilesDir, "engineering_mode") + + engineeringMode = engineeringModeSemaphore.exists() && engineeringModeSemaphore.isFile + devBranch = BuildConfig.VERSION.contains("-") || BuildConfig.VERSION.matches(Regex(".*[a-zA-Z]+.*")) + } + + fun isEngineeringModeOrRelease(): Boolean = + if (!Config.APS) true else engineeringMode || !devBranch + + fun isEngineeringMode(): Boolean = + if (!Config.APS) true else engineeringMode || !devBranch + + fun isDev(): Boolean = devBranch +} \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt index 808446ea07..9b25478625 100644 --- a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt @@ -30,7 +30,7 @@ import info.nightscout.androidaps.plugins.source.GlimpPlugin import info.nightscout.androidaps.plugins.treatments.TreatmentService import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin import info.nightscout.androidaps.utils.HardLimits -import info.nightscout.androidaps.utils.build.BuildHelper +import info.nightscout.androidaps.utils.buildHelper.BuildHelper import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Assert @@ -124,10 +124,10 @@ class ConstraintsCheckerTest : TestBase() { danaRPump = DanaRPump(aapsLogger, sp, injector) hardLimits = HardLimits(aapsLogger, sp, resourceHelper, context) objectivesPlugin = ObjectivesPlugin(injector, aapsLogger, resourceHelper, activePlugin, sp) - comboPlugin = ComboPlugin(injector, aapsLogger, rxBus, resourceHelper, constraintChecker, profileFunction, treatmentsPlugin, sp, commandQueue) + comboPlugin = ComboPlugin(injector, aapsLogger, rxBus, resourceHelper, profileFunction, treatmentsPlugin, sp, commandQueue, context) danaRPlugin = DanaRPlugin(injector, aapsLogger, rxBus, context, resourceHelper, constraintChecker, treatmentsPlugin, sp, commandQueue, danaRPump) danaRSPlugin = DanaRSPlugin(injector, aapsLogger, rxBus, context, resourceHelper, constraintChecker, profileFunction, treatmentsPlugin, sp, commandQueue, danaRPump, detailedBolusInfoStorage) - insightPlugin = LocalInsightPlugin(injector, aapsLogger, rxBus, resourceHelper, constraintChecker, treatmentsPlugin, sp, commandQueue, profileFunction) + insightPlugin = LocalInsightPlugin(injector, aapsLogger, rxBus, resourceHelper, treatmentsPlugin, sp, commandQueue, profileFunction, context) openAPSSMBPlugin = OpenAPSSMBPlugin(injector, aapsLogger, rxBus, constraintChecker, resourceHelper, profileFunction, context, activePlugin, treatmentsPlugin, iobCobCalculatorPlugin, hardLimits) openAPSAMAPlugin = OpenAPSAMAPlugin(injector, aapsLogger, rxBus, constraintChecker, resourceHelper, profileFunction, context, activePlugin, treatmentsPlugin, iobCobCalculatorPlugin, hardLimits) openAPSMAPlugin = OpenAPSMAPlugin(injector, aapsLogger, rxBus, constraintChecker, resourceHelper, profileFunction, context, activePlugin, treatmentsPlugin, iobCobCalculatorPlugin, hardLimits) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/combo/ComboPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/combo/ComboPluginTest.kt index cee948afcd..3d5df01e05 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/combo/ComboPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/combo/ComboPluginTest.kt @@ -41,6 +41,7 @@ class ComboPluginTest : TestBase() { @Mock lateinit var commandQueue: CommandQueueProvider @Mock lateinit var treatmentsPlugin: TreatmentsPlugin @Mock lateinit var sp: SP + @Mock lateinit var context: Context val injector = HasAndroidInjector { AndroidInjector { @@ -52,7 +53,7 @@ class ComboPluginTest : TestBase() { @Before fun prepareMocks() { `when`(resourceHelper.gs(R.string.novalidbasalrate)).thenReturn("No valid basal rate read from pump") - comboPlugin = ComboPlugin(injector, aapsLogger, RxBusWrapper(), resourceHelper, constraintChecker, profileFunction, treatmentsPlugin, sp, commandQueue) + comboPlugin = ComboPlugin(injector, aapsLogger, RxBusWrapper(), resourceHelper, profileFunction, treatmentsPlugin, sp, commandQueue, context) } @Test diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Calculation_InformationTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Calculation_InformationTest.kt index 25a8e36dd9..4a805821b1 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Calculation_InformationTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Calculation_InformationTest.kt @@ -12,8 +12,6 @@ class DanaRS_Packet_Bolus_Get_Calculation_InformationTest : DanaRSTestBase() { @Test fun runTest() { val packet = DanaRS_Packet_Bolus_Get_Calculation_Information(aapsLogger, danaRPump) - // test params - val testparams = packet.requestParams Assert.assertEquals(null, packet.requestParams) // test message decoding packet.handleMessage(createArray(24, 0.toByte())) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_InformationTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_InformationTest.kt index 2709178cba..b344cf3ade 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_InformationTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_InformationTest.kt @@ -12,8 +12,6 @@ class DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_InformationTest : DanaRST @Test fun runTest() { val packet = DanaRS_Packet_Bolus_Get_Carbohydrate_Calculation_Information(aapsLogger, danaRPump) - // test params - val testparams = packet.requestParams Assert.assertEquals(null, packet.requestParams) // test message decoding packet.handleMessage(createArray(24, 0.toByte())) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Extended_Menu_Option_StateTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Extended_Menu_Option_StateTest.kt index cb9216d126..4dab05c2cf 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Extended_Menu_Option_StateTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Extended_Menu_Option_StateTest.kt @@ -12,8 +12,6 @@ class DanaRS_Packet_Bolus_Get_Extended_Menu_Option_StateTest : DanaRSTestBase() @Test fun runTest() { val packet = DanaRS_Packet_Bolus_Get_Extended_Menu_Option_State(aapsLogger, danaRPump) - // test params - val testparams = packet.requestParams Assert.assertEquals(null, packet.requestParams) // test message decoding packet.handleMessage(createArray(34, 0.toByte())) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Initial_BolusTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Initial_BolusTest.kt index 9af566cd34..c9f2529bb7 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Initial_BolusTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Initial_BolusTest.kt @@ -12,15 +12,11 @@ class DanaRS_Packet_Bolus_Get_Initial_BolusTest : DanaRSTestBase() { @Test fun runTest() { val packet = DanaRS_Packet_Bolus_Get_Initial_Bolus(aapsLogger) - // test params - val testparams = packet.requestParams Assert.assertEquals(null, packet.requestParams) // test message decoding packet.handleMessage(createArray(34, 0.toByte())) // should fail only if all the initialbolusses are 0 -// DanaRPump testPump = DanaRPump.getInstance(); Assert.assertEquals(false, !packet.failed) - // assertEquals(false, packet.failed); packet.handleMessage(createArray(34, 1.toByte())) Assert.assertEquals(true, !packet.failed) Assert.assertEquals("BOLUS__GET_BOLUS_RATE", packet.friendlyName) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Step_Bolus_InformationTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Step_Bolus_InformationTest.kt index fae9d7fd83..86239a8ea1 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Step_Bolus_InformationTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Get_Step_Bolus_InformationTest.kt @@ -12,8 +12,6 @@ class DanaRS_Packet_Bolus_Get_Step_Bolus_InformationTest : DanaRSTestBase() { @Test fun runTest() { val packet = DanaRS_Packet_Bolus_Get_Step_Bolus_Information(aapsLogger, danaRPump) - // test params - val testparams = packet.requestParams Assert.assertEquals(null, packet.requestParams) // test message decoding packet.handleMessage(createArray(34, 0.toByte())) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Set_Extended_Bolus_CancelTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Set_Extended_Bolus_CancelTest.kt index 55c5838317..adf2ec11f2 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Set_Extended_Bolus_CancelTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Bolus_Set_Extended_Bolus_CancelTest.kt @@ -12,16 +12,11 @@ class DanaRS_Packet_Bolus_Set_Extended_Bolus_CancelTest : DanaRSTestBase() { @Test fun runTest() { val packet = DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel(aapsLogger) - // test params - val testparams = packet.requestParams Assert.assertEquals(null, packet.requestParams) // test message decoding packet.handleMessage(createArray(34, 0.toByte())) - // DanaRPump testPump = DanaRPump.getInstance(); Assert.assertEquals(false, packet.failed) packet.handleMessage(createArray(34, 1.toByte())) - // int valueRequested = (((byte) 1 & 0x000000FF) << 8) + (((byte) 1) & 0x000000FF); -// assertEquals(valueRequested /100d, testPump.lastBolusAmount, 0); Assert.assertEquals(true, packet.failed) Assert.assertEquals("BOLUS__SET_EXTENDED_BOLUS_CANCEL", packet.friendlyName) } diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Etc_Keep_ConnectionTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Etc_Keep_ConnectionTest.kt index cd225f6d75..e1b90f30da 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Etc_Keep_ConnectionTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_Etc_Keep_ConnectionTest.kt @@ -12,8 +12,6 @@ class DanaRS_Packet_Etc_Keep_ConnectionTest : DanaRSTestBase() { @Test fun runTest() { val packet = DanaRS_Packet_Etc_Keep_Connection(aapsLogger) - // test params - val testparams = packet.requestParams Assert.assertEquals(null, packet.requestParams) // test message decoding packet.handleMessage(byteArrayOf(0.toByte(), 0.toByte(), 0.toByte())) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Delivery_StatusTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Delivery_StatusTest.kt index 13d1d9a6dd..fd32e3ca30 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Delivery_StatusTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Delivery_StatusTest.kt @@ -12,11 +12,8 @@ class DanaRS_Packet_General_Delivery_StatusTest : DanaRSTestBase() { @Test fun runTest() { val packet = DanaRS_Packet_General_Delivery_Status(aapsLogger) - // test params - val testparams = packet.requestParams Assert.assertEquals(null, packet.requestParams) // test message decoding -// everything ok :) packet.handleMessage(createArray(15, 0.toByte())) Assert.assertEquals(false, packet.failed) packet.handleMessage(createArray(15, 161.toByte())) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_More_InformationTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_More_InformationTest.kt index fc2ba0e850..327aa1c8a6 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_More_InformationTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_More_InformationTest.kt @@ -12,14 +12,11 @@ class DanaRS_Packet_General_Get_More_InformationTest : DanaRSTestBase() { @Test fun runTest() { var packet = DanaRS_Packet_General_Get_More_Information(aapsLogger, danaRPump) - // test params - val testparams = packet.requestParams Assert.assertEquals(null, packet.requestParams) // test message decoding -// test for the length message + // test for the length message packet.handleMessage(createArray(13, 0.toByte())) Assert.assertEquals(true, packet.failed) - // everything ok :) packet = DanaRS_Packet_General_Get_More_Information(aapsLogger, danaRPump) packet.handleMessage(createArray(15, 0.toByte())) Assert.assertEquals(false, packet.failed) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_PasswordTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_PasswordTest.kt index fc7dbf6eb5..88f3ac3496 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_PasswordTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_PasswordTest.kt @@ -12,19 +12,14 @@ class DanaRS_Packet_General_Get_PasswordTest : DanaRSTestBase() { @Test fun runTest() { var packet = DanaRS_Packet_General_Get_Password(aapsLogger, danaRPump) - // test params - val testparams = packet.requestParams Assert.assertEquals(null, packet.requestParams) // test message decoding -// test for the length message + // test for the length message packet.handleMessage(createArray(1, 0.toByte())) Assert.assertEquals(true, packet.failed) - // everything ok :) packet = DanaRS_Packet_General_Get_Password(aapsLogger, danaRPump) packet.handleMessage(createArray(15, 0.toByte())) Assert.assertEquals(false, packet.failed) - // packet.handleMessage(createArray(15, (byte) 161)); -// assertEquals(true, packet.failed); Assert.assertEquals("REVIEW__GET_PASSWORD", packet.friendlyName) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_Pump_CheckTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_Pump_CheckTest.kt index d9117338bb..6cde591c19 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_Pump_CheckTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_Pump_CheckTest.kt @@ -18,19 +18,14 @@ class DanaRS_Packet_General_Get_Pump_CheckTest : DanaRSTestBase() { @Test fun runTest() { var packet = DanaRS_Packet_General_Get_Pump_Check(aapsLogger, danaRPump, rxBus, resourceHelper) - // test params - val testparams = packet.requestParams Assert.assertEquals(null, packet.requestParams) // test message decoding -// test for the length message + // test for the length message packet.handleMessage(createArray(1, 0.toByte())) Assert.assertEquals(true, packet.failed) - // everything ok :) packet = DanaRS_Packet_General_Get_Pump_Check(aapsLogger, danaRPump, rxBus, resourceHelper) packet.handleMessage(createArray(15, 0.toByte())) Assert.assertEquals(false, packet.failed) - // packet.handleMessage(createArray(15, (byte) 161)); -// assertEquals(true, packet.failed); Assert.assertEquals("REVIEW__GET_PUMP_CHECK", packet.friendlyName) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_Shipping_InformationTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_Shipping_InformationTest.kt index 6a43ce857e..3de89db27b 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_Shipping_InformationTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_Shipping_InformationTest.kt @@ -10,19 +10,15 @@ class DanaRS_Packet_General_Get_Shipping_InformationTest : DanaRSTestBase() { @Test fun runTest() { var packet = DanaRS_Packet_General_Get_Shipping_Information(aapsLogger, danaRPump) - // test params - val testparams = packet.requestParams Assert.assertEquals(null, packet.requestParams) // test message decoding -// test for the length message + // test for the length message packet.handleMessage(createArray(1, 0.toByte())) Assert.assertEquals(true, packet.failed) // everything ok :) packet = DanaRS_Packet_General_Get_Shipping_Information(aapsLogger, danaRPump) packet.handleMessage(createArray(18, 0.toByte())) Assert.assertEquals(false, packet.failed) - // packet.handleMessage(createArray(15, (byte) 161)); -// assertEquals(true, packet.failed); Assert.assertEquals("REVIEW__GET_SHIPPING_INFORMATION", packet.friendlyName) } } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_Today_Delivery_TotalTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_Today_Delivery_TotalTest.kt index f3e54111c6..1e89db2771 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_Today_Delivery_TotalTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_Today_Delivery_TotalTest.kt @@ -12,14 +12,11 @@ class DanaRS_Packet_General_Get_Today_Delivery_TotalTest : DanaRSTestBase() { @Test fun runTest() { var packet = DanaRS_Packet_General_Get_Today_Delivery_Total(aapsLogger, danaRPump) - // test params - val testparams = packet.requestParams Assert.assertEquals(null, packet.requestParams) // test message decoding -// test for the length message + // test for the length message packet.handleMessage(createArray(1, 0.toByte())) Assert.assertEquals(true, packet.failed) - // everything ok :) packet = DanaRS_Packet_General_Get_Today_Delivery_Total(aapsLogger, danaRPump) packet.handleMessage(createArray(18, 0.toByte())) Assert.assertEquals(false, packet.failed) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_User_Time_Change_FlagTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_User_Time_Change_FlagTest.kt index 747bcc94cf..18f89e1096 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_User_Time_Change_FlagTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Get_User_Time_Change_FlagTest.kt @@ -12,14 +12,11 @@ class DanaRS_Packet_General_Get_User_Time_Change_FlagTest : DanaRSTestBase() { @Test fun runTest() { var packet = DanaRS_Packet_General_Get_User_Time_Change_Flag(aapsLogger) - // test params - val testparams = packet.requestParams Assert.assertEquals(null, packet.requestParams) // test message decoding -// test for the length message + // test for the length message packet.handleMessage(createArray(1, 0.toByte())) Assert.assertEquals(true, packet.failed) - // everything ok :) packet = DanaRS_Packet_General_Get_User_Time_Change_Flag(aapsLogger) packet.handleMessage(createArray(18, 0.toByte())) Assert.assertEquals(false, packet.failed) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Initial_Screen_InformationTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Initial_Screen_InformationTest.kt index fb71d10ec7..15e9f8e99b 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Initial_Screen_InformationTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/danaRS/comm/DanaRS_Packet_General_Initial_Screen_InformationTest.kt @@ -12,14 +12,11 @@ class DanaRS_Packet_General_Initial_Screen_InformationTest : DanaRSTestBase() { @Test fun runTest() { var packet = DanaRS_Packet_General_Initial_Screen_Information(aapsLogger, danaRPump) - // test params - val testparams = packet.requestParams Assert.assertEquals(null, packet.requestParams) // test message decoding -// test for the length message + // test for the length message packet.handleMessage(createArray(1, 0.toByte())) Assert.assertEquals(true, packet.failed) - // everything ok :) packet = DanaRS_Packet_General_Initial_Screen_Information(aapsLogger, danaRPump) packet.handleMessage(createArray(17, 1.toByte())) Assert.assertEquals(false, packet.failed) diff --git a/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.kt b/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.kt index bb8636d765..f66ecd4a55 100644 --- a/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueTest.kt @@ -18,7 +18,7 @@ import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin import info.nightscout.androidaps.queue.commands.Command import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.ToastUtils -import info.nightscout.androidaps.utils.build.BuildHelper +import info.nightscout.androidaps.utils.buildHelper.BuildHelper import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.sharedPreferences.SP import org.junit.Assert