2016-08-22 18:01:42 +00:00
|
|
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
2017-07-15 23:03:42 +00:00
|
|
|
// This source code is licensed under both the GPLv2 (found in the
|
|
|
|
// COPYING file in the root directory) and Apache 2.0 License
|
|
|
|
// (found in the LICENSE.Apache file in the root directory).
|
2016-08-22 18:01:42 +00:00
|
|
|
|
|
|
|
#include <jni.h>
|
|
|
|
|
|
|
|
#include "include/org_rocksdb_RocksDBExceptionTest.h"
|
|
|
|
|
|
|
|
#include "rocksdb/slice.h"
|
|
|
|
#include "rocksdb/status.h"
|
|
|
|
#include "rocksjni/portal.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_RocksDBExceptionTest
|
|
|
|
* Method: raiseException
|
|
|
|
* Signature: ()V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_RocksDBExceptionTest_raiseException(JNIEnv* env,
|
2018-04-13 00:55:14 +00:00
|
|
|
jobject /*jobj*/) {
|
2016-08-22 18:01:42 +00:00
|
|
|
rocksdb::RocksDBExceptionJni::ThrowNew(env, std::string("test message"));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_RocksDBExceptionTest
|
|
|
|
* Method: raiseExceptionWithStatusCode
|
|
|
|
* Signature: ()V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_RocksDBExceptionTest_raiseExceptionWithStatusCode(
|
2018-04-13 00:55:14 +00:00
|
|
|
JNIEnv* env, jobject /*jobj*/) {
|
2016-08-22 18:01:42 +00:00
|
|
|
rocksdb::RocksDBExceptionJni::ThrowNew(env, "test message",
|
|
|
|
rocksdb::Status::NotSupported());
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_RocksDBExceptionTest
|
|
|
|
* Method: raiseExceptionNoMsgWithStatusCode
|
|
|
|
* Signature: ()V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_RocksDBExceptionTest_raiseExceptionNoMsgWithStatusCode(
|
2018-04-13 00:55:14 +00:00
|
|
|
JNIEnv* env, jobject /*jobj*/) {
|
2016-08-22 18:01:42 +00:00
|
|
|
rocksdb::RocksDBExceptionJni::ThrowNew(env, rocksdb::Status::NotSupported());
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_RocksDBExceptionTest
|
|
|
|
* Method: raiseExceptionWithStatusCodeSubCode
|
|
|
|
* Signature: ()V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_RocksDBExceptionTest_raiseExceptionWithStatusCodeSubCode(
|
2018-04-13 00:55:14 +00:00
|
|
|
JNIEnv* env, jobject /*jobj*/) {
|
2016-08-22 18:01:42 +00:00
|
|
|
rocksdb::RocksDBExceptionJni::ThrowNew(
|
|
|
|
env, "test message",
|
|
|
|
rocksdb::Status::TimedOut(rocksdb::Status::SubCode::kLockTimeout));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_RocksDBExceptionTest
|
|
|
|
* Method: raiseExceptionNoMsgWithStatusCodeSubCode
|
|
|
|
* Signature: ()V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_RocksDBExceptionTest_raiseExceptionNoMsgWithStatusCodeSubCode(
|
2018-04-13 00:55:14 +00:00
|
|
|
JNIEnv* env, jobject /*jobj*/) {
|
2016-08-22 18:01:42 +00:00
|
|
|
rocksdb::RocksDBExceptionJni::ThrowNew(
|
|
|
|
env, rocksdb::Status::TimedOut(rocksdb::Status::SubCode::kLockTimeout));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_RocksDBExceptionTest
|
|
|
|
* Method: raiseExceptionWithStatusCodeState
|
|
|
|
* Signature: ()V
|
|
|
|
*/
|
|
|
|
void Java_org_rocksdb_RocksDBExceptionTest_raiseExceptionWithStatusCodeState(
|
2018-04-13 00:55:14 +00:00
|
|
|
JNIEnv* env, jobject /*jobj*/) {
|
2016-08-22 18:01:42 +00:00
|
|
|
rocksdb::Slice state("test state");
|
|
|
|
rocksdb::RocksDBExceptionJni::ThrowNew(env, "test message",
|
|
|
|
rocksdb::Status::NotSupported(state));
|
|
|
|
}
|