Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
tpz committed Jan 6, 2025
2 parents 47cb7d2 + 054c553 commit 643df4b
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* | __/\ V /| | || (_| | |_| | |_) |
* \___| \_/ |_|\__\__,_|____/|____/
*
* Copyright (c) 2023-2024
* Copyright (c) 2023-2025
*
* Licensed under the Business Source License, Version 1.1 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -265,7 +265,7 @@ public EvitaClient(
.trustStorePassword(configuration.trustStorePassword())
.mtls(configuration.mtlsEnabled())
.certificateClientFolderPath(configuration.certificateFolderPath())
.serverCertificateFilePath(configuration.rootCaCertificatePath())
.serverCertificateFilePath(configuration.serverCertificatePath())
.clientCertificateFilePath(configuration.certificateFileName())
.clientPrivateKeyFilePath(configuration.certificateKeyFileName())
.clientPrivateKeyPassword(configuration.certificateKeyPassword())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* | __/\ V /| | || (_| | |_| | |_) |
* \___| \_/ |_|\__\__,_|____/|____/
*
* Copyright (c) 2023-2024
* Copyright (c) 2023-2025
*
* Licensed under the Business Source License, Version 1.1 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -50,9 +50,9 @@
* set on the server side.
* @param mtlsEnabled Whether to use mutual TLS encryption. Corresponding setting must be set on the
* server side.
* @param rootCaCertificatePath A relative path to the root CA certificate. Has to be provided when
* @param serverCertificatePath A relative path to the server certificate. Has to be provided when
* `useGeneratedCertificate` and `trustCertificate` flag is disabled and server
* is using non-trusted CA certificate.
* is using non-trusted certificate (for example self-signed one).
* @param certificateFolderPath A relative path to the folder where the client certificate and private key will be located,
* or if already not present there, downloaded. In the latter, the default path in the
* `temp` folder will be used.
Expand All @@ -75,7 +75,7 @@ public record EvitaClientConfiguration(
boolean trustCertificate,
boolean tlsEnabled,
boolean mtlsEnabled,
@Nullable Path rootCaCertificatePath,
@Nullable Path serverCertificatePath,
@Nullable Path certificateFileName,
@Nullable Path certificateKeyFileName,
@Nullable String certificateKeyPassword,
Expand All @@ -96,6 +96,17 @@ public static EvitaClientConfiguration.Builder builder() {
return new EvitaClientConfiguration.Builder();
}

/**
* Returns the path to the server certificate.
* @return The path to the server certificate.
* @deprecated Use {@link #serverCertificatePath()} instead.
*/
@Deprecated
@Nullable
public Path rootCaCertificatePath() {
return serverCertificatePath;
}

/**
* Standard builder pattern implementation.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* | __/\ V /| | || (_| | |_| | |_) |
* \___| \_/ |_|\__\__,_|____/|____/
*
* Copyright (c) 2023-2024
* Copyright (c) 2023-2025
*
* Licensed under the Business Source License, Version 1.1 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -59,6 +59,7 @@
import java.util.Currency;
import java.util.EnumSet;
import java.util.Locale;
import java.util.Objects;
import java.util.UUID;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -959,7 +960,9 @@ public static BigDecimalNumberRange[] toBigDecimalNumberRangeArray(@Nonnull Grpc
@Nonnull
public static GrpcStringArray toGrpcStringArray(@Nonnull String[] stringArrayValues) {
final GrpcStringArray.Builder valueBuilder = GrpcStringArray.newBuilder();
Arrays.stream(stringArrayValues).forEach(valueBuilder::addValue);
Arrays.stream(stringArrayValues)
.filter(Objects::nonNull)
.forEach(valueBuilder::addValue);
return valueBuilder.build();
}

Expand All @@ -980,7 +983,9 @@ public static GrpcStringArray toGrpcCharacterArray(@Nonnull char[] charArrayValu
@Nonnull
public static GrpcBooleanArray toGrpcBooleanArray(@Nonnull Boolean[] booleanArrayValues) {
final GrpcBooleanArray.Builder valueBuilder = GrpcBooleanArray.newBuilder();
Arrays.stream(booleanArrayValues).forEach(valueBuilder::addValue);
Arrays.stream(booleanArrayValues)
.filter(Objects::nonNull)
.forEach(valueBuilder::addValue);
return valueBuilder.build();
}

Expand All @@ -996,7 +1001,9 @@ public static GrpcBooleanArray toGrpcBooleanArray(@Nonnull boolean[] boolArrayVa
@Nonnull
public static GrpcLongArray toGrpcLongArray(@Nonnull Long[] longArrayValues) {
final GrpcLongArray.Builder valueBuilder = GrpcLongArray.newBuilder();
Arrays.stream(longArrayValues).forEach(valueBuilder::addValue);
Arrays.stream(longArrayValues)
.filter(Objects::nonNull)
.forEach(valueBuilder::addValue);
return valueBuilder.build();
}

Expand All @@ -1012,7 +1019,9 @@ public static GrpcLongArray toGrpcLongArray(@Nonnull long[] longArrayValues) {
@Nonnull
public static GrpcIntegerArray toGrpcByteArray(@Nonnull Byte[] byteArrayValues) {
final GrpcIntegerArray.Builder valueBuilder = GrpcIntegerArray.newBuilder();
Arrays.stream(byteArrayValues).forEach(valueBuilder::addValue);
Arrays.stream(byteArrayValues)
.filter(Objects::nonNull)
.forEach(valueBuilder::addValue);
return valueBuilder.build();
}

Expand All @@ -1028,7 +1037,9 @@ public static GrpcIntegerArray toGrpcByteArray(@Nonnull byte[] byteArrayValues)
@Nonnull
public static GrpcIntegerArray toGrpcShortArray(@Nonnull Short[] shortArrayValues) {
final GrpcIntegerArray.Builder valueBuilder = GrpcIntegerArray.newBuilder();
Arrays.stream(shortArrayValues).forEach(valueBuilder::addValue);
Arrays.stream(shortArrayValues)
.filter(Objects::nonNull)
.forEach(valueBuilder::addValue);
return valueBuilder.build();
}

Expand All @@ -1044,7 +1055,9 @@ public static GrpcIntegerArray toGrpcShortArray(@Nonnull short[] shortArrayValue
@Nonnull
public static GrpcIntegerArray toGrpcIntegerArray(@Nonnull Integer[] integerArrayValues) {
final GrpcIntegerArray.Builder valueBuilder = GrpcIntegerArray.newBuilder();
Arrays.stream(integerArrayValues).forEach(valueBuilder::addValue);
Arrays.stream(integerArrayValues)
.filter(Objects::nonNull)
.forEach(valueBuilder::addValue);
return valueBuilder.build();
}

Expand All @@ -1060,7 +1073,10 @@ public static GrpcIntegerArray toGrpcIntegerArray(@Nonnull int[] intArrayValues)
@Nonnull
public static GrpcStringArray toGrpcCharacterArray(@Nonnull Character[] characterArrayValues) {
final GrpcStringArray.Builder valueBuilder = GrpcStringArray.newBuilder();
Arrays.stream(characterArrayValues).map(Object::toString).forEach(valueBuilder::addValue);
Arrays.stream(characterArrayValues)
.filter(Objects::nonNull)
.map(Object::toString)
.forEach(valueBuilder::addValue);
return valueBuilder.build();
}

Expand All @@ -1080,7 +1096,10 @@ public static GrpcBigDecimal toGrpcBigDecimal(@Nonnull BigDecimal bigDecimal) {
@Nonnull
public static GrpcBigDecimalArray toGrpcBigDecimalArray(@Nonnull BigDecimal[] bigDecimalArrayValues) {
final GrpcBigDecimalArray.Builder valueBuilder = GrpcBigDecimalArray.newBuilder();
Arrays.stream(bigDecimalArrayValues).map(EvitaDataTypesConverter::toGrpcBigDecimal).forEach(valueBuilder::addValue);
Arrays.stream(bigDecimalArrayValues)
.filter(Objects::nonNull)
.map(EvitaDataTypesConverter::toGrpcBigDecimal)
.forEach(valueBuilder::addValue);
return valueBuilder.build();
}

Expand Down Expand Up @@ -1112,7 +1131,10 @@ public static GrpcOffsetDateTime toGrpcOffsetDateTime(@Nonnull OffsetDateTime of
@Nonnull
public static GrpcOffsetDateTimeArray toGrpcOffsetDateTimeArray(@Nonnull OffsetDateTime[] offsetDateTimeArrayValues) {
final GrpcOffsetDateTimeArray.Builder valueBuilder = GrpcOffsetDateTimeArray.newBuilder();
Arrays.stream(offsetDateTimeArrayValues).map(EvitaDataTypesConverter::toGrpcOffsetDateTime).forEach(valueBuilder::addValue);
Arrays.stream(offsetDateTimeArrayValues)
.filter(Objects::nonNull)
.map(EvitaDataTypesConverter::toGrpcOffsetDateTime)
.forEach(valueBuilder::addValue);
return valueBuilder.build();
}

Expand Down Expand Up @@ -1144,7 +1166,10 @@ public static GrpcOffsetDateTime toGrpcLocalDateTime(@Nonnull LocalDateTime loca
@Nonnull
public static GrpcOffsetDateTimeArray toGrpcLocalDateTimeArray(@Nonnull LocalDateTime[] localDateTimeArrayValues) {
final GrpcOffsetDateTimeArray.Builder valueBuilder = GrpcOffsetDateTimeArray.newBuilder();
Arrays.stream(localDateTimeArrayValues).map(EvitaDataTypesConverter::toGrpcLocalDateTime).forEach(valueBuilder::addValue);
Arrays.stream(localDateTimeArrayValues)
.filter(Objects::nonNull)
.map(EvitaDataTypesConverter::toGrpcLocalDateTime)
.forEach(valueBuilder::addValue);
return valueBuilder.build();
}

Expand Down Expand Up @@ -1176,7 +1201,10 @@ public static GrpcOffsetDateTime toGrpcLocalDate(@Nonnull LocalDate localDate) {
@Nonnull
public static GrpcOffsetDateTimeArray toGrpcLocalDateArray(@Nonnull LocalDate[] localDateArrayValues) {
final GrpcOffsetDateTimeArray.Builder valueBuilder = GrpcOffsetDateTimeArray.newBuilder();
Arrays.stream(localDateArrayValues).map(EvitaDataTypesConverter::toGrpcLocalDate).forEach(valueBuilder::addValue);
Arrays.stream(localDateArrayValues)
.filter(Objects::nonNull)
.map(EvitaDataTypesConverter::toGrpcLocalDate)
.forEach(valueBuilder::addValue);
return valueBuilder.build();
}

Expand All @@ -1201,7 +1229,10 @@ public static GrpcOffsetDateTime toGrpcLocalTime(@Nonnull LocalTime localTime) {
@Nonnull
public static GrpcOffsetDateTimeArray toGrpcLocalTimeArray(@Nonnull LocalTime[] localeTimeArrayValues) {
final GrpcOffsetDateTimeArray.Builder valueBuilder = GrpcOffsetDateTimeArray.newBuilder();
Arrays.stream(localeTimeArrayValues).map(EvitaDataTypesConverter::toGrpcLocalTime).forEach(valueBuilder::addValue);
Arrays.stream(localeTimeArrayValues)
.filter(Objects::nonNull)
.map(EvitaDataTypesConverter::toGrpcLocalTime)
.forEach(valueBuilder::addValue);
return valueBuilder.build();
}

Expand All @@ -1226,7 +1257,10 @@ public static GrpcDateTimeRange toGrpcDateTimeRange(@Nonnull DateTimeRange dateT
@Nonnull
public static GrpcDateTimeRangeArray toGrpcDateTimeRangeArray(@Nonnull DateTimeRange[] dateTimeRangeArrayValues) {
final GrpcDateTimeRangeArray.Builder valueBuilder = GrpcDateTimeRangeArray.newBuilder();
Arrays.stream(dateTimeRangeArrayValues).map(EvitaDataTypesConverter::toGrpcDateTimeRange).forEach(valueBuilder::addValue);
Arrays.stream(dateTimeRangeArrayValues)
.filter(Objects::nonNull)
.map(EvitaDataTypesConverter::toGrpcDateTimeRange)
.forEach(valueBuilder::addValue);
return valueBuilder.build();
}

Expand All @@ -1253,7 +1287,10 @@ public static GrpcBigDecimalNumberRange toGrpcBigDecimalNumberRange(@Nonnull Big
@Nonnull
public static GrpcBigDecimalNumberRangeArray toGrpcBigDecimalNumberRangeArray(@Nonnull BigDecimalNumberRange[] bigDecimalNumberRangeArrayValues) {
final GrpcBigDecimalNumberRangeArray.Builder valueBuilder = GrpcBigDecimalNumberRangeArray.newBuilder();
Arrays.stream(bigDecimalNumberRangeArrayValues).map(EvitaDataTypesConverter::toGrpcBigDecimalNumberRange).forEach(valueBuilder::addValue);
Arrays.stream(bigDecimalNumberRangeArrayValues)
.filter(Objects::nonNull)
.map(EvitaDataTypesConverter::toGrpcBigDecimalNumberRange)
.forEach(valueBuilder::addValue);
return valueBuilder.build();
}

Expand All @@ -1278,7 +1315,10 @@ public static GrpcLongNumberRange toGrpcLongNumberRange(@Nonnull LongNumberRange
@Nonnull
public static GrpcLongNumberRangeArray toGrpcLongNumberRangeArray(@Nonnull LongNumberRange[] longNumberRangeArrayValues) {
final GrpcLongNumberRangeArray.Builder valueBuilder = GrpcLongNumberRangeArray.newBuilder();
Arrays.stream(longNumberRangeArrayValues).map(EvitaDataTypesConverter::toGrpcLongNumberRange).forEach(valueBuilder::addValue);
Arrays.stream(longNumberRangeArrayValues)
.filter(Objects::nonNull)
.map(EvitaDataTypesConverter::toGrpcLongNumberRange)
.forEach(valueBuilder::addValue);
return valueBuilder.build();
}

Expand All @@ -1304,21 +1344,30 @@ public static <T extends Number> GrpcIntegerNumberRange toGrpcIntegerNumberRange
@Nonnull
public static GrpcIntegerNumberRangeArray toGrpcIntegerNumberRangeArray(@Nonnull IntegerNumberRange[] integerNumberRangeArrayValues) {
final GrpcIntegerNumberRangeArray.Builder valueBuilder = GrpcIntegerNumberRangeArray.newBuilder();
Arrays.stream(integerNumberRangeArrayValues).map(EvitaDataTypesConverter::toGrpcIntegerNumberRange).forEach(valueBuilder::addValue);
Arrays.stream(integerNumberRangeArrayValues)
.filter(Objects::nonNull)
.map(EvitaDataTypesConverter::toGrpcIntegerNumberRange)
.forEach(valueBuilder::addValue);
return valueBuilder.build();
}

@Nonnull
public static GrpcIntegerNumberRangeArray toGrpcByteNumberRangeArray(@Nonnull ByteNumberRange[] byteNumberRangeArrayValues) {
final GrpcIntegerNumberRangeArray.Builder valueBuilder = GrpcIntegerNumberRangeArray.newBuilder();
Arrays.stream(byteNumberRangeArrayValues).map(EvitaDataTypesConverter::toGrpcIntegerNumberRange).forEach(valueBuilder::addValue);
Arrays.stream(byteNumberRangeArrayValues)
.filter(Objects::nonNull)
.map(EvitaDataTypesConverter::toGrpcIntegerNumberRange)
.forEach(valueBuilder::addValue);
return valueBuilder.build();
}

@Nonnull
public static GrpcIntegerNumberRangeArray toGrpcShortNumberRangeArray(@Nonnull ShortNumberRange[] shortNumberRangeArrayValues) {
final GrpcIntegerNumberRangeArray.Builder valueBuilder = GrpcIntegerNumberRangeArray.newBuilder();
Arrays.stream(shortNumberRangeArrayValues).map(EvitaDataTypesConverter::toGrpcIntegerNumberRange).forEach(valueBuilder::addValue);
Arrays.stream(shortNumberRangeArrayValues)
.filter(Objects::nonNull)
.map(EvitaDataTypesConverter::toGrpcIntegerNumberRange)
.forEach(valueBuilder::addValue);
return valueBuilder.build();
}

Expand All @@ -1339,7 +1388,10 @@ public static GrpcLocale toGrpcLocale(@Nonnull Locale locale) {
@Nonnull
public static GrpcLocaleArray toGrpcLocaleArray(@Nonnull Locale[] localeArrayValues) {
final GrpcLocaleArray.Builder valueBuilder = GrpcLocaleArray.newBuilder();
Arrays.stream(localeArrayValues).map(EvitaDataTypesConverter::toGrpcLocale).forEach(valueBuilder::addValue);
Arrays.stream(localeArrayValues)
.filter(Objects::nonNull)
.map(EvitaDataTypesConverter::toGrpcLocale)
.forEach(valueBuilder::addValue);
return valueBuilder.build();
}

Expand All @@ -1357,7 +1409,10 @@ public static GrpcCurrency toGrpcCurrency(@Nonnull Currency currency) {
@Nonnull
public static GrpcCurrencyArray toGrpcCurrencyArray(@Nonnull Currency[] currencyArrayValues) {
final GrpcCurrencyArray.Builder valueBuilder = GrpcCurrencyArray.newBuilder();
Arrays.stream(currencyArrayValues).map(EvitaDataTypesConverter::toGrpcCurrency).forEach(valueBuilder::addValue);
Arrays.stream(currencyArrayValues)
.filter(Objects::nonNull)
.map(EvitaDataTypesConverter::toGrpcCurrency)
.forEach(valueBuilder::addValue);
return valueBuilder.build();
}

Expand All @@ -1378,7 +1433,10 @@ public static GrpcUuid toGrpcUuid(@Nonnull UUID uuid) {
@Nonnull
public static GrpcUuidArray toGrpcUuidArray(@Nonnull UUID[] uuidArrayValues) {
final GrpcUuidArray.Builder valueBuilder = GrpcUuidArray.newBuilder();
Arrays.stream(uuidArrayValues).map(EvitaDataTypesConverter::toGrpcUuid).forEach(valueBuilder::addValue);
Arrays.stream(uuidArrayValues)
.filter(Objects::nonNull)
.map(EvitaDataTypesConverter::toGrpcUuid)
.forEach(valueBuilder::addValue);
return valueBuilder.build();
}

Expand Down Expand Up @@ -1564,6 +1622,7 @@ public static GrpcCatalogStatistics toGrpcCatalogStatistics(@Nonnull CatalogStat
.setSizeOnDiskInBytes(catalogStatistics.sizeOnDiskInBytes())
.addAllEntityCollectionStatistics(
Arrays.stream(catalogStatistics.entityCollectionStatistics())
.filter(Objects::nonNull)
.map(EvitaDataTypesConverter::toGrpcEntityCollectionStatistics)
.collect(Collectors.toList())
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* | __/\ V /| | || (_| | |_| | |_) |
* \___| \_/ |_|\__\__,_|____/|____/
*
* Copyright (c) 2023-2024
* Copyright (c) 2023-2025
*
* Licensed under the Business Source License, Version 1.1 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -968,7 +968,8 @@ private Map<String, String> constructTestArguments(
Stream.of(
Stream.of(
property("storage.storageDirectory", getTestDirectory().resolve(DIR_EVITA_SERVER_TEST).toString()),
property("cache.enabled", "false")
property("cache.enabled", "false"),
property("api.requestTimeoutInMillis", "10K")
),
allApis.stream()
.filter(apis::contains)
Expand All @@ -989,6 +990,7 @@ private Map<String, String> constructTestArguments(
property("api.endpoints." + it + ".host", "localhost:" + allocatedPort),
property("api.endpoints." + it + ".exposeOn", "localhost:" + allocatedPort),
property("api.endpoints." + it + ".enabled", "true")
property("api.endpoints." + it + ".enabled", "true")
);
}
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* | __/\ V /| | || (_| | |_| | |_) |
* \___| \_/ |_|\__\__,_|____/|____/
*
* Copyright (c) 2023-2024
* Copyright (c) 2023-2025
*
* Licensed under the Business Source License, Version 1.1 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -410,6 +410,8 @@ private static ApiOptions createApiOptions(
.toArray(String[]::new);
if (ArrayUtils.isEmpty(unknownApis)) {
final Builder apiOptionsBuilder = ApiOptions.builder()
// 10 s request timeout - tests are highly parallel, squeezing our CI infrastructure
.requestTimeoutInMillis(10_000)
.certificate(
CertificateSettings.builder()
.folderPath(evita.getConfiguration().storage().storageDirectory().toString() + "-certificates")
Expand Down

0 comments on commit 643df4b

Please sign in to comment.