Commit 86e94f3
authored
[ZEPPELIN-6242] Refactor initAuth in Neo4jConnectionManager for safer enum parsing and default handling
### What is this PR for?
This PR improves the Neo4j authentication initialization logic by providing a default authentication type of `NONE` when the `neo4j.auth.type` property is absent.
It enhances enum parsing with explicit try-catch handling to deliver clear, user-friendly error messages for unsupported or invalid authentication types.
Additionally, a defensive default branch is not removed in the switch statement to satisfy the compiler and guard against unforeseen enum values.
### What type of PR is it?
Refactoring
### Todos
* [x] Provide default `NONE` value when `neo4j.auth.type` is missing
* [x] Wrap enum parsing in try-catch with explicit error messages
* [X] Add unit test for the modified code.
### What is the Jira issue?
* [ZEPPELIN-6242](https://issues.apache.org/jira/browse/ZEPPELIN-6242)
### How should this be tested?
* Add new unit test for the modified code.
* Tests for missing auth type defaulting to NONE, invalid auth types throwing clear exceptions, and successful BASIC/NONE authentications should be confirmed
### Screenshots (if appropriate)
N/A
### Questions:
* Does the license files need to update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No
Closes #4975 from eunhwa99/ZEPPELIN-6242.
Signed-off-by: Philipp Dallig <philipp.dallig@gmail.com>1 parent 573fc4e commit 86e94f3
2 files changed
Lines changed: 107 additions & 3 deletions
File tree
- neo4j/src
- main/java/org/apache/zeppelin/graph/neo4j
- test/java/org/apache/zeppelin/graph/neo4j
Lines changed: 12 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
89 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
90 | 98 | | |
91 | 99 | | |
92 | 100 | | |
| |||
95 | 103 | | |
96 | 104 | | |
97 | 105 | | |
98 | | - | |
| 106 | + | |
99 | 107 | | |
100 | 108 | | |
101 | 109 | | |
| |||
154 | 162 | | |
155 | 163 | | |
156 | 164 | | |
| 165 | + | |
Lines changed: 95 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
0 commit comments