FrankChen021 commented on code in PR #19822:
URL: https://github.com/apache/druid/pull/19822#discussion_r3686802613
##########
extensions-contrib/graphite-emitter/src/test/java/org/apache/druid/emitter/graphite/WhiteListBasedConverterTest.java:
##########
@@ -98,17 +104,17 @@ public void testGetPath(ServiceMetricEvent
serviceMetricEvent, String expectedPa
@Test
public void testWhiteListedStringArrayDimension() throws IOException
{
- File mapFile = File.createTempFile("testing-" + System.nanoTime(),
".json");
- mapFile.deleteOnExit();
-
- try (OutputStream outputStream = new FileOutputStream(mapFile)) {
- IOUtils.copyLarge(
-
getClass().getResourceAsStream("/testWhiteListedStringArrayDimension.json"),
- outputStream
- );
+ final File mapFile = temporaryFolder.newFile("whiteList.json");
+
+ try (
+ InputStream inputStream =
+
WhiteListBasedConverterTest.class.getResourceAsStream("/testWhiteListedStringArrayDimension.json");
+ OutputStream outputStream = new FileOutputStream(mapFile)
+ ) {
+ IOUtils.copyLarge(inputStream, outputStream);
}
Review Comment:
Fixed in 7c03364724: the Graphite test now uses Objects.requireNonNull with
a clear missing-resource message before the output stream is opened.
##########
extensions-contrib/ambari-metrics-emitter/src/test/java/org/apache/druid/emitter/ambari/metrics/WhiteListBasedDruidToTimelineEventConverterTest.java:
##########
@@ -93,29 +99,31 @@ public void testGetName(ServiceMetricEvent
serviceMetricEvent, String expectedPa
@Test
public void testWhiteListedStringArrayDimension() throws IOException
{
- File mapFile = File.createTempFile("testing-" + System.nanoTime(),
".json");
- mapFile.deleteOnExit();
+ final File mapFile = temporaryFolder.newFile("whiteList.json");
- try (OutputStream outputStream = new FileOutputStream(mapFile)) {
- IOUtils.copyLarge(
-
getClass().getResourceAsStream("/testWhiteListedStringArrayDimension.json"),
- outputStream
- );
+ try (
+ InputStream inputStream =
+ WhiteListBasedDruidToTimelineEventConverterTest.class
+
.getResourceAsStream("/testWhiteListedStringArrayDimension.json");
+ OutputStream outputStream = new FileOutputStream(mapFile)
+ ) {
+ IOUtils.copyLarge(inputStream, outputStream);
}
Review Comment:
Fixed in 7c03364724: the Ambari test now requires the classpath resource to
be non-null with a clear message before opening the output stream.
--
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]