|
18 | 18 | import org.python.core.PyDictionary;
|
19 | 19 | import org.python.core.PyFloat;
|
20 | 20 | import org.python.core.PyInteger;
|
| 21 | +import org.python.core.PyList; |
21 | 22 | import org.python.core.PyLong;
|
22 | 23 | import org.python.core.PyObject;
|
23 | 24 | import org.python.core.PyString;
|
@@ -238,7 +239,223 @@ public void testSecurityConfigModel2() throws Exception {
|
238 | 239 | assertEquals(PyOrderedDict.class, value.getClass(), "topology should be a dict");
|
239 | 240 | PyDictionary dict = (PyDictionary) value;
|
240 | 241 |
|
| 242 | + System.out.println(dict); |
| 243 | + |
241 | 244 | key = new PyString("SecurityConfiguration");
|
| 245 | + assertTrue(dict.has_key(key), "SecurityConfiguration should be present"); |
| 246 | + value = dict.__getitem__(key); |
| 247 | + assertNotNull(value, "SecurityConfiguration value should not be null"); |
| 248 | + assertEquals(PyOrderedDict.class, value.getClass(), "SecurityConfiguration should be a dict"); |
| 249 | + dict = (PyDictionary) value; |
| 250 | + |
| 251 | + key = new PyString("Realm"); |
| 252 | + assertTrue(dict.has_key(key), "Realm should be present"); |
| 253 | + value = dict.__getitem__(key); |
| 254 | + assertNotNull(value, "Realm value should not be null"); |
| 255 | + assertEquals(PyOrderedDict.class, value.getClass(), "Realm should be a dict"); |
| 256 | + dict = (PyDictionary) value; |
| 257 | + |
| 258 | + key = new PyString("myrealm"); |
| 259 | + assertTrue(dict.has_key(key), "myrealm should be present"); |
| 260 | + value = dict.__getitem__(key); |
| 261 | + assertNotNull(value, "myrealm value should not be null"); |
| 262 | + assertEquals(PyOrderedDict.class, value.getClass(), "myrealm should be a dict"); |
| 263 | + PyDictionary myrealm = (PyDictionary) value; |
| 264 | + |
| 265 | + key = new PyString("AuthenticationProvider"); |
| 266 | + assertTrue(myrealm.has_key(key), "AuthenticationProvider should be present"); |
| 267 | + value = myrealm.__getitem__(key); |
| 268 | + assertNotNull(value, "AuthenticationProvider value should not be null"); |
| 269 | + assertEquals(PyOrderedDict.class, value.getClass(), "AuthenticationProvider should be a dict"); |
| 270 | + PyDictionary authenticationProvider = (PyDictionary) value; |
| 271 | + |
| 272 | + key = new PyString("MyIdentityAsserterV2"); |
| 273 | + assertTrue(authenticationProvider.has_key(key), "MyIdentityAsserterV2 should be present"); |
| 274 | + value = authenticationProvider.__getitem__(key); |
| 275 | + assertNotNull(value, "MyIdentityAsserterV2 value should not be null"); |
| 276 | + assertEquals(PyOrderedDict.class, value.getClass(), "MyIdentityAsserterV2 should be a dict"); |
| 277 | + dict = (PyDictionary) value; |
| 278 | + |
| 279 | + key = new PyString("org.asserter.MyIdentityAsserterV2"); |
| 280 | + assertTrue(dict.has_key(key), "org.asserter.MyIdentityAsserterV2 should be present"); |
| 281 | + value = dict.__getitem__(key); |
| 282 | + assertNotNull(value, "org.asserter.MyIdentityAsserterV2 value should not be null"); |
| 283 | + assertEquals(PyOrderedDict.class, value.getClass(), "org.asserter.MyIdentityAsserterV2 should be a dict"); |
| 284 | + dict = (PyDictionary) value; |
| 285 | + |
| 286 | + key = new PyString("ExcludedContextPaths"); |
| 287 | + assertTrue(dict.has_key(key), "ExcludedContextPaths should be present"); |
| 288 | + value = dict.__getitem__(key); |
| 289 | + assertNotNull(value, "ExcludedContextPaths value should not be null"); |
| 290 | + assertEquals(PyList.class, value.getClass(), "ExcludedContextPaths should be a list"); |
| 291 | + PyList list = (PyList) value; |
| 292 | + PyObject listItem = list.__getitem__(0); |
| 293 | + assertNotNull(listItem, "ExcludedContextPaths first element should not be null"); |
| 294 | + assertEquals(PyString.class, listItem.getClass(), "ExcludedContextPaths first element should be a string"); |
| 295 | + assertEquals("/soa-infra", listItem.toString(), "ExcludedContextPaths first element value should be /soa-infra"); |
| 296 | + listItem = list.__getitem__(1); |
| 297 | + assertNotNull(listItem, "ExcludedContextPaths second element should not be null"); |
| 298 | + assertEquals(PyString.class, listItem.getClass(), "ExcludedContextPaths second element should be a string"); |
| 299 | + assertEquals("/management", listItem.toString(), "ExcludedContextPaths second element value should be /management"); |
| 300 | + listItem = list.__getitem__(2); |
| 301 | + assertNotNull(listItem, "ExcludedContextPaths third element should not be null"); |
| 302 | + assertEquals(PyString.class, listItem.getClass(), "ExcludedContextPaths third element should be a string"); |
| 303 | + assertEquals("/jolokia", listItem.toString(), "ExcludedContextPaths third element value should be /jolokia"); |
| 304 | + |
| 305 | + key = new PyString("DefaultAuthenticator"); |
| 306 | + assertTrue(authenticationProvider.has_key(key), "DefaultAuthenticator should be present"); |
| 307 | + value = authenticationProvider.__getitem__(key); |
| 308 | + assertNotNull(value, "DefaultAuthenticator value should not be null"); |
| 309 | + assertEquals(PyOrderedDict.class, value.getClass(), "AuthenticationProvider should be a dict"); |
| 310 | + dict = (PyDictionary) value; |
| 311 | + |
| 312 | + key = new PyString("DefaultAuthenticator"); |
| 313 | + assertTrue(dict.has_key(key), "DefaultAuthenticator should be present"); |
| 314 | + value = dict.__getitem__(key); |
| 315 | + assertNotNull(value, "DefaultAuthenticator value should not be null"); |
| 316 | + assertEquals(PyOrderedDict.class, value.getClass(), "AuthenticationProvider should be a dict"); |
| 317 | + dict = (PyDictionary) value; |
| 318 | + |
| 319 | + key = new PyString("ControlFlag"); |
| 320 | + assertTrue(dict.has_key(key), "ControlFlag should be present"); |
| 321 | + value = dict.__getitem__(key); |
| 322 | + assertNotNull(value, "ControlFlag value should not be null"); |
| 323 | + assertEquals(PyString.class, value.getClass(), "ControlFlag should be a string"); |
| 324 | + assertEquals("REQUIRED", value.toString(), "ControlFlag value should be REQUIRED"); |
| 325 | + |
| 326 | + key = new PyString("DefaultIdentityAsserter"); |
| 327 | + assertTrue(authenticationProvider.has_key(key), "DefaultIdentityAsserter should be present"); |
| 328 | + value = authenticationProvider.__getitem__(key); |
| 329 | + assertNotNull(value, "DefaultIdentityAsserter value should not be null"); |
| 330 | + assertEquals(PyOrderedDict.class, value.getClass(), "DefaultIdentityAsserter should be a dict"); |
| 331 | + dict = (PyDictionary) value; |
| 332 | + |
| 333 | + key = new PyString("DefaultIdentityAsserter"); |
| 334 | + assertTrue(dict.has_key(key), "DefaultIdentityAsserter should be present"); |
| 335 | + value = dict.__getitem__(key); |
| 336 | + assertNotNull(value, "DefaultIdentityAsserter value should not be null"); |
| 337 | + assertEquals(PyOrderedDict.class, value.getClass(), "DefaultIdentityAsserter should be a dict"); |
| 338 | + dict = (PyDictionary) value; |
| 339 | + |
| 340 | + key = new PyString("DefaultUserNameMapperAttributeType"); |
| 341 | + assertTrue(dict.has_key(key), "DefaultUserNameMapperAttributeType should be present"); |
| 342 | + value = dict.__getitem__(key); |
| 343 | + assertNotNull(value, "DefaultUserNameMapperAttributeType value should not be null"); |
| 344 | + assertEquals(PyString.class, value.getClass(), "DefaultUserNameMapperAttributeType should be a string"); |
| 345 | + assertEquals("CN", value.toString(), "DefaultUserNameMapperAttributeType value should be CN"); |
| 346 | + |
| 347 | + key = new PyString("ActiveType"); |
| 348 | + assertTrue(dict.has_key(key), "ActiveType should be present"); |
| 349 | + value = dict.__getitem__(key); |
| 350 | + assertNotNull(value, "ActiveType value should not be null"); |
| 351 | + assertEquals(PyList.class, value.getClass(), "ActiveType should be a list"); |
| 352 | + list = (PyList) value; |
| 353 | + listItem = list.__getitem__(0); |
| 354 | + assertNotNull(listItem, "ActiveType first element should not be null"); |
| 355 | + assertEquals(PyString.class, listItem.getClass(), "ActiveType first element should be a string"); |
| 356 | + assertEquals("AuthenticatedUser", listItem.toString(), "ActiveType first element value should be AuthenticatedUser"); |
| 357 | + listItem = list.__getitem__(1); |
| 358 | + assertNotNull(listItem, "ActiveType second element should not be null"); |
| 359 | + assertEquals(PyString.class, listItem.getClass(), "ActiveType second element should be a string"); |
| 360 | + assertEquals("X.509", listItem.toString(), "ActiveType second element value should be X.509"); |
| 361 | + |
| 362 | + key = new PyString("DefaultUserNameMapperAttributeDelimiter"); |
| 363 | + assertTrue(dict.has_key(key), "DefaultUserNameMapperAttributeDelimiter should be present"); |
| 364 | + value = dict.__getitem__(key); |
| 365 | + assertNotNull(value, "DefaultUserNameMapperAttributeDelimiter value should not be null"); |
| 366 | + assertEquals(PyString.class, value.getClass(), "DefaultUserNameMapperAttributeDelimiter should be a string"); |
| 367 | + assertEquals(",", value.toString(), "DefaultUserNameMapperAttributeDelimiter value should be ,"); |
| 368 | + |
| 369 | + key = new PyString("UseDefaultUserNameMapper"); |
| 370 | + assertTrue(dict.has_key(key), "UseDefaultUserNameMapper should be present"); |
| 371 | + value = dict.__getitem__(key); |
| 372 | + assertNotNull(value, "UseDefaultUserNameMapper value should not be null"); |
| 373 | + assertEquals(PyString.class, value.getClass(), "UseDefaultUserNameMapper should be a string"); |
| 374 | + assertEquals("true", value.toString(), "UseDefaultUserNameMapper value should be true"); |
| 375 | + |
| 376 | + key = new PyString("PasswordValidator"); |
| 377 | + assertTrue(myrealm.has_key(key), "PasswordValidator should be present"); |
| 378 | + value = myrealm.__getitem__(key); |
| 379 | + assertNotNull(value, "PasswordValidator value should not be null"); |
| 380 | + assertEquals(PyOrderedDict.class, value.getClass(), "PasswordValidator should be a dict"); |
| 381 | + dict = (PyDictionary) value; |
| 382 | + |
| 383 | + key = new PyString("SystemPasswordValidator"); |
| 384 | + assertTrue(dict.has_key(key), "SystemPasswordValidator should be present"); |
| 385 | + value = dict.__getitem__(key); |
| 386 | + assertNotNull(value, "SystemPasswordValidator value should not be null"); |
| 387 | + assertEquals(PyOrderedDict.class, value.getClass(), "SystemPasswordValidator should be a dict"); |
| 388 | + dict = (PyDictionary) value; |
| 389 | + |
| 390 | + key = new PyString("SystemPasswordValidator"); |
| 391 | + assertTrue(dict.has_key(key), "SystemPasswordValidator should be present"); |
| 392 | + value = dict.__getitem__(key); |
| 393 | + assertNotNull(value, "SystemPasswordValidator value should not be null"); |
| 394 | + assertEquals(PyOrderedDict.class, value.getClass(), "SystemPasswordValidator should be a dict"); |
| 395 | + dict = (PyDictionary) value; |
| 396 | + |
| 397 | + key = new PyString("MinAlphabeticCharacters"); |
| 398 | + assertTrue(dict.has_key(key), "MinAlphabeticCharacters should be present"); |
| 399 | + value = dict.__getitem__(key); |
| 400 | + assertNotNull(value, "MinAlphabeticCharacters value should not be null"); |
| 401 | + assertEquals(PyInteger.class, value.getClass(), "MinAlphabeticCharacters should be an integer"); |
| 402 | + assertEquals("1", value.toString(), "MinAlphabeticCharacters value should be 1"); |
| 403 | + |
| 404 | + key = new PyString("MinLowercaseCharacters"); |
| 405 | + assertTrue(dict.has_key(key), "MinLowercaseCharacters should be present"); |
| 406 | + value = dict.__getitem__(key); |
| 407 | + assertNotNull(value, "MinLowercaseCharacters value should not be null"); |
| 408 | + assertEquals(PyInteger.class, value.getClass(), "MinLowercaseCharacters should be an integer"); |
| 409 | + assertEquals("1", value.toString(), "MinLowercaseCharacters value should be 1"); |
| 410 | + |
| 411 | + key = new PyString("MinNumericCharacters"); |
| 412 | + assertTrue(dict.has_key(key), "MinNumericCharacters should be present"); |
| 413 | + value = dict.__getitem__(key); |
| 414 | + assertNotNull(value, "MinNumericCharacters value should not be null"); |
| 415 | + assertEquals(PyInteger.class, value.getClass(), "MinNumericCharacters should be an integer"); |
| 416 | + assertEquals("1", value.toString(), "MinNumericCharacters value should be 1"); |
| 417 | + |
| 418 | + key = new PyString("MaxConsecutiveCharacters"); |
| 419 | + assertTrue(dict.has_key(key), "MaxConsecutiveCharacters should be present"); |
| 420 | + value = dict.__getitem__(key); |
| 421 | + assertNotNull(value, "MaxConsecutiveCharacters value should not be null"); |
| 422 | + assertEquals(PyInteger.class, value.getClass(), "MaxConsecutiveCharacters should be an integer"); |
| 423 | + assertEquals("2", value.toString(), "MaxConsecutiveCharacters value should be 2"); |
| 424 | + |
| 425 | + key = new PyString("MinNonAlphanumericCharacters"); |
| 426 | + assertTrue(dict.has_key(key), "MinNonAlphanumericCharacters should be present"); |
| 427 | + value = dict.__getitem__(key); |
| 428 | + assertNotNull(value, "MinNonAlphanumericCharacters value should not be null"); |
| 429 | + assertEquals(PyInteger.class, value.getClass(), "MinNonAlphanumericCharacters should be an integer"); |
| 430 | + assertEquals("1", value.toString(), "MinNonAlphanumericCharacters value should be 1"); |
| 431 | + |
| 432 | + key = new PyString("MinUppercaseCharacters"); |
| 433 | + assertTrue(dict.has_key(key), "MinUppercaseCharacters should be present"); |
| 434 | + value = dict.__getitem__(key); |
| 435 | + assertNotNull(value, "MinUppercaseCharacters value should not be null"); |
| 436 | + assertEquals(PyInteger.class, value.getClass(), "MinUppercaseCharacters should be an integer"); |
| 437 | + assertEquals("1", value.toString(), "MinUppercaseCharacters value should be 1"); |
| 438 | + |
| 439 | + key = new PyString("RejectEqualOrContainUsername"); |
| 440 | + assertTrue(dict.has_key(key), "RejectEqualOrContainUsername should be present"); |
| 441 | + value = dict.__getitem__(key); |
| 442 | + assertNotNull(value, "RejectEqualOrContainUsername value should not be null"); |
| 443 | + assertEquals(PyString.class, value.getClass(), "RejectEqualOrContainUsername should be a string"); |
| 444 | + assertEquals("true", value.toString(), "RejectEqualOrContainUsername value should be true"); |
| 445 | + |
| 446 | + key = new PyString("MinPasswordLength"); |
| 447 | + assertTrue(dict.has_key(key), "MinPasswordLength should be present"); |
| 448 | + value = dict.__getitem__(key); |
| 449 | + assertNotNull(value, "MinPasswordLength value should not be null"); |
| 450 | + assertEquals(PyInteger.class, value.getClass(), "MinPasswordLength should be an integer"); |
| 451 | + assertEquals("10", value.toString(), "MinPasswordLength value should be 10"); |
| 452 | + |
| 453 | + key = new PyString("RejectEqualOrContainReverseUsername"); |
| 454 | + assertTrue(dict.has_key(key), "RejectEqualOrContainReverseUsername should be present"); |
| 455 | + value = dict.__getitem__(key); |
| 456 | + assertNotNull(value, "RejectEqualOrContainReverseUsername value should not be null"); |
| 457 | + assertEquals(PyString.class, value.getClass(), "RejectEqualOrContainReverseUsername should be a string"); |
| 458 | + assertEquals("true", value.toString(), "RejectEqualOrContainReverseUsername value should be true"); |
242 | 459 | }
|
243 | 460 |
|
244 | 461 | /**
|
|
0 commit comments