tests setup

This commit is contained in:
Hubert Plociniczak 2024-04-26 00:54:36 +02:00
parent 5bb8e4b513
commit 38604ca5b0
7 changed files with 150 additions and 15 deletions

View File

@ -58,7 +58,12 @@ http_components_version = "4.4.1"
jackson_version = "2.15.2" jackson_version = "2.15.2"
commons_io_version = "2.12.0" commons_io_version = "2.12.0"
commons_compress_version = "1.23.0" commons_compress_version = "1.23.0"
commons_lang_version = "3.12.0"
junit_version = "4.13.2"
hamcrest_version = "1.3"
## TODO: Consider replacing maven extension with
## https://github.com/bazeltools/bazel-deps
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
## After updating a list of artifacts run ## After updating a list of artifacts run
## > bazel run @unpinned_maven//:pin ## > bazel run @unpinned_maven//:pin
@ -72,6 +77,9 @@ maven.install(
"com.fasterxml.jackson.core:jackson-databind:%s" % jackson_version, "com.fasterxml.jackson.core:jackson-databind:%s" % jackson_version,
"commons-io:commons-io:%s" % commons_io_version, "commons-io:commons-io:%s" % commons_io_version,
"org.apache.commons:commons-compress:%s" % commons_compress_version, "org.apache.commons:commons-compress:%s" % commons_compress_version,
"org.apache.commons:commons-lang3:%s" % commons_lang_version,
"junit:junit:%s" % junit_version,
"org.hamcrest:hamcrest-all:%s" % hamcrest_version,
] + circe, ] + circe,
fail_if_repin_required = True, fail_if_repin_required = True,
lock_file = "//:maven_install.json", lock_file = "//:maven_install.json",

View File

@ -1,6 +1,6 @@
{ {
"lockFileVersion": 6, "lockFileVersion": 6,
"moduleFileHash": "d584f112e6db5ad4995cfcb1bb9fc95f685e79af114072e6eb1f5b3d6541bfde", "moduleFileHash": "aca62d060d6fac74ab85d7ecebf29c86d6559627d8ca071fa60397553083964e",
"flags": { "flags": {
"cmdRegistries": [ "cmdRegistries": [
"https://bcr.bazel.build/" "https://bcr.bazel.build/"
@ -159,7 +159,7 @@
"usingModule": "<root>", "usingModule": "<root>",
"location": { "location": {
"file": "@@//:MODULE.bazel", "file": "@@//:MODULE.bazel",
"line": 62, "line": 67,
"column": 22 "column": 22
}, },
"imports": { "imports": {
@ -180,6 +180,9 @@
"com.fasterxml.jackson.core:jackson-databind:2.15.2", "com.fasterxml.jackson.core:jackson-databind:2.15.2",
"commons-io:commons-io:2.12.0", "commons-io:commons-io:2.12.0",
"org.apache.commons:commons-compress:1.23.0", "org.apache.commons:commons-compress:1.23.0",
"org.apache.commons:commons-lang3:3.12.0",
"junit:junit:4.13.2",
"org.hamcrest:hamcrest-all:1.3",
"io.circe:circe-core_2.13:0.14.5", "io.circe:circe-core_2.13:0.14.5",
"io.circe:circe-generic_2.13:0.14.5", "io.circe:circe-generic_2.13:0.14.5",
"io.circe:circe-parser_2.13:0.14.5" "io.circe:circe-parser_2.13:0.14.5"
@ -194,7 +197,7 @@
"devDependency": false, "devDependency": false,
"location": { "location": {
"file": "@@//:MODULE.bazel", "file": "@@//:MODULE.bazel",
"line": 65, "line": 70,
"column": 14 "column": 14
} }
} }
@ -137125,7 +137128,7 @@
"bzlTransitiveDigest": "WLH6tV/jGiZ73lPBSYWRhoilLeqSLs6vQqjK4ph6NG0=", "bzlTransitiveDigest": "WLH6tV/jGiZ73lPBSYWRhoilLeqSLs6vQqjK4ph6NG0=",
"recordedFileInputs": { "recordedFileInputs": {
"@@rules_jvm_external~//rules_jvm_external_deps_install.json": "cafb5d2d8119391eb2b322ce3840d3352ea82d496bdb8cbd4b6779ec4d044dda", "@@rules_jvm_external~//rules_jvm_external_deps_install.json": "cafb5d2d8119391eb2b322ce3840d3352ea82d496bdb8cbd4b6779ec4d044dda",
"@@//maven_install.json": "03f27c22f4542128b7cad590d0101793c45c296c65d232296c1ee91797d202ef" "@@//maven_install.json": "46e959f9c27cf8e36a02ff708f5b46f424526bea69128821c42b61eb1578d852"
}, },
"recordedDirentsInputs": {}, "recordedDirentsInputs": {},
"envVariables": {}, "envVariables": {},
@ -137772,6 +137775,9 @@
"{ \"group\": \"com.fasterxml.jackson.core\", \"artifact\": \"jackson-databind\", \"version\": \"2.15.2\" }", "{ \"group\": \"com.fasterxml.jackson.core\", \"artifact\": \"jackson-databind\", \"version\": \"2.15.2\" }",
"{ \"group\": \"commons-io\", \"artifact\": \"commons-io\", \"version\": \"2.12.0\" }", "{ \"group\": \"commons-io\", \"artifact\": \"commons-io\", \"version\": \"2.12.0\" }",
"{ \"group\": \"org.apache.commons\", \"artifact\": \"commons-compress\", \"version\": \"1.23.0\" }", "{ \"group\": \"org.apache.commons\", \"artifact\": \"commons-compress\", \"version\": \"1.23.0\" }",
"{ \"group\": \"org.apache.commons\", \"artifact\": \"commons-lang3\", \"version\": \"3.12.0\" }",
"{ \"group\": \"junit\", \"artifact\": \"junit\", \"version\": \"4.13.2\" }",
"{ \"group\": \"org.hamcrest\", \"artifact\": \"hamcrest-all\", \"version\": \"1.3\" }",
"{ \"group\": \"io.circe\", \"artifact\": \"circe-core_2.13\", \"version\": \"0.14.5\" }", "{ \"group\": \"io.circe\", \"artifact\": \"circe-core_2.13\", \"version\": \"0.14.5\" }",
"{ \"group\": \"io.circe\", \"artifact\": \"circe-generic_2.13\", \"version\": \"0.14.5\" }", "{ \"group\": \"io.circe\", \"artifact\": \"circe-generic_2.13\", \"version\": \"0.14.5\" }",
"{ \"group\": \"io.circe\", \"artifact\": \"circe-parser_2.13\", \"version\": \"0.14.5\" }", "{ \"group\": \"io.circe\", \"artifact\": \"circe-parser_2.13\", \"version\": \"0.14.5\" }",
@ -137884,6 +137890,18 @@
"downloaded_file_path": "v1/software/amazon/awssdk/arns/2.20.128/arns-2.20.128.jar" "downloaded_file_path": "v1/software/amazon/awssdk/arns/2.20.128/arns-2.20.128.jar"
} }
}, },
"org_hamcrest_hamcrest_all_1_3": {
"bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl",
"ruleClassName": "http_file",
"attributes": {
"sha256": "4877670629ab96f34f5f90ab283125fcd9acb7e683e66319a68be6eb2cca60de",
"urls": [
"https://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3.jar",
"https://repo1.maven.org/maven2/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3.jar"
],
"downloaded_file_path": "v1/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3.jar"
}
},
"com_google_api_gax_httpjson_2_32_0": { "com_google_api_gax_httpjson_2_32_0": {
"bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl",
"ruleClassName": "http_file", "ruleClassName": "http_file",
@ -138551,6 +138569,9 @@
"{ \"group\": \"com.fasterxml.jackson.core\", \"artifact\": \"jackson-databind\", \"version\": \"2.15.2\" }", "{ \"group\": \"com.fasterxml.jackson.core\", \"artifact\": \"jackson-databind\", \"version\": \"2.15.2\" }",
"{ \"group\": \"commons-io\", \"artifact\": \"commons-io\", \"version\": \"2.12.0\" }", "{ \"group\": \"commons-io\", \"artifact\": \"commons-io\", \"version\": \"2.12.0\" }",
"{ \"group\": \"org.apache.commons\", \"artifact\": \"commons-compress\", \"version\": \"1.23.0\" }", "{ \"group\": \"org.apache.commons\", \"artifact\": \"commons-compress\", \"version\": \"1.23.0\" }",
"{ \"group\": \"org.apache.commons\", \"artifact\": \"commons-lang3\", \"version\": \"3.12.0\" }",
"{ \"group\": \"junit\", \"artifact\": \"junit\", \"version\": \"4.13.2\" }",
"{ \"group\": \"org.hamcrest\", \"artifact\": \"hamcrest-all\", \"version\": \"1.3\" }",
"{ \"group\": \"io.circe\", \"artifact\": \"circe-core_2.13\", \"version\": \"0.14.5\" }", "{ \"group\": \"io.circe\", \"artifact\": \"circe-core_2.13\", \"version\": \"0.14.5\" }",
"{ \"group\": \"io.circe\", \"artifact\": \"circe-generic_2.13\", \"version\": \"0.14.5\" }", "{ \"group\": \"io.circe\", \"artifact\": \"circe-generic_2.13\", \"version\": \"0.14.5\" }",
"{ \"group\": \"io.circe\", \"artifact\": \"circe-parser_2.13\", \"version\": \"0.14.5\" }", "{ \"group\": \"io.circe\", \"artifact\": \"circe-parser_2.13\", \"version\": \"0.14.5\" }",

View File

@ -28,7 +28,7 @@ http_archive(
load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config") load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config")
scala_config(scala_version = "2.13.12") ## TODO: impossible to match 2.13.11 scala_config(scala_version = "2.13.12") ## Version has to match the version available in `rules_scala`
load("@io_bazel_rules_scala//scala:scala.bzl", "rules_scala_setup", "rules_scala_toolchain_deps_repositories") load("@io_bazel_rules_scala//scala:scala.bzl", "rules_scala_setup", "rules_scala_toolchain_deps_repositories")

View File

@ -1,4 +1,4 @@
load("@io_bazel_rules_scala//scala:scala.bzl", "scala_library") load("@io_bazel_rules_scala//scala:scala.bzl", "scala_library", "scala_test")
java_library( java_library(
name = "downloader", name = "downloader",
@ -6,21 +6,67 @@ java_library(
deps = [ deps = [
"//tools/http-test-helper", "//tools/http-test-helper",
"//lib/scala/cli", "//lib/scala/cli",
":downloader-scala", ":downloader_scala",
"@maven//:org_slf4j_slf4j_api", "@maven//:org_slf4j_slf4j_api",
"@maven//:org_scala_lang_scala_library" "@maven//:org_scala_lang_scala_library"
] ],
visibility = ["//visibility:public"],
) )
scala_library( scala_library(
name = "downloader-scala", name = "downloader_scala",
srcs = glob(["src/main/scala/**/*.{java,scala}"]), srcs = glob(["src/main/scala/**/*.scala", "src/main/java/**/*.java"]),
deps = [ deps = [
"//tools/http-test-helper", "//tools/http-test-helper",
"//lib/scala/cli", "//lib/scala/cli",
"@maven//:org_slf4j_slf4j_api",
"@maven//:com_typesafe_scala_logging_scala_logging_2_13", "@maven//:com_typesafe_scala_logging_scala_logging_2_13",
"@maven//:commons_io_commons_io", "@maven//:commons_io_commons_io",
"@maven//:org_apache_commons_commons_compress", "@maven//:org_apache_commons_commons_compress",
##"@maven//:org_scala_lang_scala_library" ##"@maven//:org_scala_lang_scala_library"
] ],
visibility = ["//visibility:public"],
)
java_test(
name = "tests",
srcs = glob(["src/test/java/**/*.java"]),
test_class = "org.enso.downloader.http.HttpDownloaderTest",
deps = [
":downloader_scala",
":downloader",
"//lib/scala/cli",
"//lib/scala/testkit",
"//tools/http-test-helper",
"@maven//:org_typelevel_cats_core_2_13",
"@maven//:org_typelevel_cats_kernel_2_13",
"@maven//:org_scalatest_scalatest_compatible",
"@maven//:org_scalatest_scalatest_core_2_13",
"@maven//:org_scalatest_scalatest_wordspec_2_13",
"@maven//:org_scalactic_scalactic_2_13",
"@maven//:org_scala_lang_scala_library",
"@maven//:org_hamcrest_hamcrest_all",
"@maven//:com_fasterxml_jackson_core_jackson_databind",
"@maven//:com_fasterxml_jackson_core_jackson_core",
],
)
scala_test(
name = "tests_scala",
srcs = glob(["src/test/scala/**/*.scala"]),
deps = [
":downloader_scala",
":downloader",
"//lib/scala/cli",
"//tools/http-test-helper",
"@maven//:org_typelevel_cats_core_2_13",
"@maven//:org_typelevel_cats_kernel_2_13",
"@maven//:org_scalatest_scalatest_compatible",
"@maven//:org_scalatest_scalatest_core_2_13",
"@maven//:org_scalatest_scalatest_wordspec_2_13",
"@maven//:org_scalactic_scalactic_2_13",
"@maven//:org_scala_lang_scala_library",
],
tags = ["unit"]
) )

View File

@ -0,0 +1,26 @@
load("@io_bazel_rules_scala//scala:scala.bzl", "scala_library", "scala_test")
scala_library(
name = "testkit-scala",
srcs = glob(["src/main/scala/**/*.scala"]),
visibility = ["//visibility:public"],
deps = [
"@maven//:org_scalatest_scalatest_core_2_13",
"@maven//:org_scalatest_scalatest_compatible",
"@maven//:commons_io_commons_io",
"@maven//:org_apache_commons_commons_lang3",
"@maven//:org_scalactic_scalactic_2_13",
##"@maven//:org_scala_lang_scala_library",
],
)
java_library(
name = "testkit",
srcs = glob(["src/main/java/**/*.java"]),
visibility = ["//visibility:public"],
deps = [
":testkit-scala",
"@maven//:org_scala_lang_scala_library",
"@maven//:junit_junit",
],
)

View File

@ -1,7 +1,7 @@
{ {
"__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL", "__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL",
"__INPUT_ARTIFACTS_HASH": 335356565, "__INPUT_ARTIFACTS_HASH": 1841603713,
"__RESOLVED_ARTIFACTS_HASH": -939134540, "__RESOLVED_ARTIFACTS_HASH": 417026400,
"conflict_resolution": { "conflict_resolution": {
"com.google.errorprone:error_prone_annotations:2.3.2": "com.google.errorprone:error_prone_annotations:2.11.0" "com.google.errorprone:error_prone_annotations:2.3.2": "com.google.errorprone:error_prone_annotations:2.11.0"
}, },
@ -198,6 +198,12 @@
}, },
"version": "3.12.0" "version": "3.12.0"
}, },
"org.hamcrest:hamcrest-all": {
"shasums": {
"jar": "4877670629ab96f34f5f90ab283125fcd9acb7e683e66319a68be6eb2cca60de"
},
"version": "1.3"
},
"org.hamcrest:hamcrest-core": { "org.hamcrest:hamcrest-core": {
"shasums": { "shasums": {
"jar": "66fdef91e9739348df7a096aa384a5685f4e875584cce89386a7a47251c4d8e9" "jar": "66fdef91e9739348df7a096aa384a5685f4e875584cce89386a7a47251c4d8e9"
@ -934,6 +940,31 @@
"org.checkerframework.dataflow.qual", "org.checkerframework.dataflow.qual",
"org.checkerframework.framework.qual" "org.checkerframework.framework.qual"
], ],
"org.hamcrest:hamcrest-all": [
"org.hamcrest",
"org.hamcrest.beans",
"org.hamcrest.collection",
"org.hamcrest.core",
"org.hamcrest.generator",
"org.hamcrest.generator.config",
"org.hamcrest.generator.qdox",
"org.hamcrest.generator.qdox.ant",
"org.hamcrest.generator.qdox.directorywalker",
"org.hamcrest.generator.qdox.junit",
"org.hamcrest.generator.qdox.model",
"org.hamcrest.generator.qdox.model.annotation",
"org.hamcrest.generator.qdox.model.util",
"org.hamcrest.generator.qdox.parser",
"org.hamcrest.generator.qdox.parser.impl",
"org.hamcrest.generator.qdox.parser.structs",
"org.hamcrest.generator.qdox.tools",
"org.hamcrest.integration",
"org.hamcrest.internal",
"org.hamcrest.number",
"org.hamcrest.object",
"org.hamcrest.text",
"org.hamcrest.xml"
],
"org.hamcrest:hamcrest-core": [ "org.hamcrest:hamcrest-core": [
"org.hamcrest", "org.hamcrest",
"org.hamcrest.core", "org.hamcrest.core",
@ -1234,6 +1265,7 @@
"org.apache.httpcomponents:httpclient", "org.apache.httpcomponents:httpclient",
"org.apache.httpcomponents:httpcore", "org.apache.httpcomponents:httpcore",
"org.checkerframework:checker-qual", "org.checkerframework:checker-qual",
"org.hamcrest:hamcrest-all",
"org.hamcrest:hamcrest-core", "org.hamcrest:hamcrest-core",
"org.mockito:mockito-core", "org.mockito:mockito-core",
"org.objenesis:objenesis", "org.objenesis:objenesis",
@ -1295,6 +1327,7 @@
"org.apache.httpcomponents:httpclient", "org.apache.httpcomponents:httpclient",
"org.apache.httpcomponents:httpcore", "org.apache.httpcomponents:httpcore",
"org.checkerframework:checker-qual", "org.checkerframework:checker-qual",
"org.hamcrest:hamcrest-all",
"org.hamcrest:hamcrest-core", "org.hamcrest:hamcrest-core",
"org.mockito:mockito-core", "org.mockito:mockito-core",
"org.objenesis:objenesis", "org.objenesis:objenesis",

View File

@ -1,7 +1,8 @@
java_library( java_binary(
name = "http-test-helper", name = "http-test-helper",
srcs = glob(["src/main/java/**/*.java"]), srcs = glob(["src/main/java/**/*.java"]),
#main_class = "org.enso.shttp.HTTPTestHelperServer", javacopts = ["-Xlint:all"],
main_class = "org.enso.shttp.HTTPTestHelperServer",
deps = [ deps = [
"@maven//:org_apache_commons_commons_text", "@maven//:org_apache_commons_commons_text",
"@maven//:org_apache_httpcomponents_httpclient", "@maven//:org_apache_httpcomponents_httpclient",