deltafi 2.29.1rc20250818210829__tar.gz → 2.30.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of deltafi might be problematic. Click here for more details.

Files changed (55) hide show
  1. deltafi-2.30.0/PKG-INFO +38 -0
  2. deltafi-2.30.0/README.md +3 -0
  3. deltafi-2.30.0/pyproject.toml +48 -0
  4. deltafi-2.29.1rc20250818210829/.dockerignore +0 -3
  5. deltafi-2.29.1rc20250818210829/.gitignore +0 -2
  6. deltafi-2.29.1rc20250818210829/.python-version +0 -1
  7. deltafi-2.29.1rc20250818210829/PKG-INFO +0 -82
  8. deltafi-2.29.1rc20250818210829/README.md +0 -47
  9. deltafi-2.29.1rc20250818210829/pyproject.toml +0 -50
  10. deltafi-2.29.1rc20250818210829/pyproject.toml.template +0 -50
  11. deltafi-2.29.1rc20250818210829/test/__init__.py +0 -30
  12. deltafi-2.29.1rc20250818210829/test/helperutils.py +0 -81
  13. deltafi-2.29.1rc20250818210829/test/plugin_data/flows/variables.yaml +0 -6
  14. deltafi-2.29.1rc20250818210829/test/plugin_data/flows/variables.yml +0 -8
  15. deltafi-2.29.1rc20250818210829/test/plugin_data/tests/f1.yaml +0 -2
  16. deltafi-2.29.1rc20250818210829/test/plugin_data/tests/f2.yml +0 -5
  17. deltafi-2.29.1rc20250818210829/test/plugin_data/tests/f3.txt +0 -1
  18. deltafi-2.29.1rc20250818210829/test/plugin_data/tests/f4.json +0 -4
  19. deltafi-2.29.1rc20250818210829/test/sample/__init__.py +0 -19
  20. deltafi-2.29.1rc20250818210829/test/sample/actions.py +0 -76
  21. deltafi-2.29.1rc20250818210829/test/test_actioneventqueue.py +0 -69
  22. deltafi-2.29.1rc20250818210829/test/test_domain.py +0 -165
  23. deltafi-2.29.1rc20250818210829/test/test_input.py +0 -43
  24. deltafi-2.29.1rc20250818210829/test/test_kit/__init__.py +0 -30
  25. deltafi-2.29.1rc20250818210829/test/test_kit/test_compare_helpers.py +0 -300
  26. deltafi-2.29.1rc20250818210829/test/test_kit/test_testkit_egress.py +0 -140
  27. deltafi-2.29.1rc20250818210829/test/test_kit/test_testkit_timed_ingress.py +0 -159
  28. deltafi-2.29.1rc20250818210829/test/test_kit/test_testkit_transform.py +0 -367
  29. deltafi-2.29.1rc20250818210829/test/test_plugin.py +0 -235
  30. deltafi-2.29.1rc20250818210829/test/test_result.py +0 -158
  31. deltafi-2.29.1rc20250818210829/test/test_storage.py +0 -113
  32. deltafi-2.29.1rc20250818210829/test/test_transform_action.py +0 -186
  33. deltafi-2.29.1rc20250818210829/uv.lock +0 -552
  34. {deltafi-2.29.1rc20250818210829 → deltafi-2.30.0}/deltafi/__init__.py +0 -0
  35. {deltafi-2.29.1rc20250818210829 → deltafi-2.30.0}/deltafi/action.py +0 -0
  36. {deltafi-2.29.1rc20250818210829 → deltafi-2.30.0}/deltafi/actioneventqueue.py +0 -0
  37. {deltafi-2.29.1rc20250818210829 → deltafi-2.30.0}/deltafi/actiontype.py +0 -0
  38. {deltafi-2.29.1rc20250818210829 → deltafi-2.30.0}/deltafi/domain.py +0 -0
  39. {deltafi-2.29.1rc20250818210829 → deltafi-2.30.0}/deltafi/exception.py +0 -0
  40. {deltafi-2.29.1rc20250818210829 → deltafi-2.30.0}/deltafi/genericmodel.py +0 -0
  41. {deltafi-2.29.1rc20250818210829 → deltafi-2.30.0}/deltafi/input.py +0 -0
  42. {deltafi-2.29.1rc20250818210829 → deltafi-2.30.0}/deltafi/logger.py +0 -0
  43. {deltafi-2.29.1rc20250818210829 → deltafi-2.30.0}/deltafi/metric.py +0 -0
  44. {deltafi-2.29.1rc20250818210829 → deltafi-2.30.0}/deltafi/plugin.py +0 -0
  45. {deltafi-2.29.1rc20250818210829 → deltafi-2.30.0}/deltafi/result.py +0 -0
  46. {deltafi-2.29.1rc20250818210829 → deltafi-2.30.0}/deltafi/resultmessage.py +0 -0
  47. {deltafi-2.29.1rc20250818210829 → deltafi-2.30.0}/deltafi/storage.py +0 -0
  48. {deltafi-2.29.1rc20250818210829 → deltafi-2.30.0}/deltafi/test_kit/__init__.py +0 -0
  49. {deltafi-2.29.1rc20250818210829 → deltafi-2.30.0}/deltafi/test_kit/assertions.py +0 -0
  50. {deltafi-2.29.1rc20250818210829 → deltafi-2.30.0}/deltafi/test_kit/compare_helpers.py +0 -0
  51. {deltafi-2.29.1rc20250818210829 → deltafi-2.30.0}/deltafi/test_kit/constants.py +0 -0
  52. {deltafi-2.29.1rc20250818210829 → deltafi-2.30.0}/deltafi/test_kit/egress.py +0 -0
  53. {deltafi-2.29.1rc20250818210829 → deltafi-2.30.0}/deltafi/test_kit/framework.py +0 -0
  54. {deltafi-2.29.1rc20250818210829 → deltafi-2.30.0}/deltafi/test_kit/timed_ingress.py +0 -0
  55. {deltafi-2.29.1rc20250818210829 → deltafi-2.30.0}/deltafi/test_kit/transform.py +0 -0
@@ -0,0 +1,38 @@
1
+ Metadata-Version: 2.3
2
+ Name: deltafi
3
+ Version: 2.30.0
4
+ Summary: SDK for DeltaFi plugins and actions
5
+ License: Apache License, Version 2.0
6
+ Keywords: deltafi
7
+ Author: DeltaFi
8
+ Author-email: deltafi@systolic.com
9
+ Requires-Python: >=3.9,<4.0
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: License :: Other/Proprietary License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Software Development
22
+ Requires-Dist: PyYAML (==6.0.2)
23
+ Requires-Dist: deepdiff (==6.7.1)
24
+ Requires-Dist: json-logging (==1.5.1)
25
+ Requires-Dist: minio (==7.2.15)
26
+ Requires-Dist: pydantic (==2.11.7)
27
+ Requires-Dist: redis (==6.2.0)
28
+ Requires-Dist: requests (==2.32.4)
29
+ Requires-Dist: urllib3 (==2.5.0)
30
+ Project-URL: Bug Reports, https://chat.deltafi.org/deltafi/channels/bug-reports
31
+ Project-URL: Documentation, https://docs.deltafi.org/#/
32
+ Project-URL: Source Code, https://gitlab.com/deltafi/deltafi
33
+ Description-Content-Type: text/markdown
34
+
35
+ # DeltaFi Action Kit
36
+
37
+ This project provides a Python implementation of the DeltaFi Action Kit. The DeltaFi Action Kit is a setup of modules which simplify the creation of a DeltaFi Plugin.
38
+
@@ -0,0 +1,3 @@
1
+ # DeltaFi Action Kit
2
+
3
+ This project provides a Python implementation of the DeltaFi Action Kit. The DeltaFi Action Kit is a setup of modules which simplify the creation of a DeltaFi Plugin.
@@ -0,0 +1,48 @@
1
+ [tool.poetry]
2
+ name = "deltafi"
3
+ version = "2.30.0"
4
+ description = "SDK for DeltaFi plugins and actions"
5
+ authors = ["DeltaFi <deltafi@systolic.com>"]
6
+ license = "Apache License, Version 2.0"
7
+ readme = "README.md"
8
+ keywords = ["deltafi"]
9
+ classifiers = [
10
+ "License :: OSI Approved :: Apache Software License",
11
+ "Topic :: Software Development",
12
+ "Operating System :: OS Independent",
13
+ "Development Status :: 4 - Beta",
14
+ "Intended Audience :: Developers",
15
+ "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3.9",
17
+ "Programming Language :: Python :: 3.10",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12"
20
+ ]
21
+
22
+ [tool.poetry.dependencies]
23
+ python = "^3.9"
24
+ deepdiff = "==6.7.1"
25
+ json-logging = "==1.5.1"
26
+ minio = "==7.2.15"
27
+ PyYAML = "==6.0.2"
28
+ pydantic = "==2.11.7"
29
+ redis = "==6.2.0"
30
+ requests = "==2.32.4"
31
+ urllib3 = "==2.5.0"
32
+
33
+ [tool.poetry.group.test]
34
+ optional = true
35
+
36
+ [tool.poetry.group.test.dependencies]
37
+ pytest = "==8.4.1"
38
+ pytest-mock = "==3.14.1"
39
+ mockito = "==1.5.4"
40
+
41
+ [tool.poetry.urls]
42
+ 'Source Code' = "https://gitlab.com/deltafi/deltafi"
43
+ Documentation = "https://docs.deltafi.org/#/"
44
+ 'Bug Reports' = "https://chat.deltafi.org/deltafi/channels/bug-reports"
45
+
46
+ [build-system]
47
+ requires = ["poetry-core"]
48
+ build-backend = "poetry.core.masonry.api"
@@ -1,3 +0,0 @@
1
- .venv
2
- venv
3
- **/__pycache__
@@ -1,2 +0,0 @@
1
- venv
2
- .venv
@@ -1 +0,0 @@
1
- 3.13
@@ -1,82 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: deltafi
3
- Version: 2.29.1rc20250818210829
4
- Summary: SDK for DeltaFi plugins and actions
5
- Project-URL: Source Code, https://gitlab.com/deltafi/deltafi
6
- Project-URL: Documentation, https://docs.deltafi.org/#/
7
- Project-URL: Bug Reports, https://chat.deltafi.org/deltafi/channels/bug-reports
8
- Author-email: DeltaFi <deltafi@systolic.com>
9
- License: Apache License, Version 2.0
10
- Keywords: deltafi
11
- Classifier: Development Status :: 4 - Beta
12
- Classifier: Intended Audience :: Developers
13
- Classifier: License :: OSI Approved :: Apache Software License
14
- Classifier: Operating System :: OS Independent
15
- Classifier: Programming Language :: Python :: 3
16
- Classifier: Programming Language :: Python :: 3.13
17
- Classifier: Topic :: Software Development
18
- Requires-Python: >=3.13
19
- Requires-Dist: deepdiff==6.7.1
20
- Requires-Dist: json-logging==1.5.1
21
- Requires-Dist: minio==7.2.15
22
- Requires-Dist: pydantic==2.11.7
23
- Requires-Dist: pyyaml==6.0.2
24
- Requires-Dist: redis==6.2.0
25
- Requires-Dist: requests==2.32.4
26
- Requires-Dist: urllib3==2.5.0
27
- Provides-Extra: dev
28
- Requires-Dist: mypy>=1.8.0; extra == 'dev'
29
- Requires-Dist: ruff>=0.1.0; extra == 'dev'
30
- Provides-Extra: test
31
- Requires-Dist: mockito==1.5.4; extra == 'test'
32
- Requires-Dist: pytest-mock==3.14.1; extra == 'test'
33
- Requires-Dist: pytest==8.4.1; extra == 'test'
34
- Description-Content-Type: text/markdown
35
-
36
- # DeltaFi Action Kit
37
-
38
- This project provides a Python implementation of the DeltaFi Action Kit. The DeltaFi Action Kit is a setup of modules which simplify the creation of a DeltaFi Plugin.
39
-
40
- ## Development Setup
41
-
42
- This project uses [uv](https://github.com/astral-sh/uv) for dependency management and building. uv is a fast Python package installer and resolver.
43
-
44
- ### Prerequisites
45
-
46
- - Python 3.13 or higher
47
- - uv (will be installed automatically via the build process)
48
-
49
- ### Building and Testing
50
-
51
- The project uses Gradle to orchestrate the build process with uv:
52
-
53
- ```bash
54
- # Build the project
55
- ./gradlew assemble
56
-
57
- # Run tests
58
- ./gradlew test
59
-
60
- # Clean build artifacts
61
- ./gradlew clean
62
- ```
63
-
64
- ### Manual Development
65
-
66
- For manual development without Gradle:
67
-
68
- ```bash
69
- cd src
70
-
71
- # Install uv if not already installed
72
- brew install uv || pip install uv
73
-
74
- # Install dependencies
75
- uv pip install -e .[test]
76
-
77
- # Run tests
78
- uv run pytest
79
-
80
- # Build package
81
- uv build
82
- ```
@@ -1,47 +0,0 @@
1
- # DeltaFi Action Kit
2
-
3
- This project provides a Python implementation of the DeltaFi Action Kit. The DeltaFi Action Kit is a setup of modules which simplify the creation of a DeltaFi Plugin.
4
-
5
- ## Development Setup
6
-
7
- This project uses [uv](https://github.com/astral-sh/uv) for dependency management and building. uv is a fast Python package installer and resolver.
8
-
9
- ### Prerequisites
10
-
11
- - Python 3.13 or higher
12
- - uv (will be installed automatically via the build process)
13
-
14
- ### Building and Testing
15
-
16
- The project uses Gradle to orchestrate the build process with uv:
17
-
18
- ```bash
19
- # Build the project
20
- ./gradlew assemble
21
-
22
- # Run tests
23
- ./gradlew test
24
-
25
- # Clean build artifacts
26
- ./gradlew clean
27
- ```
28
-
29
- ### Manual Development
30
-
31
- For manual development without Gradle:
32
-
33
- ```bash
34
- cd src
35
-
36
- # Install uv if not already installed
37
- brew install uv || pip install uv
38
-
39
- # Install dependencies
40
- uv pip install -e .[test]
41
-
42
- # Run tests
43
- uv run pytest
44
-
45
- # Build package
46
- uv build
47
- ```
@@ -1,50 +0,0 @@
1
- [project]
2
- name = "deltafi"
3
- version = "2.29.1rc20250818210829"
4
- description = "SDK for DeltaFi plugins and actions"
5
- authors = [
6
- {name = "DeltaFi", email = "deltafi@systolic.com"}
7
- ]
8
- license = {text = "Apache License, Version 2.0"}
9
- readme = "README.md"
10
- keywords = ["deltafi"]
11
- classifiers = [
12
- "License :: OSI Approved :: Apache Software License",
13
- "Topic :: Software Development",
14
- "Operating System :: OS Independent",
15
- "Development Status :: 4 - Beta",
16
- "Intended Audience :: Developers",
17
- "Programming Language :: Python :: 3",
18
- "Programming Language :: Python :: 3.13"
19
- ]
20
- requires-python = ">=3.13"
21
- dependencies = [
22
- "deepdiff==6.7.1",
23
- "json-logging==1.5.1",
24
- "minio==7.2.15",
25
- "PyYAML==6.0.2",
26
- "pydantic==2.11.7",
27
- "redis==6.2.0",
28
- "requests==2.32.4",
29
- "urllib3==2.5.0",
30
- ]
31
-
32
- [project.optional-dependencies]
33
- test = [
34
- "pytest==8.4.1",
35
- "pytest-mock==3.14.1",
36
- "mockito==1.5.4",
37
- ]
38
- dev = [
39
- "ruff>=0.1.0",
40
- "mypy>=1.8.0",
41
- ]
42
-
43
- [project.urls]
44
- "Source Code" = "https://gitlab.com/deltafi/deltafi"
45
- Documentation = "https://docs.deltafi.org/#/"
46
- "Bug Reports" = "https://chat.deltafi.org/deltafi/channels/bug-reports"
47
-
48
- [build-system]
49
- requires = ["hatchling"]
50
- build-backend = "hatchling.build"
@@ -1,50 +0,0 @@
1
- [project]
2
- name = "deltafi"
3
- version = "0.0.0"
4
- description = "SDK for DeltaFi plugins and actions"
5
- authors = [
6
- {name = "DeltaFi", email = "deltafi@systolic.com"}
7
- ]
8
- license = {text = "Apache License, Version 2.0"}
9
- readme = "README.md"
10
- keywords = ["deltafi"]
11
- classifiers = [
12
- "License :: OSI Approved :: Apache Software License",
13
- "Topic :: Software Development",
14
- "Operating System :: OS Independent",
15
- "Development Status :: 4 - Beta",
16
- "Intended Audience :: Developers",
17
- "Programming Language :: Python :: 3",
18
- "Programming Language :: Python :: 3.13"
19
- ]
20
- requires-python = ">=3.13"
21
- dependencies = [
22
- "deepdiff==6.7.1",
23
- "json-logging==1.5.1",
24
- "minio==7.2.15",
25
- "PyYAML==6.0.2",
26
- "pydantic==2.11.7",
27
- "redis==6.2.0",
28
- "requests==2.32.4",
29
- "urllib3==2.5.0",
30
- ]
31
-
32
- [project.optional-dependencies]
33
- test = [
34
- "pytest==8.4.1",
35
- "pytest-mock==3.14.1",
36
- "mockito==1.5.4",
37
- ]
38
- dev = [
39
- "ruff>=0.1.0",
40
- "mypy>=1.8.0",
41
- ]
42
-
43
- [project.urls]
44
- "Source Code" = "https://gitlab.com/deltafi/deltafi"
45
- Documentation = "https://docs.deltafi.org/#/"
46
- "Bug Reports" = "https://chat.deltafi.org/deltafi/channels/bug-reports"
47
-
48
- [build-system]
49
- requires = ["hatchling"]
50
- build-backend = "hatchling.build"
@@ -1,30 +0,0 @@
1
- #
2
- # DeltaFi - Data transformation and enrichment platform
3
- #
4
- # Copyright 2021-2025 DeltaFi Contributors <deltafi@deltafi.org>
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- import os
20
- import sys
21
-
22
- PROJECT_PATH = os.getcwd()
23
- SOURCE_PATH = os.path.join(
24
- PROJECT_PATH, "src"
25
- )
26
- sys.path.append(SOURCE_PATH)
27
- TEST_PATH = os.path.join(
28
- PROJECT_PATH, "src/test"
29
- )
30
- sys.path.append(TEST_PATH)
@@ -1,81 +0,0 @@
1
- #
2
- # DeltaFi - Data transformation and enrichment platform
3
- #
4
- # Copyright 2021-2025 DeltaFi Contributors <deltafi@deltafi.org>
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- from deltafi.domain import Context, Event
20
- from deltafi.storage import Segment
21
-
22
- SEG_ID = "1"
23
- TEST_DID = "123did"
24
-
25
-
26
- def make_segment(seg_id):
27
- return Segment(uuid=seg_id, offset=0, size=100, did=TEST_DID)
28
-
29
-
30
- def make_context_dict():
31
- return {
32
- 'did': TEST_DID,
33
- 'deltaFileName': 'FILENAME',
34
- 'dataSource': 'DATA_SOURCE',
35
- 'flowName': 'FLOW_NAME',
36
- 'flowId': 'FLOW_ID',
37
- 'actionName': 'ACTION_NAME',
38
- 'actionVersion': '1.0',
39
- 'hostname': 'HOSTNAME',
40
- 'systemName': 'SYSTEM_NAME'
41
- }
42
-
43
-
44
- def make_content_dict(name):
45
- return {
46
- 'name': name,
47
- 'segments': [make_segment(SEG_ID).json()],
48
- 'mediaType': 'xml'
49
- }
50
-
51
-
52
- def make_delta_file_message_dict():
53
- return {
54
- 'metadata': {'plKey1': 'valueA', 'plKey2': 'valueB'},
55
- 'contentList': [make_content_dict('CONTENT_NAME'), make_content_dict('CONTENT 2')]
56
- }
57
-
58
-
59
- def make_context():
60
- return Context(did=TEST_DID,
61
- delta_file_name='FILENAME',
62
- data_source='DATA_SOURCE',
63
- flow_name='FLOW_NAME',
64
- flow_id='FLOW_ID',
65
- action_name='ACTION_NAME',
66
- action_version='1.0',
67
- hostname='HOSTNAME',
68
- system_name='SYSTEM_NAME',
69
- content_service=None)
70
-
71
-
72
- def make_event(content_service):
73
- logger = None
74
- event = Event.create({
75
- 'deltaFileMessages': [make_delta_file_message_dict()],
76
- 'actionContext': make_context_dict(),
77
- 'actionParams': {
78
- "thing": "theThing"
79
- }
80
- }, content_service, logger)
81
- return event
@@ -1,6 +0,0 @@
1
- - name: name1
2
- description: d1
3
- - name: name2
4
- description: d2
5
- - name: name3
6
- description: d3
@@ -1,8 +0,0 @@
1
- name: name1
2
- description: d1
3
- ---
4
- name: name2
5
- description: d2
6
- ---
7
- name: name3
8
- description: d3
@@ -1,2 +0,0 @@
1
- name: name1
2
- description: d1
@@ -1,5 +0,0 @@
1
- name: name2
2
- description: d2
3
- ---
4
- name: name3
5
- description: d3
@@ -1 +0,0 @@
1
- This file will be ignored by _read_valid_files() due to its extension
@@ -1,4 +0,0 @@
1
- {
2
- "name": "name4",
3
- "description": "d4"
4
- }
@@ -1,19 +0,0 @@
1
- #
2
- # DeltaFi - Data transformation and enrichment platform
3
- #
4
- # Copyright 2021-2025 DeltaFi Contributors <deltafi@deltafi.org>
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
-
@@ -1,76 +0,0 @@
1
- #
2
- # DeltaFi - Data transformation and enrichment platform
3
- #
4
- # Copyright 2021-2025 DeltaFi Contributors <deltafi@deltafi.org>
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- from abc import abstractmethod
20
- from typing import Dict, List
21
-
22
- from deltafi.action import ActionOptions, DescriptionWithConditions, InputSpec, OutputSpec, TransformAction
23
- from deltafi.domain import Context, Content
24
- from deltafi.input import TransformInput
25
- from deltafi.result import TransformResult
26
- from deltafi.storage import ContentService
27
- from mockito import mock
28
- from pydantic import BaseModel, Field
29
-
30
-
31
- class SampleTransformParameters(BaseModel):
32
- a_string: str = Field(description="this string parameter is required")
33
- def_string: str = Field(default="default-val", description="str with default")
34
- a_dict: dict[str, str] = Field(description="this dict parameter is required")
35
- def_dict: Dict[str, str] = Field(default={"key1:" "val1"}, description="dict has default")
36
- a_list: List[str] = Field(default=[], description="list with default")
37
- a_bool: bool = Field(description="this boolean parameter is required")
38
- def_int: int = Field(default=100, description="int with default")
39
-
40
-
41
- class SampleTransformAction(TransformAction):
42
- def __init__(self):
43
- super().__init__('', ActionOptions(description='Transform action description',
44
- input_spec=InputSpec(content_summary='The input content summary', metadata_summary='The input metadata summary'),
45
- output_spec=OutputSpec(content_summary='The output content summary', metadata_summary='The output metadata summary', annotations_summary='The output annotations summary'),
46
- filters=[DescriptionWithConditions('Filter 1', ['Condition A', 'Condition B']),
47
- 'Filter 2'],
48
- errors=[DescriptionWithConditions('Error 1', ['Condition A', 'Condition B']),
49
- 'Error 2'],
50
- notes=['Note 1', 'Note2'],
51
- details='The details'))
52
-
53
- def param_class(self):
54
- return SampleTransformParameters
55
-
56
- def transform(self, context: Context, params: SampleTransformParameters, transform_input: TransformInput):
57
- return TransformResult(context).add_metadata('transformKey', 'transformValue') \
58
- .add_content(Content(name='transformed content', segments=[], media_type='text/plain',
59
- content_service=mock(ContentService)))
60
-
61
-
62
- class SampleAbstractTransformAction(TransformAction):
63
- def __init__(self):
64
- super().__init__('Transform action description - ignored due to the abstract method')
65
-
66
- def param_class(self):
67
- return SampleTransformParameters
68
-
69
- @abstractmethod
70
- def extra_abstract_method(self):
71
- pass
72
-
73
- def transform(self, context: Context, params: SampleTransformParameters, transform_input: TransformInput):
74
- return TransformResult(context).add_metadata('transformKey', 'transformValue') \
75
- .add_content(Content(name='transformed content', segments=[], media_type='text/plain',
76
- content_service=mock(ContentService)))
@@ -1,69 +0,0 @@
1
- #
2
- # DeltaFi - Data transformation and enrichment platform
3
- #
4
- # Copyright 2021-2025 DeltaFi Contributors <deltafi@deltafi.org>
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- import time
20
-
21
- import redis
22
- from deltafi.actioneventqueue import ActionEventQueue
23
- from mockito import when, mock, unstub
24
-
25
- TEST_URL = "http://127.0.0.1:12345"
26
- TEST_ACTION = "Action"
27
- TEST_ITEM = "1234"
28
-
29
-
30
- def test_action_event_queue_size():
31
- unstub()
32
- mock_pool = mock(redis.ConnectionPool)
33
- mock_conn = mock(redis.Redis)
34
-
35
- when(redis).ConnectionPool(...).thenReturn(mock_pool)
36
- when(redis).Redis(connection_pool=mock_pool).thenReturn(mock_conn)
37
- when(mock_conn).zcard(TEST_ACTION).thenReturn(1)
38
-
39
- service = ActionEventQueue(TEST_URL, 5, "password", None)
40
- assert service.size(TEST_ACTION) == 1
41
-
42
-
43
- def test_action_event_queue_put():
44
- unstub()
45
- mock_pool = mock(redis.ConnectionPool)
46
- mock_conn = mock(redis.Redis)
47
-
48
- when(redis).ConnectionPool(...).thenReturn(mock_pool)
49
- when(redis).Redis(connection_pool=mock_pool).thenReturn(mock_conn)
50
- when(time).time().thenReturn(1.6)
51
- when(mock_conn).zadd(TEST_ACTION, {TEST_ITEM: 1600}, nx=True).thenReturn(1)
52
-
53
- service = ActionEventQueue(TEST_URL, 5, "password", None)
54
- assert service.put(TEST_ACTION, TEST_ITEM) == 1
55
-
56
-
57
- def test_action_event_queue_take():
58
- unstub()
59
- mock_pool = mock(redis.ConnectionPool)
60
- mock_conn = mock(redis.Redis)
61
-
62
- result_tuple = (TEST_ACTION, TEST_ITEM, 1600)
63
-
64
- when(redis).ConnectionPool(...).thenReturn(mock_pool)
65
- when(redis).Redis(connection_pool=mock_pool).thenReturn(mock_conn)
66
- when(mock_conn).bzpopmin(TEST_ACTION, 0).thenReturn(result_tuple)
67
-
68
- service = ActionEventQueue(TEST_URL, 5, "password", "some-pod")
69
- assert service.take(TEST_ACTION) == TEST_ITEM