|
| 1 | +load("@rules_java//java:java_library.bzl", "java_library") |
| 2 | +load("//third_party/cel/expr:cel_test.bzl", "cel_test", "make_test_targets", "test_runtime") |
| 3 | + |
| 4 | +package( |
| 5 | + default_applicable_licenses = ["//:license"], |
| 6 | + default_testonly = 1, |
| 7 | +) |
| 8 | + |
| 9 | +java_library( |
| 10 | + name = "basic_user_test", |
| 11 | + srcs = ["BasicUserTest.java"], |
| 12 | + deps = [ |
| 13 | + "//bundle:cel", |
| 14 | + "//runtime:function_binding", |
| 15 | + "//testing/testrunner:cel_test_context", |
| 16 | + "//testing/testrunner:cel_user_test_template", |
| 17 | + "@maven//:junit_junit", |
| 18 | + ], |
| 19 | +) |
| 20 | + |
| 21 | +java_library( |
| 22 | + name = "error_output_user_test", |
| 23 | + srcs = ["ErrorOutputUserTest.java"], |
| 24 | + deps = [ |
| 25 | + "//testing/testrunner:cel_test_context", |
| 26 | + "//testing/testrunner:cel_user_test_template", |
| 27 | + "@maven//:junit_junit", |
| 28 | + ], |
| 29 | +) |
| 30 | + |
| 31 | +java_library( |
| 32 | + name = "context_proto_user_test", |
| 33 | + srcs = ["ContextProtoUserTest.java"], |
| 34 | + deps = [ |
| 35 | + "//bundle:cel", |
| 36 | + "//checker:proto_type_mask", |
| 37 | + "//testing/testrunner:cel_test_context", |
| 38 | + "//testing/testrunner:cel_user_test_template", |
| 39 | + "@cel_spec//proto/cel/expr/conformance/proto3:test_all_types_java_proto", |
| 40 | + "@maven//:junit_junit", |
| 41 | + ], |
| 42 | +) |
| 43 | + |
| 44 | +java_library( |
| 45 | + name = "late_function_binding_user_test", |
| 46 | + srcs = ["LateFunctionBindingUserTest.java"], |
| 47 | + deps = [ |
| 48 | + "//bundle:cel", |
| 49 | + "//runtime", |
| 50 | + "//runtime:function_binding", |
| 51 | + "//testing/testrunner:cel_test_context", |
| 52 | + "//testing/testrunner:cel_user_test_template", |
| 53 | + "@maven//:junit_junit", |
| 54 | + ], |
| 55 | +) |
| 56 | + |
| 57 | +java_library( |
| 58 | + name = "custom_variable_binding_user_test", |
| 59 | + srcs = ["CustomVariableBindingUserTest.java"], |
| 60 | + deps = [ |
| 61 | + "//bundle:cel", |
| 62 | + "//runtime:function_binding", |
| 63 | + "//testing/testrunner:cel_test_context", |
| 64 | + "//testing/testrunner:cel_user_test_template", |
| 65 | + "@maven//:com_google_guava_guava", |
| 66 | + "@maven//:junit_junit", |
| 67 | + ], |
| 68 | +) |
| 69 | + |
| 70 | +java_library( |
| 71 | + name = "custom_test_suite", |
| 72 | + srcs = ["CustomTestSuite.java"], |
| 73 | + deps = [ |
| 74 | + "//testing/testrunner:annotations", |
| 75 | + "//testing/testrunner:cel_test_suite", |
| 76 | + "@maven//:com_google_guava_guava", |
| 77 | + ], |
| 78 | +) |
| 79 | + |
| 80 | +cel_test( |
| 81 | + name = "example_0_test", |
| 82 | + cel_expr = "basictest/expression.cel", |
| 83 | + config = "basictest/config.yaml", |
| 84 | + filegroup = "//codelab:testrunner_codelab_resources", # Users can use exports_files with appropriate visibility in which case filegroup is not required. |
| 85 | + test_data_path = "//codelab/src/test/codelab/testrunner/resources", |
| 86 | + test_suite = "basictest/testsuite.yaml", |
| 87 | + test_targets = [make_test_targets( |
| 88 | + runtime = test_runtime.JAVA, |
| 89 | + test_srcs = [":basic_user_test"], |
| 90 | + )], |
| 91 | +) |
| 92 | + |
| 93 | +cel_test( |
| 94 | + name = "example_0_test_with_raw_expression", |
| 95 | + cel_expr = "foo(a) || bar(a) == true", |
| 96 | + config = "basictest/config.yaml", |
| 97 | + filegroup = "//codelab:testrunner_codelab_resources", |
| 98 | + is_raw_expr = True, |
| 99 | + test_data_path = "//codelab/src/test/codelab/testrunner/resources", |
| 100 | + test_suite = "basictest/testsuite.yaml", |
| 101 | + test_targets = [make_test_targets( |
| 102 | + runtime = test_runtime.JAVA, |
| 103 | + test_srcs = [":basic_user_test"], |
| 104 | + )], |
| 105 | +) |
| 106 | + |
| 107 | +cel_test( |
| 108 | + name = "example_0_test_with_policy", |
| 109 | + cel_expr = "basictest/policy.yaml", |
| 110 | + config = "basictest/config.yaml", |
| 111 | + filegroup = "//codelab:testrunner_codelab_resources", |
| 112 | + test_data_path = "//codelab/src/test/codelab/testrunner/resources", |
| 113 | + test_suite = "basictest/testsuite.yaml", |
| 114 | + test_targets = [make_test_targets( |
| 115 | + runtime = test_runtime.JAVA, |
| 116 | + test_srcs = [":basic_user_test"], |
| 117 | + )], |
| 118 | +) |
| 119 | + |
| 120 | +cel_test( |
| 121 | + name = "example_1_test", |
| 122 | + cel_expr = "foo(a) || bar(a) == true", |
| 123 | + config = "basictest/config.yaml", |
| 124 | + filegroup = "//codelab:testrunner_codelab_resources", |
| 125 | + is_raw_expr = True, |
| 126 | + test_data_path = "//codelab/src/test/codelab/testrunner/resources", |
| 127 | + test_suite = "unknownoutputtest/testsuite.yaml", |
| 128 | + test_targets = [make_test_targets( |
| 129 | + runtime = test_runtime.JAVA, |
| 130 | + test_srcs = [":basic_user_test"], |
| 131 | + )], |
| 132 | +) |
| 133 | + |
| 134 | +cel_test( |
| 135 | + name = "example_2_test", |
| 136 | + cel_expr = "basictest/policy.yaml", |
| 137 | + config = "basictest/config.yaml", |
| 138 | + filegroup = "//codelab:testrunner_codelab_resources", |
| 139 | + test_data_path = "//codelab/src/test/codelab/testrunner/resources", |
| 140 | + test_suite = "erroroutputtest/testsuite.yaml", |
| 141 | + test_targets = [make_test_targets( |
| 142 | + runtime = test_runtime.JAVA, |
| 143 | + test_srcs = [":error_output_user_test"], |
| 144 | + )], |
| 145 | +) |
| 146 | + |
| 147 | +cel_test( |
| 148 | + name = "example_4_test", |
| 149 | + cel_expr = "basictest/expression.cel", |
| 150 | + config = "basictest/config.yaml", |
| 151 | + filegroup = "//codelab:testrunner_codelab_resources", |
| 152 | + test_data_path = "//codelab/src/test/codelab/testrunner/resources", |
| 153 | + test_targets = [make_test_targets( |
| 154 | + runtime = test_runtime.JAVA, |
| 155 | + test_srcs = [":basic_user_test"], |
| 156 | + deps = [":custom_test_suite"], |
| 157 | + )], |
| 158 | +) |
| 159 | + |
| 160 | +cel_test( |
| 161 | + name = "example_5_test", |
| 162 | + cel_expr = "foo(a) || bar(a) == true", |
| 163 | + config = "basictest/config.yaml", |
| 164 | + filegroup = "//codelab:testrunner_codelab_resources", |
| 165 | + is_raw_expr = True, |
| 166 | + test_data_path = "//codelab/src/test/codelab/testrunner/resources", |
| 167 | + test_suite = "customvariablebindingtest/testsuite.yaml", |
| 168 | + test_targets = [make_test_targets( |
| 169 | + runtime = test_runtime.JAVA, |
| 170 | + test_srcs = [":custom_variable_binding_user_test"], |
| 171 | + )], |
| 172 | +) |
| 173 | + |
| 174 | +cel_test( |
| 175 | + name = "example_6_test", |
| 176 | + cel_expr = "contextprototest/policy.yaml", |
| 177 | + config = "contextprototest/config.yaml", |
| 178 | + filegroup = "//codelab:testrunner_codelab_resources", |
| 179 | + test_data_path = "//codelab/src/test/codelab/testrunner/resources", |
| 180 | + test_suite = "contextprototest/testsuite.yaml", |
| 181 | + test_targets = [make_test_targets( |
| 182 | + runtime = test_runtime.JAVA, |
| 183 | + test_srcs = [":context_proto_user_test"], |
| 184 | + )], |
| 185 | +) |
| 186 | + |
| 187 | +cel_test( |
| 188 | + name = "example_7_test", |
| 189 | + cel_expr = "foo(a) || bar(a) == true", |
| 190 | + config = "basictest/config.yaml", |
| 191 | + filegroup = "//codelab:testrunner_codelab_resources", |
| 192 | + is_raw_expr = True, |
| 193 | + test_data_path = "//codelab/src/test/codelab/testrunner/resources", |
| 194 | + test_suite = "basictest/testsuite.yaml", |
| 195 | + test_targets = [make_test_targets( |
| 196 | + runtime = test_runtime.JAVA, |
| 197 | + test_srcs = [":late_function_binding_user_test"], |
| 198 | + )], |
| 199 | +) |
0 commit comments