@@ -433,70 +433,46 @@ public void testFromMapConfigurationWithList() {
433433
434434 @ Test
435435 public void testUrlOptionNormalizeAddsDefaultScheme () {
436- Map < String , Object > map = new HashMap <> ();
437- map . put ("restserver.url" , "127.0.0.1:8080" );
438- map . put ("gremlinserver.url" , "127.0.0.1:8182" );
439- map . put ("server.urls_to_pd" , "0.0.0.0:8080" );
440- map . put ("server.k8s_url" , "127.0.0.1:8888" );
436+ PropertiesConfiguration conf = new PropertiesConfiguration ();
437+ conf . setProperty ("restserver.url" , "127.0.0.1:8080" );
438+ conf . setProperty ("gremlinserver.url" , "127.0.0.1:8182" );
439+ conf . setProperty ("server.urls_to_pd" , "0.0.0.0:8080" );
440+ conf . setProperty ("server.k8s_url" , "127.0.0.1:8888" );
441441
442- HugeConfig config = new HugeConfig (map );
442+ HugeConfig config = new HugeConfig (conf );
443443
444444 Assert .assertEquals ("http://127.0.0.1:8080" ,
445445 config .get (UrlOptions .restUrl ));
446446 Assert .assertEquals ("http://127.0.0.1:8182" ,
447447 config .get (UrlOptions .gremlinUrl ));
448448 Assert .assertEquals ("http://0.0.0.0:8080" ,
449449 config .get (UrlOptions .urlsToPd ));
450-
451- // critical corner case: must NOT downgrade to http
452450 Assert .assertEquals ("https://127.0.0.1:8888" ,
453451 config .get (UrlOptions .k8sUrl ));
454452 }
455453
456- @ Test
457- public void testUrlOptionNormalizeKeepsExistingScheme () {
458- Map <String , Object > map = new HashMap <>();
459- map .put ("restserver.url" , "https://127.0.0.1:8080" );
460- map .put ("gremlinserver.url" , "http://127.0.0.1:8182" );
461- map .put ("server.k8s_url" , "http://127.0.0.1:8888" );
462-
463- HugeConfig config = new HugeConfig (map );
464-
465- Assert .assertEquals ("https://127.0.0.1:8080" ,
466- config .get (UrlOptions .restUrl ));
467- Assert .assertEquals ("http://127.0.0.1:8182" ,
468- config .get (UrlOptions .gremlinUrl ));
469- Assert .assertEquals ("http://127.0.0.1:8888" ,
470- config .get (UrlOptions .k8sUrl ));
471- }
472-
473454 @ Test
474455 public void testUrlNormalizationEdgeCases () {
475- Map <String , Object > map = new HashMap <>();
476-
477456 // Whitespace handling
478- map .put ("restserver.url" , " 127.0.0.1:8080 " );
479- HugeConfig config = new HugeConfig (map );
457+ PropertiesConfiguration conf = new PropertiesConfiguration ();
458+ conf .setProperty ("restserver.url" , " 127.0.0.1:8080 " );
459+ HugeConfig config = new HugeConfig (conf );
480460 Assert .assertEquals ("http://127.0.0.1:8080" ,
481461 config .get (UrlOptions .restUrl ));
482462
483- // Mixed case scheme preservation
484- map .put ("restserver.url" , "HTTP://127.0.0.1:8080" );
485- config = new HugeConfig (map );
486- Assert .assertEquals ("http://127.0.0.1:8080" ,
463+ // Mixed case scheme preservation (lowercase "http://" is kept as-is)
464+ conf = new PropertiesConfiguration ();
465+ conf .setProperty ("restserver.url" , "HTTP://127.0.0.1:8080" );
466+ config = new HugeConfig (conf );
467+ Assert .assertEquals ("HTTP://127.0.0.1:8080" ,
487468 config .get (UrlOptions .restUrl ));
488469
489470 // IPv6
490- map .put ("restserver.url" , "[::1]:8080" );
491- config = new HugeConfig (map );
471+ conf = new PropertiesConfiguration ();
472+ conf .setProperty ("restserver.url" , "[::1]:8080" );
473+ config = new HugeConfig (conf );
492474 Assert .assertEquals ("http://[::1]:8080" ,
493475 config .get (UrlOptions .restUrl ));
494-
495- // 5. Malformed URLs
496- map .put ("restserver.url" , "://invalid" );
497- config = new HugeConfig (map );
498- Assert .assertEquals ("http://://invalid" ,
499- config .get (UrlOptions .restUrl ));
500476 }
501477
502478 public static class TestOptions extends OptionHolder {
0 commit comments