github-advanced-security[bot] commented on code in PR #19917:
URL: https://github.com/apache/druid/pull/19917#discussion_r3735987498
##########
extensions-contrib/influxdb-emitter/src/test/java/org/apache/druid/emitter/influxdb/InfluxdbEmitterConfigTest.java:
##########
@@ -163,47 +167,51 @@
"password",
null
);
-
Assert.assertFalse(influxdbEmitterConfig.equals(influxdbEmitterConfigComparison));
+
Assertions.assertFalse(influxdbEmitterConfig.equals(influxdbEmitterConfigComparison));
}
- @Test(expected = NullPointerException.class)
+ @Test
public void testConfigWithNullInfluxdbUserName()
{
- InfluxdbEmitterConfig influxdbEmitterConfigWithNullHostname = new
InfluxdbEmitterConfig(
- "localhost",
- 8086,
- null,
- null,
- null,
- null,
- "dbname",
- 10000,
- 15000,
- 30000,
- null,
- "password",
- null
- );
+ assertThrows(NullPointerException.class, () -> {
+ InfluxdbEmitterConfig influxdbEmitterConfigWithNullHostname = new
InfluxdbEmitterConfig(
+ "localhost",
+ 8086,
+ null,
+ null,
+ null,
+ null,
+ "dbname",
+ 10000,
+ 15000,
+ 30000,
+ null,
+ "password",
+ null
+ );
+ });
}
- @Test(expected = NullPointerException.class)
+ @Test
public void testConfigWithNullInfluxdbPassword()
{
- InfluxdbEmitterConfig influxdbEmitterConfigWithNullHostname = new
InfluxdbEmitterConfig(
- "localhost",
- 8086,
- null,
- null,
- null,
- null,
- "dbname",
- 10000,
- 15000,
- 30000,
- "adam",
- null,
- null
- );
+ assertThrows(NullPointerException.class, () -> {
+ InfluxdbEmitterConfig influxdbEmitterConfigWithNullHostname = new
InfluxdbEmitterConfig(
+ "localhost",
+ 8086,
+ null,
+ null,
+ null,
+ null,
+ "dbname",
+ 10000,
+ 15000,
+ 30000,
+ "adam",
+ null,
+ null
+ );
Review Comment:
## CodeQL / Unread local variable
Variable 'InfluxdbEmitterConfig influxdbEmitterConfigWithNullHostname' is
never read.
[Show more
details](https://github.com/apache/druid/security/code-scanning/11682)
##########
extensions-contrib/influxdb-emitter/src/test/java/org/apache/druid/emitter/influxdb/InfluxdbEmitterConfigTest.java:
##########
@@ -79,27 +81,29 @@
"password",
null
);
- Assert.assertNotEquals(influxdbEmitterConfig,
influxdbEmitterConfigComparison);
+ Assertions.assertNotEquals(influxdbEmitterConfig,
influxdbEmitterConfigComparison);
}
- @Test(expected = NullPointerException.class)
+ @Test
public void testConfigWithNullHostname()
{
- InfluxdbEmitterConfig influxdbEmitterConfigWithNullHostname = new
InfluxdbEmitterConfig(
- null,
- 8080,
- null,
- null,
- null,
- null,
- "dbname",
- 10000,
- 15000,
- 30000,
- "adam",
- "password",
- null
- );
+ assertThrows(NullPointerException.class, () -> {
+ InfluxdbEmitterConfig influxdbEmitterConfigWithNullHostname = new
InfluxdbEmitterConfig(
+ null,
+ 8080,
+ null,
+ null,
+ null,
+ null,
+ "dbname",
+ 10000,
+ 15000,
+ 30000,
+ "adam",
+ "password",
+ null
+ );
Review Comment:
## CodeQL / Unread local variable
Variable 'InfluxdbEmitterConfig influxdbEmitterConfigWithNullHostname' is
never read.
[Show more
details](https://github.com/apache/druid/security/code-scanning/11680)
##########
extensions-contrib/influxdb-emitter/src/test/java/org/apache/druid/emitter/influxdb/InfluxdbEmitterTest.java:
##########
@@ -219,97 +221,105 @@
String expected =
"druid_metric,service=druid/historical,hostname=localhost,dataSource=wikipedia,taskType=index
druid_time=1234 1509357600000000000"
+ "\n";
String actual = influxdbEmitter.transformForInfluxSystems(event);
- Assert.assertEquals(expected, actual);
+ Assertions.assertEquals(expected, actual);
}
@Test
public void testJacksonModules()
{
- Assert.assertTrue(new
InfluxdbEmitterModule().getJacksonModules().isEmpty());
+ Assertions.assertTrue(new
InfluxdbEmitterModule().getJacksonModules().isEmpty());
}
- @Test(expected = IllegalStateException.class)
+ @Test
public void testBuildInfluxdbClientWithHttpsProtocolAndNoTrustStore()
{
- InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
- "localhost",
- 8086,
- "https",
- null,
- null,
- null,
- "dbname",
- 10000,
- 15000,
- 30000,
- "adam",
- "password",
- null
- );
- InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+ assertThrows(IllegalStateException.class, () -> {
+ InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
+ "localhost",
+ 8086,
+ "https",
+ null,
+ null,
+ null,
+ "dbname",
+ 10000,
+ 15000,
+ 30000,
+ "adam",
+ "password",
+ null
+ );
+ InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
Review Comment:
## CodeQL / Unread local variable
Variable 'InfluxdbEmitter influxdbEmitter' is never read.
[Show more
details](https://github.com/apache/druid/security/code-scanning/11683)
##########
extensions-contrib/influxdb-emitter/src/test/java/org/apache/druid/emitter/influxdb/InfluxdbEmitterTest.java:
##########
@@ -219,97 +221,105 @@
String expected =
"druid_metric,service=druid/historical,hostname=localhost,dataSource=wikipedia,taskType=index
druid_time=1234 1509357600000000000"
+ "\n";
String actual = influxdbEmitter.transformForInfluxSystems(event);
- Assert.assertEquals(expected, actual);
+ Assertions.assertEquals(expected, actual);
}
@Test
public void testJacksonModules()
{
- Assert.assertTrue(new
InfluxdbEmitterModule().getJacksonModules().isEmpty());
+ Assertions.assertTrue(new
InfluxdbEmitterModule().getJacksonModules().isEmpty());
}
- @Test(expected = IllegalStateException.class)
+ @Test
public void testBuildInfluxdbClientWithHttpsProtocolAndNoTrustStore()
{
- InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
- "localhost",
- 8086,
- "https",
- null,
- null,
- null,
- "dbname",
- 10000,
- 15000,
- 30000,
- "adam",
- "password",
- null
- );
- InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+ assertThrows(IllegalStateException.class, () -> {
+ InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
+ "localhost",
+ 8086,
+ "https",
+ null,
+ null,
+ null,
+ "dbname",
+ 10000,
+ 15000,
+ 30000,
+ "adam",
+ "password",
+ null
+ );
+ InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+ });
}
- @Test(expected = IllegalStateException.class)
+ @Test
public void testBuildInfluxdbClientWithHttpsProtocolAndNullTrustStorePath()
{
- InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
- "localhost",
- 8086,
- "https",
- null,
- null,
- "pass",
- "dbname",
- 10000,
- 15000,
- 30000,
- "adam",
- "password",
- null
- );
- InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+ assertThrows(IllegalStateException.class, () -> {
+ InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
+ "localhost",
+ 8086,
+ "https",
+ null,
+ null,
+ "pass",
+ "dbname",
+ 10000,
+ 15000,
+ 30000,
+ "adam",
+ "password",
+ null
+ );
+ InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+ });
}
- @Test(expected = IllegalStateException.class)
+ @Test
public void
testBuildInfluxdbClientWithHttpsProtocolAndNullTrustStorePassword()
{
- InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
- "localhost",
- 8086,
- "https",
- "path",
- null,
- null,
- "dbname",
- 10000,
- 15000,
- 30000,
- "adam",
- "password",
- null
- );
- InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+ assertThrows(IllegalStateException.class, () -> {
+ InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
+ "localhost",
+ 8086,
+ "https",
+ "path",
+ null,
+ null,
+ "dbname",
+ 10000,
+ 15000,
+ 30000,
+ "adam",
+ "password",
+ null
+ );
+ InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+ });
}
- @Test(expected = IllegalStateException.class)
+ @Test
public void testUnableToLoadTrustStore()
{
- InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
- "localhost",
- 8086,
- "https",
- "path",
- null,
- "pass",
- "dbname",
- 10000,
- 15000,
- 30000,
- "adam",
- "password",
- null
- );
- InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+ assertThrows(IllegalStateException.class, () -> {
+ InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
+ "localhost",
+ 8086,
+ "https",
+ "path",
+ null,
+ "pass",
+ "dbname",
+ 10000,
+ 15000,
+ 30000,
+ "adam",
+ "password",
+ null
+ );
+ InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
Review Comment:
## CodeQL / Unread local variable
Variable 'InfluxdbEmitter influxdbEmitter' is never read.
[Show more
details](https://github.com/apache/druid/security/code-scanning/11686)
##########
extensions-contrib/influxdb-emitter/src/test/java/org/apache/druid/emitter/influxdb/InfluxdbEmitterTest.java:
##########
@@ -219,97 +221,105 @@
String expected =
"druid_metric,service=druid/historical,hostname=localhost,dataSource=wikipedia,taskType=index
druid_time=1234 1509357600000000000"
+ "\n";
String actual = influxdbEmitter.transformForInfluxSystems(event);
- Assert.assertEquals(expected, actual);
+ Assertions.assertEquals(expected, actual);
}
@Test
public void testJacksonModules()
{
- Assert.assertTrue(new
InfluxdbEmitterModule().getJacksonModules().isEmpty());
+ Assertions.assertTrue(new
InfluxdbEmitterModule().getJacksonModules().isEmpty());
}
- @Test(expected = IllegalStateException.class)
+ @Test
public void testBuildInfluxdbClientWithHttpsProtocolAndNoTrustStore()
{
- InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
- "localhost",
- 8086,
- "https",
- null,
- null,
- null,
- "dbname",
- 10000,
- 15000,
- 30000,
- "adam",
- "password",
- null
- );
- InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+ assertThrows(IllegalStateException.class, () -> {
+ InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
+ "localhost",
+ 8086,
+ "https",
+ null,
+ null,
+ null,
+ "dbname",
+ 10000,
+ 15000,
+ 30000,
+ "adam",
+ "password",
+ null
+ );
+ InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+ });
}
- @Test(expected = IllegalStateException.class)
+ @Test
public void testBuildInfluxdbClientWithHttpsProtocolAndNullTrustStorePath()
{
- InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
- "localhost",
- 8086,
- "https",
- null,
- null,
- "pass",
- "dbname",
- 10000,
- 15000,
- 30000,
- "adam",
- "password",
- null
- );
- InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+ assertThrows(IllegalStateException.class, () -> {
+ InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
+ "localhost",
+ 8086,
+ "https",
+ null,
+ null,
+ "pass",
+ "dbname",
+ 10000,
+ 15000,
+ 30000,
+ "adam",
+ "password",
+ null
+ );
+ InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+ });
}
- @Test(expected = IllegalStateException.class)
+ @Test
public void
testBuildInfluxdbClientWithHttpsProtocolAndNullTrustStorePassword()
{
- InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
- "localhost",
- 8086,
- "https",
- "path",
- null,
- null,
- "dbname",
- 10000,
- 15000,
- 30000,
- "adam",
- "password",
- null
- );
- InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+ assertThrows(IllegalStateException.class, () -> {
+ InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
+ "localhost",
+ 8086,
+ "https",
+ "path",
+ null,
+ null,
+ "dbname",
+ 10000,
+ 15000,
+ 30000,
+ "adam",
+ "password",
+ null
+ );
+ InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
Review Comment:
## CodeQL / Unread local variable
Variable 'InfluxdbEmitter influxdbEmitter' is never read.
[Show more
details](https://github.com/apache/druid/security/code-scanning/11685)
##########
extensions-contrib/influxdb-emitter/src/test/java/org/apache/druid/emitter/influxdb/InfluxdbEmitterTest.java:
##########
@@ -219,97 +221,105 @@
String expected =
"druid_metric,service=druid/historical,hostname=localhost,dataSource=wikipedia,taskType=index
druid_time=1234 1509357600000000000"
+ "\n";
String actual = influxdbEmitter.transformForInfluxSystems(event);
- Assert.assertEquals(expected, actual);
+ Assertions.assertEquals(expected, actual);
}
@Test
public void testJacksonModules()
{
- Assert.assertTrue(new
InfluxdbEmitterModule().getJacksonModules().isEmpty());
+ Assertions.assertTrue(new
InfluxdbEmitterModule().getJacksonModules().isEmpty());
}
- @Test(expected = IllegalStateException.class)
+ @Test
public void testBuildInfluxdbClientWithHttpsProtocolAndNoTrustStore()
{
- InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
- "localhost",
- 8086,
- "https",
- null,
- null,
- null,
- "dbname",
- 10000,
- 15000,
- 30000,
- "adam",
- "password",
- null
- );
- InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+ assertThrows(IllegalStateException.class, () -> {
+ InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
+ "localhost",
+ 8086,
+ "https",
+ null,
+ null,
+ null,
+ "dbname",
+ 10000,
+ 15000,
+ 30000,
+ "adam",
+ "password",
+ null
+ );
+ InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+ });
}
- @Test(expected = IllegalStateException.class)
+ @Test
public void testBuildInfluxdbClientWithHttpsProtocolAndNullTrustStorePath()
{
- InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
- "localhost",
- 8086,
- "https",
- null,
- null,
- "pass",
- "dbname",
- 10000,
- 15000,
- 30000,
- "adam",
- "password",
- null
- );
- InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
+ assertThrows(IllegalStateException.class, () -> {
+ InfluxdbEmitterConfig config = new InfluxdbEmitterConfig(
+ "localhost",
+ 8086,
+ "https",
+ null,
+ null,
+ "pass",
+ "dbname",
+ 10000,
+ 15000,
+ 30000,
+ "adam",
+ "password",
+ null
+ );
+ InfluxdbEmitter influxdbEmitter = new InfluxdbEmitter(config);
Review Comment:
## CodeQL / Unread local variable
Variable 'InfluxdbEmitter influxdbEmitter' is never read.
[Show more
details](https://github.com/apache/druid/security/code-scanning/11684)
##########
extensions-contrib/influxdb-emitter/src/test/java/org/apache/druid/emitter/influxdb/InfluxdbEmitterConfigTest.java:
##########
@@ -163,47 +167,51 @@
"password",
null
);
-
Assert.assertFalse(influxdbEmitterConfig.equals(influxdbEmitterConfigComparison));
+
Assertions.assertFalse(influxdbEmitterConfig.equals(influxdbEmitterConfigComparison));
}
- @Test(expected = NullPointerException.class)
+ @Test
public void testConfigWithNullInfluxdbUserName()
{
- InfluxdbEmitterConfig influxdbEmitterConfigWithNullHostname = new
InfluxdbEmitterConfig(
- "localhost",
- 8086,
- null,
- null,
- null,
- null,
- "dbname",
- 10000,
- 15000,
- 30000,
- null,
- "password",
- null
- );
+ assertThrows(NullPointerException.class, () -> {
+ InfluxdbEmitterConfig influxdbEmitterConfigWithNullHostname = new
InfluxdbEmitterConfig(
+ "localhost",
+ 8086,
+ null,
+ null,
+ null,
+ null,
+ "dbname",
+ 10000,
+ 15000,
+ 30000,
+ null,
+ "password",
+ null
+ );
Review Comment:
## CodeQL / Unread local variable
Variable 'InfluxdbEmitterConfig influxdbEmitterConfigWithNullHostname' is
never read.
[Show more
details](https://github.com/apache/druid/security/code-scanning/11681)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]