Author: dushshantha
Date: Tue Dec  4 01:06:51 2007
New Revision: 10474

Log:



Added:
   trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/
   
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/client/
   
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/client/build.bat
   
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/client/rpl_det_policy.xml
   
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/service/
   
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/service/build.bat
   
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/service/build.sh
   
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/service/echo.c
   
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/service/echo.h
   
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/service/echo_skeleton.c
   
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/service/services.xml

Added: 
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/client/build.bat
==============================================================================
--- (empty file)
+++ 
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/client/build.bat
    Tue Dec  4 01:06:51 2007
@@ -0,0 +1 @@
+copy rpl_det_policy.xml %WSFC_HOME%\bin\samples

Added: 
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/client/rpl_det_policy.xml
==============================================================================
--- (empty file)
+++ 
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/client/rpl_det_policy.xml
   Tue Dec  4 01:06:51 2007
@@ -0,0 +1,36 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy";>
+    <wsp:ExactlyOne>
+        <wsp:All>
+            <sp:AsymmetricBinding 
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";>
+                <wsp:Policy>
+                    <sp:InitiatorToken>
+                        <wsp:Policy>
+                            <sp:X509Token 
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient";>
+                                <wsp:Policy>
+                                    <sp:WssX509V3Token10/>
+                                </wsp:Policy>
+                            </sp:X509Token>
+                        </wsp:Policy>
+                    </sp:InitiatorToken>
+                    <sp:RecipientToken>
+                        <wsp:Policy>
+                            <sp:X509Token 
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never";>
+                                <wsp:Policy>
+                                    <sp:WssX509V3Token10/>
+                                </wsp:Policy>
+                            </sp:X509Token>
+                        </wsp:Policy>
+                    </sp:RecipientToken>
+                    <sp:Layout>
+                        <wsp:Policy>
+                            <sp:Strict/>
+                        </wsp:Policy>
+                    </sp:Layout>
+                    <sp:IncludeTimestamp/>
+                </wsp:Policy>
+            </sp:AsymmetricBinding>
+            <rampc:RampartConfig 
xmlns:rampc="http://ws.apache.org/rampart/c/policy";>
+            </rampc:RampartConfig>
+        </wsp:All>
+    </wsp:ExactlyOne>
+</wsp:Policy>

Added: 
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/service/build.bat
==============================================================================
--- (empty file)
+++ 
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/service/build.bat
   Tue Dec  4 01:06:51 2007
@@ -0,0 +1,5 @@
+cl.exe /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "AXIS2_DECLARE_EXPORT"  /D 
"AXIS2_SVR_MULTI_THREADED" /w /nologo /I%WSFC_HOME%\include /D "NDEBUG" /O2 *.c 
/link /nologo /LIBPATH:%WSFC_HOME%\lib *.obj axutil.lib axiom.lib 
axis2_parser.lib axis2_engine.lib neethi.lib axis2_http_receiver.lib  
axis2_http_sender.lib /DLL /OUT:rpl_echo.dll
+
+mkdir %WSFC_HOME%\services\rpl_echo
+copy rpl_echo.dll %WSFC_HOME%\services\rpl_echo
+copy services.xml %WSFC_HOME%\services\rpl_echo
\ No newline at end of file

Added: 
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/service/build.sh
==============================================================================
--- (empty file)
+++ 
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/service/build.sh
    Tue Dec  4 01:06:51 2007
@@ -0,0 +1,20 @@
+#!/bin/bash
+#ANY_HOME=$AXIS2C_HOME
+ANY_HOME=$WSFC_HOME
+INST_DIR=$WSFC_HOME
+CLIENT_REPO=$WSFC_HOME/client_repo
+
+gcc -shared *.c -g -o libsec_echo.so -I$ANY_HOME/include/axis2-1.1/ \
+                        -I$ANY_HOME/include/rampart-1.0 \
+                        -L$ANY_HOME/lib \
+                    -laxutil \
+                    -laxis2_axiom \
+                    -laxis2_engine \
+                    -laxis2_parser \
+                    -lpthread \
+                    -laxis2_http_sender \
+                    -laxis2_http_receiver
+
+mkdir $ANY_HOME/services/sec_echo                    
+cp libsec_echo.so  $ANY_HOME/services/sec_echo
+cp services.xml $ANY_HOME/services/sec_echo

Added: 
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/service/echo.c
==============================================================================
--- (empty file)
+++ 
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/service/echo.c
      Tue Dec  4 01:06:51 2007
@@ -0,0 +1,57 @@
+/*
+ * 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 "echo.h"
+#include <axiom_xml_writer.h>
+#include <axiom_util.h>
+#include <stdio.h>
+
+axiom_node_t *
+build_om_programatically(const axutil_env_t *env, axis2_char_t *text);
+
+axiom_node_t *
+axis2_echo_echo(const axutil_env_t *env, axiom_node_t *node)
+{
+    axiom_node_t *ret_node = NULL;
+    axis2_char_t *name = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    name = axiom_util_get_localname(node, env);
+     
+    ret_node = build_om_programatically(env, name);
+    return ret_node;
+}
+
+/* Builds the response content */
+axiom_node_t *
+build_om_programatically(const axutil_env_t *env, axis2_char_t *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/rampart/samples";, "ns1");
+    echo_om_ele = axiom_element_create(env, NULL, "RecievedNode", ns1, 
&echo_om_node);
+
+    text_om_ele = axiom_element_create(env, echo_om_node, "LocalName", NULL, 
&text_om_node);
+
+    axiom_element_set_text(text_om_ele, env, text, text_om_node);
+ 
+    return echo_om_node;
+}
+

Added: 
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/service/echo.h
==============================================================================
--- (empty file)
+++ 
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/service/echo.h
      Tue Dec  4 01:06:51 2007
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+#ifndef CALC_H
+#define CALC_H
+
+
+#include <axis2_svc_skeleton.h>
+#include <axutil_log_default.h>
+#include <axutil_error_default.h>
+#include <axiom_text.h>
+#include <axiom_node.h>
+#include <axiom_element.h>
+
+axiom_node_t *axis2_echo_echo(const axutil_env_t *env, axiom_node_t *node);
+
+#endif /* CALC_H*/

Added: 
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/service/echo_skeleton.c
==============================================================================
--- (empty file)
+++ 
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/service/echo_skeleton.c
     Tue Dec  4 01:06:51 2007
@@ -0,0 +1,174 @@
+/*
+ * 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_svc_skeleton.h>
+#include "echo.h"
+#include <axutil_array_list.h>
+#include <axis2_msg_ctx.h>
+#include <stdio.h>
+
+int AXIS2_CALL
+echo_free(axis2_svc_skeleton_t *svc_skeleton,
+        const axutil_env_t *env);
+
+/*
+ * This method invokes the right service method
+ */
+axiom_node_t* AXIS2_CALL
+echo_invoke(axis2_svc_skeleton_t *svc_skeleton,
+        const axutil_env_t *env,
+        axiom_node_t *node,
+        axis2_msg_ctx_t *msg_ctx);
+
+
+int AXIS2_CALL
+echo_init(axis2_svc_skeleton_t *svc_skeleton,
+        const axutil_env_t *env);
+
+axiom_node_t* AXIS2_CALL
+echo_on_fault(axis2_svc_skeleton_t *svc_skeli,
+        const axutil_env_t *env, axiom_node_t *node);
+
+static const axis2_svc_skeleton_ops_t echo_svc_skeleton_ops_var = {
+    echo_init,
+    echo_invoke,
+    echo_on_fault,
+    echo_free
+};
+
+
+/*Create function */
+axis2_svc_skeleton_t *
+axis2_echo_create(const axutil_env_t *env)
+{
+    axis2_svc_skeleton_t *svc_skeleton = NULL;
+    /* Allocate memory for the structs */
+    svc_skeleton = AXIS2_MALLOC(env->allocator,
+            sizeof(axis2_svc_skeleton_t));
+
+    svc_skeleton->ops = AXIS2_MALLOC(
+                env->allocator, sizeof(axis2_svc_skeleton_ops_t));
+
+    svc_skeleton->ops = &echo_svc_skeleton_ops_var;
+
+    svc_skeleton->func_array = NULL;
+    /* Assign function pointers */
+
+    return svc_skeleton;
+}
+
+/* Initialize the service */
+int AXIS2_CALL
+echo_init(axis2_svc_skeleton_t *svc_skeleton,
+        const axutil_env_t *env)
+{
+    svc_skeleton->func_array = axutil_array_list_create(env, 0);
+    /* Add the implemented operation names of the service to
+     * the array list of functions 
+     */
+    axutil_array_list_add(svc_skeleton->func_array, env, "echoString");
+    /* Any initialization stuff of echo service should go here */
+    return AXIS2_SUCCESS;
+}
+
+/*
+ * This method invokes the right service method
+ */
+axiom_node_t* AXIS2_CALL
+echo_invoke(axis2_svc_skeleton_t *svc_skeleton,
+        const axutil_env_t *env,
+        axiom_node_t *node,
+        axis2_msg_ctx_t *msg_ctx)
+{
+    /* Invoke the business logic.
+     * Depending on the function name invoke the correct impl method.
+     * We have only echo in this sample, hence invoke echo method.
+     * To see how to deal with multiple impl methods, have a look at the
+     * math sample.
+     */
+
+    return axis2_echo_echo(env, node);
+}
+
+/* On fault, handle the fault */
+axiom_node_t* AXIS2_CALL
+echo_on_fault(axis2_svc_skeleton_t *svc_skeli,
+        const axutil_env_t *env, axiom_node_t *node)
+{
+    /* Here we are just setting a simple error message inside an element
+     * called 'EchoServiceError' 
+     */
+    axiom_node_t *error_node = NULL;
+    axiom_node_t *text_node = NULL;
+    axiom_element_t *error_ele = NULL;
+    
+       error_ele = axiom_element_create(env, NULL, "EchoServiceError", NULL,  
&error_node);
+    axiom_element_set_text(error_ele, env, "Echo service failed ", text_node);
+    return error_node;
+}
+
+/* Free the resources used */
+int AXIS2_CALL
+echo_free(axis2_svc_skeleton_t *svc_skeleton,
+        const axutil_env_t *env)
+{
+    /* Free the function array */
+    if (svc_skeleton->func_array)
+    {
+        axutil_array_list_free(svc_skeleton->func_array, env);
+        svc_skeleton->func_array = NULL;
+    }
+
+
+    /* Free the service skeleton */
+    if (svc_skeleton)
+    {
+        AXIS2_FREE(env->allocator, svc_skeleton);
+        svc_skeleton = NULL;
+    }
+
+    return AXIS2_SUCCESS;
+}
+
+
+/**
+ * Following block distinguish the exposed part of the dll.
+ */
+AXIS2_EXPORT int
+axis2_get_instance(axis2_svc_skeleton_t **inst,
+        const axutil_env_t *env)
+{
+    *inst = axis2_echo_create(env);
+    if (!(*inst))
+    {
+        return AXIS2_FAILURE;
+    }
+
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXPORT int
+axis2_remove_instance(axis2_svc_skeleton_t *inst,
+        const axutil_env_t *env)
+{
+    axis2_status_t status = AXIS2_FAILURE;
+    if (inst)
+    {
+        status = AXIS2_SVC_SKELETON_FREE(inst, env);
+    }
+    return status;
+}
+

Added: 
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/service/services.xml
==============================================================================
--- (empty file)
+++ 
trunk/commons/qa/wsf/c/TestFramework/testcases/rampart/replay_detection/service/services.xml
        Tue Dec  4 01:06:51 2007
@@ -0,0 +1,52 @@
+<service name="rpl_echo">
+    <parameter name="ServiceClass" locked="xsd:false">rpl_echo</parameter>
+
+   <description>
+        This is a testing service , to test the system is working or not
+   </description>
+
+    <module ref="rampart"/>
+
+    <operation name="echoString">
+            <parameter 
name="wsamapping">http://example.com/ws/2004/09/policy/Test/EchoRequest</parameter>
+    </operation>
+
+    <wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy";>
+        <wsp:ExactlyOne>
+            <wsp:All>
+                <sp:AsymmetricBinding 
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";>
+                    <wsp:Policy>
+                        <sp:InitiatorToken>
+                            <wsp:Policy>
+                                <sp:X509Token 
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient";>
+                                    <wsp:Policy>
+                                        <sp:WssX509V3Token10/>
+                                    </wsp:Policy>
+                                </sp:X509Token>
+                            </wsp:Policy>
+                        </sp:InitiatorToken>
+                        <sp:RecipientToken>
+                            <wsp:Policy>
+                                <sp:X509Token 
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never";>
+                                    <wsp:Policy>
+                                        <sp:WssX509V3Token10/>
+                                    </wsp:Policy>
+                                </sp:X509Token>
+                            </wsp:Policy>
+                        </sp:RecipientToken>
+                        <sp:Layout>
+                            <wsp:Policy>
+                                <sp:Strict/>
+                            </wsp:Policy>
+                        </sp:Layout>
+                        <sp:IncludeTimestamp/>
+                    </wsp:Policy>
+                </sp:AsymmetricBinding>
+                <rampc:RampartConfig 
xmlns:rampc="http://ws.apache.org/rampart/c/policy";>
+                                       
<rampc:ReplayDetection>5</rampc:ReplayDetection>
+                                       
<rampc:ReplayDetectionModule>C:\wsfc_1.2.0\wso2-wsf-c-src-1.2.0\wso2-wsf-c-bin-1.2.0-win32\bin\samples\rampart\replay_detector\rdflatfile.dll</rampc:ReplayDetectionModule>
+                </rampc:RampartConfig>
+            </wsp:All>
+        </wsp:ExactlyOne>
+    </wsp:Policy>
+</service>

_______________________________________________
Commons-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/commons-dev

Reply via email to