Test if basexserver is running?

Thursday, 29 August 2019 · 3 messages · last reply 2 Sep 2019
BE
Ben Engbers29 Aug 2019 15:03 #
Hi, Last year I have written a R-client for basex (https://github.com/BaseXdb/basex/tree/master/basex-api/src/main/r/RbaseXClient.R). The present version uses no exception handling and you have to include the source-file in your R-code. A much cleaner solution would be catch all the errors and to pack the sources in a package. At this moment, I am working on such a R-package. The first test that should be executed in the package, is to test if a basexserver is available. How can I test on Linux, Apple and Windows if a baseserver is running? Ben
MS
Michael Seiferle30 Aug 2019 14:44 #
Hi Ben, I maybe don’t fully get your question right (and I admin I do not know much about R), but I’d simply open the socket on the port I expect BaseX to be listening on and see whether or not I receive a BaseX:123456789 response and close the connection immediately after. Best Michael
Quoted text · Ben Engbers · 17 lines
> Am 29.08.2019 um 15:03 schrieb Ben Engbers <Ben.Engbers at Be-Logical.nl>: > > Hi, > > Last year I have written a R-client for basex > (https://github.com/BaseXdb/basex/tree/master/basex-api/src/main/r/RbaseXClient.R <https://github.com/BaseXdb/basex/tree/master/basex-api/src/main/r/RbaseXClient.R>). > The present version uses no exception handling and you have to include > the source-file in your R-code. A much cleaner solution would be catch > all the errors and to pack the sources in a package. At this moment, I > am working on such a R-package. > > The first test that should be executed in the package, is to test if a > basexserver is available. > > How can I test on Linux, Apple and Windows if a baseserver is running? > > Ben
BE
Ben Engbers2 Sep 2019 11:21 #
Hi Michael, When unit-testing a package, the first test should be to test if a connection to basexserver can be established. This is not difficult, in fact the first thing I do in my code, is opening a connection so I already know that my code works. But what does it mean when an attempt to open a connection fails? Does this mean that there is an error in my code or does the attempt fail because there is no Basexserver running? So if you want to test the code, you first have to be certain that a server is running. Using Google, I found this solution when using Linux. In linux, you can use the 'ps -fC java' command to see which processes are running in java. 'ps -fC java | grep basex | echo $?' returns 0, meaning that a basexserver-instance is running. I guess that it will be easy to incorporate this command in a R-function. Do you know if a similar command is available for Windows? Ben PS. What do you mean with BaseX:123456789?
Quoted text · Michael Seiferle · 30 lines
Op 30-08-19 om 14:44 schreef Michael Seiferle: > Hi Ben, > > I maybe don’t fully get your question right (and I admin I do not know > much about R), but I’d simply open the socket on the port I expect BaseX > to be listening on and see whether or not I receive a `BaseX:123456789` > response and close the connection immediately after. > > Best > Michael > >> Am 29.08.2019 um 15:03 schrieb Ben Engbers <Ben.Engbers at Be-Logical.nl >> <mailto:Ben.Engbers at Be-Logical.nl>>: >> >> Hi, >> >> Last year I have written a R-client for basex >> (https://github.com/BaseXdb/basex/tree/master/basex-api/src/main/r/RbaseXClient.R). >> The present version uses no exception handling and you have to include >> the source-file in your R-code. A much cleaner solution would be catch >> all the errors and to pack the sources in a package. At this moment, I >> am working on such a R-package. >> >> The first test that should be executed in the package, is to test if a >> basexserver is available. >> >> How can I test on Linux, Apple and Windows if a baseserver is running? >> >> Ben >

⚡Generated with XQuery