You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ka...@apache.org on 2007/02/05 10:02:35 UTC
svn commit: r503594 - in /webservices/axis2/trunk/c/rampart: ./ test/
test/c14n/ test/c14n/res/
Author: kaushalye
Date: Mon Feb 5 01:02:33 2007
New Revision: 503594
URL: http://svn.apache.org/viewvc?view=rev&rev=503594
Log:
Added c14n tests.
Added:
webservices/axis2/trunk/c/rampart/test/c14n/
webservices/axis2/trunk/c/rampart/test/c14n/Makefile.am
webservices/axis2/trunk/c/rampart/test/c14n/res/
webservices/axis2/trunk/c/rampart/test/c14n/res/a.xml
webservices/axis2/trunk/c/rampart/test/c14n/res/b.xml
webservices/axis2/trunk/c/rampart/test/c14n/res/c.xml
webservices/axis2/trunk/c/rampart/test/c14n/res/d.xml
webservices/axis2/trunk/c/rampart/test/c14n/res/e.xml
webservices/axis2/trunk/c/rampart/test/c14n/res/ex1.xml
webservices/axis2/trunk/c/rampart/test/c14n/res/ex2.xml
webservices/axis2/trunk/c/rampart/test/c14n/res/ex3.xml
webservices/axis2/trunk/c/rampart/test/c14n/res/ex4.xml
webservices/axis2/trunk/c/rampart/test/c14n/res/ex5.xml
webservices/axis2/trunk/c/rampart/test/c14n/res/f.xml
webservices/axis2/trunk/c/rampart/test/c14n/res/g.xml
webservices/axis2/trunk/c/rampart/test/c14n/res/ns1.xml
webservices/axis2/trunk/c/rampart/test/c14n/res/null.xml
webservices/axis2/trunk/c/rampart/test/c14n/res/unicode.xml
webservices/axis2/trunk/c/rampart/test/c14n/test.c
Modified:
webservices/axis2/trunk/c/rampart/configure.ac
webservices/axis2/trunk/c/rampart/test/Makefile.am
Modified: webservices/axis2/trunk/c/rampart/configure.ac
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/configure.ac?view=diff&rev=503594&r1=503593&r2=503594
==============================================================================
--- webservices/axis2/trunk/c/rampart/configure.ac (original)
+++ webservices/axis2/trunk/c/rampart/configure.ac Mon Feb 5 01:02:33 2007
@@ -87,6 +87,7 @@
src/util/Makefile \
test/Makefile \
test/omxmlsec/Makefile \
+ test/c14n/Makefile \
test/openssl/Makefile
])
Modified: webservices/axis2/trunk/c/rampart/test/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/Makefile.am?view=diff&rev=503594&r1=503593&r2=503594
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/Makefile.am (original)
+++ webservices/axis2/trunk/c/rampart/test/Makefile.am Mon Feb 5 01:02:33 2007
@@ -1,2 +1,2 @@
-SUBDIRS = omxmlsec openssl
+SUBDIRS = openssl c14n
Added: webservices/axis2/trunk/c/rampart/test/c14n/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/c14n/Makefile.am?view=auto&rev=503594
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/c14n/Makefile.am (added)
+++ webservices/axis2/trunk/c/rampart/test/c14n/Makefile.am Mon Feb 5 01:02:33 2007
@@ -0,0 +1,16 @@
+TESTS = test_c14n
+noinst_PROGRAMS = test_c14n
+
+#AM_CFLAGS = -g -O2 -pthread
+
+test_c14n_SOURCES = test.c
+
+INCLUDES = -I$(top_builddir)/include \
+ -I ../../../include \
+ -I ../../../util/include \
+ -I ../../../axiom/include
+
+test_c14n_LDADD = ../../../util/src/libaxis2_util.la \
+ ../../../axiom/src/om/libaxis2_axiom.la \
+ ../../../axiom/src/parser/libxml2/libaxis2_libxml2.la \
+ ../../../rampart/src/omxmlsec/c14n/libaxis2_c14n.la
Added: webservices/axis2/trunk/c/rampart/test/c14n/res/a.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/c14n/res/a.xml?view=auto&rev=503594
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/c14n/res/a.xml (added)
+++ webservices/axis2/trunk/c/rampart/test/c14n/res/a.xml Mon Feb 5 01:02:33 2007
@@ -0,0 +1,12 @@
+<z:doc xmlns:z="urn:zzzz" xmlns='urn:sadjfksdf'>
+ <x:a xmlns="" xmlns:x="urn:test">
+ <a10 xmlns:x="urn:tst">
+ <a101 xmlns:x="urn:test"/>
+ </a10>
+ <a1 xmlns="" xmlns:x="urn:test">
+ <x:a11 xmlns="urn:NEED" xmlns:x="urn:test">
+ <t/>
+ </x:a11>
+ </a1>
+ </x:a>
+</z:doc>
Added: webservices/axis2/trunk/c/rampart/test/c14n/res/b.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/c14n/res/b.xml?view=auto&rev=503594
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/c14n/res/b.xml (added)
+++ webservices/axis2/trunk/c/rampart/test/c14n/res/b.xml Mon Feb 5 01:02:33 2007
@@ -0,0 +1,10 @@
+<doc xmlns:w3c="http://www.w3.org">
+ <w3c:e1>
+ <e2>
+ <e4>tex
+
+ t</e4>
+ <e3 id="E3"/>
+ </e2>
+ </w3c:e1>
+</doc>
Added: webservices/axis2/trunk/c/rampart/test/c14n/res/c.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/c14n/res/c.xml?view=auto&rev=503594
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/c14n/res/c.xml (added)
+++ webservices/axis2/trunk/c/rampart/test/c14n/res/c.xml Mon Feb 5 01:02:33 2007
@@ -0,0 +1,9 @@
+<doc xmlns:test = "urn:test">
+ <e xmlns="urn:a" xmlns:c="urn:ccc"
+ xmlns:a="urn:zzz" zoo= " zoo" xmlns:b="urn:aaa" firstattr="first"
+ a:attr1="one" b:attr2='two' a:attr2="three"/>
+ <test:f id=' ' &   
	 ' '/>
+ <g> ' &   
	 ' </g>
+<!--this is a comment inside-->
+</doc>
+<!--this is a comment outside-->
Added: webservices/axis2/trunk/c/rampart/test/c14n/res/d.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/c14n/res/d.xml?view=auto&rev=503594
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/c14n/res/d.xml (added)
+++ webservices/axis2/trunk/c/rampart/test/c14n/res/d.xml Mon Feb 5 01:02:33 2007
@@ -0,0 +1,9 @@
+<doc xmlns:test = "urn:test">
+ <!--this is a comment inside-->
+ <e xmlns="urn:a" xmlns:c="urn:ccc"
+ xmlns:a="urn:zzz" zoo= " zoo" xmlns:b="urn:aaa" firstattr="first"
+ a:attr1="one" b:attr2='two' a:attr2="three"/>
+ <test:f id=' ' &   
	 ' '/>
+ <g> ' &   
	 ' </g>
+</doc>
+<!--this is a comment outside-->
Added: webservices/axis2/trunk/c/rampart/test/c14n/res/e.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/c14n/res/e.xml?view=auto&rev=503594
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/c14n/res/e.xml (added)
+++ webservices/axis2/trunk/c/rampart/test/c14n/res/e.xml Mon Feb 5 01:02:33 2007
@@ -0,0 +1,4 @@
+<doc>
+ <a>© © more data 
 some more 2</a>
+ <b><![CDATA[value>"0"]]></b>
+</doc>
Added: webservices/axis2/trunk/c/rampart/test/c14n/res/ex1.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/c14n/res/ex1.xml?view=auto&rev=503594
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/c14n/res/ex1.xml (added)
+++ webservices/axis2/trunk/c/rampart/test/c14n/res/ex1.xml Mon Feb 5 01:02:33 2007
@@ -0,0 +1,3 @@
+<a>
+ <x:b xmlns:x="urn:xxx"></x:b>
+</a>
Added: webservices/axis2/trunk/c/rampart/test/c14n/res/ex2.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/c14n/res/ex2.xml?view=auto&rev=503594
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/c14n/res/ex2.xml (added)
+++ webservices/axis2/trunk/c/rampart/test/c14n/res/ex2.xml Mon Feb 5 01:02:33 2007
@@ -0,0 +1,4 @@
+<doc xmlns:test = "urn:test">
+ <e xmlns="urn:a" xmlns:c="urn:ccc" />
+ <test:f id=''/>
+</doc>
Added: webservices/axis2/trunk/c/rampart/test/c14n/res/ex3.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/c14n/res/ex3.xml?view=auto&rev=503594
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/c14n/res/ex3.xml (added)
+++ webservices/axis2/trunk/c/rampart/test/c14n/res/ex3.xml Mon Feb 5 01:02:33 2007
@@ -0,0 +1,4 @@
+<doc xmlns:test = "urn:test">
+ <e c:attr="att" xmlns:c="urn:ccc" xmlns:a="urn:zzz" />
+ <test:f id=''/>
+</doc>
Added: webservices/axis2/trunk/c/rampart/test/c14n/res/ex4.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/c14n/res/ex4.xml?view=auto&rev=503594
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/c14n/res/ex4.xml (added)
+++ webservices/axis2/trunk/c/rampart/test/c14n/res/ex4.xml Mon Feb 5 01:02:33 2007
@@ -0,0 +1,6 @@
+<a xmlns="urn:def" xmlns:x="urn:xxx">
+ <x:b att1="v"/>
+ <c/>
+ <d x:att2="v" xmlns:x="urn:yyy"/>
+ <x:e x:att3="v"/>
+</a>
Added: webservices/axis2/trunk/c/rampart/test/c14n/res/ex5.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/c14n/res/ex5.xml?view=auto&rev=503594
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/c14n/res/ex5.xml (added)
+++ webservices/axis2/trunk/c/rampart/test/c14n/res/ex5.xml Mon Feb 5 01:02:33 2007
@@ -0,0 +1,3 @@
+<a xmlns="urn:def" xmlns:x="urn:xxx">
+ <d x:att2="v" xmlns:x="urn:yyy"/>
+</a>
Added: webservices/axis2/trunk/c/rampart/test/c14n/res/f.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/c14n/res/f.xml?view=auto&rev=503594
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/c14n/res/f.xml (added)
+++ webservices/axis2/trunk/c/rampart/test/c14n/res/f.xml Mon Feb 5 01:02:33 2007
@@ -0,0 +1,10 @@
+<doc xmlns:ietf="http://www.ietf.org" xmlns="http://www.ietf.org" xmlns:w3c="http://www.w3.org">
+ <e1>
+ <e2 xmlns="">
+ <e3 id="E3"/>
+ </e2>
+ </e1>
+</doc>
+
+
+<!--(//. | //@* | //namespace::*)[self::e1 or (parent::e1 and not(self::text() or self::e2)) or count(id("E3")|ancestor-or-self::node()) = count(ancestor-or-self::node())]-->
\ No newline at end of file
Added: webservices/axis2/trunk/c/rampart/test/c14n/res/g.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/c14n/res/g.xml?view=auto&rev=503594
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/c14n/res/g.xml (added)
+++ webservices/axis2/trunk/c/rampart/test/c14n/res/g.xml Mon Feb 5 01:02:33 2007
@@ -0,0 +1,10 @@
+<a xmlns:x="urn:xxx" xmlns:y="urn:yyy" xmlns:z="urn:zzz">
+ <b x:attr1="attval1">
+ <x:c>
+ <d z:attr2="attval2">
+ </d>
+ </x:c>
+ </b>
+ <y:e/>
+ <z:f x:attr1="attrval1" z:attr2="attval2"/>
+</a>
Added: webservices/axis2/trunk/c/rampart/test/c14n/res/ns1.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/c14n/res/ns1.xml?view=auto&rev=503594
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/c14n/res/ns1.xml (added)
+++ webservices/axis2/trunk/c/rampart/test/c14n/res/ns1.xml Mon Feb 5 01:02:33 2007
@@ -0,0 +1,6 @@
+<doc xmlns="urn:def" xmlns:x='urn:xxx'>
+ <x:a xmlns="" xmlns:x="urn:xyx">
+ <b xmlns="urn:def" xmlns:x="urn:xxx"/>
+ <c xmlns:r="urn:xxx"/>
+ </x:a>
+</doc>
Added: webservices/axis2/trunk/c/rampart/test/c14n/res/null.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/c14n/res/null.xml?view=auto&rev=503594
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/c14n/res/null.xml (added)
+++ webservices/axis2/trunk/c/rampart/test/c14n/res/null.xml Mon Feb 5 01:02:33 2007
@@ -0,0 +1,21 @@
+<a xmlns="urn:gdfa">
+ <b xmlns="urn:def">
+ <c xmlns="">
+ <d xmlns="urn:def">
+ </d>
+ </c>
+ </b>
+
+<a1 xmlns="">
+ <b1 xmlns="urn:def">
+ <c1 xmlns="">
+ <cc1 xmlns=""/>
+ <d1 xmlns="urn:def">
+ <e1 xmlns="urn:def"/>
+ </d1>
+ </c1>
+ </b1>
+</a1>
+
+
+</a>
Added: webservices/axis2/trunk/c/rampart/test/c14n/res/unicode.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/c14n/res/unicode.xml?view=auto&rev=503594
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/c14n/res/unicode.xml (added)
+++ webservices/axis2/trunk/c/rampart/test/c14n/res/unicode.xml Mon Feb 5 01:02:33 2007
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE doc [
+ <!ELEMENT doc (test+)>
+ <!ELEMENT test (#PCDATA)>
+ <!ENTITY ccedil "ç">
+ <!ATTLIST test lang CDATA #IMPLIED>
+]>
+<doc>
+ <test lang="français">UTF-8 character.</test>
+ <test lang="français">numeric ref.</test>
+ <test lang="français">entity ref.</test>
+</doc>
Added: webservices/axis2/trunk/c/rampart/test/c14n/test.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/c14n/test.c?view=auto&rev=503594
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/c14n/test.c (added)
+++ webservices/axis2/trunk/c/rampart/test/c14n/test.c Mon Feb 5 01:02:33 2007
@@ -0,0 +1,141 @@
+/*
+ * 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_env.h>
+#include <axis2_allocator.h>
+#include <axiom.h>
+#include <axiom_xml_reader.h>
+#include <axiom_stax_builder.h>
+#include "oxs_c14n.h"
+
+int test(int argc, char **argv);
+
+void p_fail()
+{
+ printf ("File cannot be processed. \n");
+}
+
+int main(int argc, char **argv)
+{
+ return test(argc, argv);
+/* return test2();*/
+}
+
+/*int test2()
+{
+ axis2_allocator_t *allocator = NULL;
+ axis2_env_t *env = NULL;
+ allocator = axis2_allocator_init(NULL);
+ env = axis2_env_create(allocator);
+
+ axiom_namespace_t *ns1 = axiom_namespace_create(env, "urn:ns1", "ns1");
+ axiom_namespace_t *ns2 = axiom_namespace_create(env, "urn:ns2", "ns2");
+ axiom_namespace_t *ns3 = axiom_namespace_create(env, "urn:ns3", "ns3");
+ return 0;
+}*/
+
+int test(int argc, char **argv)
+{
+ axis2_allocator_t *allocator = NULL;
+ axis2_env_t *env = NULL;
+
+ axis2_char_t *file = NULL;
+
+ axiom_xml_reader_t *xml_reader = NULL;
+ axiom_stax_builder_t *om_builder = NULL;
+ axiom_document_t *doc = NULL;
+ axis2_stream_t *stream = NULL;
+ axis2_char_t *c14n_doc = NULL;
+ int len;
+ axis2_status_t res = AXIS2_SUCCESS;
+
+ if (argc < 2)
+ {
+ printf("Usage: test_c14n filename [exclusive]\n");
+ return 1;
+ }
+
+ allocator = axis2_allocator_init(NULL);
+ env = axis2_env_create(allocator);
+
+ file = argv[1];
+
+ xml_reader = axiom_xml_reader_create_for_file(env, file, "UTF-8"); /*"ISO-8859-1")*/
+ if (!xml_reader) { p_fail(); return 1; }
+
+ om_builder = axiom_stax_builder_create(env, xml_reader);
+ if (!om_builder) { p_fail(); return 1; }
+
+ doc = AXIOM_STAX_BUILDER_GET_DOCUMENT(om_builder, env);
+
+ if (!doc) { p_fail(); return 1; }
+ axis2_char_t *txt = NULL;
+ /*res = oxs_c14n_apply(env, doc, AXIS2_TRUE, &txt, AXIS2_FALSE, NULL);
+ printf("%s", txt);*/
+
+ /*printf("\n--------------stream:\n");*/ /*removed for xml_pp*/
+
+ stream = axis2_stream_create_basic(env);
+
+ if (argc>2 && !(argv[2][0]-'e'))
+ res = oxs_c14n_apply_stream(env, doc, AXIS2_TRUE, stream, AXIS2_TRUE , NULL);
+ else
+ res = oxs_c14n_apply_stream(env, doc, AXIS2_TRUE, stream, AXIS2_FALSE , NULL);
+
+ if (!res) return -1; /*error occured!*/
+
+ len = AXIS2_STREAM_BASIC_GET_LEN(stream, env) + 1;
+ c14n_doc = (axis2_char_t*)AXIS2_MALLOC(env->allocator, len);
+
+
+ AXIS2_STREAM_READ(stream, env, c14n_doc, len);
+
+ printf("%s",c14n_doc);
+
+ if (txt)
+ {
+ AXIS2_FREE(env->allocator, txt);
+ txt = NULL;
+ }
+ if (stream)
+ {
+ AXIS2_STREAM_FREE(stream, env);
+ stream = NULL;
+ }
+ if (c14n_doc)
+ {
+ AXIS2_FREE(env->allocator, c14n_doc);
+ c14n_doc = NULL;
+ }
+
+ if (om_builder)
+ {
+ AXIOM_STAX_BUILDER_FREE(om_builder, env);
+ om_builder = NULL;
+ }
+
+ if (env)
+ {
+ axis2_env_free(env);
+ env = NULL;
+ }
+
+ printf("\n");
+ return 0;
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org