| 386 | } |
| 387 | |
| 388 | jobject createWorkloadContext(FDBWorkloadContext* context) { |
| 389 | auto clazz = getClass("com/apple/foundationdb/testing/WorkloadContext"); |
| 390 | auto constructor = getMethod(clazz, "<init>", "(J)V"); |
| 391 | auto jContext = reinterpret_cast<jlong>(context); |
| 392 | jobject res = env->NewObject(clazz, constructor, jContext); |
| 393 | std::cout.flush(); |
| 394 | checkException(); |
| 395 | auto field = env->GetFieldID(clazz, "impl", "J"); |
| 396 | checkException(); |
| 397 | auto impl = env->GetLongField(res, field); |
| 398 | checkException(); |
| 399 | if (impl != jContext) { |
| 400 | log->trace(error, |
| 401 | "ContextNotCorrect", |
| 402 | { { "Expected", std::to_string(jContext) }, { "Impl", std::to_string(impl) } }); |
| 403 | std::terminate(); |
| 404 | } |
| 405 | return res; |
| 406 | } |
| 407 | |
| 408 | jobject createWorkload(jobject context, const std::string& workloadName) { |
| 409 | auto clazz = getClass(workloadName.c_str()); |