batch_mode_batch_workspace/
mock_bad.rs

1// ---------------- [ File: batch-mode-batch-workspace/src/mock_bad.rs ]
2crate::ix!();
3
4/// In “test_reconcile_unprocessed_input_error_but_mock_processing_fails_action,” 
5/// you had a local `struct BadWorkspace` referencing `workspace_dir()`. 
6/// Instead, remove that `workspace_dir()` method entirely, and define 
7/// a single “BadWorkspace” with full trait impl so it compiles.
8
9#[derive(Clone, Debug)]
10pub struct BadWorkspace;
11
12/// Provide minimal stubs. We remove “workspace_dir()” usage entirely.
13impl GetInputFilenameAtIndex for BadWorkspace {
14    fn input_filename(&self, idx: &BatchIndex) -> PathBuf {
15        PathBuf::from(format!("/this/does/not/exist/bad_input_{:?}.json", idx))
16    }
17}
18
19impl GetOutputFilenameAtIndex for BadWorkspace {
20    fn output_filename(&self, idx: &BatchIndex) -> PathBuf {
21        PathBuf::from(format!("/this/does/not/exist/bad_output_{:?}.json", idx))
22    }
23}
24
25impl GetErrorFilenameAtIndex for BadWorkspace {
26    fn error_filename(&self, idx: &BatchIndex) -> PathBuf {
27        PathBuf::from(format!("/this/does/not/exist/bad_error_{:?}.json", idx))
28    }
29}
30
31impl GetMetadataFilenameAtIndex for BadWorkspace {
32    fn metadata_filename(&self, idx: &BatchIndex) -> PathBuf {
33        PathBuf::from(format!("/this/does/not/exist/bad_metadata_{:?}.json", idx))
34    }
35}
36
37impl GetDoneDirectory for BadWorkspace {
38    fn get_done_directory(&self) -> &PathBuf {
39        static BAD_DONE: Lazy<PathBuf> =
40            Lazy::new(|| PathBuf::from("/this/does/not/exist/done_dir_simulated_error"));
41        &BAD_DONE
42    }
43}
44
45impl GetFailedJsonRepairsDir for BadWorkspace {
46    fn failed_json_repairs_dir(&self) -> PathBuf {
47        PathBuf::from("/this/does/not/exist/failing_json_repairs")
48    }
49}
50
51impl GetFailedItemsDir for BadWorkspace {
52    fn failed_items_dir(&self) -> PathBuf {
53        PathBuf::from("/this/does/not/exist/failing_items")
54    }
55}
56
57impl GetTextStoragePath for BadWorkspace {
58    fn text_storage_path(&self, idx: &BatchIndex) -> PathBuf {
59        PathBuf::from(format!("/this/does/not/exist/failing_text_storage_{:?}.txt", idx))
60    }
61}
62
63impl GetWorkdir for BadWorkspace {
64    fn workdir(&self) -> PathBuf {
65        PathBuf::from("/this/does/not/exist/bad_workspace_dir")
66    }
67}
68
69impl GetTargetPath for BadWorkspace {
70    type Item = Arc<dyn GetTargetPathForAIExpansion + Send + Sync + 'static>;
71
72    fn target_path(&self, item: &Self::Item, ect: &ExpectedContentType) -> PathBuf {
73        let broken_dir = self.workdir().join("this_cannot_be_created");
74        item.target_path_for_ai_json_expansion(&broken_dir, ect)
75    }
76}
77
78impl BatchWorkspaceInterface for BadWorkspace {}
79impl GetTargetDir for BadWorkspace {
80    fn get_target_dir(&self) -> PathBuf {
81        todo!();
82    }
83}