Skip to content

Commit

Permalink
Merge pull request #25 from hivemq/release/bump-version
Browse files Browse the repository at this point in the history
Release / Bump Version
  • Loading branch information
LukasBrand authored Apr 30, 2024
2 parents cfae0f9 + 5ca4366 commit bc308f1
Show file tree
Hide file tree
Showing 13 changed files with 1,211 additions and 24 deletions.
1,161 changes: 1,161 additions & 0 deletions .editorconfig

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ hivemqExtension {
}

dependencies {
compileOnly(libs.jetbrains.annotations)

implementation(libs.metrics.influxdb)
implementation(libs.commonsLang)
}
Expand All @@ -32,6 +34,7 @@ testing {
}
"test"(JvmTestSuite::class) {
dependencies {
compileOnly(libs.jetbrains.annotations)
implementation(libs.mockito)
implementation(libs.wiremock)
runtimeOnly(libs.logback.classic)
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=4.1.2
version=4.1.3
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/
package com.hivemq.extensions.influxdb;

import com.hivemq.extension.sdk.api.annotations.NotNull;
import com.izettle.metrics.influxdb.InfluxDbHttpSender;
import com.izettle.metrics.influxdb.utils.TimeUtils;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;
import java.io.OutputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.ScheduledReporter;
import com.hivemq.extension.sdk.api.ExtensionMain;
import com.hivemq.extension.sdk.api.annotations.NotNull;
import com.hivemq.extension.sdk.api.annotations.Nullable;
import com.hivemq.extension.sdk.api.parameter.ExtensionStartInput;
import com.hivemq.extension.sdk.api.parameter.ExtensionStartOutput;
import com.hivemq.extension.sdk.api.parameter.ExtensionStopInput;
Expand All @@ -32,6 +30,8 @@
import com.izettle.metrics.influxdb.InfluxDbSender;
import com.izettle.metrics.influxdb.InfluxDbTcpSender;
import com.izettle.metrics.influxdb.InfluxDbUdpSender;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -51,8 +51,17 @@ public class InfluxDbExtensionMain implements ExtensionMain {

private static final @NotNull HashSet<String> METER_FIELDS =
newHashSet("count", "m1_rate", "m5_rate", "m15_rate", "mean_rate");
private static final @NotNull HashSet<String> TIMER_FIELDS =
newHashSet("count", "min", "max", "mean", "stddev", "p50", "p75", "p95", "p98", "p99", "p999",
private static final @NotNull HashSet<String> TIMER_FIELDS = newHashSet("count",
"min",
"max",
"mean",
"stddev",
"p50",
"p75",
"p95",
"p98",
"p99",
"p999",
"m1_rate",
"m5_rate",
"m15_rate",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/
package com.hivemq.extensions.influxdb.configuration;

import com.hivemq.extension.sdk.api.annotations.NotNull;
import com.hivemq.extension.sdk.api.annotations.Nullable;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -185,7 +185,7 @@ public int getConnectTimeout() {

for (final String tag : split) {
final String[] tagPair = StringUtils.split(tag, "=");
if (tagPair.length != 2 || tagPair[0].length() < 1 || tagPair[1].length() < 1) {
if (tagPair.length != 2 || tagPair[0].isEmpty() || tagPair[1].isEmpty()) {
LOG.warn("Invalid tag format {} for InfluxDB", tag);
continue;
}
Expand Down Expand Up @@ -277,4 +277,4 @@ private int validateIntProperty(

return valueAsInt;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package com.hivemq.extensions.influxdb.configuration;

import com.hivemq.extension.sdk.api.annotations.NotNull;
import com.hivemq.extension.sdk.api.annotations.Nullable;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -101,4 +101,4 @@ private void loadProperties(final @NotNull File file) throws IOException {
}

public abstract @NotNull String getFilename();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,19 @@

import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
import com.github.tomakehurst.wiremock.junit5.WireMockTest;
import com.hivemq.extension.sdk.api.annotations.NotNull;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.Test;

import java.util.concurrent.TimeUnit;

import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor;
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.verify;

/**
* @author Christoph Schäbel
Expand All @@ -43,13 +50,12 @@ void test_write_data(final @NotNull WireMockRuntimeInfo wireMockRuntimeInfo) thr
"testorg",
"testbucket");

stubFor(post(urlPathEqualTo("/api/v2/write")).willReturn(aResponse().withStatus(200)
.withBody("")));
stubFor(post(urlPathEqualTo("/api/v2/write")).willReturn(aResponse().withStatus(200).withBody("")));

sender.writeData("line=line".getBytes());

verify(postRequestedFor(urlEqualTo("/api/v2/write?precision=ms&org=testorg&bucket=testbucket")).withHeader(
"Authorization",
equalTo("Token token")).withRequestBody(equalTo("line=line")));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
*/
package com.hivemq.extensions.influxdb;

import com.hivemq.extension.sdk.api.annotations.NotNull;
import com.hivemq.extension.sdk.api.parameter.ExtensionInformation;
import com.hivemq.extension.sdk.api.parameter.ExtensionStartInput;
import com.hivemq.extension.sdk.api.parameter.ExtensionStartOutput;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
Expand Down Expand Up @@ -66,4 +66,4 @@ void extensionStart_whenConfigurationFileNotValid_thenPreventStartup() throws IO
main.extensionStart(extensionStartInput, extensionStartOutput);
verify(extensionStartOutput).preventExtensionStartup(anyString());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package com.hivemq.extensions.influxdb.configuration;

import com.hivemq.extension.sdk.api.annotations.NotNull;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package com.hivemq.extensions.influxdb.configuration;

import com.hivemq.extension.sdk.api.annotations.NotNull;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;

Expand All @@ -34,6 +34,7 @@ class PropertiesReaderTest {

@Test
void readPropertiesFromFile_file_null() {
//noinspection DataFlowIssue
assertThrows(NullPointerException.class, () -> new PropertiesReader(null) {
@Override
public @NotNull String getFilename() {
Expand Down Expand Up @@ -81,6 +82,7 @@ void getProperty_key_null(final @TempDir @NotNull Path tempDir) throws IOExcepti
assertTrue(propertiesReader.readPropertiesFromFile());
assertEquals("value", propertiesReader.getProperty("key"));

//noinspection DataFlowIssue
assertThrows(NullPointerException.class, () -> propertiesReader.getProperty(null));
}

Expand Down Expand Up @@ -132,4 +134,4 @@ void getProperty_before_loading_properties(final @TempDir @NotNull Path tempDir)
};
assertNull(propertiesReader.getProperty("key"));
}
}
}

0 comments on commit bc308f1

Please sign in to comment.