pub struct TestContext { /* private fields */ }Expand description
Mock implementation of OperatorContext for testing
Implementations§
Source§impl TestContext
impl TestContext
Sourcepub fn new(version: CommitVersion) -> Self
pub fn new(version: CommitVersion) -> Self
Create a new test context with the given version
Sourcepub fn state_store(&self) -> &Arc<Mutex<HashMap<EncodedKey, EncodedValues>>>
pub fn state_store(&self) -> &Arc<Mutex<HashMap<EncodedKey, EncodedValues>>>
Get a reference to the internal state store for inspection
Sourcepub fn clear_logs(&self)
pub fn clear_logs(&self)
Clear all captured logs
Sourcepub fn version(&self) -> CommitVersion
pub fn version(&self) -> CommitVersion
Get the current version
Sourcepub fn set_version(&mut self, version: CommitVersion)
pub fn set_version(&mut self, version: CommitVersion)
Set the current version
Sourcepub fn set_state(&self, key: EncodedKey, value: Vec<u8>)
pub fn set_state(&self, key: EncodedKey, value: Vec<u8>)
Set state value
Sourcepub fn remove_state(&self, key: &EncodedKey) -> Option<Vec<u8>>
pub fn remove_state(&self, key: &EncodedKey) -> Option<Vec<u8>>
Remove state value
Sourcepub fn has_state(&self, key: &EncodedKey) -> bool
pub fn has_state(&self, key: &EncodedKey) -> bool
Check if a key exists in state
Sourcepub fn state_count(&self) -> usize
pub fn state_count(&self) -> usize
Get the number of state entries
Sourcepub fn clear_state(&self)
pub fn clear_state(&self)
Clear all state
Sourcepub fn state_keys(&self) -> Vec<EncodedKey>
pub fn state_keys(&self) -> Vec<EncodedKey>
Get all state keys
Sourcepub fn as_operator_context(&self) -> OperatorContext
pub fn as_operator_context(&self) -> OperatorContext
Create an OperatorContext from this test context
§Status: NOT IMPLEMENTED
This method is currently a placeholder and will panic if called. To implement this, we would need to:
- Create FFI callbacks that bridge TestContext with OperatorContext
- Extend OperatorContext to support a testing/mock mode
Note: This functionality is not required for the current testing infrastructure. Most testing can be done using the builders, assertions, and stateful helpers without needing to create an OperatorContext.
§Panics
This method will always panic with “not implemented”.
Trait Implementations§
Source§impl Clone for TestContext
impl Clone for TestContext
Source§fn clone(&self) -> TestContext
fn clone(&self) -> TestContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more