You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-commits@axis.apache.org by ro...@apache.org on 2026/02/04 15:43:30 UTC
(axis-axis2-c-core) 04/04: Add HTTP/2 service provider interface test
This is an automated email from the ASF dual-hosted git repository.
robertlazarski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/axis-axis2-c-core.git
commit ca03b60cde602ca62182b66e367bd8f709a2c447
Author: Robert Lazarski <ro...@gmail.com>
AuthorDate: Wed Feb 4 04:23:24 2026 -1000
Add HTTP/2 service provider interface test
Creates test_http_service_provider_interface.cc for HTTP/2 builds:
- Verifies WITH_NGHTTP2 and AXIS2_JSON_ENABLED are defined
- Tests HTTP transport constants availability
- Placeholder for future service provider integration tests
Co-Authored-By: Claude Opus 4.5 <no...@anthropic.com>
---
.../engine/test_http_service_provider_interface.cc | 116 +++++++++++++++++++++
1 file changed, 116 insertions(+)
diff --git a/test/core/engine/test_http_service_provider_interface.cc b/test/core/engine/test_http_service_provider_interface.cc
new file mode 100644
index 000000000..3d078aeb1
--- /dev/null
+++ b/test/core/engine/test_http_service_provider_interface.cc
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file test_http_service_provider_interface.cc
+ * @brief Unit tests for HTTP/2 Service Provider Interface Pattern
+ *
+ * Tests verify the HTTP/2 JSON-only service provider interface that
+ * bypasses SOAP/XML processing for pure JSON services.
+ *
+ * Architecture:
+ * - HTTP/2 mode uses direct JSON processing (json-c)
+ * - Dummy SOAP envelope provides framework compatibility
+ * - Service providers can process JSON natively
+ */
+
+#include <gtest/gtest.h>
+
+extern "C" {
+#include <axutil_env.h>
+#include <axutil_allocator.h>
+#include <axutil_error_default.h>
+#include <axutil_log_default.h>
+#include <axis2_http_transport.h>
+}
+
+class HTTPServiceProviderInterfaceTest : public ::testing::Test {
+protected:
+ axutil_env_t *env;
+
+ void SetUp() override {
+ axutil_allocator_t *allocator = axutil_allocator_init(NULL);
+ axutil_error_t *error = axutil_error_create(allocator);
+ axutil_log_t *log = axutil_log_create(allocator, NULL, NULL);
+ env = axutil_env_create_with_error_log(allocator, error, log);
+ ASSERT_NE(env, nullptr);
+ }
+
+ void TearDown() override {
+ if (env) {
+ axutil_env_free(env);
+ env = NULL;
+ }
+ }
+};
+
+/**
+ * Test that HTTP/2 transport constants are defined
+ */
+TEST_F(HTTPServiceProviderInterfaceTest, TransportConstantsDefined) {
+ /* Verify HTTP transport header constants exist */
+ EXPECT_NE(AXIS2_HTTP_HEADER_CONTENT_TYPE, nullptr);
+ EXPECT_NE(AXIS2_HTTP_HEADER_ACCEPT, nullptr);
+}
+
+/**
+ * Test environment creation for HTTP/2 mode
+ */
+TEST_F(HTTPServiceProviderInterfaceTest, EnvironmentCreation) {
+ ASSERT_NE(env, nullptr);
+ ASSERT_NE(env->allocator, nullptr);
+ ASSERT_NE(env->error, nullptr);
+}
+
+/**
+ * Test that WITH_NGHTTP2 is defined in HTTP/2 build
+ */
+TEST_F(HTTPServiceProviderInterfaceTest, HTTP2BuildEnabled) {
+#ifdef WITH_NGHTTP2
+ SUCCEED() << "HTTP/2 build enabled (WITH_NGHTTP2 defined)";
+#else
+ FAIL() << "HTTP/2 build not enabled - WITH_NGHTTP2 not defined";
+#endif
+}
+
+/**
+ * Test that JSON is enabled in HTTP/2 build
+ */
+TEST_F(HTTPServiceProviderInterfaceTest, JSONEnabled) {
+#ifdef AXIS2_JSON_ENABLED
+ SUCCEED() << "JSON enabled (AXIS2_JSON_ENABLED defined)";
+#else
+ FAIL() << "JSON not enabled - AXIS2_JSON_ENABLED not defined";
+#endif
+}
+
+/**
+ * Placeholder for future service provider interface tests
+ * These will test:
+ * - Service registration with JSON handlers
+ * - Request routing for HTTP/2 streams
+ * - Response generation without SOAP overhead
+ */
+TEST_F(HTTPServiceProviderInterfaceTest, ServiceProviderPlaceholder) {
+ /* Future tests will verify:
+ * 1. Service can be registered with JSON-only handler
+ * 2. Incoming HTTP/2 request is routed correctly
+ * 3. JSON response is generated without SOAP envelope overhead
+ * 4. Error handling produces JSON error responses
+ */
+ SUCCEED() << "Service provider interface tests - implementation pending";
+}