summaryrefslogtreecommitdiffstats
path: root/test/core
diff options
context:
space:
mode:
authorGravatar gmcdonald2010-02-13 01:32:03 +0000
committerGravatar gmcdonald2010-02-13 01:32:03 +0000
commit0425aadc78680e53000fd0108b540d6eca048516 (patch)
tree8ec7ab8e015d454c5ec586dfc91e05a2dce1cfc0 /test/core
downloadaxis2c-0425aadc78680e53000fd0108b540d6eca048516.tar.gz
axis2c-0425aadc78680e53000fd0108b540d6eca048516.tar.bz2
Moving axis svn, part of TLP move INFRA-2441
git-svn-id: http://svn.apache.org/repos/asf/axis/axis2/c/core/trunk@909681 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/core')
-rw-r--r--test/core/Makefile.am3
-rw-r--r--test/core/addr/Makefile.am21
-rw-r--r--test/core/addr/test_addr.c182
-rw-r--r--test/core/clientapi/Makefile.am49
-rw-r--r--test/core/clientapi/addr_echo.xml23
-rw-r--r--test/core/clientapi/echo.xml1
-rw-r--r--test/core/clientapi/test_client.c182
-rw-r--r--test/core/clientapi/test_clientapi.c119
-rw-r--r--test/core/clientapi/test_svc_client_handler_count.c22
-rw-r--r--test/core/context/Makefile.am21
-rw-r--r--test/core/context/test_context.c124
-rw-r--r--test/core/deployment/Makefile.am25
-rw-r--r--test/core/deployment/axis2.xml126
-rw-r--r--test/core/deployment/test_deployment.c360
-rw-r--r--test/core/description/Makefile.am26
-rw-r--r--test/core/description/test_description.c215
-rw-r--r--test/core/engine/Makefile.am25
-rw-r--r--test/core/engine/test_engine.c123
-rw-r--r--test/core/transport/Makefile.am1
-rw-r--r--test/core/transport/http/Makefile.am21
-rw-r--r--test/core/transport/http/test_http_transport.c274
21 files changed, 1943 insertions, 0 deletions
diff --git a/test/core/Makefile.am b/test/core/Makefile.am
new file mode 100644
index 0000000..3fa8f58
--- /dev/null
+++ b/test/core/Makefile.am
@@ -0,0 +1,3 @@
+TESTS =
+SUBDIRS = description context engine deployment addr transport clientapi
+
diff --git a/test/core/addr/Makefile.am b/test/core/addr/Makefile.am
new file mode 100644
index 0000000..9d42172
--- /dev/null
+++ b/test/core/addr/Makefile.am
@@ -0,0 +1,21 @@
+TESTS = test_addr
+check_PROGRAMS = test_addr
+noinst_PROGRAMS = test_addr
+SUBDIRS =
+AM_CFLAGS = -g -pthread
+test_addr_SOURCES = test_addr.c
+
+test_addr_LDADD = \
+ ../../../util/src/libaxutil.la \
+ ../../../axiom/src/om/libaxis2_axiom.la \
+ ../../../axiom/src/parser/$(WRAPPER_DIR)/libaxis2_parser.la \
+ $(top_builddir)/neethi/src/libneethi.la \
+ $(top_builddir)/src/core/engine/libaxis2_engine.la \
+ $(top_builddir)/src/core/transport/http/common/libaxis2_http_common.la
+
+INCLUDES = -I${CUTEST_HOME}/include \
+ -I$(top_builddir)/src/xml/guththila \
+ -I$(top_builddir)/include \
+ -I ../../../util/include \
+ -I ../../../axiom/include
+
diff --git a/test/core/addr/test_addr.c b/test/core/addr/test_addr.c
new file mode 100644
index 0000000..c013a57
--- /dev/null
+++ b/test/core/addr/test_addr.c
@@ -0,0 +1,182 @@
+
+/*
+ * 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.
+ */
+
+#include <axis2_msg_info_headers.h>
+#include <axutil_env.h>
+#include <axutil_allocator.h>
+#include <axis2_endpoint_ref.h>
+#include <stdio.h>
+
+int
+axis2_test_msg_info_headers(
+ )
+{
+ axis2_endpoint_ref_t *to = NULL;
+ axis2_endpoint_ref_t *from = NULL;
+ axis2_endpoint_ref_t *reply_to = NULL;
+ axis2_endpoint_ref_t *fault_to = NULL;
+ axis2_endpoint_ref_t *axis2_endpoint_ref = NULL;
+ axis2_status_t status = AXIS2_FAILURE;
+ axis2_msg_info_headers_t *axis2_msg_info_headers = NULL;
+ axutil_allocator_t *allocator = axutil_allocator_init(NULL);
+ const axutil_env_t *env = axutil_env_create(allocator);
+ const axis2_char_t *action = "test action";
+ const axis2_char_t *get_action = NULL;
+ to = axis2_endpoint_ref_create(env, "to");
+ from = axis2_endpoint_ref_create(env, "from");
+ reply_to = axis2_endpoint_ref_create(env, "reply to");
+ fault_to = axis2_endpoint_ref_create(env, "fault to");
+
+ axis2_msg_info_headers = axis2_msg_info_headers_create(env, NULL, action);
+ if (axis2_msg_info_headers)
+ printf("SUCCESS axis2_msg_info_headers_create\n");
+ else
+ {
+ printf("ERROR AXIS2_MSG_INFO_HEADERS_CREATE\n");
+ return -1;
+ }
+
+ status = axis2_msg_info_headers_set_to(axis2_msg_info_headers, env, to);
+
+ if (status == AXIS2_SUCCESS)
+ printf("SUCCESS axis2_msg_info_headers_set_to\n");
+ else
+ {
+ printf("ERROR axis2_msg_info_headers_set_to");
+ return -1;
+ }
+
+ axis2_endpoint_ref =
+ axis2_msg_info_headers_get_to(axis2_msg_info_headers, env);
+
+ if (axis2_endpoint_ref)
+ printf("SUCCESS axis2_msg_info_headers_get_to\n");
+ else
+ {
+ printf("ERROR axis2_msg_info_headers_get_to\n");
+ return -1;
+ }
+
+ status = AXIS2_FAILURE;
+ status = axis2_msg_info_headers_set_from(axis2_msg_info_headers, env, from);
+
+ if (status)
+ printf("SUCCESS axis2_msg_info_headers_set_from\n");
+ else
+ {
+ printf("ERROR axis2_msg_info_headers_set_from\n");
+ return -1;
+ }
+
+ axis2_endpoint_ref = NULL;
+ axis2_endpoint_ref =
+ axis2_msg_info_headers_get_from(axis2_msg_info_headers, env);
+
+ if (axis2_endpoint_ref)
+ printf("SUCCESS axis2_msg_info_headers_get_from\n");
+ else
+ {
+ printf("ERROR axis2_msg_info_headers_get_from\n");
+ return -1;
+ }
+
+ axis2_endpoint_ref = NULL;
+ axis2_endpoint_ref =
+ axis2_msg_info_headers_get_reply_to(axis2_msg_info_headers, env);
+
+ if (status)
+ printf("SUCCESS axis2_msg_info_headers_get_reply_to\n");
+ else
+ {
+ printf("ERROR axis2_msg_info_headers_get_reply_to\n");
+ return -1;
+ }
+
+ status = AXIS2_FAILURE;
+ status =
+ axis2_msg_info_headers_set_reply_to(axis2_msg_info_headers, env,
+ reply_to);
+
+ if (status)
+ printf("SUCCESS axis2_msg_info_headers_set_reply_to\n");
+ else
+ {
+ printf("ERROR axis2_msg_info_headers_set_reply_to\n");
+ return -1;
+ }
+
+ status = AXIS2_FAILURE;
+ status =
+ axis2_msg_info_headers_set_fault_to(axis2_msg_info_headers, env,
+ fault_to);
+ if (status)
+ printf("SUCCESS axis2_msg_info_headers_set_fault_to\n");
+ else
+ {
+ printf("ERROR axis2_msg_info_headers_set_fault_to\n");
+ return -1;
+ }
+
+ axis2_endpoint_ref = NULL;
+ axis2_endpoint_ref =
+ axis2_msg_info_headers_get_fault_to(axis2_msg_info_headers, env);
+ if (axis2_endpoint_ref)
+ printf("SUCCESS axis2_msg_info_headers_get_fault_to\n");
+ else
+ {
+ printf("ERROR axis2_msg_info_headers_get_fault_to\n");
+ return -1;
+ }
+
+ get_action = axis2_msg_info_headers_get_action(axis2_msg_info_headers, env);
+ if (get_action)
+ printf("SUCCESS axis2_msg_info_headers_get_action\n");
+ else
+ {
+ printf("ERROR axis2_msg_info_headers_get_action\n");
+ return -1;
+ }
+
+ status = AXIS2_FAILURE;
+ status =
+ axis2_msg_info_headers_set_action(axis2_msg_info_headers, env, action);
+ if (status)
+ printf("SUCCESS axis2_msg_info_headers_set_action\n");
+ else
+ {
+ printf("ERROR axis2_msg_info_headers_set_action\n");
+ }
+
+ status = AXIS2_FAILURE;
+ /* status = axis2_msg_info_headers_free(axis2_msg_info_headers, env); */
+ if (status)
+ printf("SUCCESS axis2_msg_info_headers_free\n");
+ else
+ {
+ printf("ERROR axis2_msg_info_headers_free\n");
+ }
+ return 0;
+}
+
+int
+main(
+ )
+{
+ axis2_test_msg_info_headers();
+ return 0;
+}
diff --git a/test/core/clientapi/Makefile.am b/test/core/clientapi/Makefile.am
new file mode 100644
index 0000000..e88c350
--- /dev/null
+++ b/test/core/clientapi/Makefile.am
@@ -0,0 +1,49 @@
+TESTS = test_client test_clientapi test_svc_client_handler_count
+noinst_PROGRAMS = test_client test_clientapi test_svc_client_handler_count
+check_PROGRAMS = test_client test_clientapi test_svc_client_handler_count
+SUBDIRS =
+AM_CFLAGS = -g -pthread
+test_client_SOURCES = test_client.c
+test_clientapi_SOURCES = test_clientapi.c
+test_svc_client_handler_count_SOURCES = test_svc_client_handler_count.c
+
+test_clientapi_LDADD = \
+ ../../../util/src/libaxutil.la \
+ ../../../axiom/src/om/libaxis2_axiom.la \
+ ../../../axiom/src/parser/$(WRAPPER_DIR)/libaxis2_parser.la \
+ $(top_builddir)/neethi/src/libneethi.la \
+ -lpthread \
+ $(top_builddir)/src/core/engine/libaxis2_engine.la \
+ $(top_builddir)/src/core/transport/http/sender/libaxis2_http_sender.la
+
+test_client_LDADD = \
+ ../../../util/src/libaxutil.la \
+ ../../../axiom/src/om/libaxis2_axiom.la \
+ ../../../axiom/src/parser/$(WRAPPER_DIR)/libaxis2_parser.la \
+ $(top_builddir)/neethi/src/libneethi.la \
+ -lpthread \
+ $(top_builddir)/src/core/engine/libaxis2_engine.la \
+ $(top_builddir)/src/core/transport/http/sender/libaxis2_http_sender.la
+
+test_svc_client_handler_count_LDADD = \
+ ../../../util/src/libaxutil.la \
+ ../../../axiom/src/om/libaxis2_axiom.la \
+ ../../../axiom/src/parser/$(WRAPPER_DIR)/libaxis2_parser.la \
+ $(top_builddir)/neethi/src/libneethi.la \
+ -lpthread \
+ $(top_builddir)/src/core/engine/libaxis2_engine.la \
+ $(top_builddir)/src/core/transport/http/sender/libaxis2_http_sender.la
+
+
+INCLUDES = -I${CUTEST_HOME}/include \
+ -I$(top_builddir)/include \
+ -I$(top_builddir)/src/core/description \
+ -I$(top_builddir)/src/core/context \
+ -I$(top_builddir)/src/core/phaseresolver \
+ -I$(top_builddir)/src/core/deployment \
+ -I$(top_builddir)/src/core/engine \
+ -I$(top_builddir)/src/core/clientapi \
+ -I ../../../util/include \
+ -I ../../../neethi/include \
+ -I ../../../axiom/include
+
diff --git a/test/core/clientapi/addr_echo.xml b/test/core/clientapi/addr_echo.xml
new file mode 100644
index 0000000..85284bf
--- /dev/null
+++ b/test/core/clientapi/addr_echo.xml
@@ -0,0 +1,23 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa=
+"http://schemas.xmlsoap.org/ws/2004/08/addressing">
+ <soapenv:Header>
+ <wsrm:Sequence xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm" soapenv:mustUnderstand="1">
+ <wsrm:Identifier>uuid:967F11455D2EC0EC9411374901147634</wsrm:Identifier>
+ <wsrm:MessageNumber>1</wsrm:MessageNumber>
+ <wsrm:LastMessage />
+ </wsrm:Sequence>
+ <wsa:To xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://127.0.0.1:9090/axis2/services/echo</wsa:To>
+ <wsa:Action xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://127.0.0.1:9090/axis2/services/echo/__OPERATION_OUT_IN__</wsa:Action>
+ <wsa:ReplyTo xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
+ <wsa:Address>http://192.168.1.217:9090/axis2/services/__ANONYMOUS_SERVICE__/__OPERATION_OUT_IN__</wsa:Address>
+ </wsa:ReplyTo>
+ <wsa:MessageID xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">38DDECF77196B604F511374901138822
+ </wsa:MessageID>
+ </soapenv:Header>
+ <soapenv:Body>
+ <echoString xmlns="">
+ <text xmlns="">echo5</text>
+ </echoString>
+ </soapenv:Body>
+ </soapenv:Envelope> \ No newline at end of file
diff --git a/test/core/clientapi/echo.xml b/test/core/clientapi/echo.xml
new file mode 100644
index 0000000..fad1895
--- /dev/null
+++ b/test/core/clientapi/echo.xml
@@ -0,0 +1 @@
+<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><echoString><text>echo5</text></echoString></soapenv:Body></soapenv:Envelope>
diff --git a/test/core/clientapi/test_client.c b/test/core/clientapi/test_client.c
new file mode 100644
index 0000000..83a417e
--- /dev/null
+++ b/test/core/clientapi/test_client.c
@@ -0,0 +1,182 @@
+
+/*
+ * 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.
+ */
+
+#include <stdio.h>
+#include <strings.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <axis2_const.h>
+#include <stdlib.h>
+
+/* Function prototypes */
+int write_to_socket(
+ const char *address,
+ const char *port,
+ const char *filename,
+ const char *endpoint);
+
+/* End of function prototypes */
+
+void
+error(
+ const char *msg)
+{
+ perror(msg);
+ exit(0);
+}
+
+int
+main(
+ int argc,
+ char *argv[])
+{
+ const axis2_char_t *hostname = "localhost";
+ const axis2_char_t *port = "9090";
+ const axis2_char_t *filename = "echo.xml";
+ const axis2_char_t *endpoint = "/axis2/services/echo/echo";
+ int c;
+ extern char *optarg;
+
+ while ((c = getopt(argc, argv, ":h:p:f:e:")) != -1)
+ {
+ switch (c)
+ {
+ case 'h':
+ hostname = optarg;
+ break;
+ case 'p':
+ port = optarg;
+ break;
+ case 'f':
+ filename = optarg;
+ break;
+ case 'e':
+ endpoint = optarg;
+ break;
+ }
+ }
+
+ write_to_socket(hostname, port, filename, endpoint);
+ return 0;
+}
+
+int
+write_to_socket(
+ const char *address,
+ const char *port,
+ const char *filename,
+ const char *endpoint)
+{
+ axis2_char_t buffer_l[4999];
+ int sockfd,
+ portno,
+ n,
+ i;
+ struct sockaddr_in serv_addr;
+ struct hostent *server;
+ struct stat buf;
+ axis2_char_t *buffer;
+ axis2_char_t tmpstr[10];
+ int bufsize = 0;
+
+ portno = atoi(port);
+ sockfd = socket(AF_INET, SOCK_STREAM, 0);
+ if (sockfd < 0)
+ error("ERROR opening socket");
+ server = gethostbyname(address);
+ if (server == NULL)
+ {
+ fprintf(stderr, "ERROR, no such host\n");
+ exit(0);
+ }
+ bzero((char *) &serv_addr, sizeof(serv_addr));
+ serv_addr.sin_family = AF_INET;
+ bcopy((char *) server->h_addr,
+ (char *) &serv_addr.sin_addr.s_addr, server->h_length);
+ serv_addr.sin_port = htons(portno);
+ if (connect(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0)
+ error("ERROR connecting");
+
+ /* Read from file */
+ stat(filename, &buf);
+ bufsize = (buf.st_size + 1) * sizeof(char);
+ buffer = (char *) malloc(bufsize);
+ int fd = open(filename, O_RDONLY, 0);
+ if (fd == -1)
+ {
+ printf("can't open file %s\n", filename);
+ return -1;
+ }
+ else
+ printf("opened file %s\n", filename);
+
+ i = read(fd, buffer, bufsize - 1);
+ if (i > 0)
+ {
+ buffer[i] = '\0';
+ printf("%s...\n", buffer);
+ }
+ sprintf(buffer_l,
+ "POST %s HTTP/1.1\r\nUser-Agent: Axis/2.0/C\r\nConnection: Keep-Alive\r\nHost: ",
+ endpoint);
+ strcat(buffer_l, address);
+ strcat(buffer_l, ":");
+ strcat(buffer_l, port);
+ strcat(buffer_l, "\r\n");
+ strcat(buffer_l, "Content-Length: ");
+ sprintf(tmpstr, "%d", (int) strlen(buffer));
+ strcat(buffer_l, tmpstr);
+ strcat(buffer_l, "\r\n");
+ /*strcat(buffer_l, "SOAPAction: http://localhost:9090/axis2/services/echo/echo\r\n"); */
+ strcat(buffer_l, "Content-Type: application/soap+xml;\r\n");
+ strcat(buffer_l, "\r\n");
+
+ printf("Writing buffer_1...\n%s", buffer_l);
+ n = write(sockfd, buffer_l, strlen(buffer_l));
+
+ n = write(sockfd, buffer, strlen(buffer));
+ if (n < 0)
+ error("ERROR writing to socket");
+
+ printf("Done writing to server\n");
+
+ buffer[0] = '\0';
+
+ printf("Reading the reply from server :\n");
+ while ((n = read(sockfd, buffer, bufsize - 1)) > 0)
+ {
+ buffer[n] = '\0';
+ printf("%s", buffer);
+ }
+ printf("\nReading from server done ...\n");
+
+ if (n < 0)
+ {
+ error("ERROR reading from socket");
+ buffer[0] = '\0';
+ }
+ free(buffer);
+ return 0;
+}
diff --git a/test/core/clientapi/test_clientapi.c b/test/core/clientapi/test_clientapi.c
new file mode 100644
index 0000000..e20d44a
--- /dev/null
+++ b/test/core/clientapi/test_clientapi.c
@@ -0,0 +1,119 @@
+
+/*
+ * 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.
+ */
+
+#include <axis2_const.h>
+#include <axutil_env.h>
+#include <axis2_engine.h>
+#include <axutil_allocator.h>
+#include <axis2_svc_client.h>
+#include <axis2_options.h>
+#include <platforms/axutil_platform_auto_sense.h>
+
+axiom_node_t *build_om_payload_for_echo_svc(
+ const axutil_env_t * env,
+ const axis2_char_t * echo_str);
+
+void
+axis2_test_svc_client_blocking(
+ )
+{
+ axutil_env_t *env = NULL;
+ axis2_options_t *options = NULL;
+ const axis2_char_t *client_home = NULL;
+ axis2_svc_client_t *svc_client = NULL;
+ axiom_node_t *payload = NULL;
+ axiom_node_t *ret_node = NULL;
+ const axis2_char_t *address = NULL;
+ axis2_endpoint_ref_t *endpoint_ref = NULL;
+
+ axutil_allocator_t *allocator = axutil_allocator_init(NULL);
+ env = axutil_env_create(allocator);
+ axiom_element_t *result_ele = NULL;
+ const axis2_char_t *echo_text = "echo_text";
+ axis2_char_t *result = NULL;
+
+ address = "http://localhost:9090/axis2/services/echo/echo";
+ endpoint_ref = axis2_endpoint_ref_create(env, address);
+ client_home = AXIS2_GETENV("AXIS2C_HOME");
+ if (!client_home)
+ client_home = "../../deploy";
+
+ svc_client = axis2_svc_client_create(env, client_home);
+
+ if (!svc_client)
+ {
+ printf("axis2_test axis2_svc_client_create FAILURE\n");
+ printf
+ ("Client repository path not properly set. Please check AXIS2C_HOME setting\n");
+ return;
+ }
+
+ options = axis2_options_create(env);
+ axis2_options_set_to(options, env, endpoint_ref);
+ axis2_svc_client_set_options(svc_client, env, options);
+
+ payload = build_om_payload_for_echo_svc(env, echo_text);
+ ret_node = axis2_svc_client_send_receive(svc_client, env, payload);
+ if (ret_node)
+ {
+ if (axiom_node_get_node_type(ret_node, env) == AXIOM_ELEMENT)
+ {
+ ret_node = axiom_node_get_first_child(ret_node, env);
+ result_ele =
+ (axiom_element_t *) axiom_node_get_data_element(ret_node, env);
+ result = axiom_element_get_text(result_ele, env, ret_node);
+ if (!strcmp(result, echo_text))
+ printf("axis2_test SVC_CLIENT_SEND_RECEIVE SUCCESS\n");
+ else
+ printf("axis2_test SVC_CLIENT_SEND_RECEIVE FAILURE\n");
+ }
+ }
+ axis2_svc_client_free(svc_client, env);
+}
+
+/* build SOAP request message content using OM */
+axiom_node_t *
+build_om_payload_for_echo_svc(
+ const axutil_env_t * env,
+ const axis2_char_t * echo_text)
+{
+ axiom_node_t *echo_om_node = NULL;
+ axiom_element_t *echo_om_ele = NULL;
+ axiom_node_t *text_om_node = NULL;
+ axiom_element_t *text_om_ele = NULL;
+ axiom_namespace_t *ns1 = NULL;
+
+ ns1 =
+ axiom_namespace_create(env, "http://ws.apache.org/axis2/c/samples",
+ "ns1");
+ echo_om_ele =
+ axiom_element_create(env, NULL, "echoString", ns1, &echo_om_node);
+ text_om_ele =
+ axiom_element_create(env, echo_om_node, "text", NULL, &text_om_node);
+ axiom_element_set_text(text_om_ele, env, echo_text, text_om_node);
+
+ return echo_om_node;
+}
+
+int
+main(
+ )
+{
+ axis2_test_svc_client_blocking();
+ return 0;
+}
diff --git a/test/core/clientapi/test_svc_client_handler_count.c b/test/core/clientapi/test_svc_client_handler_count.c
new file mode 100644
index 0000000..a4904dd
--- /dev/null
+++ b/test/core/clientapi/test_svc_client_handler_count.c
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include <axis2_util.h>
+#include <axis2_client.h>
+
+int
+main(
+ )
+{
+ axutil_env_t *env =
+ axutil_env_create_all("hello_client.log", AXIS2_LOG_LEVEL_TRACE);
+ const int TIMES = 1000;
+ int i;
+ for (i = 1; i <= TIMES; ++i)
+ {
+ printf("%d\n", i);
+ axis2_svc_client_t *svc_client =
+ axis2_svc_client_create(env, AXIS2_GETENV("AXIS2C_HOME"));
+ axis2_svc_client_free(svc_client, env);
+ }
+ axutil_env_free(env);
+ return 0;
+}
diff --git a/test/core/context/Makefile.am b/test/core/context/Makefile.am
new file mode 100644
index 0000000..01642e2
--- /dev/null
+++ b/test/core/context/Makefile.am
@@ -0,0 +1,21 @@
+TESTS = test_context
+check_PROGRAMS = test_context
+noinst_PROGRAMS = test_context
+SUBDIRS =
+AM_CFLAGS = -g -pthread
+test_context_SOURCES = test_context.c
+
+
+test_context_LDADD = ../../../util/src/libaxutil.la \
+ ../../../axiom/src/om/libaxis2_axiom.la \
+ ../../../axiom/src/parser/$(WRAPPER_DIR)/libaxis2_parser.la \
+ $(top_builddir)/src/core/engine/libaxis2_engine.la \
+ $(top_builddir)/src/core/transport/http/common/libaxis2_http_common.la \
+ $(top_builddir)/neethi/src/libneethi.la
+
+INCLUDES = -I${CUTEST_HOME}/include \
+ -I$(top_builddir)/src/xml/guththila/src \
+ -I$(top_builddir)/include \
+ -I$(top_builddir)/src/core/description \
+ -I ../../../util/include \
+ -I ../../../axiom/include
diff --git a/test/core/context/test_context.c b/test/core/context/test_context.c
new file mode 100644
index 0000000..253691a
--- /dev/null
+++ b/test/core/context/test_context.c
@@ -0,0 +1,124 @@
+
+/*
+ * 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.
+ */
+
+#include <axis2_conf_ctx.h>
+#include <axis2_svc_grp.h>
+#include <axis2_const.h>
+#include <axutil_allocator.h>
+#include <axutil_env.h>
+#include <stdio.h>
+
+void
+axis2_test_conf_ctx_init(
+ )
+{
+ struct axis2_conf *conf = NULL;
+ struct axis2_svc_grp_ctx *svc_grp_ctx1 = NULL;
+ struct axis2_svc_grp_ctx *svc_grp_ctx2 = NULL;
+ struct axis2_svc_grp *svc_grp1 = NULL;
+ struct axis2_svc_grp *svc_grp2 = NULL;
+ struct axis2_conf_ctx *conf_ctx = NULL;
+ struct axis2_svc_ctx *svc_ctx1 = NULL;
+ struct axis2_svc_ctx *svc_ctx2 = NULL;
+ struct axis2_svc *svc1 = NULL;
+ struct axis2_svc *svc2 = NULL;
+ struct axutil_qname *qname1 = NULL;
+ struct axutil_qname *qname2 = NULL;
+ struct axis2_op_ctx *op_ctx1 = NULL;
+ struct axis2_op_ctx *op_ctx2 = NULL;
+ struct axis2_op *op = NULL;
+ struct axutil_hash_t *op_ctx_map = NULL;
+ struct axutil_hash_t *svc_ctx_map = NULL;
+ struct axutil_hash_t *svc_grp_ctx_map = NULL;
+
+ axis2_status_t status = AXIS2_FAILURE;
+ axutil_allocator_t *allocator = axutil_allocator_init(NULL);
+ const axutil_env_t *env = axutil_env_create(allocator);
+
+ conf = axis2_conf_create(env);
+
+ op = axis2_op_create(env);
+
+ conf_ctx = axis2_conf_ctx_create(env, conf);
+
+ svc_grp1 = axis2_svc_grp_create(env);
+ svc_grp2 = axis2_svc_grp_create(env);
+
+ svc_grp_ctx1 = axis2_svc_grp_ctx_create(env, svc_grp1, conf_ctx);
+ svc_grp_ctx2 = axis2_svc_grp_ctx_create(env, svc_grp2, conf_ctx);
+
+ qname1 = axutil_qname_create(env, "name1", NULL, NULL);
+ qname2 = axutil_qname_create(env, "name2", NULL, NULL);
+
+ svc1 = axis2_svc_create_with_qname(env, qname1);
+ svc2 = axis2_svc_create_with_qname(env, qname2);
+
+ svc_ctx1 = axis2_svc_ctx_create(env, svc1, svc_grp_ctx1);
+ svc_ctx2 = axis2_svc_ctx_create(env, svc2, svc_grp_ctx2);
+
+ op = axis2_op_create(env);
+ op_ctx1 = axis2_op_ctx_create(env, op, svc_ctx1);
+ op_ctx2 = axis2_op_ctx_create(env, op, svc_ctx2);
+
+ op_ctx_map = axis2_conf_ctx_get_op_ctx_map(conf_ctx, env);
+
+ if (op_ctx_map)
+ {
+ axutil_hash_set(op_ctx_map, "op_ctx1", AXIS2_HASH_KEY_STRING, op_ctx1);
+ axutil_hash_set(op_ctx_map, "op_ctx2", AXIS2_HASH_KEY_STRING, op_ctx2);
+ }
+
+ svc_ctx_map = axis2_conf_ctx_get_svc_ctx_map(conf_ctx, env);
+
+ if (svc_ctx_map)
+ {
+ axutil_hash_set(svc_ctx_map, "svc_ctx1", AXIS2_HASH_KEY_STRING,
+ svc_ctx1);
+ axutil_hash_set(svc_ctx_map, "svc_ctx2", AXIS2_HASH_KEY_STRING,
+ svc_ctx2);
+ }
+
+ svc_grp_ctx_map = axis2_conf_ctx_get_svc_grp_ctx_map(conf_ctx, env);
+
+ if (svc_grp_ctx_map)
+ {
+ axutil_hash_set(svc_ctx_map, "svc_grp_ctx1", AXIS2_HASH_KEY_STRING,
+ svc_grp_ctx1);
+ axutil_hash_set(svc_ctx_map, "svc_grp_ctx2", AXIS2_HASH_KEY_STRING,
+ svc_grp_ctx2);
+ }
+
+ status = axis2_conf_ctx_init(conf_ctx, env, conf);
+
+ if (status != AXIS2_SUCCESS)
+ {
+ printf("ERROR %d\n", status);
+ }
+ else
+ printf("SUCCESS\n");
+
+ axis2_conf_ctx_free(conf_ctx, env);
+}
+
+int
+main(
+ )
+{
+ axis2_test_conf_ctx_init();
+ return 0;
+}
diff --git a/test/core/deployment/Makefile.am b/test/core/deployment/Makefile.am
new file mode 100644
index 0000000..298457d
--- /dev/null
+++ b/test/core/deployment/Makefile.am
@@ -0,0 +1,25 @@
+TESTS = test_deployment
+noinst_PROGRAMS = test_deployment
+SUBDIRS =
+AM_CFLAGS = $(CFLAGS) -g -pthread
+test_deployment_SOURCES = test_deployment.c
+
+test_deployment_LDADD = \
+ ../../../util/src/libaxutil.la \
+ ../../../axiom/src/om/libaxis2_axiom.la \
+ ../../../axiom/src/parser/$(WRAPPER_DIR)/libaxis2_parser.la \
+ $(top_builddir)/neethi/src/libneethi.la \
+ $(top_builddir)/src/core/engine/libaxis2_engine.la \
+ $(top_builddir)/src/core/transport/http/common/libaxis2_http_common.la
+
+INCLUDES = -I$(top_builddir)/include \
+ -I$(top_builddir)/src/core/description \
+ -I$(top_builddir)/src/core/context \
+ -I$(top_builddir)/src/core/phaseresolver \
+ -I$(top_builddir)/src/core/deployment \
+ -I$(top_builddir)/src/core/engine \
+ -I$(top_builddir)/src/core/clientapi \
+ -I$(top_builddir)/src/core/util \
+ -I ../../../util/include \
+ -I ../../../axiom/include \
+ -I ../../../neethi/include
diff --git a/test/core/deployment/axis2.xml b/test/core/deployment/axis2.xml
new file mode 100644
index 0000000..fb4ccc4
--- /dev/null
+++ b/test/core/deployment/axis2.xml
@@ -0,0 +1,126 @@
+<axisconfig name="AxisJava2.0">
+ <!-- ================================================= -->
+ <!-- Parameters -->
+ <!-- ================================================= -->
+ <parameter name="hotdeployment" locked="false">true</parameter>
+ <parameter name="hotupdate" locked="false">false</parameter>
+ <parameter name="enableMTOM" locked="false">true</parameter>
+ <!-- Uncomment this to enable REST support -->
+ <!-- <parameter name="enableREST" locked="false">true</parameter>-->
+
+
+ <parameter name="userName" locked="false">admin</parameter>
+ <parameter name="password" locked="false">axis2</parameter>
+
+ <parameter name="seralizeLocation" locked="false">.</parameter>
+
+
+
+ <!--if you want to extract the service archive file and work with that please uncomment this-->
+ <!--else , it wont extract archive file or does not take into consideration if someone drop-->
+ <!--exploded directory into /service directory-->
+ <!--<parameter name="extractServiceArchive" locked="false">true</parameter>-->
+
+
+<!-- The way of adding listener to the system-->
+<!-- <listener class="org.apache.axis2.ObserverIMPL">-->
+<!-- <parameter name="RSS_URL" locked="false">http://127.0.0.1/rss</parameter>-->
+<!-- </listener>-->
+
+ <!--Registering Axis Storage Class if you comment this default one will -->
+ <!--does the job (org.apache.axis2.storage.impl.AxisMemoryStorage) , if you-->
+ <!--want to register new one write a class by extanding AbastractStorage-->
+ <!--and put that name here-->
+ <axisStorage class="org.apache.axis2.storage.impl.AxisMemoryStorage">
+ <parameter name="StoreLocation" locked="false">N:S</parameter>
+ </axisStorage>
+
+
+
+ <!-- ================================================= -->
+ <!-- Message Receivers -->
+ <!-- ================================================= -->
+ <!-- This is the Deafult Message Receiver for the Request Response style Operations -->
+ <messageReceiver mep="INOUT" class="axis2_raw_xml_in_out_msg_recv">
+
+ <!-- ================================================= -->
+ <!-- Transport Ins -->
+ <!-- ================================================= -->
+ <transportReceiver name="http" class="org.apache.axis2.transport.http.SimpleHTTPServer">
+ <parameter name="port" locked="false">6060</parameter>
+ </transportReceiver>
+
+ <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver
+ <transportReceiver name="mail" class="org.apache.axis2.transport.mail.SimpleMailListener">
+ <parameter name="transport.mail.pop3.host" locked="false">127.0.0.1</parameter>
+ <parameter name="transport.mail.pop3.user" locked="false">axis2</parameter>
+ <parameter name="transport.mail.pop3.password" locked="false">axis2</parameter>
+ <parameter name="transport.mail.pop3.port" locked="false">110</parameter>
+ <parameter name="transport.mail.replyToAddress" locked="false">axis2@127.0.0.1</parameter>
+ </transportReceiver> -->
+
+ <transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPServer">
+ <parameter name="port" locked="false">6060</parameter>
+ </transportReceiver>
+
+ <!-- ================================================= -->
+ <!-- Transport Outs -->
+ <!-- ================================================= -->
+
+ <transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender"/>
+ <transportSender name="local" class="org.apache.axis2.transport.local.LocalTransportSender"/>
+ <transportSender name="http" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+ <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+ </transportSender>
+ <transportSender name="https" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+ <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+ </transportSender>
+
+ <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver
+ <transportSender name="mail" class="org.apache.axis2.transport.mail.MailTransportSender">
+ <parameter name="transport.mail.smtp.host" locked="false">127.0.0.1</parameter>
+ <parameter name="transport.mail.smtp.user" locked="false">axis2</parameter>
+ <parameter name="transport.mail.smtp.password" locked="false">axis2</parameter>
+ <parameter name="transport.mail.smtp.port" locked="false">25</parameter>
+ </transportSender>
+ -->
+
+ <!-- ================================================= -->
+ <!-- Global Modules -->
+ <!-- ================================================= -->
+ <!-- Comment this to disable Addressing -->
+ <module ref="addressing"/>
+
+
+ <!--Configuring module , providing paramters for modules whether they refer or not-->
+ <!--<moduleConfig name="addressing">-->
+ <!--<parameter name="addressingPara" locked="false">N/A</parameter>-->
+ <!--</moduleConfig>-->
+
+ <!-- ================================================= -->
+ <!-- Phases -->
+ <!-- ================================================= -->
+ <phaseOrder type="inflow">
+ <!-- System pre defined phases -->
+ <phase name="TransportIn"/>
+ <phase name="PreDispatch"/>
+ <phase name="Dispatch"/>
+ <phase name="PostDispatch"/>
+ <!-- System pre defined phases -->
+ <!-- After Postdispatch phase module author or or service author can add any phase he want -->
+ <phase name="userphase1"/>
+ </phaseOrder>
+ <phaseOrder type="outflow">
+ <!-- user can add his own phases to this area -->
+ <phase name="userphase1"/>
+ </phaseOrder>
+ <phaseOrder type="INfaultflow">
+ <!-- user can add his own phases to this area -->
+ <phase name="userphase1"/>
+ </phaseOrder>
+ <phaseOrder type="Outfaultflow">
+ <!-- user can add his own phases to this area -->
+ <phase name="userphase1"/>
+ </phaseOrder>
+</axisconfig>
+
diff --git a/test/core/deployment/test_deployment.c b/test/core/deployment/test_deployment.c
new file mode 100644
index 0000000..d0730d8
--- /dev/null
+++ b/test/core/deployment/test_deployment.c
@@ -0,0 +1,360 @@
+
+/*
+ * 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.
+ */
+
+#include <stdio.h>
+#include <axis2_op.h>
+#include <axis2_module_desc.h>
+#include <axis2_phases_info.h>
+#include <stdio.h>
+#include <axis2_op.h>
+#include <axis2_dep_engine.h>
+#include <axutil_env.h>
+#include <axutil_allocator.h>
+#include <axutil_class_loader.h>
+#include <axutil_error_default.h>
+#include <axutil_log_default.h>
+#include <axis2_transport_sender.h>
+#include <axis2_transport_receiver.h>
+#include <axis2_core_utils.h>
+
+const axutil_env_t *env = NULL;
+
+int
+axis2_test_dep_engine_load(
+ )
+{
+ axis2_dep_engine_t *dep_engine = NULL;
+ axis2_conf_t *conf = NULL;
+ axutil_hash_t *svc_map = NULL;
+ axutil_array_list_t *in_phases = NULL;
+ axis2_char_t *axis2c_home = NULL;
+
+ printf("******************************************\n");
+ printf("testing dep_engine_load method \n");
+ printf("******************************************\n");
+
+ axis2c_home = AXIS2_GETENV("AXIS2C_HOME");
+ dep_engine = axis2_dep_engine_create_with_repos_name(env, axis2c_home);
+ if (!dep_engine)
+ {
+ printf("dep engine is not created \n");
+ return -1;
+ }
+ conf = axis2_dep_engine_load(dep_engine, env);
+ axis2_conf_set_dep_engine(conf, env, dep_engine);
+ if (!conf)
+ {
+ printf("conf is NULL\n)");
+ return -1;
+ }
+
+ svc_map = axis2_conf_get_all_svcs(conf, env);
+ if (svc_map)
+ printf("svc_map count = %d\n", axutil_hash_count(svc_map));
+ else
+ printf("svc_map count = zero\n");
+
+ if (svc_map)
+ {
+ axutil_hash_index_t *hi = NULL;
+ void *service = NULL;
+ for (hi = axutil_hash_first(svc_map, env);
+ hi; hi = axutil_hash_next(env, hi))
+ {
+ axutil_hash_t *ops = NULL;
+ axis2_svc_t *svc = NULL;
+ axutil_param_t *impl_info_param = NULL;
+
+ axutil_hash_this(hi, NULL, NULL, &service);
+ svc = (axis2_svc_t *) service;
+ impl_info_param =
+ axis2_svc_get_param(svc, env, AXIS2_SERVICE_CLASS);
+ if (!impl_info_param)
+ {
+ printf("imple_info_param is null\n");
+ }
+ ops = axis2_svc_get_all_ops(svc, env);
+ if (ops)
+ {
+ printf("ops count = %d\n", axutil_hash_count(ops));
+
+ axutil_hash_index_t *hi2 = NULL;
+ void *op = NULL;
+ axis2_char_t *oname = NULL;
+
+ for (hi2 = axutil_hash_first(ops, env); hi2;
+ hi2 = axutil_hash_next(env, hi2))
+ {
+ if (!hi2)
+ break;
+ axutil_hash_this(hi2, NULL, NULL, &op);
+ if (op)
+ {
+ const axutil_qname_t *qname = NULL;
+ qname = axis2_op_get_qname((axis2_op_t *) op, env);
+ oname = axutil_qname_get_localpart(qname, env);
+ printf("op name = %s\n", oname);
+ }
+ }
+ }
+ else
+ printf("ops count = zero\n");
+ }
+ }
+
+ in_phases =
+ axis2_conf_get_in_phases_upto_and_including_post_dispatch(conf, env);
+ if (!in_phases)
+ {
+ printf("in phases up to and including post dispatch is NULL\n");
+ }
+ else
+ {
+ printf("dep engine load is successfull\n");
+ }
+ axis2_conf_free(conf, env);
+
+ return 0;
+}
+
+int
+axis2_test_transport_receiver_load(
+ )
+{
+ axutil_dll_desc_t *dll_desc = NULL;
+ axis2_char_t *dll_name = NULL;
+ axis2_transport_receiver_t *transport_recv = NULL;
+ axutil_param_t *impl_info_param = NULL;
+ axis2_bool_t is_running = AXIS2_FALSE;
+ axis2_char_t *axis2c_home = NULL;
+
+ printf("******************************************\n");
+ printf("testing axis2_transport_recv load\n");
+ printf("******************************************\n");
+
+ dll_desc = axutil_dll_desc_create(env);
+
+ axis2c_home = AXIS2_GETENV("AXIS2C_HOME");
+ dll_name =
+ axutil_stracat(env, axis2c_home, "/lib/libaxis2_http_receiver.so");
+ printf("transport receiver name:%s\n", dll_name);
+ axutil_dll_desc_set_name(dll_desc, env, dll_name);
+ axutil_dll_desc_set_type(dll_desc, env, AXIS2_TRANSPORT_RECV_DLL);
+ impl_info_param = axutil_param_create(env, NULL, NULL);
+ axutil_param_set_value(impl_info_param, env, dll_desc);
+ axutil_class_loader_init(env);
+ transport_recv =
+ (axis2_transport_receiver_t *) axutil_class_loader_create_dll(env,
+ impl_info_param);
+ is_running = axis2_transport_receiver_is_running(transport_recv, env);
+ printf("is_running:%d\n", is_running);
+ AXIS2_FREE(env->allocator, dll_name);
+ printf("transport receiver load test successful\n");
+ return 0;
+}
+
+int
+axis2_test_transport_sender_load(
+ )
+{
+ axutil_dll_desc_t *dll_desc = NULL;
+ axis2_char_t *dll_name = NULL;
+ axis2_transport_sender_t *transport_sender = NULL;
+ axutil_param_t *impl_info_param = NULL;
+ axis2_char_t *axis2c_home = NULL;
+ axis2_msg_ctx_t *msg_ctx = NULL;
+
+ printf("******************************************\n");
+ printf("testing axis2_transport_sender load\n");
+ printf("******************************************\n");
+
+ msg_ctx = (axis2_msg_ctx_t *) AXIS2_MALLOC(env->allocator, 5);
+ dll_desc = axutil_dll_desc_create(env);
+
+ axis2c_home = AXIS2_GETENV("AXIS2C_HOME");
+ dll_name = axutil_stracat(env, axis2c_home, "/lib/libaxis2_http_sender.so");
+ printf("transport sender name:%s\n", dll_name);
+ axutil_dll_desc_set_name(dll_desc, env, dll_name);
+ axutil_dll_desc_set_type(dll_desc, env, AXIS2_TRANSPORT_SENDER_DLL);
+ impl_info_param = axutil_param_create(env, NULL, NULL);
+ axutil_param_set_value(impl_info_param, env, dll_desc);
+ axutil_class_loader_init(env);
+ transport_sender =
+ (axis2_transport_sender_t *) axutil_class_loader_create_dll(env,
+ impl_info_param);
+
+ AXIS2_FREE(env->allocator, dll_name);
+ printf("transport sender load test successful\n");
+ return 0;
+}
+
+int
+axis2_test_default_module_version(
+ )
+{
+
+ axis2_conf_t *axis_conf = NULL;
+ axutil_qname_t *mod_qname1 = NULL;
+ axutil_qname_t *mod_qname2 = NULL;
+ axutil_qname_t *mod_qname3 = NULL;
+ axutil_qname_t *mod_qname4 = NULL;
+ axutil_qname_t *mod_qname5 = NULL;
+ axis2_module_desc_t *module1 = NULL;
+ axis2_module_desc_t *module2 = NULL;
+ axis2_module_desc_t *module3 = NULL;
+ axis2_module_desc_t *module4 = NULL;
+ axis2_module_desc_t *module5 = NULL;
+ axis2_module_desc_t *def_mod = NULL;
+ axutil_array_list_t *engaged_modules = NULL;
+ axutil_qname_t *engage_qname = NULL;
+ axis2_bool_t found1 = AXIS2_FALSE;
+ axis2_bool_t found2 = AXIS2_FALSE;
+ axis2_bool_t found3 = AXIS2_FALSE;
+
+ printf("******************************************\n");
+ printf("testing axis2_default_module_version\n");
+ printf("******************************************\n");
+
+ axis_conf = axis2_conf_create(env);
+ mod_qname1 = axutil_qname_create(env, "module1", NULL, NULL);
+ module1 = axis2_module_desc_create_with_qname(env, mod_qname1);
+ axis2_conf_add_module(axis_conf, env, module1);
+
+ mod_qname2 = axutil_qname_create(env, "module2-0.90", NULL, NULL);
+ module2 = axis2_module_desc_create_with_qname(env, mod_qname2);
+ axis2_conf_add_module(axis_conf, env, module2);
+
+ mod_qname3 = axutil_qname_create(env, "module2-0.92", NULL, NULL);
+ module3 = axis2_module_desc_create_with_qname(env, mod_qname3);
+ axis2_conf_add_module(axis_conf, env, module3);
+
+ mod_qname4 = axutil_qname_create(env, "module2-0.91", NULL, NULL);
+ module4 = axis2_module_desc_create_with_qname(env, mod_qname4);
+ axis2_conf_add_module(axis_conf, env, module4);
+
+ mod_qname5 = axutil_qname_create(env, "test_module-1.92", NULL, NULL);
+ module5 = axis2_module_desc_create_with_qname(env, mod_qname5);
+ axis2_conf_add_module(axis_conf, env, module5);
+
+ axis2_core_utils_calculate_default_module_version(env,
+ axis2_conf_get_all_modules
+ (axis_conf, env),
+ axis_conf);
+ def_mod = axis2_conf_get_default_module(axis_conf, env, "module1");
+ if (def_mod != module1)
+ {
+ printf("axis2_default_module_version (module1) .. FAILED\n");
+ return AXIS2_FAILURE;
+ }
+ def_mod = axis2_conf_get_default_module(axis_conf, env, "module2");
+ if (def_mod != module3)
+ {
+ printf("axis2_default_module_version (module2) .. FAILED\n");
+ return AXIS2_FAILURE;
+ }
+ def_mod = axis2_conf_get_default_module(axis_conf, env, "test_module");
+ if (def_mod != module5)
+ {
+ printf("axis2_default_module_version (test_module) .. FAILED\n");
+ return AXIS2_FAILURE;
+ }
+ engage_qname = axutil_qname_create(env, "module2", NULL, NULL);
+ axis2_conf_engage_module(axis_conf, env, engage_qname);
+ axutil_qname_free(engage_qname, env);
+ engage_qname = NULL;
+
+ engage_qname = axutil_qname_create(env, "module1", NULL, NULL);
+ axis2_conf_engage_module(axis_conf, env, engage_qname);
+ axutil_qname_free(engage_qname, env);
+ engage_qname = NULL;
+
+ axis2_conf_engage_module_with_version(axis_conf, env, "test_module",
+ "1.92");
+
+ engaged_modules = axis2_conf_get_all_engaged_modules(axis_conf, env);
+
+ if (engaged_modules)
+ {
+ int list_size = 0;
+ int i = 0;
+ list_size = axutil_array_list_size(engaged_modules, env);
+ for (i = 0; i < list_size; i++)
+ {
+ axutil_qname_t *engaged_mod_qname = NULL;
+ engaged_mod_qname = axutil_array_list_get(engaged_modules, env, i);
+ if (0 == axutil_strcmp("module2-0.92",
+ axutil_qname_get_localpart(engaged_mod_qname,
+ env)))
+ {
+ found1 = AXIS2_TRUE;
+ }
+ if (0 == axutil_strcmp("module1",
+ axutil_qname_get_localpart(engaged_mod_qname,
+ env)))
+ {
+ found2 = AXIS2_TRUE;
+ }
+ if (0 == axutil_strcmp("test_module-1.92",
+ axutil_qname_get_localpart(engaged_mod_qname,
+ env)))
+ {
+ found3 = AXIS2_TRUE;
+ }
+
+ }
+ }
+ if (AXIS2_FALSE == found1)
+ {
+ printf("axis2_default_module_version (module2 engaging) .. FAILED\n");
+ return AXIS2_FAILURE;
+ }
+ if (AXIS2_FALSE == found2)
+ {
+ printf("axis2_default_module_version (module1 engaging) .. FAILED\n");
+ return AXIS2_FAILURE;
+ }
+ if (AXIS2_FALSE == found3)
+ {
+ printf
+ ("axis2_default_module_version (test_module engaging) .. FAILED\n");
+ return AXIS2_FAILURE;
+ }
+ printf("axis2_default_module_version .. SUCCESS\n");
+ axis2_conf_free(axis_conf, env);
+ return AXIS2_SUCCESS;
+}
+
+int
+main(
+ )
+{
+ axutil_allocator_t *allocator = NULL;
+ axutil_error_t *error = NULL;
+ axutil_log_t *log = NULL;
+
+ allocator = axutil_allocator_init(NULL);
+ error = axutil_error_create(allocator);
+ log = axutil_log_create(allocator, NULL, "test_deployment.log");
+ env = axutil_env_create_with_error_log(allocator, error, log);
+ env->log->level = AXIS2_LOG_LEVEL_INFO;
+ /*axis2_test_transport_receiver_load();
+ axis2_test_transport_sender_load(); */
+ axis2_test_dep_engine_load();
+ axis2_test_default_module_version();
+ return 0;
+}
diff --git a/test/core/description/Makefile.am b/test/core/description/Makefile.am
new file mode 100644
index 0000000..0241eeb
--- /dev/null
+++ b/test/core/description/Makefile.am
@@ -0,0 +1,26 @@
+TESTS = test_description
+noinst_PROGRAMS = test_description
+SUBDIRS =
+AM_CFLAGS = -g -O2 -pthread
+test_description_SOURCES = test_description.c
+
+test_description_LDADD = \
+ ../../../util/src/libaxutil.la \
+ ../../../axiom/src/om/libaxis2_axiom.la \
+ ../../../axiom/src/parser/$(WRAPPER_DIR)/libaxis2_parser.la \
+ -lpthread \
+ $(top_builddir)/neethi/src/libneethi.la \
+ $(top_builddir)/src/core/engine/libaxis2_engine.la \
+ $(top_builddir)/src/core/transport/http/common/libaxis2_http_common.la
+
+INCLUDES = -I$(top_builddir)/include \
+ -I$(top_builddir)/src/core/description \
+ -I$(top_builddir)/src/core/context \
+ -I$(top_builddir)/src/core/phaseresolver \
+ -I$(top_builddir)/src/core/deployment \
+ -I$(top_builddir)/src/core/transport \
+ -I$(top_builddir)/src/core/engine \
+ -I$(top_builddir)/src/core/clientapi \
+ -I ../../../util/include \
+ -I ../../../axiom/include
+
diff --git a/test/core/description/test_description.c b/test/core/description/test_description.c
new file mode 100644
index 0000000..17675ba
--- /dev/null
+++ b/test/core/description/test_description.c
@@ -0,0 +1,215 @@
+
+/*
+ * 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.
+ */
+
+#include <stdio.h>
+#include <axis2_op.h>
+#include <axis2_conf.h>
+#include <axis2_module_desc.h>
+#include <axis2_phases_info.h>
+#include <axutil_env.h>
+#include <axutil_allocator.h>
+
+struct axis2_module_desc *create_module_desc(
+ const axutil_env_t * env);
+
+int
+axis2_test_op_engage_module(
+ )
+{
+ struct axis2_module_desc *moduleref = NULL;
+ axis2_conf_t *conf = NULL;
+
+ axis2_status_t status = AXIS2_FAILURE;
+
+ printf("******************************************\n");
+ printf("testing axis2_op_engage_module\n");
+ printf("******************************************\n");
+
+ axutil_allocator_t *allocator = axutil_allocator_init(NULL);
+ axutil_env_t *env = axutil_env_create(allocator);
+ axis2_op_t *op = axis2_op_create(env);
+
+ moduleref = axis2_module_desc_create(env);
+ conf = axis2_conf_create(env);
+
+ status = axis2_op_engage_module(op, env, moduleref, conf);
+ moduleref = NULL;
+ if (status != AXIS2_SUCCESS)
+ {
+ axis2_op_free(op, env);
+ printf("ERROR %d\n", status);
+ }
+
+ axis2_op_free(op, env);
+ axutil_env_free(env);
+ return 0;
+}
+
+int
+axis2_test_svc_add_module_ops(
+ )
+{
+ struct axis2_svc *svc = NULL;
+ struct axutil_qname *qname = NULL;
+ struct axis2_module_desc *module_desc = NULL;
+ struct axis2_conf *axis2_config = NULL;
+
+ axis2_status_t status = AXIS2_FAILURE;
+
+ printf("******************************************\n");
+ printf("testing axis2_svc_add_module_ops\n");
+ printf("******************************************\n");
+
+ axutil_allocator_t *allocator = axutil_allocator_init(NULL);
+ const axutil_env_t *env = axutil_env_create(allocator);
+ qname = axutil_qname_create(env, "name1", NULL, NULL);
+ svc = axis2_svc_create_with_qname(env, qname);
+ module_desc = axis2_module_desc_create(env);
+ axis2_config = axis2_conf_create(env);
+ status = axis2_svc_add_module_ops(svc, env, module_desc, axis2_config);
+ if (status != AXIS2_SUCCESS)
+ {
+ printf("axis2_test_description_add_module_ops ERROR %d\n", status);
+ }
+ else
+ printf("axis2_test_add_module_ops SUCCESS\n");
+
+ axis2_svc_free(svc, env);
+ axutil_qname_free(qname, env);
+ axis2_module_desc_free(module_desc, env);
+ axis2_conf_free(axis2_config, env);
+
+ return 0;
+}
+
+int
+axis2_test_svc_engage_module(
+ )
+{
+ axis2_svc_t *svc = NULL;
+ axutil_qname_t *qname = NULL;
+ axis2_module_desc_t *moduleref = NULL;
+ axis2_conf_t *axis2_config = NULL;
+ axis2_status_t status = AXIS2_FAILURE;
+
+ printf("******************************************\n");
+ printf("testing axis2_svc_engage_module\n");
+ printf("******************************************\n");
+
+ axutil_allocator_t *allocator = axutil_allocator_init(NULL);
+ const axutil_env_t *env = axutil_env_create(allocator);
+ qname = axutil_qname_create(env, "name1", NULL, NULL);
+ svc = axis2_svc_create_with_qname(env, qname);
+ moduleref = axis2_module_desc_create(env);
+ axis2_config = axis2_conf_create(env);
+
+ status = axis2_svc_engage_module(svc, env, moduleref, axis2_config);
+ moduleref = NULL;
+ if (status != AXIS2_SUCCESS)
+ {
+ printf("axis2_test_description_svc_engage_module ERROR %d\n", status);
+ }
+ else
+ printf("axis2_test_svc_engage_module SUCCESS\n");
+
+ axis2_svc_free(svc, env);
+ axutil_qname_free(qname, env);
+ axis2_conf_free(axis2_config, env);
+
+ return 0;
+}
+
+int
+axis2_test_svc_get_op(
+ )
+{
+ struct axis2_svc *svc = NULL;
+ struct axutil_qname *qname = NULL;
+ struct axutil_hash_t *ops = NULL;
+ struct axis2_op *op = NULL;
+ axis2_status_t status = AXIS2_SUCCESS;
+
+ printf("******************************************\n");
+ printf("testing axis2_svc_get_op\n");
+ printf("******************************************\n");
+
+ axutil_allocator_t *allocator = axutil_allocator_init(NULL);
+ const axutil_env_t *env = axutil_env_create(allocator);
+ qname = axutil_qname_create(env, "op1", NULL, NULL);
+ op = axis2_op_create_with_qname(env, qname);
+ qname = axutil_qname_create(env, "svc1", NULL, NULL);
+ svc = axis2_svc_create_with_qname(env, qname);
+
+ status = axis2_svc_add_op(svc, env, op);
+
+ qname = axutil_qname_create(env, "op2", NULL, NULL);
+ op = axis2_op_create_with_qname(env, qname);
+ status = axis2_svc_add_op(svc, env, op);
+
+ ops = axis2_svc_get_all_ops(svc, env);
+
+ if (ops)
+ printf("SUCCESS AXIS2_SVC_GET_OPS\n");
+ else
+ {
+ printf("ERROR AXIS2_SVC_GET_OPS\n");
+ return -1;
+ }
+
+ if (ops)
+ {
+ printf("ops count = %d\n", axutil_hash_count(ops));
+
+ axutil_hash_index_t *hi2 = NULL;
+ void *op2 = NULL;
+ axis2_char_t *oname = NULL;
+ int count = 0;
+
+ for (hi2 = axutil_hash_first(ops, env); hi2;
+ hi2 = axutil_hash_next(env, hi2))
+ {
+ printf("count = %d \n", count++);
+ axis2_svc_get_all_ops(svc, env);
+ if (!(hi2))
+ break;
+ axutil_hash_this(hi2, NULL, NULL, &op2);
+ if (op2)
+ {
+ const axutil_qname_t *qname = NULL;
+ qname = axis2_op_get_qname((axis2_op_t *) op2, env);
+ oname = axutil_qname_get_localpart(qname, env);
+ printf("op name = %s\n", oname);
+ }
+ }
+ }
+ else
+ printf("ops count = zero\n");
+
+ return 0;
+}
+
+int
+main(
+ )
+{
+ axis2_test_op_engage_module();
+ axis2_test_svc_add_module_ops();
+ axis2_test_svc_engage_module();
+ axis2_test_svc_get_op();
+ return 0;
+}
diff --git a/test/core/engine/Makefile.am b/test/core/engine/Makefile.am
new file mode 100644
index 0000000..e6d41de
--- /dev/null
+++ b/test/core/engine/Makefile.am
@@ -0,0 +1,25 @@
+TESTS = test_engine
+check_PROGRAMS = test_engine
+noinst_PROGRAMS = test_engine
+SUBDIRS =
+AM_CFLAGS = -g -pthread
+test_engine_SOURCES = test_engine.c
+
+
+test_engine_LDADD = \
+ ../../../util/src/libaxutil.la \
+ ../../../axiom/src/om/libaxis2_axiom.la \
+ ../../../axiom/src/parser/$(WRAPPER_DIR)/libaxis2_parser.la \
+ $(top_builddir)/src/core/engine/libaxis2_engine.la \
+ $(top_builddir)/src/core/transport/http/common/libaxis2_http_common.la \
+ $(top_builddir)/neethi/src/libneethi.la
+
+INCLUDES = -I$(top_builddir)/src/xml/guththila \
+ -I$(top_builddir)/include \
+ -I$(top_builddir)/src/core/description \
+ -I$(top_builddir)/src/core/deployment \
+ -I$(top_builddir)/src/core/engine \
+ -I ../../../util/include \
+ -I ../../../axiom/include \
+ -I ../../../neethi/include
+
diff --git a/test/core/engine/test_engine.c b/test/core/engine/test_engine.c
new file mode 100644
index 0000000..4df5b1d
--- /dev/null
+++ b/test/core/engine/test_engine.c
@@ -0,0 +1,123 @@
+
+/*
+ * 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.
+ */
+
+#include <stdio.h>
+#include <axutil_env.h>
+#include <axis2_engine.h>
+#include <axis2_conf_ctx.h>
+#include <axis2_msg_ctx.h>
+#include <axis2_conf_builder.h>
+
+int
+axis2_test_engine_send(
+ )
+{
+ axis2_status_t status = AXIS2_FAILURE;
+ axutil_allocator_t *allocator = axutil_allocator_init(NULL);
+ const axutil_env_t *env = axutil_env_create(allocator);
+ struct axis2_conf *conf = NULL;
+ conf = axis2_conf_create(env);
+
+ struct axis2_conf_ctx *conf_ctx;
+ struct axis2_msg_ctx *msg_ctx;
+ struct axis2_op_ctx *op_ctx;
+ struct axis2_op *op;
+ struct axis2_svc *svc;
+ struct axis2_svc_ctx *svc_ctx;
+ struct axis2_svc_grp *svc_grp;
+ struct axis2_svc_grp_ctx *svc_grp_ctx;
+ struct axutil_qname *qname;
+
+ conf_ctx = axis2_conf_ctx_create(env, conf);
+
+ svc_grp = axis2_svc_grp_create(env);
+ svc_grp_ctx = axis2_svc_grp_ctx_create(env, svc_grp, conf_ctx);
+
+ qname = axutil_qname_create(env, "name1", NULL, NULL);
+ svc = axis2_svc_create_with_qname(env, qname);
+ svc_ctx = axis2_svc_ctx_create(env, svc, svc_grp_ctx);
+
+ op = axis2_op_create(env);
+ op_ctx = axis2_op_ctx_create(env, op, svc_ctx);
+
+ msg_ctx = axis2_msg_ctx_create(env, conf_ctx, NULL, NULL);
+
+ axis2_msg_ctx_set_conf_ctx(msg_ctx, env, conf_ctx);
+ axis2_msg_ctx_set_op_ctx(msg_ctx, env, op_ctx);
+ axis2_msg_ctx_set_svc_ctx(msg_ctx, env, svc_ctx);
+
+ axis2_engine_t *engine = axis2_engine_create(env, conf_ctx);
+ status = axis2_engine_send(engine, env, msg_ctx);
+ if (status != AXIS2_SUCCESS)
+ {
+ printf("axis2_test_engine_send ERROR %d\n", status);
+ }
+ else
+ printf("axis2_test_engine_send SUCCESS\n");
+
+ axis2_conf_ctx_free(conf_ctx, env);
+ axis2_msg_ctx_free(msg_ctx, env);
+ axutil_qname_free(qname, env);
+ axis2_svc_grp_ctx_free(svc_grp_ctx, env);
+ axis2_svc_ctx_free(svc_ctx, env);
+ axis2_svc_free(svc, env);
+ axis2_op_ctx_free(op_ctx, env);
+ axis2_op_free(op, env);
+ axis2_engine_free(engine, env);
+ return 0;
+}
+
+int
+axis2_test_engine_receive(
+ )
+{
+ axis2_status_t status = AXIS2_FAILURE;
+ axutil_allocator_t *allocator = axutil_allocator_init(NULL);
+ const axutil_env_t *env = axutil_env_create(allocator);
+ axis2_conf_t *conf = NULL;
+ conf = axis2_conf_create(env);
+
+ struct axis2_conf_ctx *conf_ctx;
+ struct axis2_msg_ctx *msg_ctx;
+ conf_ctx = axis2_conf_ctx_create(env, conf);
+
+ msg_ctx = axis2_msg_ctx_create(env, conf_ctx, NULL, NULL);
+
+ axis2_engine_t *engine = axis2_engine_create(env, conf_ctx);
+
+ status = axis2_engine_receive(engine, env, msg_ctx);
+ if (status != AXIS2_SUCCESS)
+ {
+ printf("axis2_test_engine_receive ERROR %d\n", status);
+ }
+ else
+ printf("axis2_test_engine_receive SUCCESS\n");
+ axis2_conf_ctx_free(conf_ctx, env);
+ axis2_msg_ctx_free(msg_ctx, env);
+ axis2_engine_free(engine, env);
+ return 0;
+}
+
+int
+main(
+ )
+{
+ axis2_test_engine_send();
+ axis2_test_engine_receive();
+ return 0;
+}
diff --git a/test/core/transport/Makefile.am b/test/core/transport/Makefile.am
new file mode 100644
index 0000000..b7e93db
--- /dev/null
+++ b/test/core/transport/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = http
diff --git a/test/core/transport/http/Makefile.am b/test/core/transport/http/Makefile.am
new file mode 100644
index 0000000..34eeefe
--- /dev/null
+++ b/test/core/transport/http/Makefile.am
@@ -0,0 +1,21 @@
+TESTS = test_http_transport
+check_PROGRAMS = test_http_transport
+noinst_PROGRAMS = test_http_transport
+SUBDIRS =
+AM_CFLAGS = -g -pthread
+test_http_transport_SOURCES = test_http_transport.c
+
+test_http_transport_LDADD = \
+ $(LDFLAGS) \
+ ../../../../util/src/libaxutil.la \
+ ../../../../axiom/src/om/libaxis2_axiom.la \
+ $(top_builddir)/neethi/src/libneethi.la \
+ ../../../../axiom/src/parser/$(WRAPPER_DIR)/libaxis2_parser.la \
+ $(top_builddir)/src/core/engine/libaxis2_engine.la \
+ $(top_builddir)/src/core/transport/http/sender/libaxis2_http_sender.la
+
+INCLUDES = -I${CUTEST_HOME}/include \
+ -I$(top_builddir)/include \
+ -I ../../../../util/include \
+ -I ../../../../axiom/include
+
diff --git a/test/core/transport/http/test_http_transport.c b/test/core/transport/http/test_http_transport.c
new file mode 100644
index 0000000..69134bc
--- /dev/null
+++ b/test/core/transport/http/test_http_transport.c
@@ -0,0 +1,274 @@
+
+/*
+ * 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.
+ */
+
+#include <stdio.h>
+#include <axis2_http_request_line.h>
+#include <axis2_http_status_line.h>
+#include <axis2_http_header.h>
+#include <axutil_error_default.h>
+#include <axutil_url.h>
+#include <axis2_http_client.h>
+
+typedef struct a
+{
+ axis2_char_t *value;
+}
+a;
+
+axutil_env_t *
+test_init(
+ )
+{
+ axutil_allocator_t *allocator = axutil_allocator_init(NULL);
+ axutil_error_t *error = axutil_error_create(allocator);
+ axutil_env_t *env = axutil_env_create_with_error(allocator, error);
+ return env;
+}
+
+void
+test_http_request_line(
+ const axutil_env_t * env)
+{
+ const char *request_line_str =
+ "POST http://ws.apache.org/axis2/c/services/test_svc/test_op?x=1 HTTP/1.1\r\n";
+ axis2_http_request_line_t *request_line;
+
+ printf("Starting http_request_line tests\n");
+ request_line = axis2_http_request_line_parse_line(env, request_line_str);
+ printf("Method: %s|URI: %s|HTTP Version: %s|\n",
+ axis2_http_request_line_get_method(request_line, env),
+ axis2_http_request_line_get_uri(request_line, env),
+ axis2_http_request_line_get_http_version(request_line, env));
+ axis2_http_request_line_free(request_line, env);
+ printf("Finished http_request_line tests ..........\n\n");
+}
+
+void
+test_http_status_line(
+ const axutil_env_t * env)
+{
+ const char *status_line_str = "HTTP/1.1 202 Accepted\r\n";
+ axis2_http_status_line_t *status_line;
+
+ printf("Starting http_status_line tests\n");
+ status_line = axis2_http_status_line_create(env, status_line_str);
+ printf("Staus Line starts with HTTP ? :%d\n",
+ axis2_http_status_line_starts_with_http(status_line, env));
+ printf("HTTP Version :%s|Status Code:%d|Reason Phrase:%s|\n",
+ axis2_http_status_line_get_http_version(status_line, env),
+ axis2_http_status_line_get_status_code(status_line, env),
+ axis2_http_status_line_get_reason_phrase(status_line, env));
+ printf("to_string :%s\n",
+ axis2_http_status_line_to_string(status_line, env));
+ axis2_http_status_line_free(status_line, env);
+ printf("Finished http_status_line tests ..........\n\n");
+}
+
+void
+test_http_header(
+ const axutil_env_t * env)
+{
+ const char *header_name = "Content-Type";
+ const char *header_value = "text/xml";
+ const char *str_header = "Content-Type: text/xml; charset=UTF-8\r\n";
+ axis2_http_header_t *http_header;
+ axis2_char_t *external_form = NULL;
+
+ printf("Starting http_header tests\n");
+ http_header = axis2_http_header_create(env, header_name, header_value);
+ external_form = axis2_http_header_to_external_form(http_header, env);
+ printf("Heder Name :%s|Header Value:%s|External Form:%s\n",
+ axis2_http_header_get_name(http_header, env),
+ axis2_http_header_get_value(http_header, env), external_form);
+ AXIS2_FREE(env->allocator, external_form);
+ axis2_http_header_free(http_header, env);
+
+ http_header = axis2_http_header_create_by_str(env, str_header);
+ printf("Finished http_header tests ..........\n\n");
+}
+
+void
+test_url(
+ const axutil_env_t * env)
+{
+ const axis2_char_t *str_url = "http://ws.apache.org/axis2/";
+ axutil_url_t *url = axutil_url_parse_string(env, str_url);
+ if (!url)
+ {
+ printf("URL is NULL\n");
+ return;
+ }
+ printf("Starting URL Test ....\n");
+ printf
+ ("Parsed URL : \n Protocol :%s|\n Host :%s|\n Port :%d|\n Path : %s|\n",
+ axutil_url_get_protocol(url, env), axutil_url_get_host(url, env),
+ axutil_url_get_port(url, env), axutil_url_get_path(url, env));
+ printf("End of URL Test ... \n");
+ axutil_url_free(url, env);
+}
+
+void
+test_http_client(
+ const axutil_env_t * env)
+{
+ axis2_http_client_t *client = NULL;
+ axis2_http_simple_request_t *request = NULL;
+ axis2_http_request_line_t *request_line = NULL;
+ axutil_url_t *url = NULL;
+ axis2_http_header_t *header = NULL;
+ axutil_stream_t *request_body = NULL;
+ axis2_http_simple_response_t *response = NULL;
+ int status = 0;
+ char *body_bytes = NULL;
+ int body_bytes_len = 0;
+
+ printf("Starting http_client tests\n");
+ request_line = axis2_http_request_line_create(env, "GET",
+ "/axis2/services",
+ "HTTP/1.0");
+ request_body = axutil_stream_create_basic(env);
+ request = axis2_http_simple_request_create(env, request_line,
+ NULL, 0, NULL);
+ url = axutil_url_create(env, "http", "localhost", 80, NULL);
+ header =
+ axis2_http_header_create(env, "Host", axutil_url_get_host(url, env));
+ axis2_http_simple_request_add_header(request, env, header);
+ client = axis2_http_client_create(env, url);
+
+ status = axis2_http_client_send(client, env, request, NULL);
+ if (status < 0)
+ {
+ printf("Test FAILED .........Can't send the request. Status :%d\n",
+ status);
+ return;
+ }
+ status = axis2_http_client_recieve_header(client, env);
+ if (status < 0)
+ {
+ printf("Test FAILED ......... Can't recieve. Status: %d\n", status);
+ return;
+ }
+ response = axis2_http_client_get_response(client, env);
+ if (!response)
+ {
+ printf("Test Failed : NULL response");
+ return;
+ }
+ printf("Content Type :%s\n",
+ axis2_http_simple_response_get_content_type(response, env));
+ printf("Content Length :%d\n",
+ axis2_http_simple_response_get_content_length(response, env));
+ printf("Status code :%d\n", status);
+ body_bytes_len =
+ axis2_http_simple_response_get_body_bytes(response, env, &body_bytes);
+ printf("body :%s\n", body_bytes);
+
+ axis2_http_client_free(client, env);
+ axis2_http_simple_request_free(request, env);
+ axutil_stream_free(request_body, env);
+ AXIS2_FREE(env->allocator, body_bytes);
+ printf("Finished http_client tests ..........\n\n");
+}
+
+void
+test_https_client(
+ const axutil_env_t * env)
+{
+#ifndef AXIS2_SSL_ENABLED
+ return;
+#else
+ axis2_http_client_t *client = NULL;
+ axis2_http_simple_request_t *request = NULL;
+ axis2_http_request_line_t *request_line = NULL;
+ axutil_url_t *url = NULL;
+ axis2_http_header_t *header = NULL;
+ axutil_stream_t *request_body = NULL;
+ axis2_http_simple_response_t *response = NULL;
+ int status = 0;
+ char *body_bytes = NULL;
+ int body_bytes_len = 0;
+
+ printf("Starting https_client tests\n");
+ request_line = axis2_http_request_line_create(env, "GET", "/", "HTTP/1.0");
+ request_body = axutil_stream_create_basic(env);
+ request = axis2_http_simple_request_create(env, request_line,
+ NULL, 0, NULL);
+ url = axutil_url_create(env, "https", "localhost", 9090, NULL);
+
+ header =
+ axis2_http_header_create(env, "Host", axutil_url_get_host(url, env));
+ axis2_http_simple_request_add_header(request, env, header);
+ client = axis2_http_client_create(env, url);
+
+ /* if you weant to test the proxy uncomment following */
+ /*axis2_http_client_set_proxy(client, env, "127.0.0.1", 8080); */
+
+ /* Add CA/Server certificate */
+ status = axis2_http_client_set_server_cert(client, env,
+ "/home/dummy/dummyCA/demoCA/cacert.pem");
+
+ status = axis2_http_client_send(client, env, request, NULL);
+ if (status < 0)
+ {
+ printf("Test FAILED .........Can't send the request. Status :%d\n",
+ status);
+ return;
+ }
+ status = axis2_http_client_recieve_header(client, env);
+ if (status < 0)
+ {
+ printf("Test FAILED ......... Can't recieve. Status: %d\n", status);
+ return;
+ }
+ response = axis2_http_client_get_response(client, env);
+ if (!response)
+ {
+ printf("Test Failed : NULL response");
+ return;
+ }
+ printf("Content Type :%s\n",
+ axis2_http_simple_response_get_content_type(response, env));
+ printf("Content Length :%d\n",
+ axis2_http_simple_response_get_content_length(response, env));
+ printf("Status code :%d\n", status);
+ body_bytes_len =
+ axis2_http_simple_response_get_body_bytes(response, env, &body_bytes);
+
+ axis2_http_client_free(client, env);
+ axis2_http_simple_request_free(request, env);
+ axutil_stream_free(request_body, env);
+ AXIS2_FREE(env->allocator, body_bytes);
+ printf("Finished https_client tests ..........\n\n");
+#endif
+}
+
+int
+main(
+ void)
+{
+ axutil_env_t *env = test_init();
+ test_http_request_line(env);
+ test_http_status_line(env);
+ test_http_header(env);
+ test_http_client(env);
+ test_https_client(env);
+ test_url(env);
+
+ axutil_env_free(env);
+ return 0;
+}