diff --git a/R/data-storage-log-file.R b/R/data-storage-log-file.R index 1032a352..fba31309 100644 --- a/R/data-storage-log-file.R +++ b/R/data-storage-log-file.R @@ -36,7 +36,6 @@ DataStorageLogFile <- R6::R6Class( # nolint object_name_linter #' @param log_file_path string with path to JSON log file user actions initialize = function(log_file_path) { - super$initialize() logger::log_debug( "path to file: {log_file_path}", namespace = "shiny.telemetry" diff --git a/R/data-storage-mariadb.R b/R/data-storage-mariadb.R index 83e52da7..52a2c175 100644 --- a/R/data-storage-mariadb.R +++ b/R/data-storage-mariadb.R @@ -47,7 +47,6 @@ DataStorageMariaDB <- R6::R6Class( # nolint object_name_linter port = 3306, dbname = "shiny_telemetry" ) { - super$initialize() checkmate::assert_string(password) checkmate::assert_string(username) checkmate::assert_string(hostname) diff --git a/R/data-storage-plumber.R b/R/data-storage-plumber.R index 431101ff..b6a8865d 100644 --- a/R/data-storage-plumber.R +++ b/R/data-storage-plumber.R @@ -68,7 +68,6 @@ DataStoragePlumber <- R6::R6Class( # nolint object_name_linter secret = NULL, authorization = NULL ) { - super$initialize() private$hostname <- hostname private$port <- port diff --git a/R/data-storage-postgresql.R b/R/data-storage-postgresql.R index 4e82ba74..f88f95f0 100644 --- a/R/data-storage-postgresql.R +++ b/R/data-storage-postgresql.R @@ -46,7 +46,6 @@ DataStoragePostgreSQL <- R6::R6Class( # nolint object_name_linter port = 5432, dbname = "shiny_telemetry" ) { - super$initialize() checkmate::assert_string(password) checkmate::assert_string(username) checkmate::assert_string(hostname) diff --git a/R/data-storage-sql-family.R b/R/data-storage-sql-family.R index 40a11e79..c6c05c3d 100644 --- a/R/data-storage-sql-family.R +++ b/R/data-storage-sql-family.R @@ -9,14 +9,6 @@ DataStorageSQLFamily <- R6::R6Class( # nolint object_name_linter # # Public public = list( - - #' @description - #' Initialize the data storage class - - initialize = function() { - super$initialize() - } - ), # # Private diff --git a/R/data-storage-sqlite.R b/R/data-storage-sqlite.R index 41fe7cd7..c830a3b9 100644 --- a/R/data-storage-sqlite.R +++ b/R/data-storage-sqlite.R @@ -38,7 +38,6 @@ DataStorageSQLite <- R6::R6Class( # nolint object_name_linter initialize = function( db_path = "user_stats.sqlite" ) { - super$initialize() logger::log_debug("path to db: {db_path}", namespace = "shiny.telemetry") private$connect(db_path) diff --git a/R/data-storage.R b/R/data-storage.R index a5b4b3f9..3efa037c 100644 --- a/R/data-storage.R +++ b/R/data-storage.R @@ -12,7 +12,7 @@ DataStorage <- R6::R6Class( # nolint object_name_linter #' @description initialize data storage object common with all providers initialize = function() { - + stop(paste(class(self)[1], "is an abstract class that can't be initialized.")) }, #' @description Insert new data diff --git a/tests/testthat/test-data_storage.R b/tests/testthat/test-data_storage.R deleted file mode 100644 index 2e13e1ad..00000000 --- a/tests/testthat/test-data_storage.R +++ /dev/null @@ -1,38 +0,0 @@ -logger::log_threshold("ERROR", namespace = "shiny.telemetry") - -test_that("Data storage initializes a dummy class", { - data_storage <- DataStorage$new() - - date_from <- Sys.Date() - 365 * 10 - date_to <- Sys.Date() + 10 - - app_name <- "test_dashboard" - - error_msg <- "Method not implemented." - - expect_error(data_storage$insert(), arg_missing_msg("app_name")) - expect_error(data_storage$insert("dash"), arg_missing_msg("type")) - - data_storage$insert( - app_name = app_name, - type = "without_session" - ) %>% expect_error(error_msg) - - data_storage$insert( - app_name = app_name, - type = "without_session", - details = list(value = "132") - ) %>% expect_error(error_msg) - - data_storage$read_event_data(date_from, date_to) %>% - expect_error(error_msg) - - data_storage$insert( - app_name = app_name, - session = "some_session_id", - type = "login" - ) %>% expect_error(error_msg) - - expect_error(data_storage$close(), error_msg) - -})