1616import net .ravendb .client .serverwide .ConnectionStringType ;
1717import net .ravendb .client .documents .operations .etl .RavenConnectionString ;
1818import org .junit .jupiter .api .Test ;
19+ import java .lang .reflect .InvocationTargetException ;
20+ import java .lang .reflect .Method ;
1921import java .util .EnumSet ;
2022import java .util .List ;
2123
@@ -633,36 +635,45 @@ public void isEqualReturnsFalseForDifferentNames() {
633635
634636 @ EnableOnServer (thresholdVersion = "7.1" )
635637 @ Test
636- public void usingEncryptedCommunicationChannelDetectsHttps () {
638+ public void usingEncryptedCommunicationChannelDetectsHttps () throws NoSuchMethodException , InvocationTargetException , IllegalAccessException {
637639 OpenAiSettings openAiSettings = new OpenAiSettings ();
638640 openAiSettings .setApiKey ("key" );
639641 openAiSettings .setEndpoint ("https://api.openai.com/" );
640642 openAiSettings .setModel ("model" );
641643
642644 AiConnectionString cs1 = new AiConnectionString ();
643645 cs1 .setOpenAiSettings (openAiSettings );
644- assertThat (cs1 .usingEncryptedCommunicationChannel ()).isTrue ();
646+ Method method = AiConnectionString .class .getDeclaredMethod ("usingEncryptedCommunicationChannel" );
647+ method .setAccessible (true );
648+ boolean result = (boolean ) method .invoke (cs1 );
649+ assertThat (result ).isTrue ();
645650
646651 OllamaSettings ollamaSettings1 = new OllamaSettings ();
647652 ollamaSettings1 .setUri ("http://localhost:11434" );
648653 ollamaSettings1 .setModel ("llama2" );
649654
650655 AiConnectionString cs2 = new AiConnectionString ();
651656 cs2 .setOllamaSettings (ollamaSettings1 );
652- assertThat (cs2 .usingEncryptedCommunicationChannel ()).isFalse ();
657+ Method method2 = AiConnectionString .class .getDeclaredMethod ("usingEncryptedCommunicationChannel" );
658+ method2 .setAccessible (true );
659+ boolean result2 = (boolean ) method .invoke (cs2 );
660+ assertThat (result2 ).isFalse ();
653661
654662 OllamaSettings ollamaSettings2 = new OllamaSettings ();
655663 ollamaSettings2 .setUri ("https://secure-ollama.com" );
656664 ollamaSettings2 .setModel ("llama2" );
657665
658666 AiConnectionString cs3 = new AiConnectionString ();
659667 cs3 .setOllamaSettings (ollamaSettings2 );
660- assertThat (cs3 .usingEncryptedCommunicationChannel ()).isTrue ();
668+ Method method3 = AiConnectionString .class .getDeclaredMethod ("usingEncryptedCommunicationChannel" );
669+ method3 .setAccessible (true );
670+ boolean result3 = (boolean ) method .invoke (cs3 );
671+ assertThat (result3 ).isTrue ();
661672 }
662673
663674 @ EnableOnServer (thresholdVersion = "7.1" )
664675 @ Test
665- public void getQueryEmbeddingsMaxConcurrentBatchesUsesProviderValue () {
676+ public void getQueryEmbeddingsMaxConcurrentBatchesUsesProviderValue () throws NoSuchMethodException , InvocationTargetException , IllegalAccessException {
666677 OpenAiSettings settings = new OpenAiSettings ();
667678 settings .setApiKey ("key" );
668679 settings .setEndpoint ("https://api.openai.com/" );
@@ -671,13 +682,15 @@ public void getQueryEmbeddingsMaxConcurrentBatchesUsesProviderValue() {
671682
672683 AiConnectionString cs = new AiConnectionString ();
673684 cs .setOpenAiSettings (settings );
674-
675- assertThat (cs .getQueryEmbeddingsMaxConcurrentBatches (10 )).isEqualTo (5 );
685+ Method method = AiConnectionString .class .getDeclaredMethod ("getQueryEmbeddingsMaxConcurrentBatches" , int .class );
686+ method .setAccessible (true );
687+ int result = (int ) method .invoke (cs , 10 );
688+ assertThat (result ).isEqualTo (5 );
676689 }
677690
678691 @ EnableOnServer (thresholdVersion = "7.1" )
679692 @ Test
680- public void getQueryEmbeddingsMaxConcurrentBatchesUsesGlobalValueWhenNotSet () {
693+ public void getQueryEmbeddingsMaxConcurrentBatchesUsesGlobalValueWhenNotSet () throws NoSuchMethodException , InvocationTargetException , IllegalAccessException {
681694 OpenAiSettings settings = new OpenAiSettings ();
682695 settings .setApiKey ("key" );
683696 settings .setEndpoint ("https://api.openai.com/" );
@@ -686,7 +699,10 @@ public void getQueryEmbeddingsMaxConcurrentBatchesUsesGlobalValueWhenNotSet() {
686699 cs .setOpenAiSettings (settings );
687700
688701 int fallbackValue = 10 ;
689- assertThat (cs .getQueryEmbeddingsMaxConcurrentBatches (fallbackValue )).isEqualTo (10 );
702+ Method method = AiConnectionString .class .getDeclaredMethod ("getQueryEmbeddingsMaxConcurrentBatches" );
703+ method .setAccessible (true );
704+ int result = (int ) method .invoke (cs , fallbackValue );
705+ assertThat (result ).isEqualTo (10 );
690706 }
691707
692708 @ EnableOnServer (thresholdVersion = "7.1" )
0 commit comments