Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): bump elasticsearch from 8.10.2 to 8.11.1 in /examples/skywalking #878

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/skywalking/Dockerfile-elasticsearch
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM elasticsearch:8.10.2@sha256:53efb4ba72e1c71c8223ee8d8de6537e8d992ad6cc8fcdf5dd944be93b6ab814
FROM elasticsearch:8.11.1@sha256:bb4361cbc4a556b71779de08250794b4d8c52c1f8ba71fb7c73b20fccae3b425
13 changes: 11 additions & 2 deletions mobile/library/common/jni/jni_utility.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "library/common/jni/jni_utility.h"

#include <stdlib.h>
#include <string.h>
#include <cstdlib>
#include <cstring>

#include "source/common/common/assert.h"

Expand Down Expand Up @@ -355,6 +355,15 @@ void javaByteArrayToProto(JniHelper& jni_helper, jbyteArray source,
RELEASE_ASSERT(success, "Failed to parse protobuf message.");
}

LocalRefUniquePtr<jbyteArray> protoToJavaByteArray(JniHelper& jni_helper,
const Envoy::Protobuf::MessageLite& source) {
size_t size = source.ByteSizeLong();
LocalRefUniquePtr<jbyteArray> byte_array = jni_helper.newByteArray(size);
auto bytes = jni_helper.getByteArrayElements(byte_array.get(), nullptr);
source.SerializeToArray(bytes.get(), size);
return byte_array;
}

std::string javaStringToString(JniHelper& jni_helper, jstring java_string) {
if (!java_string) {
return "";
Expand Down
4 changes: 4 additions & 0 deletions mobile/library/common/jni/jni_utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ void javaByteArrayToString(JniHelper& jni_helper, jbyteArray jbytes, std::string
void javaByteArrayToProto(JniHelper& jni_helper, jbyteArray source,
Envoy::Protobuf::MessageLite* dest);

/** Converts from Proto to Java byte array. */
LocalRefUniquePtr<jbyteArray> protoToJavaByteArray(JniHelper& jni_helper,
const Envoy::Protobuf::MessageLite& source);

/** Converts from Java `String` to C++ string. */
std::string javaStringToString(JniHelper& jni_helper, jstring java_string);

Expand Down
20 changes: 20 additions & 0 deletions mobile/test/common/jni/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,23 @@ cc_binary(
":jni_helper_test_lib",
],
)

cc_library(
name = "jni_utility_test_lib",
srcs = [
"jni_utility_test.cc",
],
deps = [
"//library/common/jni:jni_utility_lib",
],
alwayslink = True,
)

cc_binary(
name = "libenvoy_jni_utility_test.so",
testonly = True,
linkshared = True,
deps = [
":jni_utility_test_lib",
],
)
17 changes: 17 additions & 0 deletions mobile/test/common/jni/jni_utility_test.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <jni.h>

#include "library/common/jni/jni_utility.h"

// NOLINT(namespace-envoy)

// This file contains JNI implementation used by
// `test/java/io/envoyproxy/envoymobile/jni/JniUtilityTest.java` unit tests.

extern "C" JNIEXPORT jbyteArray JNICALL
Java_io_envoyproxy_envoymobile_jni_JniUtilityTest_protoJavaByteArrayConversion(JNIEnv* env, jclass,
jbyteArray source) {
Envoy::JNI::JniHelper jni_helper(env);
Envoy::ProtobufWkt::Struct s;
Envoy::JNI::javaByteArrayToProto(jni_helper, source, &s);
return Envoy::JNI::protoToJavaByteArray(jni_helper, s).release();
}
14 changes: 14 additions & 0 deletions mobile/test/java/io/envoyproxy/envoymobile/jni/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,17 @@ envoy_mobile_android_test(
],
native_lib_name = "envoy_jni_helper_test",
)

envoy_mobile_android_test(
name = "jni_utility_test",
srcs = [
"JniUtilityTest.java",
],
native_deps = [
"//test/common/jni:libenvoy_jni_utility_test.so",
],
native_lib_name = "envoy_jni_utility_test",
deps = [
"@maven//:com_google_protobuf_protobuf_javalite",
],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package io.envoyproxy.envoymobile.jni;

import static org.assertj.core.api.Assertions.assertThat;

import com.google.protobuf.Struct;
import com.google.protobuf.Value;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;

@RunWith(RobolectricTestRunner.class)
public class JniUtilityTest {
public JniUtilityTest() { System.loadLibrary("envoy_jni_utility_test"); }

//================================================================================
// Native methods for testing.
//================================================================================
public static native byte[] protoJavaByteArrayConversion(byte[] source);

@Test
public void testProtoJavaByteArrayConversion() throws Exception {
Struct source =
Struct.newBuilder()
.putFields("string_key", Value.newBuilder().setStringValue("string_value").build())
.putFields("num_key", Value.newBuilder().setNumberValue(123).build())
.putFields("bool_key", Value.newBuilder().setBoolValue(true).build())
.build();
Struct dest = Struct.parseFrom(protoJavaByteArrayConversion(source.toByteArray()));
assertThat(source).isEqualTo(dest);
}
}
2 changes: 1 addition & 1 deletion source/server/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,6 @@ envoy_cc_library(
"//source/common/upstream:cluster_manager_lib",
"//source/common/upstream:health_discovery_service_lib",
"//source/common/version:version_lib",
"//source/server:overload_manager_lib",
"//source/server/admin:admin_lib",
"@envoy_api//envoy/admin/v3:pkg_cc_proto",
"@envoy_api//envoy/config/bootstrap/v3:pkg_cc_proto",
Expand All @@ -450,6 +449,7 @@ envoy_cc_library(
deps = [
":server_base_lib",
"//source/common/memory:heap_shrinker_lib",
"//source/server:overload_manager_lib",
],
)

Expand Down