@@ -66,47 +66,6 @@ void testCustomSslContext() throws NoSuchAlgorithmException, SSLException {
6666 Assertions .assertThat (clientConfig1 .getGrpcSslContext ()).isNotNull ();
6767 }
6868
69- @ EnabledIfEnvironmentVariable (named = "TESTING_INFLUXDB_URL" , matches = ".*" )
70- @ EnabledIfEnvironmentVariable (named = "TESTING_INFLUXDB_TOKEN" , matches = ".*" )
71- @ EnabledIfEnvironmentVariable (named = "TESTING_INFLUXDB_DATABASE" , matches = ".*" )
72- @ Test
73- void testQueryProxy () throws Exception {
74- URI queryProxyUri = new URI ("http://127.0.0.1:10000" );
75- URI uri = new URI (System .getenv ("TESTING_INFLUXDB_URL" ));
76-
77- ProxyDetector proxyDetector = (targetServerAddress ) -> {
78- InetSocketAddress targetAddress = (InetSocketAddress ) targetServerAddress ;
79- if (uri .getHost ().equals (targetAddress .getHostString ())) {
80- return HttpConnectProxiedSocketAddress .newBuilder ()
81- .setProxyAddress (new InetSocketAddress (queryProxyUri .getHost (), queryProxyUri .getPort ()))
82- .setTargetAddress (targetAddress )
83- .build ();
84- }
85- return null ;
86- };
87- ProxySelector proxy = ProxySelector .of (new InetSocketAddress (queryProxyUri .getHost (), queryProxyUri .getPort ()));
88- ClientConfig clientConfig = new ClientConfig .Builder ()
89- .host (uri .toString ())
90- .token (System .getenv ("TESTING_INFLUXDB_TOKEN" ).toCharArray ())
91- .database (System .getenv ("TESTING_INFLUXDB_DATABASE" ))
92- .proxy (proxy )
93- .queryApiProxy (proxyDetector )
94- .build ();
95-
96- InfluxDBClient influxDBClient = InfluxDBClient .getInstance (clientConfig );
97- influxDBClient .writePoint (
98- Point .measurement ("test1" )
99- .setField ("field" , "field1" )
100- );
101-
102- try (Stream <PointValues > stream = influxDBClient .queryPoints ("SELECT * FROM test1" )) {
103- stream .findFirst ()
104- .ifPresent (pointValues -> {
105- Assertions .assertThat (pointValues .getField ("field" )).isEqualTo ("field1" );
106- });
107- }
108- }
109-
11069 @ Test
11170 void requiredHost () {
11271
0 commit comments