Skip to content

Commit 8e43417

Browse files
authored
Merge branch 'dev' into fitbit-hrv
2 parents 7a68bd8 + 0300a6a commit 8e43417

File tree

10 files changed

+286
-275
lines changed

10 files changed

+286
-275
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
FROM --platform=$BUILDPLATFORM gradle:8.1-jdk11 as builder
15+
FROM --platform=$BUILDPLATFORM gradle:8.4-jdk11 as builder
1616

1717
RUN mkdir /code
1818
WORKDIR /code
@@ -32,7 +32,7 @@ COPY ./kafka-connect-fitbit-source/src/ /code/kafka-connect-fitbit-source/src
3232

3333
RUN gradle jar
3434

35-
FROM confluentinc/cp-kafka-connect-base:7.4.0
35+
FROM confluentinc/cp-kafka-connect-base:7.5.0
3636

3737
MAINTAINER Joris Borgdorff <[email protected]>
3838

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ description = "Kafka connector for REST API sources"
1010

1111
radarRootProject {
1212
projectVersion.set(Versions.project)
13+
gradleVersion.set(Versions.wrapper)
1314
}
1415

1516
subprojects {

buildSrc/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
kotlin("jvm") version "1.8.10"
2+
kotlin("jvm") version "1.9.10"
33
}
44

55
repositories {

buildSrc/src/main/kotlin/Versions.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
@Suppress("ConstPropertyName", "MemberVisibilityCanBePrivate")
12
object Versions {
23
const val project = "0.4.2-SNAPSHOT"
34

45
const val java = 11
56
const val kotlin = "1.9.10"
7+
const val wrapper = "8.4"
68

79
const val radarCommons = "1.1.1"
810
const val confluent = "7.5.0"
@@ -16,10 +18,9 @@ object Versions {
1618

1719
const val okhttp = "4.11.0"
1820

19-
const val managementPortal = "2.0.0"
20-
2121
const val firebaseAdmin = "9.1.0"
2222
const val radarSchemas = "0.8.6-SNAPSHOT"
23+
const val ktor = "2.3.5"
2324

2425
const val junit = "5.9.3"
2526
const val wiremock = "2.27.2"

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
145145
case $MAX_FD in #(
146146
max*)
147147
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
148-
# shellcheck disable=SC3045
148+
# shellcheck disable=SC2039,SC3045
149149
MAX_FD=$( ulimit -H -n ) ||
150150
warn "Could not query maximum file descriptor limit"
151151
esac
152152
case $MAX_FD in #(
153153
'' | soft) :;; #(
154154
*)
155155
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
156-
# shellcheck disable=SC3045
156+
# shellcheck disable=SC2039,SC3045
157157
ulimit -n "$MAX_FD" ||
158158
warn "Could not set maximum file descriptor limit to $MAX_FD"
159159
esac
@@ -202,11 +202,11 @@ fi
202202
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203203
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204204

205-
# Collect all arguments for the java command;
206-
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
207-
# shell script including quotes and variable substitutions, so put them in
208-
# double quotes to make sure that they get re-expanded; and
209-
# * put everything else in single quotes, so that it's not re-expanded.
205+
# Collect all arguments for the java command:
206+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207+
# and any embedded shellness will be escaped.
208+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209+
# treated as '${Hostname}' itself on the command line.
210210

211211
set -- \
212212
"-Dorg.gradle.appname=$APP_BASE_NAME" \

kafka-connect-fitbit-source/build.gradle.kts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,18 @@ dependencies {
44
api(project(":kafka-connect-rest-source"))
55
api("io.confluent:kafka-connect-avro-converter:${Versions.confluent}")
66
api("org.radarbase:radar-schemas-commons:${Versions.radarSchemas}")
7-
implementation("org.radarbase:oauth-client-util:${Versions.managementPortal}")
7+
implementation("org.radarbase:radar-commons-kotlin:${Versions.radarCommons}")
88

99
implementation(platform("com.fasterxml.jackson:jackson-bom:${Versions.jackson}"))
1010
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml")
1111
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
1212
implementation("com.google.firebase:firebase-admin:${Versions.firebaseAdmin}")
1313

14+
implementation("io.ktor:ktor-client-auth:${Versions.ktor}")
15+
implementation("io.ktor:ktor-client-content-negotiation:${Versions.ktor}")
16+
implementation("io.ktor:ktor-serialization-jackson:${Versions.ktor}")
17+
implementation("io.ktor:ktor-client-cio-jvm:${Versions.ktor}")
18+
1419
// Included in connector runtime
1520
compileOnly("org.apache.kafka:connect-api:${Versions.kafka}")
1621
compileOnly(platform("com.fasterxml.jackson:jackson-bom:${Versions.jackson}"))

kafka-connect-fitbit-source/src/main/java/org/radarbase/connect/rest/fitbit/FitbitRestSourceConnectorConfig.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@
1717

1818
package org.radarbase.connect.rest.fitbit;
1919

20+
import static io.ktor.http.URLUtilsKt.URLBuilder;
2021
import static org.apache.kafka.common.config.ConfigDef.NO_DEFAULT_VALUE;
2122

2223
import java.lang.reflect.InvocationTargetException;
23-
import java.net.MalformedURLException;
24-
import java.net.URL;
2524
import java.nio.charset.StandardCharsets;
2625
import java.nio.file.Path;
2726
import java.nio.file.Paths;
@@ -31,8 +30,9 @@
3130
import java.util.List;
3231
import java.util.Map;
3332

33+
import io.ktor.http.URLParserException;
34+
import io.ktor.http.Url;
3435
import okhttp3.Headers;
35-
import okhttp3.HttpUrl;
3636
import org.apache.kafka.common.config.ConfigDef;
3737
import org.apache.kafka.common.config.ConfigDef.Importance;
3838
import org.apache.kafka.common.config.ConfigDef.NonEmptyString;
@@ -479,18 +479,18 @@ public Path getFitbitUserCredentialsPath() {
479479
return Paths.get(getString(FITBIT_USER_CREDENTIALS_DIR_CONFIG));
480480
}
481481

482-
public HttpUrl getFitbitUserRepositoryUrl() {
482+
public Url getFitbitUserRepositoryUrl() {
483483
String urlString = getString(FITBIT_USER_REPOSITORY_URL_CONFIG).trim();
484484
if (urlString.charAt(urlString.length() - 1) != '/') {
485485
urlString += '/';
486486
}
487-
HttpUrl url = HttpUrl.parse(urlString);
488-
if (url == null) {
487+
try {
488+
return URLBuilder(urlString).build();
489+
} catch (URLParserException ex) {
489490
throw new ConfigException(FITBIT_USER_REPOSITORY_URL_CONFIG,
490491
getString(FITBIT_USER_REPOSITORY_URL_CONFIG),
491-
"User repository URL " + urlString + " cannot be parsed as URL.");
492+
"User repository URL " + urlString + " cannot be parsed as URL: " + ex);
492493
}
493-
return url;
494494
}
495495

496496
public Headers getClientCredentials() {
@@ -533,15 +533,17 @@ public String getFitbitUserRepositoryClientSecret() {
533533
return getPassword(FITBIT_USER_REPOSITORY_CLIENT_SECRET_CONFIG).value();
534534
}
535535

536-
public URL getFitbitUserRepositoryTokenUrl() {
536+
public Url getFitbitUserRepositoryTokenUrl() {
537537
String value = getString(FITBIT_USER_REPOSITORY_TOKEN_URL_CONFIG);
538538
if (value == null || value.isEmpty()) {
539539
return null;
540540
} else {
541541
try {
542-
return new URL(getString(FITBIT_USER_REPOSITORY_TOKEN_URL_CONFIG));
543-
} catch (MalformedURLException e) {
544-
throw new ConfigException("Fitbit user repository token URL is invalid.");
542+
return URLBuilder(value).build();
543+
} catch (URLParserException ex) {
544+
throw new ConfigException(FITBIT_USER_REPOSITORY_URL_CONFIG,
545+
getString(FITBIT_USER_REPOSITORY_URL_CONFIG),
546+
"Fitbit user repository token URL " + value + " cannot be parsed as URL: " + ex);
545547
}
546548
}
547549
}

0 commit comments

Comments
 (0)