-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Improvements in Mongo connection including batch script for windows and warnings, minor fixes plus parameterised JUnit allowing a mongo environment to be used for connection testing. This is something to be expanded for use significantly in future allowing full automated testing of saving to NS too * Fixed a couple bugs. One in advisor related to how dates are handled. So changed all date parsing to use the pattern matching and created date formats. Also added Junit tests to check each format works and a performance test case comparing 1,000,000 calls using pattern matching and a fixed date format. Second bug seemed to prevent window synchronisation from working. The key thread was being conditionally created - and I've no idea why. Removed the condition so now always created and synch from window works once again * Completed changes for v4.1 * included an assert in date unit test
- Loading branch information
Showing
36 changed files
with
1,226 additions
and
3,547 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
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,119 @@ | ||
@ECHO OFF | ||
REM --------------------------------------------------------------------------- | ||
REM | ||
REM Run script for launching the NightScoutLoader application | ||
REM | ||
REM 1 Checks that jar file is correctly installed in folder | ||
REM 2 Checks that the C:\Temp folder exists for log file | ||
REM 3 Ensures that correct parameters are passed to runtime JVM | ||
REM | ||
REM --------------------------------------------------------------------------- | ||
SETLOCAL enabledelayedexpansion | ||
|
||
REM | ||
REM Set some variables up | ||
REM | ||
SET jarfile=NightScoutLoader.jar | ||
SET tmpdir=C:\Temp | ||
SET msgdir=%temp% | ||
|
||
REM | ||
REM Ensure that the script runs from the same directory the script resides in | ||
REM The assumption is that both the BAT script and the JAR file are in the same | ||
REM directory. | ||
REM | ||
cd /D "%~dp0" | ||
|
||
REM --------------------------------------------------------------------------- | ||
REM | ||
REM Do some basic checks and alert if needed | ||
REM | ||
REM --------------------------------------------------------------------------- | ||
|
||
REM | ||
REM Java file needs to be present | ||
REM | ||
if NOT EXIST %jarfile% ( | ||
CALL :displayMessage CRITICAL "NightScoutLoader Jar file needs to be present as '%jarfile%'" "" "Did the download append '(1)' to the filename perhaps?" "" "If so, please rename the Jar file to '%jarfile%' in directory %~dp0" | ||
SET ERRORLEVEL=1 | ||
EXIT /B %ERRORLEVEL% | ||
) | ||
|
||
REM | ||
REM NightScoutLoader logs to %tmpdir% so ensure it exists too | ||
REM | ||
if NOT EXIST %tmpdir% ( | ||
md %tmpdir% | ||
if NOT EXIST %tmpdir% ( | ||
CALL :displayMessage EXCLAMATION "NightScoutLoader relies on %tmpdir% by default for its log file" "" "However, you don't have permission to create this folder" "" "Use elevated permissions to create manually" | ||
SET ERRORLEVEL=1 | ||
EXIT /B %ERRORLEVEL% | ||
) | ||
CALL :displayMessage INFORMATION "Successfully created %tmpdir% for NightScoutLoader log file" "" "Select OK to continue" | ||
) | ||
|
||
REM | ||
REM Invoke NightScoutLoader with options to increase memory and also with the TLS option set | ||
REM TLS is needed to successfully connect to Mongo Atlas on Windows | ||
REM | ||
java -Xmx1024m -Xms128m -Djdk.tls.client.protocols=TLSv1.2 -jar %jarfile% | ||
EXIT /B %ERRORLEVEL% | ||
|
||
REM --------------------------------------------------------------------------- | ||
REM | ||
REM Display Message function for notifications | ||
REM | ||
REM %~1 CRITICAL, QUESTION, EXCLAMATION or INFORMATION - sets msgbox symbol | ||
REM %~2 First line message | ||
REM %~2 Second line message | ||
REM ... | ||
REM %~2 Fifth line message | ||
REM --------------------------------------------------------------------------- | ||
:displayMessage | ||
SET symbol="" | ||
SET header="" | ||
|
||
if "%~1"=="CRITICAL" ( | ||
SET symbol=, vbCritical + vbOKOnly | ||
SET header="SETUP ERROR:" | ||
) | ||
if "%~1"=="QUESTION" ( | ||
SET symbol=, vbQuestion + vbOKOnly | ||
SET header="" | ||
) | ||
if "%~1"=="EXCLAMATION" ( | ||
SET symbol=, vbExclamation + vbOKOnly | ||
SET header="SETUP ERROR:" | ||
) | ||
if "%~1"=="INFORMATION" ( | ||
SET symbol=, vbInformation + vbOKOnly | ||
SET header="Please Note:" | ||
) | ||
shift | ||
|
||
IF NOT "%~5"=="" goto fiveLines | ||
IF NOT "%~4"=="" goto fourLines | ||
IF NOT "%~3"=="" goto threeLines | ||
IF NOT "%~2"=="" goto twoLines | ||
IF NOT "%~1"=="" goto oneLine | ||
|
||
:oneLine | ||
echo MSGBOX %header% ^& vbCrLf ^& vbCrLf ^& "%~1" %symbol% > %msgdir%\TEMPmessage.vbs | ||
goto runVB | ||
:twoLines | ||
echo MSGBOX %header% ^& vbCrLf ^& vbCrLf ^& "%~1" ^& vbCrLf ^& "%~2" %symbol% > %msgdir%\TEMPmessage.vbs | ||
goto runVB | ||
:threeLines | ||
echo MSGBOX %header% ^& vbCrLf ^& vbCrLf ^& "%~1" ^& vbCrLf ^& "%~2" ^& vbCrLf ^& "%~3" %symbol% > %msgdir%\TEMPmessage.vbs | ||
goto runVB | ||
:fourLines | ||
echo MSGBOX %header% ^& vbCrLf ^& vbCrLf ^& "%~1" ^& vbCrLf ^& "%~2" ^& vbCrLf ^& "%~3" ^& vbCrLf ^& "%~4" %symbol% > %msgdir%\TEMPmessage.vbs | ||
goto runVB | ||
:fiveLines | ||
echo MSGBOX %header% ^& vbCrLf ^& vbCrLf ^& "%~1" ^& vbCrLf ^& "%~2" ^& vbCrLf ^& "%~3" ^& vbCrLf ^& "%~4" ^& vbCrLf ^& "%~5" %symbol% > %msgdir%\TEMPmessage.vbs | ||
goto runVB | ||
|
||
:runVB | ||
call %msgdir%\TEMPmessage.vbs | ||
del %msgdir%\TEMPmessage.vbs /f /q | ||
EXIT /B 0 |
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,36 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# Linux script to run NightScoutLoader to load all Diasend files from the $inDir | ||
# in succession, one after the other. | ||
# As each file gets processed, the file is moved to $arDir archive directory and | ||
# timestamped with processing date/time | ||
# | ||
# Variables below need to be set carefully | ||
# | ||
|
||
dir="" # Directory of the NightScoutLoader.jar file and probably this script too | ||
inDir="" # Directory where Diasend files to upload are put | ||
arDir="" # Directory where Diasend files once processed get archived | ||
log="${dir}/loadDiasend.log" | ||
jarLog="${dir}/NightscoutLoader_Diasend.log" | ||
jar="${dir}/NightScoutLoader.jar" | ||
msr="" # Set to your MongoDB URI | ||
mdb="" # Set to your MongoDB DB | ||
weeks=104 | ||
|
||
processFile() | ||
{ | ||
file=$1 | ||
ofile=`basename "${file}" .xls`.`echo $(date +%FT%H%M%S)`.xls | ||
|
||
echo "$(date +%FT%H%M%S) - Processing Diasend file $file" | tee -a $log | ||
java -Xmx1024m -Xms128m -jar $jar -m diasend -f "${file}" -s $msr -d $mdb -w $weeks -l "$jarLog" | tee -a $log | ||
echo "Archiving file as $ofile in $arDir" | ||
mv "${file}" "${arDir}/${ofile}" | ||
} | ||
|
||
for f in ${inDir}/*; | ||
do | ||
processFile "$f" | ||
done |
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,36 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# Linux script to run NightScoutLoader to load all LibreView files from the $inDir | ||
# in succession, one after the other. | ||
# As each file gets processed, the file is moved to $arDir archive directory and | ||
# timestamped with processing date/time | ||
# | ||
# Variables below need to be set carefully | ||
# | ||
|
||
dir="" # Directory of the NightScoutLoader.jar file and probably this script too | ||
inDir="" # Directory where LibreView files to upload are put | ||
arDir="" # Directory where LibreView files once processed get archived | ||
log="${dir}/loadLibreview.log" | ||
jarLog="${dir}/NightscoutLoader_Libre.log" | ||
jar="${dir}/NightScoutLoader.jar" | ||
msr="" # Set to your MongoDB URI | ||
mdb="" # Set to your MongoDB DB | ||
weeks=104 | ||
|
||
processFile() | ||
{ | ||
file=$1 | ||
ofile=`basename "${file}" .csv`.`echo $(date +%FT%H%M%S)`.csv | ||
|
||
echo "$(date +%FT%H%M%S) - Processing Libreview file $file" | tee -a $log | ||
java -Xmx1024m -Xms128m -jar $jar -m libreview -f "${file}" -s $msr -d $mdb -w $weeks -l "$jarLog" | tee -a $log | ||
echo "Archiving file as $ofile in $arDir" | ||
mv "${file}" "${arDir}/${ofile}" | ||
} | ||
|
||
for f in ${inDir}/*; | ||
do | ||
processFile "$f" | ||
done |
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
Oops, something went wrong.