@@ -53,12 +53,7 @@ public void serializationIsIdempotentForMinimalConfigUsedTemplateBasedDNResolvin
53
53
.get ();
54
54
sourceCfg .put ("retrieval.password.enableAssociation" , "false" );
55
55
56
- LdapConfiguration processor = new LdapConfiguration ();
57
- processor .fromProperties (ConfigurationComparator .getAsString (sourceCfg ), LdapPasswordVerificator .NAME ,
58
- msg );
59
- String converted = processor .toProperties (LdapPasswordVerificator .NAME , msg );
60
-
61
- Properties result = ConfigurationComparator .fromString (converted , PREFIX ).get ();
56
+ Properties result = parsePropertiesAndBack (sourceCfg , LdapPasswordVerificator .NAME );
62
57
63
58
createComparator (PREFIX , META )
64
59
.ignoringSuperflous ("embeddedTranslationProfile" , "additionalSearch.1.scope" , "validUsersFilter" )
@@ -74,11 +69,7 @@ public void serializationIsIdempotentForMinimalCertConfigUsedTemplateBasedDNReso
74
69
.update ("userDNTemplate" , "cn={USERNAME}" ).get ();
75
70
sourceCfg .put ("retrieval.tls.enableAssociation" , "false" );
76
71
77
- LdapConfiguration processor = new LdapConfiguration ();
78
- processor .fromProperties (ConfigurationComparator .getAsString (sourceCfg ), LdapCertVerificator .NAME ,
79
- msg );
80
- String converted = processor .toProperties (LdapCertVerificator .NAME , msg );
81
- Properties result = ConfigurationComparator .fromString (converted , PREFIX ).get ();
72
+ Properties result = parsePropertiesAndBack (sourceCfg , LdapCertVerificator .NAME );
82
73
83
74
createComparator (PREFIX , META )
84
75
.ignoringSuperflous ("embeddedTranslationProfile" , "additionalSearch.1.scope" )
@@ -93,11 +84,8 @@ public void serializationIsIdempotentForMinimalExplicitDefaultsConfigUsedTemplat
93
84
Properties sourceCfg = ConfigurationGenerator .generateMinimalWithDefaults (PREFIX , META )
94
85
.update ("userDNTemplate" , "cn={USERNAME}" ).get ();
95
86
sourceCfg .put ("retrieval.password.enableAssociation" , "false" );
96
- LdapConfiguration processor = new LdapConfiguration ();
97
- processor .fromProperties (ConfigurationComparator .getAsString (sourceCfg ), LdapPasswordVerificator .NAME ,
98
- msg );
99
- String converted = processor .toProperties (LdapPasswordVerificator .NAME , msg );
100
- Properties result = ConfigurationComparator .fromString (converted , PREFIX ).get ();
87
+
88
+ Properties result = parsePropertiesAndBack (sourceCfg , LdapPasswordVerificator .NAME );
101
89
102
90
createComparator (PREFIX , META ).ignoringMissing ("translationProfile" )
103
91
.ignoringSuperflous ("embeddedTranslationProfile" , "additionalSearch.1.scope" )
@@ -119,11 +107,9 @@ public void serializationIsIdempotentForCompleteNonDefaultConfigUsedTemplateBase
119
107
Properties sourceCfgRet = ConfigurationGenerator .generateCompleteWithNonDefaults (
120
108
PasswordRetrievalProperties .P , PasswordRetrievalProperties .defaults ).get ();
121
109
sourceCfg .putAll (sourceCfgRet );
122
- LdapConfiguration processor = new LdapConfiguration ();
123
- processor .fromProperties (ConfigurationComparator .getAsString (sourceCfg ), LdapPasswordVerificator .NAME ,
124
- msg );
125
- String converted = processor .toProperties (LdapPasswordVerificator .NAME , msg );
126
- Properties result = ConfigurationComparator .fromString (converted , PREFIX ).get ();
110
+
111
+ Properties result = parsePropertiesAndBack (sourceCfg , LdapPasswordVerificator .NAME );
112
+
127
113
createComparator (PREFIX , META )
128
114
.ignoringMissing ("translationProfile" ).checkMatching (result , sourceCfg );
129
115
}
@@ -142,11 +128,8 @@ public void serializationIsIdempotentForCompleteNonDefaultConfigUsedLdapSearchDN
142
128
Properties sourceCfgRet = ConfigurationGenerator .generateCompleteWithNonDefaults (
143
129
PasswordRetrievalProperties .P , PasswordRetrievalProperties .defaults ).get ();
144
130
sourceCfg .putAll (sourceCfgRet );
145
- LdapConfiguration processor = new LdapConfiguration ();
146
- processor .fromProperties (ConfigurationComparator .getAsString (sourceCfg ), LdapPasswordVerificator .NAME ,
147
- msg );
148
- String converted = processor .toProperties (LdapPasswordVerificator .NAME , msg );
149
- Properties result = ConfigurationComparator .fromString (converted , PREFIX ).get ();
131
+
132
+ Properties result = parsePropertiesAndBack (sourceCfg , LdapPasswordVerificator .NAME );
150
133
151
134
createComparator (PREFIX , META )
152
135
.withAlias (PREFIX + "additionalSearch.searchUserDN.filter" , PREFIX + "additionalSearch.1.filter" )
@@ -156,4 +139,14 @@ public void serializationIsIdempotentForCompleteNonDefaultConfigUsedLdapSearchDN
156
139
.withExpectedChange ("userDNSearchKey" , "searchUserDN" )
157
140
.checkMatching (result , sourceCfg );
158
141
}
142
+
143
+ private Properties parsePropertiesAndBack (Properties sourceCfg , String verificatorType )
144
+ {
145
+ LdapConfiguration processor = new LdapConfiguration ();
146
+ processor .fromProperties (ConfigurationComparator .getAsString (sourceCfg ), verificatorType ,
147
+ msg );
148
+ String converted = processor .toProperties (verificatorType , msg );
149
+
150
+ return ConfigurationComparator .fromString (converted , PREFIX ).get ();
151
+ }
159
152
}
0 commit comments