From 060b9a9592ae02c06e7a4acf93b584e126ce3230 Mon Sep 17 00:00:00 2001 From: Sergei Galiamichev Date: Mon, 11 Mar 2024 17:46:51 +0100 Subject: [PATCH] Bazel Build Scripts --- .bazelproject | 23 +++++ .bazelrc | 14 +++ MODULE.bazel | 10 ++ WORKSPACE.bazel | 96 +++++++++++++++++++ bom/BUILD | 20 ++++ databind/BUILD | 31 ++++++ .../AnnotationFirstNamingStrategyTest.java | 2 +- ...t.java => BaseNamingStrategyTestBase.java} | 2 +- json-jackson-v2/BUILD | 18 ++++ repository-inmemory/BUILD | 33 +++++++ repository-test/BUILD | 22 +++++ repository-ydb-common/BUILD | 14 +++ repository-ydb-v1/BUILD | 57 +++++++++++ ...ractMultipleVarsYqlStatementTestBase.java} | 2 +- .../DeleteByIdStatementIntegrationTest.java | 2 +- .../InsertYqlStatementIntegrationTest.java | 2 +- .../UpsertYqlStatementIntegrationTest.java | 2 +- repository-ydb-v2/BUILD | 68 +++++++++++++ ...ractMultipleVarsYqlStatementTestBase.java} | 2 +- .../statement/DeleteByIdStatementTest.java | 2 +- .../ydb/statement/InsertYqlStatementTest.java | 2 +- .../ydb/statement/UpsertYqlStatementTest.java | 2 +- repository/BUILD | 38 ++++++++ .../db/testcaller/TestDbTxCaller.java | 3 +- .../repository/testcaller/TestTxCaller.java | 3 +- util/BUILD | 29 ++++++ 26 files changed, 485 insertions(+), 14 deletions(-) create mode 100644 .bazelproject create mode 100644 .bazelrc create mode 100644 MODULE.bazel create mode 100644 WORKSPACE.bazel create mode 100644 bom/BUILD create mode 100644 databind/BUILD rename databind/src/test/java/tech/ydb/yoj/databind/schema/naming/{BaseNamingStrategyTest.java => BaseNamingStrategyTestBase.java} (92%) create mode 100644 json-jackson-v2/BUILD create mode 100644 repository-inmemory/BUILD create mode 100644 repository-test/BUILD create mode 100644 repository-ydb-common/BUILD create mode 100644 repository-ydb-v1/BUILD rename repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/{AbstractMultipleVarsYqlStatementTest.java => AbstractMultipleVarsYqlStatementTestBase.java} (97%) create mode 100644 repository-ydb-v2/BUILD rename repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/{AbstractMultipleVarsYqlStatementTest.java => AbstractMultipleVarsYqlStatementTestBase.java} (97%) create mode 100644 repository/BUILD create mode 100644 util/BUILD diff --git a/.bazelproject b/.bazelproject new file mode 100644 index 00000000..28183481 --- /dev/null +++ b/.bazelproject @@ -0,0 +1,23 @@ +workspace_type: java + +java_language_level: 21 + +directories: + . + -databind/pom.xml + -repository/pom.xml + -json-jackson-v2/pom.xml + -repository-inmemory/pom.xml + -repository-test/pom.xml + -repository-ydb-common/pom.xml + -repository-ydb-v1/pom.xml + -repository-ydb-v2/pom.xml + -util/pom.xml + +test_sources: + databind/src/test + repository/src/test + repository-inmemory/src/test + repository-ydb-v1/src/test + repository-ydb-v2/src/test + util/src/test diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 00000000..c29c2e8e --- /dev/null +++ b/.bazelrc @@ -0,0 +1,14 @@ +common --enable_bzlmod + +# java common flags +common --java_language_version=21 +common --java_runtime_version=remotejdk_21 +common --tool_java_language_version=21 +common --tool_java_runtime_version=remotejdk_21 + +# java build flags +build --nojava_header_compilation +#build --strict_java_deps error + +# Don't depend on a JAVA_HOME pointing at a system JDK, see https://github.com/bazelbuild/rules_jvm_external/issues/445 +build --repo_env=JAVA_HOME=../bazel_tools/jdk diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 00000000..814deff8 --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,10 @@ +############################################################################### +# Bazel now uses Bzlmod by default to manage external dependencies. +# Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel. +# +# For more details, please check https://github.com/bazelbuild/bazel/issues/18958 +############################################################################### +bazel_dep(name = "rules_java", version = "7.4.0") +bazel_dep(name = "contrib_rules_jvm", version = "0.24.0") +bazel_dep(name = "rules_jvm_external", version = "6.0") +bazel_dep(name = "apple_rules_lint", version = "0.3.2") diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel new file mode 100644 index 00000000..ea345ff1 --- /dev/null +++ b/WORKSPACE.bazel @@ -0,0 +1,96 @@ +load("@rules_jvm_external//:defs.bzl", "maven_install") +load("@rules_jvm_external//:specs.bzl", "maven") + +ANNOTATION_API_VERSION = "1.3.2" + +ASSERTJ_VERSION = "3.25.1" + +COMMONS_TEXT_VERSION = "1.10.0" + +ECLIPSE_COLLECTIONS_VERSION = "9.2.0" + +FIND_BUGS_VERSION = "3.0.2" + +GRPC_VERSION = "1.61.0" + +GUAVA_VERSION = "33.0.0-jre" + +JACKSON_VERSION = "2.16.1" + +JUNIT_JUPITER_VERSION = "5.10.1" + +JUNIT_VERSION = "4.13.2" + +KOTLIN_VERSION = "1.9.22" + +LOG4J_VERSION = "2.22.1" + +LOMBOK_VERSION = "1.18.30" + +MOCKITO_VERSION = "5.9.0" + +PROMETHEUS_VERSION = "1.1.0" + +SIMPLECLIENT_VERSION = "0.9.0" + +SLF4J_VERSION = "2.0.11" + +SNAKEYAML_VERSION = "1.33" + +YDB_PROTOAPI_VERSION = "1.6.0" + +YDB_SDK_V1_VERSION = "1.14.14" + +YDB_SDK_VERSION = "2.1.12" + +maven_install( + name = "java_contribs_stable", + artifacts = [ + "com.fasterxml.jackson.core:jackson-databind:" + JACKSON_VERSION, + "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:" + JACKSON_VERSION, + "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:" + JACKSON_VERSION, + "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:" + JACKSON_VERSION, + "com.google.code.findbugs:jsr305:" + FIND_BUGS_VERSION, + "com.google.guava:guava:" + GUAVA_VERSION, + "com.yandex.ydb:ydb-sdk-core:" + YDB_SDK_V1_VERSION, + "com.yandex.ydb:ydb-sdk-proto:" + YDB_SDK_V1_VERSION, + "com.yandex.ydb:ydb-sdk-table:" + YDB_SDK_V1_VERSION, + "io.grpc:grpc-bom:" + GRPC_VERSION, + "io.grpc:grpc-netty-shaded:" + GRPC_VERSION, + "io.grpc:grpc-netty:" + GRPC_VERSION, + "io.prometheus:simpleclient:" + SIMPLECLIENT_VERSION, + "javax.annotation:javax.annotation-api:" + ANNOTATION_API_VERSION, + "junit:junit:" + JUNIT_VERSION, + "org.apache.commons:commons-text:" + COMMONS_TEXT_VERSION, + "org.yaml:snakeyaml:" + SNAKEYAML_VERSION, + "org.apache.logging.log4j:log4j-api:" + LOG4J_VERSION, + "org.apache.logging.log4j:log4j-slf4j2-impl:" + LOG4J_VERSION, + "org.assertj:assertj-core:" + ASSERTJ_VERSION, + "org.eclipse.collections:eclipse-collections-api:" + ECLIPSE_COLLECTIONS_VERSION, + "org.eclipse.collections:eclipse-collections:" + ECLIPSE_COLLECTIONS_VERSION, + "org.jetbrains.kotlin:kotlin-reflect:" + KOTLIN_VERSION, + "org.mockito:mockito-core:" + MOCKITO_VERSION, + "org.projectlombok:lombok:" + LOMBOK_VERSION, + "org.slf4j:slf4j-api:" + SLF4J_VERSION, + "tech.ydb:ydb-proto-api:" + YDB_PROTOAPI_VERSION, + "tech.ydb:ydb-sdk-bom:" + YDB_SDK_VERSION, + "tech.ydb:ydb-sdk-topic:" + YDB_SDK_VERSION, + "tech.ydb:ydb-sdk-core:" + YDB_SDK_VERSION, + "tech.ydb:ydb-sdk-table:" + YDB_SDK_VERSION, + "tech.ydb:ydb-sdk-scheme:" + YDB_SDK_VERSION, + "tech.ydb.test:ydb-junit4-support:" + YDB_SDK_VERSION, + maven.artifact( + artifact = "grpc-core", + exclusions = [ + "io.grpc:grpc-util", + ], + group = "io.grpc", + version = GRPC_VERSION, + ), + ], + fetch_sources = True, + generate_compat_repositories = True, + repositories = [ + "https://repo1.maven.org/maven2", + ], +) diff --git a/bom/BUILD b/bom/BUILD new file mode 100644 index 00000000..3cf8bff9 --- /dev/null +++ b/bom/BUILD @@ -0,0 +1,20 @@ +load("@contrib_rules_jvm//java:defs.bzl", "java_library") + +java_plugin( + name = "lombok_plugin", + generates_api = True, + processor_class = "lombok.launch.AnnotationProcessorHider$AnnotationProcessor", + deps = ["@java_contribs_stable//:org_projectlombok_lombok"], +) + +java_library( + name = "lombok", + data = ["lombok.config"], + exported_plugins = [":lombok_plugin"], + neverlink = True, + visibility = ["//visibility:public"], + exports = [ + "@java_contribs_stable//:org_projectlombok_lombok", + "@java_contribs_stable//:org_slf4j_slf4j_api", + ], +) diff --git a/databind/BUILD b/databind/BUILD new file mode 100644 index 00000000..7e7df95d --- /dev/null +++ b/databind/BUILD @@ -0,0 +1,31 @@ +load("@contrib_rules_jvm//java:defs.bzl", "java_library", "java_test_suite") + +java_library( + name = "databind", + srcs = glob(["src/main/**/*.java"]), + visibility = ["//visibility:public"], + deps = [ + "//bom:lombok", + "@java_contribs_stable//:com_google_code_findbugs_jsr305", + "@java_contribs_stable//:com_google_guava_guava", + "@java_contribs_stable//:javax_annotation_javax_annotation_api", + "@java_contribs_stable//:org_jetbrains_annotations", + "@java_contribs_stable//:org_jetbrains_kotlin_kotlin_reflect", + "@java_contribs_stable//:org_jetbrains_kotlin_kotlin_stdlib", + "@java_contribs_stable//:org_slf4j_slf4j_api", + ], +) + +java_test_suite( + name = "databind-tests", + srcs = glob(["src/test/java/**/*.java"]), + package_prefixes = [".tech"], + resources = glob(["src/test/resources/**"]), + runner = "junit4", + deps = [ + ":databind", + "//bom:lombok", + "@java_contribs_stable//:javax_annotation_javax_annotation_api", + "@java_contribs_stable//:org_assertj_assertj_core", + ], +) diff --git a/databind/src/test/java/tech/ydb/yoj/databind/schema/naming/AnnotationFirstNamingStrategyTest.java b/databind/src/test/java/tech/ydb/yoj/databind/schema/naming/AnnotationFirstNamingStrategyTest.java index a2756e7f..472d7d0e 100644 --- a/databind/src/test/java/tech/ydb/yoj/databind/schema/naming/AnnotationFirstNamingStrategyTest.java +++ b/databind/src/test/java/tech/ydb/yoj/databind/schema/naming/AnnotationFirstNamingStrategyTest.java @@ -3,7 +3,7 @@ import org.junit.Test; import tech.ydb.yoj.databind.schema.Schema; -public class AnnotationFirstNamingStrategyTest extends BaseNamingStrategyTest { +public class AnnotationFirstNamingStrategyTest extends BaseNamingStrategyTestBase { @Test public void testEntityTableName() { verifyTableName(TestEntity.class, "TestEntity"); diff --git a/databind/src/test/java/tech/ydb/yoj/databind/schema/naming/BaseNamingStrategyTest.java b/databind/src/test/java/tech/ydb/yoj/databind/schema/naming/BaseNamingStrategyTestBase.java similarity index 92% rename from databind/src/test/java/tech/ydb/yoj/databind/schema/naming/BaseNamingStrategyTest.java rename to databind/src/test/java/tech/ydb/yoj/databind/schema/naming/BaseNamingStrategyTestBase.java index bb10a165..4181c505 100644 --- a/databind/src/test/java/tech/ydb/yoj/databind/schema/naming/BaseNamingStrategyTest.java +++ b/databind/src/test/java/tech/ydb/yoj/databind/schema/naming/BaseNamingStrategyTestBase.java @@ -4,7 +4,7 @@ import static org.assertj.core.api.Assertions.assertThat; -public abstract class BaseNamingStrategyTest { +public abstract class BaseNamingStrategyTestBase { protected abstract Schema getSchema(Class entityType); protected void verifyTableName(Class entityType, String tableName) { diff --git a/json-jackson-v2/BUILD b/json-jackson-v2/BUILD new file mode 100644 index 00000000..656b291a --- /dev/null +++ b/json-jackson-v2/BUILD @@ -0,0 +1,18 @@ +load("@contrib_rules_jvm//java:defs.bzl", "java_library", "java_test_suite") + +java_library( + name = "json-jackson-v2", + srcs = glob(["src/main/**/*.java"]), + visibility = ["//visibility:public"], + deps = [ + "//bom:lombok", + "//repository", + "@java_contribs_stable//:com_fasterxml_jackson_core_jackson_annotations", + "@java_contribs_stable//:com_fasterxml_jackson_core_jackson_databind", + "@java_contribs_stable//:com_fasterxml_jackson_datatype_jackson_datatype_jdk8", + "@java_contribs_stable//:com_fasterxml_jackson_datatype_jackson_datatype_jsr310", + "@java_contribs_stable//:com_google_code_findbugs_jsr305", + "@java_contribs_stable//:com_google_guava_guava", + "@java_contribs_stable//:javax_annotation_javax_annotation_api", + ], +) diff --git a/repository-inmemory/BUILD b/repository-inmemory/BUILD new file mode 100644 index 00000000..568343a0 --- /dev/null +++ b/repository-inmemory/BUILD @@ -0,0 +1,33 @@ +load("@contrib_rules_jvm//java:defs.bzl", "java_library", "java_test_suite") + +java_library( + name = "repository-inmemory", + srcs = glob(["src/main/**/*.java"]), + visibility = ["//visibility:public"], + deps = [ + "//bom:lombok", + "//databind", + "//repository", + "//util", + "@java_contribs_stable//:com_google_code_findbugs_jsr305", + "@java_contribs_stable//:com_google_guava_guava", + "@java_contribs_stable//:javax_annotation_javax_annotation_api", + "@java_contribs_stable//:org_eclipse_collections_eclipse_collections", + "@java_contribs_stable//:org_eclipse_collections_eclipse_collections_api", + ], +) + +java_test_suite( + name = "repository-inmemory-tests", + srcs = glob(["src/test/java/**/*.java"]), + package_prefixes = [".tech"], + resources = glob(["src/test/resources/**"]), + runner = "junit4", + deps = [ + "repository-inmemory", + "//bom:lombok", + "//json-jackson-v2", + "//repository", + "//repository-test", + ], +) diff --git a/repository-test/BUILD b/repository-test/BUILD new file mode 100644 index 00000000..eb251236 --- /dev/null +++ b/repository-test/BUILD @@ -0,0 +1,22 @@ +load("@contrib_rules_jvm//java:defs.bzl", "java_library", "java_test_suite") + +java_library( + name = "repository-test", + srcs = glob(["src/main/**/*.java"]), + visibility = ["//visibility:public"], + deps = [ + "//bom:lombok", + "//databind", + "//repository", + "//util", + "@java_contribs_stable//:com_fasterxml_jackson_core_jackson_annotations", + "@java_contribs_stable//:com_fasterxml_jackson_core_jackson_core", + "@java_contribs_stable//:com_fasterxml_jackson_core_jackson_databind", + "@java_contribs_stable//:com_fasterxml_jackson_datatype_jackson_datatype_jdk8", + "@java_contribs_stable//:com_fasterxml_jackson_datatype_jackson_datatype_jsr310", + "@java_contribs_stable//:com_google_guava_guava", + "@java_contribs_stable//:javax_annotation_javax_annotation_api", + "@java_contribs_stable//:junit_junit", + "@java_contribs_stable//:org_assertj_assertj_core", + ], +) diff --git a/repository-ydb-common/BUILD b/repository-ydb-common/BUILD new file mode 100644 index 00000000..c2ff6a6b --- /dev/null +++ b/repository-ydb-common/BUILD @@ -0,0 +1,14 @@ +load("@contrib_rules_jvm//java:defs.bzl", "java_library", "java_test_suite") + +java_library( + name = "repository-ydb-common", + srcs = glob(["src/main/**/*.java"]), + visibility = ["//visibility:public"], + deps = [ + "//bom:lombok", + "//databind", + "//repository", + "//util", + "@java_contribs_stable//:io_prometheus_simpleclient", + ], +) diff --git a/repository-ydb-v1/BUILD b/repository-ydb-v1/BUILD new file mode 100644 index 00000000..ac0b2908 --- /dev/null +++ b/repository-ydb-v1/BUILD @@ -0,0 +1,57 @@ +load("@contrib_rules_jvm//java:defs.bzl", "java_library", "java_test_suite") + +java_library( + name = "repository-ydb-v1", + srcs = glob(["src/main/**/*.java"]), + visibility = ["//visibility:public"], + deps = [ + "//bom:lombok", + "//databind", + "//repository", + "//repository-ydb-common", + "//util", + "@java_contribs_stable//:com_google_code_findbugs_jsr305", + "@java_contribs_stable//:com_google_guava_guava", + "@java_contribs_stable//:com_google_protobuf_protobuf_java", + "@java_contribs_stable//:com_yandex_ydb_ydb_sdk_core", + "@java_contribs_stable//:com_yandex_ydb_ydb_sdk_proto", + "@java_contribs_stable//:com_yandex_ydb_ydb_sdk_table", + "@java_contribs_stable//:io_grpc_grpc_api", + "@java_contribs_stable//:io_grpc_grpc_netty", + "@java_contribs_stable//:javax_annotation_javax_annotation_api", + "@java_contribs_stable//:org_apache_commons_commons_text", + ], +) + +java_test_suite( + name = "repository-ydb-v1-tests", + srcs = glob(["src/test/java/**/*.java"]), + package_prefixes = [".tech"], + resources = glob(["src/test/resources/**"]), + runner = "junit4", + test_suffixes_excludes = ["IntegrationTest.java"], + deps = [ + "repository-ydb-v1", + "//bom:lombok", + "//databind", + "//json-jackson-v2", + "//repository", + "//repository-test", + "//repository-ydb-common", + "@java_contribs_stable//:com_fasterxml_jackson_core_jackson_core", + "@java_contribs_stable//:com_fasterxml_jackson_core_jackson_databind", + "@java_contribs_stable//:com_google_guava_guava", + "@java_contribs_stable//:com_google_protobuf_protobuf_java", + "@java_contribs_stable//:com_yandex_ydb_ydb_sdk_core", + "@java_contribs_stable//:com_yandex_ydb_ydb_sdk_proto", + "@java_contribs_stable//:com_yandex_ydb_ydb_sdk_table", + "@java_contribs_stable//:io_grpc_grpc_api", + "@java_contribs_stable//:io_grpc_grpc_netty", + "@java_contribs_stable//:io_grpc_grpc_stub", + "@java_contribs_stable//:io_netty_netty_handler", + "@java_contribs_stable//:javax_annotation_javax_annotation_api", + "@java_contribs_stable//:junit_junit", + "@java_contribs_stable//:org_assertj_assertj_core", + "@java_contribs_stable//:org_mockito_mockito_core", + ], +) diff --git a/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/AbstractMultipleVarsYqlStatementTest.java b/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/AbstractMultipleVarsYqlStatementTestBase.java similarity index 97% rename from repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/AbstractMultipleVarsYqlStatementTest.java rename to repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/AbstractMultipleVarsYqlStatementTestBase.java index 9fe7bade..16cec2c1 100644 --- a/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/AbstractMultipleVarsYqlStatementTest.java +++ b/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/AbstractMultipleVarsYqlStatementTestBase.java @@ -20,7 +20,7 @@ import tech.ydb.yoj.repository.ydb.YdbRepository; import tech.ydb.yoj.repository.ydb.YdbRepositoryTransaction; -public abstract class AbstractMultipleVarsYqlStatementTest extends RepositoryTestSupport { +public abstract class AbstractMultipleVarsYqlStatementTestBase extends RepositoryTestSupport { protected static final TestEntity ENTITY_1 = new TestEntity(TestEntity.Id.of("a"), "foo"); protected static final TestEntity ENTITY_1_1 = new TestEntity(TestEntity.Id.of("a"), "fuu"); diff --git a/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/DeleteByIdStatementIntegrationTest.java b/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/DeleteByIdStatementIntegrationTest.java index 06112448..17c95dd6 100644 --- a/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/DeleteByIdStatementIntegrationTest.java +++ b/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/DeleteByIdStatementIntegrationTest.java @@ -4,7 +4,7 @@ import static org.assertj.core.api.Assertions.assertThat; -public class DeleteByIdStatementIntegrationTest extends AbstractMultipleVarsYqlStatementTest { +public class DeleteByIdStatementIntegrationTest extends AbstractMultipleVarsYqlStatementTestBase { @Test public void testDelete() { diff --git a/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/InsertYqlStatementIntegrationTest.java b/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/InsertYqlStatementIntegrationTest.java index 55a9093c..63ba7be4 100644 --- a/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/InsertYqlStatementIntegrationTest.java +++ b/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/InsertYqlStatementIntegrationTest.java @@ -4,7 +4,7 @@ import static org.assertj.core.api.Assertions.assertThat; -public class InsertYqlStatementIntegrationTest extends AbstractMultipleVarsYqlStatementTest { +public class InsertYqlStatementIntegrationTest extends AbstractMultipleVarsYqlStatementTestBase { @Test public void testInsert() { diff --git a/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/UpsertYqlStatementIntegrationTest.java b/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/UpsertYqlStatementIntegrationTest.java index 4390d74f..e1bbf894 100644 --- a/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/UpsertYqlStatementIntegrationTest.java +++ b/repository-ydb-v1/src/test/java/tech/ydb/yoj/repository/ydb/statement/UpsertYqlStatementIntegrationTest.java @@ -4,7 +4,7 @@ import static org.assertj.core.api.Assertions.assertThat; -public class UpsertYqlStatementIntegrationTest extends AbstractMultipleVarsYqlStatementTest { +public class UpsertYqlStatementIntegrationTest extends AbstractMultipleVarsYqlStatementTestBase { @Test public void testUpsert() { diff --git a/repository-ydb-v2/BUILD b/repository-ydb-v2/BUILD new file mode 100644 index 00000000..18f41e4b --- /dev/null +++ b/repository-ydb-v2/BUILD @@ -0,0 +1,68 @@ +load("@contrib_rules_jvm//java:defs.bzl", "java_library", "java_test_suite") + +java_library( + name = "repository-ydb-v2", + srcs = glob(["src/main/**/*.java"]), + visibility = ["//visibility:public"], + deps = [ + "//bom:lombok", + "//databind", + "//repository", + "//repository-ydb-common", + "//util", + "@java_contribs_stable//:com_google_code_findbugs_jsr305", + "@java_contribs_stable//:com_google_guava_guava", + "@java_contribs_stable//:com_google_protobuf_protobuf_java", + "@java_contribs_stable//:io_grpc_grpc_api", + "@java_contribs_stable//:io_grpc_grpc_netty", + "@java_contribs_stable//:io_grpc_grpc_netty_shaded", + "@java_contribs_stable//:javax_annotation_javax_annotation_api", + "@java_contribs_stable//:org_apache_commons_commons_text", + "@java_contribs_stable//:tech_ydb_ydb_auth_api", + "@java_contribs_stable//:tech_ydb_ydb_proto_api", + "@java_contribs_stable//:tech_ydb_ydb_sdk_bom", + "@java_contribs_stable//:tech_ydb_ydb_sdk_core", + "@java_contribs_stable//:tech_ydb_ydb_sdk_scheme", + "@java_contribs_stable//:tech_ydb_ydb_sdk_table", + ], +) + +java_test_suite( + name = "repository-ydb-v2-tests", + srcs = glob(["src/test/java/**/*.java"]), + package_prefixes = [".tech"], + resources = glob(["src/test/resources/**"]), + runner = "junit4", + test_suffixes_excludes = ["IntegrationTest.java"], + deps = [ + "repository-ydb-v2", + "//bom:lombok", + "//databind", + "//json-jackson-v2", + "//repository", + "//repository-test", + "//repository-ydb-common", + "@java_contribs_stable//:com_fasterxml_jackson_core_jackson_core", + "@java_contribs_stable//:com_fasterxml_jackson_core_jackson_databind", + "@java_contribs_stable//:com_fasterxml_jackson_dataformat_jackson_dataformat_yaml", + "@java_contribs_stable//:com_google_guava_guava", + "@java_contribs_stable//:com_google_protobuf_protobuf_java", + "@java_contribs_stable//:io_grpc_grpc_api", + "@java_contribs_stable//:io_grpc_grpc_netty", + "@java_contribs_stable//:io_grpc_grpc_stub", + "@java_contribs_stable//:io_netty_netty_handler", + "@java_contribs_stable//:javax_annotation_javax_annotation_api", + "@java_contribs_stable//:junit_junit", + "@java_contribs_stable//:org_assertj_assertj_core", + "@java_contribs_stable//:org_mockito_mockito_core", + "@java_contribs_stable//:org_testcontainers_testcontainers", + "@java_contribs_stable//:org_yaml_snakeyaml", + "@java_contribs_stable//:tech_ydb_test_ydb_junit4_support", + "@java_contribs_stable//:tech_ydb_test_ydb_tests_common", + "@java_contribs_stable//:tech_ydb_ydb_auth_api", + "@java_contribs_stable//:tech_ydb_ydb_proto_api", + "@java_contribs_stable//:tech_ydb_ydb_sdk_core", + "@java_contribs_stable//:tech_ydb_ydb_sdk_scheme", + "@java_contribs_stable//:tech_ydb_ydb_sdk_table", + ], +) diff --git a/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/AbstractMultipleVarsYqlStatementTest.java b/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/AbstractMultipleVarsYqlStatementTestBase.java similarity index 97% rename from repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/AbstractMultipleVarsYqlStatementTest.java rename to repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/AbstractMultipleVarsYqlStatementTestBase.java index 16ce9ee7..021d555b 100644 --- a/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/AbstractMultipleVarsYqlStatementTest.java +++ b/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/AbstractMultipleVarsYqlStatementTestBase.java @@ -22,7 +22,7 @@ import tech.ydb.yoj.repository.ydb.YdbRepository; import tech.ydb.yoj.repository.ydb.YdbRepositoryTransaction; -public abstract class AbstractMultipleVarsYqlStatementTest extends RepositoryTestSupport { +public abstract class AbstractMultipleVarsYqlStatementTestBase extends RepositoryTestSupport { @ClassRule public static final GrpcTransportRule ydbTransport = new GrpcTransportRule(); diff --git a/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/DeleteByIdStatementTest.java b/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/DeleteByIdStatementTest.java index 15bff957..d9390c32 100644 --- a/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/DeleteByIdStatementTest.java +++ b/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/DeleteByIdStatementTest.java @@ -4,7 +4,7 @@ import static org.assertj.core.api.Assertions.assertThat; -public class DeleteByIdStatementTest extends AbstractMultipleVarsYqlStatementTest { +public class DeleteByIdStatementTest extends AbstractMultipleVarsYqlStatementTestBase { @Test public void testDelete() { diff --git a/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/InsertYqlStatementTest.java b/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/InsertYqlStatementTest.java index b20d97fe..8c2666bb 100644 --- a/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/InsertYqlStatementTest.java +++ b/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/InsertYqlStatementTest.java @@ -4,7 +4,7 @@ import static org.assertj.core.api.Assertions.assertThat; -public class InsertYqlStatementTest extends AbstractMultipleVarsYqlStatementTest { +public class InsertYqlStatementTest extends AbstractMultipleVarsYqlStatementTestBase { @Test public void testInsert() { diff --git a/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/UpsertYqlStatementTest.java b/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/UpsertYqlStatementTest.java index f71b87e1..d6202740 100644 --- a/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/UpsertYqlStatementTest.java +++ b/repository-ydb-v2/src/test/java/tech/ydb/yoj/repository/ydb/statement/UpsertYqlStatementTest.java @@ -4,7 +4,7 @@ import static org.assertj.core.api.Assertions.assertThat; -public class UpsertYqlStatementTest extends AbstractMultipleVarsYqlStatementTest { +public class UpsertYqlStatementTest extends AbstractMultipleVarsYqlStatementTestBase { @Test public void testUpsert() { diff --git a/repository/BUILD b/repository/BUILD new file mode 100644 index 00000000..6b1b3802 --- /dev/null +++ b/repository/BUILD @@ -0,0 +1,38 @@ +load("@contrib_rules_jvm//java:defs.bzl", "java_library", "java_test_suite") + +java_library( + name = "repository", + srcs = glob(["src/main/**/*.java"]), + visibility = ["//visibility:public"], + deps = [ + "//bom:lombok", + "//databind", + "//util", + "@java_contribs_stable//:com_google_code_findbugs_jsr305", + "@java_contribs_stable//:com_google_guava_guava", + "@java_contribs_stable//:io_prometheus_simpleclient", + "@java_contribs_stable//:javax_annotation_javax_annotation_api", + ], +) + +java_test_suite( + name = "repository-tests", + srcs = glob(["src/test/java/**/*.java"]), + package_prefixes = [".tech"], + resources = ["src/test/resources/log4j2.yaml"], + runner = "junit4", + deps = [ + "repository", + "//bom:lombok", + "//databind", + "@java_contribs_stable//:com_fasterxml_jackson_dataformat_jackson_dataformat_yaml", + "@java_contribs_stable//:com_google_guava_guava", + "@java_contribs_stable//:javax_annotation_javax_annotation_api", + "@java_contribs_stable//:org_apache_logging_log4j_log4j_api", + "@java_contribs_stable//:org_apache_logging_log4j_log4j_core", + "@java_contribs_stable//:org_apache_logging_log4j_log4j_slf4j2_impl", + "@java_contribs_stable//:org_assertj_assertj_core", + "@java_contribs_stable//:org_mockito_mockito_core", + "@java_contribs_stable//:org_yaml_snakeyaml", + ], +) diff --git a/repository/src/test/java/tech/ydb/yoj/repository/db/testcaller/TestDbTxCaller.java b/repository/src/test/java/tech/ydb/yoj/repository/db/testcaller/TestDbTxCaller.java index 5158160b..e289b307 100644 --- a/repository/src/test/java/tech/ydb/yoj/repository/db/testcaller/TestDbTxCaller.java +++ b/repository/src/test/java/tech/ydb/yoj/repository/db/testcaller/TestDbTxCaller.java @@ -5,7 +5,6 @@ import tech.ydb.yoj.repository.db.Repository; import tech.ydb.yoj.repository.db.RepositoryTransaction; import tech.ydb.yoj.repository.db.StdTxManager; -import tech.ydb.yoj.repository.db.StdTxManagerTest; import tech.ydb.yoj.repository.db.Tx; import tech.ydb.yoj.repository.db.TxOptions; import tech.ydb.yoj.repository.db.cache.TransactionLocal; @@ -18,7 +17,7 @@ import static org.mockito.Mockito.when; /** - * Part of {@link StdTxManagerTest}. + * Part of {@link tech.ydb.yoj.repository.db.StdTxManagerTest}. * This is a copy of {@link TestTxCaller} * for testing calls from different packages. */ diff --git a/repository/src/test/java/tech/ydb/yoj/repository/testcaller/TestTxCaller.java b/repository/src/test/java/tech/ydb/yoj/repository/testcaller/TestTxCaller.java index 1ed1f942..6300ed65 100644 --- a/repository/src/test/java/tech/ydb/yoj/repository/testcaller/TestTxCaller.java +++ b/repository/src/test/java/tech/ydb/yoj/repository/testcaller/TestTxCaller.java @@ -5,7 +5,6 @@ import tech.ydb.yoj.repository.db.Repository; import tech.ydb.yoj.repository.db.RepositoryTransaction; import tech.ydb.yoj.repository.db.StdTxManager; -import tech.ydb.yoj.repository.db.StdTxManagerTest; import tech.ydb.yoj.repository.db.Tx; import tech.ydb.yoj.repository.db.TxOptions; import tech.ydb.yoj.repository.db.cache.TransactionLocal; @@ -18,7 +17,7 @@ import static org.mockito.Mockito.when; /** - * Part of {@link StdTxManagerTest}. + * Part of {@link import tech.ydb.yoj.repository.db.StdTxManagerTest}. * This is a copy of {@link TestDbTxCaller} * for testing calls from different packages. */ diff --git a/util/BUILD b/util/BUILD new file mode 100644 index 00000000..21d4ce21 --- /dev/null +++ b/util/BUILD @@ -0,0 +1,29 @@ +load("@contrib_rules_jvm//java:defs.bzl", "java_library", "java_test_suite") + +java_library( + name = "util", + srcs = glob(["src/main/**/*.java"]), + visibility = ["//visibility:public"], + deps = [ + "//bom:lombok", + "@java_contribs_stable//:com_google_code_findbugs_jsr305", + "@java_contribs_stable//:com_google_guava_guava", + "@java_contribs_stable//:javax_annotation_javax_annotation_api", + "@java_contribs_stable//:org_slf4j_slf4j_api", + ], +) + +java_test_suite( + name = "util-test", + srcs = glob(["src/test/java/**/*.java"]), + package_prefixes = [".tech"], + runner = "junit4", + visibility = ["//visibility:public"], + deps = [ + ":util", + "//bom:lombok", + "@java_contribs_stable//:junit_junit", + "@java_contribs_stable//:org_apache_logging_log4j_log4j_slf4j2_impl", + "@java_contribs_stable//:org_assertj_assertj_core", + ], +)