|
23 | 23 | #include "dbutils.h" |
24 | 24 | #include "cloudsync.h" |
25 | 25 | #include "cloudsync_private.h" |
| 26 | +#include <jni.h> |
| 27 | +#include "call_java.h" |
26 | 28 |
|
27 | 29 | // declared only if macro CLOUDSYNC_UNITTEST is defined |
28 | 30 | extern char *OUT_OF_MEMORY_BUFFER; |
@@ -3273,6 +3275,24 @@ bool do_test_alter(int nclients, int alter_version, bool print_result, bool clea |
3273 | 3275 | return result; |
3274 | 3276 | } |
3275 | 3277 |
|
| 3278 | +bool test_call_https_java(void) { |
| 3279 | + JNIEnv* env = getEnv(); |
| 3280 | + if (!env) { |
| 3281 | + printf("Could not get JNIEnv\n"); |
| 3282 | + return false; |
| 3283 | + } |
| 3284 | + |
| 3285 | + const char* javaResult = call_https_java(env); |
| 3286 | + if (javaResult) { |
| 3287 | + printf("Got from Java: %s\n", javaResult); |
| 3288 | + free((void*)javaResult); |
| 3289 | + return true; |
| 3290 | + } else { |
| 3291 | + printf("call_https_java returned NULL\n"); |
| 3292 | + return false; |
| 3293 | + } |
| 3294 | +} |
| 3295 | + |
3276 | 3296 | // MARK: - |
3277 | 3297 |
|
3278 | 3298 | int test_report(const char *description, bool result){ |
@@ -3341,7 +3361,8 @@ int main(int argc, const char * argv[]) { |
3341 | 3361 | result += test_report("Test Alter Table 1:", do_test_alter(3, 1, print_result, cleanup_databases)); |
3342 | 3362 | result += test_report("Test Alter Table 2:", do_test_alter(3, 2, print_result, cleanup_databases)); |
3343 | 3363 | result += test_report("Test Alter Table 3:", do_test_alter(3, 3, print_result, cleanup_databases)); |
3344 | | - |
| 3364 | + result += test_report("JNI call_https_java Test:", test_call_https_java()); |
| 3365 | + |
3345 | 3366 | finalize: |
3346 | 3367 | printf("\n"); |
3347 | 3368 | if (rc != SQLITE_OK) printf("%s (%d)\n", (db) ? sqlite3_errmsg(db) : "N/A", rc); |
|
0 commit comments