Skip to content

Commit

Permalink
Review update
Browse files Browse the repository at this point in the history
  • Loading branch information
lordgamez committed Oct 30, 2024
1 parent ceb83b8 commit 682a2ff
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 28 deletions.
29 changes: 15 additions & 14 deletions extensions/standard-processors/tests/unit/FlowJsonTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ TEST_CASE("Test sensitive parameters in sensitive properties") {
"name": "my_value",
"description": "",
"sensitive": true,
"value": "{}"
"value": "{encrypted_parameter_value}"
}}
]
}}
Expand All @@ -842,12 +842,12 @@ TEST_CASE("Test sensitive parameters in sensitive properties") {
"schedulingStrategy": "TIMER_DRIVEN",
"schedulingPeriod": "3 sec",
"properties": {{
"Sensitive Property": "{}"
"Sensitive Property": "{encrypted_sensitive_property_value}"
}}
}}],
"parameterContextName": "my-context"
}}
}})", encrypted_parameter_value, encrypted_sensitive_property_value);
}})", fmt::arg("encrypted_parameter_value", encrypted_parameter_value), fmt::arg("encrypted_sensitive_property_value", encrypted_sensitive_property_value));

std::unique_ptr<core::ProcessGroup> flow = config.getRootFromPayload(CONFIG_JSON);
REQUIRE(flow);
Expand Down Expand Up @@ -879,13 +879,13 @@ TEST_CASE("Test sensitive parameters in sensitive property value sequence") {
"name": "first_value",
"description": "",
"sensitive": true,
"value": "{}"
"value": "{encrypted_parameter_value_1}"
}},
{{
"name": "second_value",
"description": "",
"sensitive": true,
"value": "{}"
"value": "{encrypted_parameter_value_2}"
}}
]
}}
Expand All @@ -900,14 +900,15 @@ TEST_CASE("Test sensitive parameters in sensitive property value sequence") {
"schedulingPeriod": "3 sec",
"properties": {{
"Sensitive Property": [
{{"value": "{}"}},
{{"value": "{}"}}
{{"value": "{encrypted_sensitive_property_value_1}"}},
{{"value": "{encrypted_sensitive_property_value_2}"}}
]
}}
}}],
"parameterContextName": "my-context"
}}
}})", encrypted_parameter_value_1, encrypted_parameter_value_2, encrypted_sensitive_property_value_1, encrypted_sensitive_property_value_2);
}})", fmt::arg("encrypted_parameter_value_1", encrypted_parameter_value_1), fmt::arg("encrypted_parameter_value_2", encrypted_parameter_value_2),
fmt::arg("encrypted_sensitive_property_value_1", encrypted_sensitive_property_value_1), fmt::arg("encrypted_sensitive_property_value_2", encrypted_sensitive_property_value_2));

std::unique_ptr<core::ProcessGroup> flow = config.getRootFromPayload(CONFIG_JSON);
REQUIRE(flow);
Expand Down Expand Up @@ -1049,7 +1050,7 @@ TEST_CASE("Test parameters in controller services") {
"name": "my_value_1",
"description": "",
"sensitive": true,
"value": "{}"
"value": "{encrypted_parameter_value}"
}},
{{
"name": "my_value_2",
Expand All @@ -1068,14 +1069,14 @@ TEST_CASE("Test parameters in controller services") {
"name": "SSLContextService",
"type": "org.apache.nifi.minifi.controllers.SSLContextService",
"properties": {{
"Passphrase": "{}",
"Passphrase": "{encrypted_sensitive_property_value}",
"Private Key": "#{{my_value_2}}",
"Use System Cert Store": "true"
}}
}}],
"parameterContextName": "my-context"
}}
}})", encrypted_parameter_value, encrypted_sensitive_property_value);
}})", fmt::arg("encrypted_parameter_value", encrypted_parameter_value), fmt::arg("encrypted_sensitive_property_value", encrypted_sensitive_property_value));

std::unique_ptr<core::ProcessGroup> flow = json_config.getRootFromPayload(CONFIG_JSON);
REQUIRE(flow);
Expand Down Expand Up @@ -1106,7 +1107,7 @@ TEST_CASE("Parameters can be used in controller services in nested process group
"name": "my_value_1",
"description": "",
"sensitive": true,
"value": "{}"
"value": "{encrypted_parameter_value}"
}},
{{
"name": "my_value_2",
Expand All @@ -1128,15 +1129,15 @@ TEST_CASE("Parameters can be used in controller services in nested process group
"name": "SSLContextService",
"type": "org.apache.nifi.minifi.controllers.SSLContextService",
"properties": {{
"Passphrase": "{}",
"Passphrase": "{encrypted_sensitive_property_value}",
"Private Key": "#{{my_value_2}}",
"Use System Cert Store": "true"
}}
}}],
"parameterContextName": "my-context"
}}]
}}
}})", encrypted_parameter_value, encrypted_sensitive_property_value);
}})", fmt::arg("encrypted_parameter_value", encrypted_parameter_value), fmt::arg("encrypted_sensitive_property_value", encrypted_sensitive_property_value));

std::unique_ptr<core::ProcessGroup> flow = json_config.getRootFromPayload(CONFIG_JSON);
REQUIRE(flow);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1692,7 +1692,7 @@ Parameter Contexts:
- name: my_value
description: ''
sensitive: true
value: {}
value: {encrypted_parameter_value}
Processors:
- id: b0c04f28-0158-1000-0000-000000000000
name: DummyFlowYamlProcessor
Expand All @@ -1703,9 +1703,9 @@ Parameter Contexts:
auto-terminated relationships list: [success]
Properties:
Simple Property: simple
Sensitive Property: {}
Sensitive Property: {encrypted_sensitive_property_value}
Parameter Context Name: my-context
)", encrypted_parameter_value, encrypted_sensitive_property_value);
)", fmt::arg("encrypted_parameter_value", encrypted_parameter_value), fmt::arg("encrypted_sensitive_property_value", encrypted_sensitive_property_value));

std::unique_ptr<core::ProcessGroup> flow = yaml_config.getRootFromPayload(TEST_CONFIG_YAML);
REQUIRE(flow);
Expand Down Expand Up @@ -1737,11 +1737,11 @@ Parameter Contexts:
- name: my_value_1
description: ''
sensitive: true
value: {}
value: {encrypted_parameter_value_1}
- name: my_value_2
description: ''
sensitive: true
value: {}
value: {encrypted_parameter_value_2}
Processors:
- id: b0c04f28-0158-1000-0000-000000000000
name: DummyFlowYamlProcessor
Expand All @@ -1753,10 +1753,11 @@ Parameter Contexts:
Properties:
Simple Property: simple
Sensitive Property:
- value: {}
- value: {}
- value: {encrypted_sensitive_property_value_1}
- value: {encrypted_sensitive_property_value_2}
Parameter Context Name: my-context
)", encrypted_parameter_value_1, encrypted_parameter_value_2, encrypted_sensitive_property_value_1, encrypted_sensitive_property_value_2);
)", fmt::arg("encrypted_parameter_value_1", encrypted_parameter_value_1), fmt::arg("encrypted_parameter_value_2", encrypted_parameter_value_2),
fmt::arg("encrypted_sensitive_property_value_1", encrypted_sensitive_property_value_1), fmt::arg("encrypted_sensitive_property_value_2", encrypted_sensitive_property_value_2));

std::unique_ptr<core::ProcessGroup> flow = yaml_config.getRootFromPayload(TEST_CONFIG_YAML);
REQUIRE(flow);
Expand Down Expand Up @@ -1789,7 +1790,7 @@ Parameter Contexts:
- name: my_value_1
description: ''
sensitive: true
value: {}
value: {encrypted_parameter_value_1}
- name: my_value_2
description: ''
sensitive: false
Expand All @@ -1802,11 +1803,11 @@ Controller Services:
Properties:
CA Certificate:
Client Certificate:
Passphrase: {}
Passphrase: {encrypted_sensitive_property_value_1}
Private Key: "#{{my_value_2}}"
Use System Cert Store: 'true'
Parameter Context Name: my-context
)", encrypted_parameter_value_1, encrypted_sensitive_property_value_1);
)", fmt::arg("encrypted_parameter_value_1", encrypted_parameter_value_1), fmt::arg("encrypted_sensitive_property_value_1", encrypted_sensitive_property_value_1));

std::unique_ptr<core::ProcessGroup> flow = yaml_config.getRootFromPayload(TEST_CONFIG_YAML);
REQUIRE(flow);
Expand Down Expand Up @@ -1837,7 +1838,7 @@ Parameter Contexts:
- name: my_value_1
description: ''
sensitive: true
value: {}
value: {encrypted_parameter_value_1}
- name: my_value_2
description: ''
sensitive: false
Expand All @@ -1859,11 +1860,11 @@ Process Groups:
Properties:
CA Certificate:
Client Certificate:
Passphrase: {}
Passphrase: {encrypted_sensitive_property_value_1}
Private Key: "#{{my_value_2}}"
Use System Cert Store: 'true'
Parameter Context Name: sub-context
)", encrypted_parameter_value_1, encrypted_sensitive_property_value_1);
)", fmt::arg("encrypted_parameter_value_1", encrypted_parameter_value_1), fmt::arg("encrypted_sensitive_property_value_1", encrypted_sensitive_property_value_1));

std::unique_ptr<core::ProcessGroup> flow = yaml_config.getRootFromPayload(TEST_CONFIG_YAML);
REQUIRE(flow);
Expand Down

0 comments on commit 682a2ff

Please sign in to comment.