mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-17 01:41:17 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd05ade67b | ||
|
|
c65be54d3f | ||
|
|
81e1b42ff9 | ||
|
|
548826df4d | ||
|
|
8a719f24be | ||
|
|
8387cfcb06 | ||
|
|
88bfcbc68d | ||
|
|
6944a2c41c | ||
|
|
4dd58e00a4 | ||
|
|
a773287762 | ||
|
|
bbd693e7e4 | ||
|
|
560f84181c | ||
|
|
b1e980ac0b | ||
|
|
86eaaf8769 | ||
|
|
9a999d46b0 | ||
|
|
dac1cf4505 | ||
|
|
0cf9ed8994 | ||
|
|
452b74dec0 | ||
|
|
b516ceee5b | ||
|
|
c636980011 | ||
|
|
fe4a3e9dc4 | ||
|
|
25841cdc75 | ||
|
|
d33e81ef0a | ||
|
|
9e3160473a | ||
|
|
16442aeba9 | ||
|
|
b5995f67d8 | ||
|
|
14bfe8a3c2 | ||
|
|
4a37f59ce1 | ||
|
|
4a01835603 | ||
|
|
4bf9efefcd | ||
|
|
f51d161a24 | ||
|
|
45d8f67e10 | ||
|
|
8860c43c4f | ||
|
|
ff122d13a0 | ||
|
|
0d484b075d | ||
|
|
c9c61cc275 | ||
|
|
9a98713268 | ||
|
|
b0d1119294 | ||
|
|
42f2e5051b | ||
|
|
add23d04b0 | ||
|
|
b1a1112338 | ||
|
|
441b4e3e3e | ||
|
|
41d1b33258 | ||
|
|
a96fc882e0 | ||
|
|
27b59455b5 | ||
|
|
b70953fad1 | ||
|
|
42bbcc05c2 | ||
|
|
083c74988a | ||
|
|
81944e064b | ||
|
|
297ce8631d | ||
|
|
e1841ed7fe | ||
|
|
f863bda93f | ||
|
|
2e53550cc7 | ||
|
|
883e5a9a06 | ||
|
|
9d82283043 | ||
|
|
965b3402a0 | ||
|
|
98857f6458 | ||
|
|
5607428d37 | ||
|
|
6d12ea30d8 | ||
|
|
833b3c698d | ||
|
|
7a1008c321 | ||
|
|
501a2b6bc6 | ||
|
|
e96b7a70f8 | ||
|
|
ea0369bfa5 | ||
|
|
ba0189a318 | ||
|
|
a7a78dd2b3 | ||
|
|
510d8a73ef | ||
|
|
24b0229c31 | ||
|
|
6102de78ee | ||
|
|
0e1d16f71b | ||
|
|
b9aa007300 | ||
|
|
4a60bedd4c | ||
|
|
18af53e400 | ||
|
|
a30bae61bb | ||
|
|
45c52ebdef | ||
|
|
ea61bb562d | ||
|
|
075316fdcb | ||
|
|
c37c61e2d1 | ||
|
|
d1f550da12 | ||
|
|
cc751e03b2 | ||
|
|
b7b9bd7b5c | ||
|
|
7552a4f711 | ||
|
|
ddd0ce62f4 | ||
|
|
bd935f917b | ||
|
|
9db0c916ed | ||
|
|
b878abf6ab | ||
|
|
d56057ac65 | ||
|
|
d93d481cb7 | ||
|
|
b99eff69c0 | ||
|
|
4e4824afab |
No files matched your search
+1
-1
@@ -203,7 +203,7 @@
|
||||
</pre>
|
||||
|
||||
Use this to create lists. Lists contains <item>
|
||||
elements
|
||||
elements which have to contain <term> containers.
|
||||
|
||||
<pre>
|
||||
<list type="table"> </lits>
|
||||
|
||||
@@ -39,6 +39,48 @@ A: The Mono Project is an open development initiative sponsored by
|
||||
implement various technologies developed by Microsoft that have now
|
||||
been submitted to the ECMA for standardization.
|
||||
|
||||
The Mono project has also sparked a lot of interest in developing
|
||||
C#-based components, libraries and frameworks. Today Mono is not
|
||||
limited to implement the .NET Framework, but also contains other
|
||||
components. Some of the components of the Mono platform were
|
||||
developed by the Mono team, and some others we have incorporated
|
||||
from other open source efforts, the most important ones:
|
||||
|
||||
<ul>
|
||||
<li><a
|
||||
href="http://remoting-corba.sourceforge.net/">Remoting.CORBA</a>: A
|
||||
CORBA implementation for Mono.
|
||||
|
||||
<li>Ginzu: An implementation on top of Remoting for the <a
|
||||
href="http://www.zeroc.com">ICE</a> stack
|
||||
|
||||
<li><a href="http://gtk-sharp.sf.net">Gtk#</a>: Bindings for
|
||||
the popular Gtk+ GUI toolkit for Unix and Windows systems.
|
||||
Other bindings are available: Diacanvas-Sharp and MrProject.
|
||||
|
||||
<li><a
|
||||
href="http://www.icsharpcode.net/OpenSource/SharpZipLib/Default.aspx">#ZipLib</a>:
|
||||
A library to manipulate various kinds of compressed files and
|
||||
archives (Zip and tar).
|
||||
|
||||
<li>GlGen (available from the Mono CVS): Bindings for OpenGL.
|
||||
|
||||
<li>Mono.LDAP: LDAP access for .NET apps.
|
||||
|
||||
<li>Mono.Data: We ship support for Postgress, MySql, Sybase,
|
||||
DB2, SqlLite, Tds (SQL server protocol) and Oracle databases.
|
||||
|
||||
<li>Mono.Cairo: Bindings for the <a
|
||||
href="http://www.cairographics.org">Cairo</a> rendering
|
||||
engine (Our System.Drawing is implemented on top of this).
|
||||
|
||||
<li>Mono.Posix: Bindings for building POSIX applications using
|
||||
C#.
|
||||
|
||||
<li>Mono.Http: Support for creating custom, embedded HTTP
|
||||
servers and common HTTP handlers for your applications.
|
||||
</ul>
|
||||
|
||||
Q: What is the difference between Mono and the .NET Initiative?
|
||||
|
||||
A: The ".NET Initiative" is a somewhat nebulous company-wide effort by
|
||||
@@ -59,7 +101,9 @@ A: Mono contains a number of components useful for building new
|
||||
compiler, and a garbage collecting runtime.
|
||||
|
||||
* A class library that can work with any language
|
||||
which works on the CLR.
|
||||
which works on the CLR. Both .NET compatible class
|
||||
libraries as well as Mono-provided class libraries
|
||||
are included.
|
||||
|
||||
* A compiler for the C# language. In the future we
|
||||
might work on other compilers that target the Common
|
||||
@@ -133,7 +177,7 @@ A: Different parts of Mono will achieve usability at different stages,
|
||||
Q: When will Mono 1.0 ship?
|
||||
|
||||
A: We are planning on releasing Mono 1.0 (Mono Core) which will ship all the
|
||||
components of Mono that are known to be stable in Q4 2003.
|
||||
components of Mono that are known to be stable in Q4 2003/Q1 2004.
|
||||
|
||||
This release will lack System.Windows.Forms and
|
||||
Enterprise.Services, as they will not be production ready on this timeframe.
|
||||
@@ -303,9 +347,14 @@ A: There are several reasons for this.
|
||||
Win32 message loop. In order to maintain compatibility, Wine must be used,
|
||||
and this is being done; see the
|
||||
<a href="/winforms.html">System.Windows.Forms effort page</a>.
|
||||
|
||||
Additionally, Wine apps don't currently fit in -- visually -- with
|
||||
Gtk+ or Qt apps.
|
||||
|
||||
Q: Wine applications do not look like native applications, what are
|
||||
you going to do about this?
|
||||
|
||||
A: We have already a few patches into our version of Windows.Forms
|
||||
that makes Wine use the colors and font settings from your desktop,
|
||||
improving the integration a lot. In the future, we will continue
|
||||
to improve this interoperability scenario.
|
||||
|
||||
Q: Will I be able to run my smart clients on systems powered by Mono?
|
||||
|
||||
@@ -346,6 +395,12 @@ A: We do not know, volunteers are working on this, but there is no set
|
||||
date yet. The current approach is using the Wine Library to implement
|
||||
it.
|
||||
|
||||
Q: Do you have a comparission chart about the various toolkit
|
||||
offerings?
|
||||
|
||||
A: A document explaining this is available at: <a
|
||||
href="http://primates.ximian.com/~miguel/toolkits.html">http://primates.ximian.com/~miguel/toolkits.html</a>.
|
||||
|
||||
<a name="msft"></a>
|
||||
** Mono and Microsoft
|
||||
|
||||
@@ -488,6 +543,27 @@ A: Mono requires Unicode versions of Win32 APIs to run,
|
||||
Win32 libs. This is achieved by inserting -lunimono before
|
||||
-lkerner32/user32 in the linker's specs file.
|
||||
|
||||
Q: Why support Windows, when you can run the real thing?
|
||||
|
||||
A: There are various reasons:
|
||||
|
||||
<ul>
|
||||
<li> About half the contributors to Mono are Windows developers.
|
||||
They have many different for contributing to the effort, and
|
||||
we find it very important to let those developers run the runtime on Windows without forcing
|
||||
them to use a new operating system.
|
||||
|
||||
<li> Supporting Windows helps us identify the portable portions
|
||||
of Mono from the non-portable versions of it, helping Mono
|
||||
become more portable in the future.
|
||||
|
||||
<li> Mono does not heavily modify the windows registry, update system DLLs,
|
||||
install DLLs to the Windows/System32 path. Another words, I knew Mono would
|
||||
not cause any legacy enterprise applications to stop working - and it
|
||||
hasn't. However, our CIO er is againt it because of the changes that would
|
||||
be made to Windows 2000, such as, affecting security.
|
||||
</ul>
|
||||
|
||||
<a name="compatibility"></a>
|
||||
** Compatibility
|
||||
|
||||
@@ -1381,6 +1457,17 @@ A: First some background information.
|
||||
components, and things that we have developed (like Gtk#) or Apache
|
||||
integration.
|
||||
|
||||
Q: Is Mono only an implementation of the .NET Framework?
|
||||
|
||||
A: Mono implements both the .NET Framework, as well as plenty of class
|
||||
libraries that are either Unix specific, <a
|
||||
href="http://www.gnome.org">Gnome</a> specific, or that are not
|
||||
part of the .NET Framework but people find useful.
|
||||
|
||||
The following map shows the relationship between the components:
|
||||
|
||||
<img src="http://primates.ximian.com/~miguel/tmp/map.png">
|
||||
|
||||
<a name="etc"></a>
|
||||
** Miscellaneous Questions
|
||||
|
||||
@@ -1479,4 +1566,4 @@ A: It's possible to run VC++ generated apps under Mono, but we do not
|
||||
|
||||
** Credits
|
||||
|
||||
The FAQ contains material contributed by Miguel de Icaza, Jaime Anguiano, Lluis Sánchez.
|
||||
The FAQ contains material contributed by Miguel de Icaza, Jaime Anguiano, Lluis Sánchez.
|
||||
@@ -142,9 +142,6 @@
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@item Sep 3rd, 2003: Authenticode; WSE
|
||||
|
||||
|
||||
@item Sep 1st, 2003: Ice for Mono; XmlSerializer generators; Monodoc progress.
|
||||
|
||||
<b>Ice:</b> Vladimir has checked into CVS (Module ginzu) an
|
||||
|
||||
+3
-2
@@ -9,7 +9,8 @@ CORCOMPARE=../../../mcs/tools/corcompare
|
||||
|
||||
OBJECTS= \
|
||||
deploy/ado-net.html \
|
||||
deploy/provider-factory.html \
|
||||
deploy/bugs.html \
|
||||
deploy/provider-factory.html \
|
||||
deploy/mysql.html \
|
||||
deploy/odbc.html \
|
||||
deploy/oledb.html \
|
||||
@@ -128,7 +129,7 @@ transform.exe: transform.cs
|
||||
|
||||
|
||||
.PRECIOUS: src/%.src
|
||||
src/%.src: ../% commands template.html.in #makefile
|
||||
src/%.src: ../% commands template.html.in makefile
|
||||
perl htmlify $< > $@
|
||||
|
||||
.PRECIOUS: ../class-status-%
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
<a class="topmenu" href="download.html">Downloads</a> |
|
||||
<a class="topmenu" href="http://go-mono.com/daily">Daily snapshots</a> |
|
||||
<a class="topmenu" href="screenshots.html">Screenshots</a> |
|
||||
<a class="topmenu" href="http://mono.ximian.com:8080">Documentation</a>
|
||||
<a class="topmenu" href="http://www.go-mono.com:8080">Documentation</a> |
|
||||
<a class="topmenu" href="bugs.html">Bugs</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -195,7 +195,9 @@ for details on how to use this file.
|
||||
.SH NOTES
|
||||
During compilation the MCS compiler defines the __MonoCS__ symbol,
|
||||
this can be used by pre-processor instructions to compile Mono C#
|
||||
compiler specific code.
|
||||
compiler specific code. Please note that this symbol is only to test
|
||||
for the compiler, and is not useful to distinguish compilation or
|
||||
deployment platforms.
|
||||
.SH AUTHORS
|
||||
The Mono C# Compiler was written by Miguel de Icaza, Ravi Pratap and
|
||||
Martin Baulig at Ximian.
|
||||
|
||||
+3
-2
@@ -115,8 +115,9 @@ Instructs the runtime to collect profiling information about execution
|
||||
times and memory allocation, and dump it at the end of the execution.
|
||||
If a profiler is not specified, the default profiler is used. profiler_args
|
||||
is a profiler-specific string of options for the profiler itself.
|
||||
|
||||
|
||||
.PP
|
||||
The default profiler accepts -time and -alloc to options to disable
|
||||
the time profiling or the memory allocation profilng.
|
||||
.SH JIT MAINTAINER OPTIONS
|
||||
The maintainer options are only used by those developing the runtime
|
||||
itself, and not typically of interest to runtime users or developers.
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
2003-09-14 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* ConfigurationBaseTest.cs: New. Test all WSE1 static protected methods.
|
||||
* FilterConfigurationTest.cs: New. Test presence of default input/output
|
||||
SOAP filters.
|
||||
* WebServicesConfigurationTest.cs: New. Test FilterConfiguration.
|
||||
Executable
+344
@@ -0,0 +1,344 @@
|
||||
//
|
||||
// ConfigurationBaseTest.cs: ConfigurationBase Unit Tests
|
||||
//
|
||||
// Author:
|
||||
// Sebastien Pouliot ([email protected])
|
||||
//
|
||||
// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.Xml;
|
||||
|
||||
using WSEC = Microsoft.Web.Services.Configuration;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.MS.Web.Services.Configuration {
|
||||
|
||||
[TestFixture]
|
||||
public class ConfigurationBaseTest : WSEC.ConfigurationBase {
|
||||
|
||||
[Test]
|
||||
public void CheckForChildNodes_NoChildNode ()
|
||||
{
|
||||
string xml = "<node attrib=\"value\"/>";
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (xml);
|
||||
CheckForChildNodes (doc.DocumentElement);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void CheckForChildNodes_Null ()
|
||||
{
|
||||
CheckForChildNodes (null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ConfigurationException))]
|
||||
public void CheckForChildNodes_OneNode ()
|
||||
{
|
||||
string xml = "<test><childnode/></test>";
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (xml);
|
||||
CheckForChildNodes (doc.DocumentElement);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckForDuplicateChildNodes_NoDupes ()
|
||||
{
|
||||
string xml = "<test><childnode/></test>";
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (xml);
|
||||
CheckForDuplicateChildNodes (doc.DocumentElement);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void CheckForDuplicateChildNodes_Null ()
|
||||
{
|
||||
CheckForDuplicateChildNodes (null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ConfigurationException))]
|
||||
public void CheckForDuplicateChildNodes_Dupes ()
|
||||
{
|
||||
string xml = "<test><childnode/><childnode/></test>";
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (xml);
|
||||
CheckForDuplicateChildNodes (doc.DocumentElement);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckForUnrecognizedAttributes_NoAttribute ()
|
||||
{
|
||||
string xml = "<node/>";
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (xml);
|
||||
CheckForUnrecognizedAttributes (doc.DocumentElement);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void CheckForUnrecognizedAttributes_Null ()
|
||||
{
|
||||
CheckForUnrecognizedAttributes (null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ConfigurationException))]
|
||||
public void CheckForUnrecognizedAttributes_OneAttribute ()
|
||||
{
|
||||
string xml = "<test attrib=\"value\"/>";
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (xml);
|
||||
CheckForUnrecognizedAttributes (doc.DocumentElement);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetAndRemoveAttribute_AttribPresentNotRequired ()
|
||||
{
|
||||
string xml = "<test attrib=\"value\"/>";
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (xml);
|
||||
XmlNode xn = GetAndRemoveAttribute (doc.DocumentElement, "attrib", false);
|
||||
Assertion.AssertEquals ("GetAndRemoveAttribute_AttribPresentNotRequired", "attrib=\"value\"", xn.OuterXml);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetAndRemoveAttribute_AttribPresentAndRequired ()
|
||||
{
|
||||
string xml = "<test attrib=\"value\"/>";
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (xml);
|
||||
XmlNode xn = GetAndRemoveAttribute (doc.DocumentElement, "attrib", true);
|
||||
Assertion.AssertEquals ("GetAndRemoveAttribute_AttribPresentAndRequired", "attrib=\"value\"", xn.OuterXml);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetAndRemoveAttribute_AttribNotPresentNotRequired ()
|
||||
{
|
||||
string xml = "<test/>";
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (xml);
|
||||
XmlNode xn = GetAndRemoveAttribute (doc.DocumentElement, "attrib", false);
|
||||
Assertion.AssertNull ("GetAndRemoveAttribute_AttribNotPresentNotRequired", xn);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ConfigurationException))]
|
||||
public void GetAndRemoveAttribute_AttribNotPresentAndRequired ()
|
||||
{
|
||||
string xml = "<test/>";
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (xml);
|
||||
XmlNode xn = GetAndRemoveAttribute (doc.DocumentElement, "attrib", true);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void GetAndRemoveAttribute_NullNode ()
|
||||
{
|
||||
GetAndRemoveAttribute (null, "attrib", true);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetAndRemoveAttribute_NullAttrib ()
|
||||
{
|
||||
string xml = "<test/>";
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (xml);
|
||||
XmlNode xn = GetAndRemoveAttribute (doc.DocumentElement, null, false);
|
||||
Assertion.AssertNull ("GetAndRemoveAttribute_NullAttrib", xn);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetAndRemoveBoolAttribute_AttribPresentNotRequired ()
|
||||
{
|
||||
string xml = "<test attrib=\"true\"/>";
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (xml);
|
||||
bool result = false;
|
||||
XmlNode xn = GetAndRemoveBoolAttribute (doc.DocumentElement, "attrib", false, ref result);
|
||||
Assertion.AssertEquals ("GetAndRemoveBoolAttribute_AttribPresentNotRequired", "attrib=\"true\"", xn.OuterXml);
|
||||
Assertion.Assert ("GetAndRemoveBoolAttribute_AttribPresentNotRequired", result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetAndRemoveBoolAttribute_AttribPresentAndRequired ()
|
||||
{
|
||||
string xml = "<test attrib=\"true\"/>";
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (xml);
|
||||
bool result = false;
|
||||
XmlNode xn = GetAndRemoveBoolAttribute (doc.DocumentElement, "attrib", true, ref result);
|
||||
Assertion.AssertEquals ("GetAndRemoveBoolAttribute_AttribPresentAndRequired", "attrib=\"true\"", xn.OuterXml);
|
||||
Assertion.Assert ("GetAndRemoveBoolAttribute_AttribPresentAndRequired", result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetAndRemoveBoolAttribute_AttribNotPresentNotRequired ()
|
||||
{
|
||||
string xml = "<test/>";
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (xml);
|
||||
bool result = false;
|
||||
XmlNode xn = GetAndRemoveBoolAttribute (doc.DocumentElement, "attrib", false, ref result);
|
||||
Assertion.AssertNull ("GetAndRemoveBoolAttribute_AttribNotPresentNotRequired", xn);
|
||||
Assertion.Assert ("GetAndRemoveBoolAttribute_AttribNotPresentNotRequired", !result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ConfigurationException))]
|
||||
public void GetAndRemoveBoolAttribute_AttribNotPresentAndRequired ()
|
||||
{
|
||||
string xml = "<test/>";
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (xml);
|
||||
bool result = false;
|
||||
XmlNode xn = GetAndRemoveBoolAttribute (doc.DocumentElement, "attrib", true, ref result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void GetAndRemoveBoolAttribute_NullNode ()
|
||||
{
|
||||
bool result = false;
|
||||
GetAndRemoveBoolAttribute (null, "attrib", true, ref result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetAndRemoveBoolAttribute_NullAttrib ()
|
||||
{
|
||||
string xml = "<test/>";
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (xml);
|
||||
bool result = false;
|
||||
XmlNode xn = GetAndRemoveBoolAttribute (doc.DocumentElement, null, false, ref result);
|
||||
Assertion.AssertNull ("GetAndRemoveBoolAttribute_NullAttrib", xn);
|
||||
Assertion.Assert ("GetAndRemoveBoolAttribute_NullAttrib", !result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetAndRemoveStringAttribute_AttribPresentNotRequired ()
|
||||
{
|
||||
string xml = "<test attrib=\"true\"/>";
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (xml);
|
||||
string result = null;
|
||||
XmlNode xn = GetAndRemoveStringAttribute (doc.DocumentElement, "attrib", false, ref result);
|
||||
Assertion.AssertEquals ("GetAndRemoveStringAttribute_AttribPresentNotRequired", "attrib=\"true\"", xn.OuterXml);
|
||||
Assertion.AssertEquals ("GetAndRemoveStringAttribute_AttribPresentNotRequired", "true", result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetAndRemoveStringAttribute_AttribPresentAndRequired ()
|
||||
{
|
||||
string xml = "<test attrib=\"true\"/>";
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (xml);
|
||||
string result = null;
|
||||
XmlNode xn = GetAndRemoveStringAttribute (doc.DocumentElement, "attrib", true, ref result);
|
||||
Assertion.AssertEquals ("GetAndRemoveStringAttribute_AttribPresentAndRequired", "attrib=\"true\"", xn.OuterXml);
|
||||
Assertion.AssertEquals ("GetAndRemoveStringAttribute_AttribPresentAndRequired", "true", result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetAndRemoveStringAttribute_AttribNotPresentNotRequired ()
|
||||
{
|
||||
string xml = "<test/>";
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (xml);
|
||||
string result = null;
|
||||
XmlNode xn = GetAndRemoveStringAttribute (doc.DocumentElement, "attrib", false, ref result);
|
||||
Assertion.AssertNull ("GetAndRemoveBoolAttribute_AttribNotPresentNotRequired", xn);
|
||||
Assertion.AssertNull ("GetAndRemoveBoolAttribute_AttribNotPresentNotRequired", result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ConfigurationException))]
|
||||
public void GetAndRemoveStringAttribute_AttribNotPresentAndRequired ()
|
||||
{
|
||||
string xml = "<test/>";
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (xml);
|
||||
string result = null;
|
||||
XmlNode xn = GetAndRemoveStringAttribute (doc.DocumentElement, "attrib", true, ref result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void GetAndRemoveStringAttribute_NullNode ()
|
||||
{
|
||||
string result = null;
|
||||
GetAndRemoveStringAttribute (null, "attrib", true, ref result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetAndRemoveStringAttribute_NullAttrib ()
|
||||
{
|
||||
string xml = "<test/>";
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (xml);
|
||||
string result = null;
|
||||
XmlNode xn = GetAndRemoveStringAttribute (doc.DocumentElement, null, false, ref result);
|
||||
Assertion.AssertNull ("GetAndRemoveStringAttribute_NullAttrib", xn);
|
||||
Assertion.AssertNull ("GetAndRemoveStringAttribute_NullAttrib", result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ThrowIfElement_NoElement ()
|
||||
{
|
||||
string xml = "<element><!-- comment --></element>";
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (xml);
|
||||
ThrowIfElement (doc.DocumentElement.ChildNodes [0]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void ThrowIfElement_Null ()
|
||||
{
|
||||
ThrowIfElement (null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ConfigurationException))]
|
||||
public void ThrowIfElement_Element ()
|
||||
{
|
||||
string xml = "<element/>";
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (xml);
|
||||
ThrowIfElement (doc.DocumentElement);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ThrowIfNotComment_NoComment ()
|
||||
{
|
||||
string xml = "<element><!-- comment --></element>";
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (xml);
|
||||
ThrowIfNotComment (doc.DocumentElement.ChildNodes [0]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void ThrowIfNotComment_Null ()
|
||||
{
|
||||
ThrowIfNotComment (null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ConfigurationException))]
|
||||
public void ThrowIfNotComment_Element ()
|
||||
{
|
||||
string xml = "<element/>";
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (xml);
|
||||
ThrowIfNotComment (doc.DocumentElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// FilterConfigurationTest.cs: FilterConfiguration Unit Tests
|
||||
//
|
||||
// Author:
|
||||
// Sebastien Pouliot ([email protected])
|
||||
//
|
||||
// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.Xml;
|
||||
|
||||
using Microsoft.Web.Services.Configuration;
|
||||
using Microsoft.Web.Services.Security;
|
||||
using Microsoft.Web.Services.Timestamp;
|
||||
using Microsoft.Web.Services.Referral;
|
||||
using Microsoft.Web.Services.Routing;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.MS.Web.Services.Configuration {
|
||||
|
||||
[TestFixture]
|
||||
public class FilterConfigurationTest : Assertion {
|
||||
|
||||
[Test]
|
||||
public void InputFilters ()
|
||||
{
|
||||
FilterConfiguration fc = WebServicesConfiguration.FilterConfiguration;
|
||||
AssertEquals ("InputFilters.Count", 4, fc.InputFilters.Count);
|
||||
// order is important (think so)
|
||||
Assert ("InputFilters.0.SecurityInputFilter", fc.InputFilters [0] is SecurityInputFilter);
|
||||
Assert ("InputFilters.1.TimestampInputFilter", fc.InputFilters [1] is TimestampInputFilter);
|
||||
Assert ("InputFilters.2.ReferralInputFilter", fc.InputFilters [2] is ReferralInputFilter);
|
||||
Assert ("InputFilters.3.RoutingInputFilter", fc.InputFilters [3] is RoutingInputFilter);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OutputFilters ()
|
||||
{
|
||||
FilterConfiguration fc = WebServicesConfiguration.FilterConfiguration;
|
||||
AssertEquals ("OutputFilters.Count", 4, fc.OutputFilters.Count);
|
||||
// order is important (think so)
|
||||
Assert ("InputFilters.0.SecurityOutputFilter", fc.OutputFilters [0] is SecurityOutputFilter);
|
||||
Assert ("InputFilters.1.TimestampOutputFilter", fc.OutputFilters [1] is TimestampOutputFilter);
|
||||
Assert ("InputFilters.2.ReferralOutputFilter", fc.OutputFilters [2] is ReferralOutputFilter);
|
||||
Assert ("InputFilters.3.RoutingOutputFilter", fc.OutputFilters [3] is RoutingOutputFilter);
|
||||
}
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// WebServicesConfigurationTest.cs: WebServicesConfiguration Unit Tests
|
||||
//
|
||||
// Author:
|
||||
// Sebastien Pouliot ([email protected])
|
||||
//
|
||||
// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
using Microsoft.Web.Services.Configuration;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.MS.Web.Services.Configuration {
|
||||
|
||||
[TestFixture]
|
||||
public class WebServicesConfigurationTest : Assertion {
|
||||
|
||||
[Test]
|
||||
public void FilterConfiguration ()
|
||||
{
|
||||
FilterConfiguration fc = WebServicesConfiguration.FilterConfiguration;
|
||||
AssertNotNull ("FilterConfiguration", fc);
|
||||
}
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// MonoTests.MS.Web.Services.Timestamp.AllTests.cs
|
||||
//
|
||||
// Author:
|
||||
// Sebastien Pouliot ([email protected])
|
||||
//
|
||||
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
|
||||
//
|
||||
|
||||
using System;
|
||||
using Microsoft.Web.Services.Timestamp;
|
||||
using NUnit.Framework;
|
||||
|
||||
// note: due to compiler confusion between classes and namespace (like Timestamp)
|
||||
// I renamed the test namespace from "MonoTests.Microsoft.Web.Services.Timestamp"
|
||||
// to "MonoTests.MS.Web.Services.Timestamp".
|
||||
namespace MonoTests.MS.Web.Services.Timestamp {
|
||||
|
||||
public class AllTests {
|
||||
|
||||
// some missing overloads for the tests
|
||||
|
||||
public static void AssertEquals (string message, DateTime expected, DateTime actual)
|
||||
{
|
||||
// Format before compare (Timestamp doesn't have a good resolution)
|
||||
Assertion.Assert (message, (expected.ToString (WSTimestamp.TimeFormat) == actual.ToString (WSTimestamp.TimeFormat)));
|
||||
}
|
||||
|
||||
public static void AssertEquals (string message, long expected, long actual)
|
||||
{
|
||||
Assertion.Assert (message, (expected == actual));
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
2003-09-14 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* AllTests.cs: New. Common methods to compare DateTimes and longs.
|
||||
* ReceivedCollectionTest.cs: New. Unit tests for ReceivedCollection.
|
||||
* ReceivedTest.cs: New. Unit test for Received.
|
||||
* TimestampFormatExceptionTest.cs: Unit test for TimestampFormatException.
|
||||
* TimestampInputFilterTest.cs: Unit test for TimestampInputFilter.
|
||||
* TimestampOutputFilterTest.cs: Unit test for TimestampOutputFilter.
|
||||
* TimestampTest.cs: Unit test for Timestamp.
|
||||
* WSTimestampTest.cs: Unit test for WSTimestamp.
|
||||
Executable
+85
@@ -0,0 +1,85 @@
|
||||
//
|
||||
// ReceivedCollectionTest.cs - NUnit Test Cases for ReceivedCollection
|
||||
//
|
||||
// Author:
|
||||
// Sebastien Pouliot ([email protected])
|
||||
//
|
||||
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
|
||||
//
|
||||
|
||||
using NUnit.Framework;
|
||||
using Microsoft.Web.Services.Timestamp;
|
||||
using System;
|
||||
using System.Xml;
|
||||
|
||||
// note: due to compiler confusion between classes and namespace (like Timestamp)
|
||||
// I renamed the test namespace from "MonoTests.Microsoft.Web.Services.Timestamp"
|
||||
// to "MonoTests.MS.Web.Services.Timestamp".
|
||||
namespace MonoTests.MS.Web.Services.Timestamp {
|
||||
|
||||
[TestFixture]
|
||||
public class ReceivedCollectionTest : Assertion {
|
||||
|
||||
private ReceivedCollection coll;
|
||||
|
||||
[SetUp]
|
||||
void SetUp ()
|
||||
{
|
||||
coll = new ReceivedCollection ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Empty ()
|
||||
{
|
||||
AssertEquals ("Empty: Count = 0", 0, coll.Count);
|
||||
AssertNotNull ("Enumerator", coll.GetEnumerator ());
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentOutOfRangeException))]
|
||||
public void EmptyAccess ()
|
||||
{
|
||||
Received r = coll[0];
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Add ()
|
||||
{
|
||||
Received r = new Received (new Uri ("http://www.go-mono.com/"));
|
||||
coll.Add (r);
|
||||
AssertEquals ("Add: Count = 1", 1, coll.Count);
|
||||
Assert ("Contains 1", coll.Contains (r));
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void AddNull ()
|
||||
{
|
||||
Received r = null;
|
||||
coll.Add (r);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CopyTo ()
|
||||
{
|
||||
Received r = new Received (new Uri ("http://www.go-mono.com/"));
|
||||
coll.Add (r);
|
||||
|
||||
object[] container = new object [3];
|
||||
coll.CopyTo (container, 0);
|
||||
AssertNotNull ("CopyTo[0]", container[0]);
|
||||
AssertNull ("CopyTo[1]", container[1]);
|
||||
AssertNull ("CopyTo[2]", container[2]);
|
||||
|
||||
coll.Remove (r);
|
||||
AssertEquals ("Remove: Count = 0", 0, coll.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void CopyToException ()
|
||||
{
|
||||
coll.CopyTo (null, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
//
|
||||
// ReceivedTest.cs - NUnit Test Cases for Received
|
||||
//
|
||||
// Author:
|
||||
// Sebastien Pouliot ([email protected])
|
||||
//
|
||||
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
|
||||
//
|
||||
|
||||
using NUnit.Framework;
|
||||
using Microsoft.Web.Services.Timestamp;
|
||||
using System;
|
||||
using System.Xml;
|
||||
|
||||
// note: due to compiler confusion between classes and namespace (like Timestamp)
|
||||
// I renamed the test namespace from "MonoTests.Microsoft.Web.Services.Timestamp"
|
||||
// to "MonoTests.MS.Web.Services.Timestamp".
|
||||
namespace MonoTests.MS.Web.Services.Timestamp {
|
||||
|
||||
[TestFixture]
|
||||
public class ReceivedTest : Assertion {
|
||||
|
||||
[Test]
|
||||
public void Constructor_Uri ()
|
||||
{
|
||||
Uri uri = new Uri ("http://www.go-mono.com/");
|
||||
Received recv = new Received (uri);
|
||||
AssertNotNull ("Received (uri)", recv);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void Constructor_UriNull ()
|
||||
{
|
||||
Uri nullUri = null;
|
||||
Received recv = new Received (nullUri);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void Constructor_XmlElementNull ()
|
||||
{
|
||||
XmlElement nullXml = null;
|
||||
Received recv = new Received (nullXml);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Properties ()
|
||||
{
|
||||
string actor = "http://www.go-mono.com/";
|
||||
Uri uri = new Uri (actor);
|
||||
Received recv = new Received (uri);
|
||||
|
||||
AssertEquals ("Actor", actor, recv.Actor.AbsoluteUri);
|
||||
// compare longs not objects !!!
|
||||
AllTests.AssertEquals ("Delay", 0, recv.Delay);
|
||||
// we dont check default value because it's UtcNow (too late ;-)
|
||||
DateTime testDate = DateTime.FromFileTime (0xDEADC0DE); // 12/31/1600
|
||||
recv.Value = testDate;
|
||||
AssertEquals ("Value", testDate, recv.Value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Roundtrips ()
|
||||
{
|
||||
string actor = "http://www.go-mono.com/";
|
||||
Uri uri = new Uri (actor);
|
||||
Received recv = new Received (uri);
|
||||
recv.Value = DateTime.FromFileTime (0xDEADC0DE); // 12/31/1600
|
||||
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
XmlElement xel = recv.GetXml (doc);
|
||||
Assertion.AssertEquals ("Xml", "<wsu:Received xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\">1600-12-31T19:06:13Z</wsu:Received>", xel.OuterXml);
|
||||
|
||||
try {
|
||||
Received recv2 = new Received (xel);
|
||||
Assertion.Fail ("Expected TimestampFormatException but got none");
|
||||
}
|
||||
catch (TimestampFormatException e) {
|
||||
// not logical but as documented
|
||||
if (e.Message != TimestampFormatException.MissingActorAttributeInReceivedElement)
|
||||
Assertion.Fail ("Invalid TimestampFormatException.Message -> MissingActorAttributeInReceivedElement");
|
||||
}
|
||||
catch (Exception e) {
|
||||
Assertion.Fail ("Expected TimestampFormatException but got: " + e.ToString ());
|
||||
}
|
||||
|
||||
try {
|
||||
Received recv3 = new Received (uri);
|
||||
recv3.LoadXml (xel);
|
||||
Assertion.Fail ("Expected TimestampFormatException but got none");
|
||||
}
|
||||
catch (TimestampFormatException e) {
|
||||
// not logical but as documented
|
||||
if (e.Message != TimestampFormatException.MissingActorAttributeInReceivedElement)
|
||||
Assertion.Fail ("Invalid TimestampFormatException.Message -> MissingActorAttributeInReceivedElement");
|
||||
}
|
||||
catch (Exception e) {
|
||||
Assertion.Fail ("Expected TimestampFormatException but got: " + e.ToString ());
|
||||
}
|
||||
}
|
||||
|
||||
public void TestDelay ()
|
||||
{
|
||||
string actor = "http://www.go-mono.com/";
|
||||
Uri uri = new Uri (actor);
|
||||
Received recv = new Received (uri);
|
||||
recv.Delay = 60;
|
||||
recv.Value = DateTime.FromFileTime (0xDEADC0DE); // 12/31/1600
|
||||
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
XmlElement xel = recv.GetXml (doc);
|
||||
// Actor isn't present
|
||||
AssertEquals ("Xml", "<wsu:Received Delay=\"60\" xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\">1600-12-31T19:06:13Z</wsu:Received>", xel.OuterXml);
|
||||
|
||||
string xml = "<wsu:Received Actor=\"http://www.go-mono.com/\" Delay=\"60\" xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\">1600-12-31T19:06:13Z</wsu:Received>";
|
||||
doc.LoadXml (xml);
|
||||
|
||||
// FIXME: Shouldn't need this - Bug in WSE ?
|
||||
xel.SetAttribute (WSTimestamp.AttributeNames.Actor, actor);
|
||||
Received recv2 = new Received (xel);
|
||||
AssertEquals ("Actor", recv.Actor.AbsoluteUri, recv2.Actor.AbsoluteUri);
|
||||
AssertEquals ("Delay", recv.Delay, recv2.Delay);
|
||||
// compare DateTime not objects !!!
|
||||
AllTests.AssertEquals ("Value", recv.Value, recv2.Value);
|
||||
|
||||
Received recv3 = new Received (uri);
|
||||
recv3.LoadXml (doc.DocumentElement);
|
||||
AssertEquals ("Actor", recv.Actor.AbsoluteUri, recv3.Actor.AbsoluteUri);
|
||||
AssertEquals ("Delay", recv.Delay, recv3.Delay);
|
||||
// compare DateTime not objects !!!
|
||||
AllTests.AssertEquals ("Value", recv.Value, recv3.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// TimestampFormatExceptionTest.cs - NUnit Test Cases for TimestampFormatException
|
||||
//
|
||||
// Author:
|
||||
// Sebastien Pouliot ([email protected])
|
||||
//
|
||||
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
|
||||
//
|
||||
|
||||
using NUnit.Framework;
|
||||
using Microsoft.Web.Services.Timestamp;
|
||||
using System;
|
||||
using System.Xml;
|
||||
|
||||
// note: due to compiler confusion between classes and namespace (like Timestamp)
|
||||
// I renamed the test namespace from "MonoTests.Microsoft.Web.Services.Timestamp"
|
||||
// to "MonoTests.MS.Web.Services.Timestamp".
|
||||
namespace MonoTests.MS.Web.Services.Timestamp {
|
||||
|
||||
[TestFixture]
|
||||
public class TimestampFormatExceptionTest : Assertion {
|
||||
|
||||
[Test]
|
||||
public void Constructor ()
|
||||
{
|
||||
string msg = "message";
|
||||
TimestampFormatException e = new TimestampFormatException (msg);
|
||||
AssertEquals ("Message", msg, e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+84
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// TimestampInputFilterTest.cs - NUnit Test Cases for TimestampInputFilter
|
||||
//
|
||||
// Author:
|
||||
// Sebastien Pouliot ([email protected])
|
||||
//
|
||||
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
|
||||
//
|
||||
|
||||
using NUnit.Framework;
|
||||
using Microsoft.Web.Services;
|
||||
using Microsoft.Web.Services.Timestamp;
|
||||
using System;
|
||||
using System.Web.Services.Protocols;
|
||||
using System.Xml;
|
||||
|
||||
// note: due to compiler confusion between classes and namespace (like Timestamp)
|
||||
// I renamed the test namespace from "MonoTests.Microsoft.Web.Services.Timestamp"
|
||||
// to "MonoTests.MS.Web.Services.Timestamp".
|
||||
namespace MonoTests.MS.Web.Services.Timestamp {
|
||||
|
||||
// Reference:
|
||||
// 1. Inside the Web Services Enhancements Pipeline
|
||||
// http://msdn.microsoft.com/library/en-us/dnwebsrv/html/insidewsepipe.asp
|
||||
|
||||
[TestFixture]
|
||||
public class TimestampInputFilterTest : Assertion {
|
||||
|
||||
static string soapMinimal = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body /></soap:Envelope>";
|
||||
static string soapExpiredEnvelope = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Header><wsu:Timestamp xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\"><wsu:Created>2002-11-14T19:03:27Z</wsu:Created><wsu:Expires>2002-11-14T19:08:27Z</wsu:Expires></wsu:Timestamp></soap:Header><soap:Body /></soap:Envelope>";
|
||||
static string soapTimestampEnvelope = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Header><wsu:Timestamp xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\"><wsu:Created>2002-11-14T19:03:27Z</wsu:Created><wsu:Expires>2020-11-14T19:08:27Z</wsu:Expires></wsu:Timestamp></soap:Header><soap:Body /></soap:Envelope>";
|
||||
|
||||
[Test]
|
||||
public void NoTimestamp ()
|
||||
{
|
||||
SoapEnvelope env = new SoapEnvelope ();
|
||||
env.LoadXml (soapMinimal);
|
||||
|
||||
TimestampInputFilter tsInput = new TimestampInputFilter ();
|
||||
tsInput.ProcessMessage (env);
|
||||
AssertEquals ("Envelope", soapMinimal, env.Envelope.OuterXml);
|
||||
AllTests.AssertEquals ("Created", DateTime.MinValue, env.Context.Timestamp.Created);
|
||||
AllTests.AssertEquals ("Expires", DateTime.MaxValue, env.Context.Timestamp.Expires);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ExpiredMessage ()
|
||||
{
|
||||
SoapEnvelope env = new SoapEnvelope ();
|
||||
env.LoadXml (soapExpiredEnvelope);
|
||||
|
||||
TimestampInputFilter tsInput = new TimestampInputFilter ();
|
||||
try {
|
||||
tsInput.ProcessMessage (env);
|
||||
Fail ("Expected TimestampFault but got none");
|
||||
}
|
||||
catch (SoapHeaderException she) {
|
||||
// TimestampFault isn't public so we catch it's ancestor
|
||||
if (she.ToString ().StartsWith ("Microsoft.Web.Services.Timestamp.TimestampFault")) {
|
||||
// this is expected
|
||||
}
|
||||
else
|
||||
Fail ("Expected TimestampFault but got " + she.ToString ());
|
||||
}
|
||||
catch (Exception e) {
|
||||
Fail ("Expected TimestampFault but got " + e.ToString ());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ValidMessage ()
|
||||
{
|
||||
SoapEnvelope env = new SoapEnvelope ();
|
||||
// valid until 2020
|
||||
env.LoadXml (soapTimestampEnvelope);
|
||||
|
||||
TimestampInputFilter tsInput = new TimestampInputFilter ();
|
||||
tsInput.ProcessMessage (env);
|
||||
AssertEquals ("Envelope", "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Header></soap:Header><soap:Body /></soap:Envelope>", env.Envelope.OuterXml);
|
||||
AssertEquals ("Created", "2002-11-14T19:03:27Z", env.Context.Timestamp.Created.ToString (WSTimestamp.TimeFormat));
|
||||
AssertEquals ("Expires", "2020-11-14T19:08:27Z", env.Context.Timestamp.Expires.ToString (WSTimestamp.TimeFormat));
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+66
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// TimestampOutputFilterTest.cs - NUnit Test Cases for TimestampOutputFilter
|
||||
//
|
||||
// Author:
|
||||
// Sebastien Pouliot ([email protected])
|
||||
//
|
||||
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
|
||||
//
|
||||
|
||||
using NUnit.Framework;
|
||||
using Microsoft.Web.Services;
|
||||
using Microsoft.Web.Services.Timestamp;
|
||||
using System;
|
||||
using System.Web.Services.Protocols;
|
||||
using System.Xml;
|
||||
|
||||
// note: due to compiler confusion between classes and namespace (like Timestamp)
|
||||
// I renamed the test namespace from "MonoTests.Microsoft.Web.Services.Timestamp"
|
||||
// to "MonoTests.MS.Web.Services.Timestamp".
|
||||
namespace MonoTests.MS.Web.Services.Timestamp {
|
||||
|
||||
// Reference:
|
||||
// 1. Inside the Web Services Enhancements Pipeline
|
||||
// http://msdn.microsoft.com/library/en-us/dnwebsrv/html/insidewsepipe.asp
|
||||
|
||||
[TestFixture]
|
||||
public class TimestampOutputFilterTest : Assertion {
|
||||
|
||||
[Test]
|
||||
public void TimestampWithoutHeader ()
|
||||
{
|
||||
SoapEnvelope env = new SoapEnvelope ();
|
||||
XmlElement body = env.CreateBody ();
|
||||
env.Envelope.AppendChild (body);
|
||||
|
||||
string xml = env.Envelope.OuterXml;
|
||||
Assert ("Envelope.Header", xml.IndexOf ("<soap:Header>") < 0);
|
||||
|
||||
TimestampOutputFilter tsOutput = new TimestampOutputFilter ();
|
||||
tsOutput.ProcessMessage (env);
|
||||
xml = env.Envelope.OuterXml;
|
||||
Assert ("Envelope.Header", xml.IndexOf ("<soap:Header>") > 0);
|
||||
|
||||
// not static - more difficult to check
|
||||
Assert ("Envelope.Timestamp.Created", xml.IndexOf ("<wsu:Created>") > 0);
|
||||
Assert ("Envelope.Timestamp.Expired", xml.IndexOf ("<wsu:Expires>") > 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TimestampWithHeader ()
|
||||
{
|
||||
SoapEnvelope env = new SoapEnvelope ();
|
||||
XmlElement header = env.CreateHeader ();
|
||||
env.Envelope.AppendChild (header);
|
||||
XmlElement body = env.CreateBody ();
|
||||
env.Envelope.AppendChild (body);
|
||||
|
||||
TimestampOutputFilter tsOutput = new TimestampOutputFilter ();
|
||||
tsOutput.ProcessMessage (env);
|
||||
// not static - more difficult to check
|
||||
string xml = env.Envelope.OuterXml;
|
||||
Assert ("Envelope.Timestamp.Created", xml.IndexOf ("<wsu:Created>") > 0);
|
||||
Assert ("Envelope.Timestamp.Expired", xml.IndexOf ("<wsu:Expires>") > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
+204
@@ -0,0 +1,204 @@
|
||||
//
|
||||
// TimestampTest.cs - NUnit Test Cases for Timestamp
|
||||
//
|
||||
// Author:
|
||||
// Sebastien Pouliot ([email protected])
|
||||
//
|
||||
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
|
||||
//
|
||||
|
||||
using NUnit.Framework;
|
||||
using Microsoft.Web.Services.Timestamp;
|
||||
using System;
|
||||
using System.Xml;
|
||||
|
||||
// note: due to compiler confusion between classes and namespace (like Timestamp)
|
||||
// I renamed the test namespace from "MonoTests.Microsoft.Web.Services.Timestamp"
|
||||
// to "MonoTests.MS.Web.Services.Timestamp".
|
||||
namespace MonoTests.MS.Web.Services.Timestamp {
|
||||
|
||||
[TestFixture]
|
||||
public class TimestampTest : Assertion {
|
||||
|
||||
// compiler conflict between namespace Timestamp and class Timestamp
|
||||
private Microsoft.Web.Services.Timestamp.Timestamp ts;
|
||||
|
||||
private static string empty = "<wsu:Timestamp xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\" />";
|
||||
private static string test1 = "<wsu:Timestamp xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\"><wsu:Created>2001-09-13T08:42:00Z</wsu:Created><wsu:Expires>2001-10-13T09:00:00Z</wsu:Expires></wsu:Timestamp>";
|
||||
private static string test2 = "<wsu:Timestamp xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\"><wsu:Created>2001-09-13T08:42:00Z</wsu:Created><wsu:Expires>2001-10-13T09:00:00Z</wsu:Expires><wsu:Received Actor=\"http://x.com/\" Delay=\"60000\">2001-09-13T08:44:00Z</wsu:Received></wsu:Timestamp>";
|
||||
private static string test3 = "<wsu:Timestamp xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\"><wsu:Created wsu:Id=\"createdId\">2001-09-13T08:42:00Z</wsu:Created><wsu:Expires wsu:Id=\"expiresId\">2001-10-13T09:00:00Z</wsu:Expires><wsu:Received Actor=\"http://x.com/\" Delay=\"60000\">2001-09-13T08:44:00Z</wsu:Received></wsu:Timestamp>";
|
||||
private static string test4 = "<wsu:Timestamp wsu:Id=\"timestampId\" xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\"><wsu:Created wsu:Id=\"createdId\">2001-09-13T08:42:00Z</wsu:Created><wsu:Expires wsu:Id=\"expiresId\">2001-10-13T09:00:00Z</wsu:Expires><wsu:Received Actor=\"http://x.com/\" Delay=\"60000\" wsu:Id=\"receivedId\">2001-09-13T08:44:00Z</wsu:Received></wsu:Timestamp>";
|
||||
|
||||
[SetUp]
|
||||
void SetUp ()
|
||||
{
|
||||
ts = new Microsoft.Web.Services.Timestamp.Timestamp ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Properties ()
|
||||
{
|
||||
// test values
|
||||
DateTime testTime = DateTime.UtcNow;
|
||||
long testTTL = 1;
|
||||
// default values
|
||||
AssertEquals ("Created (default)", DateTime.MinValue, ts.Created);
|
||||
AssertEquals ("Expires (default)", DateTime.MaxValue, ts.Expires);
|
||||
AllTests.AssertEquals ("TTL (default)", 300000, ts.Ttl);
|
||||
// new ttl values
|
||||
ts.Ttl = testTTL;
|
||||
AllTests.AssertEquals ("TTL (test)", 1, ts.Ttl);
|
||||
ts.Ttl = 0;
|
||||
AllTests.AssertEquals ("TTL (0)", 0, ts.Ttl);
|
||||
AssertEquals ("Expires (0)", DateTime.MaxValue, ts.Expires);
|
||||
AssertNotNull ("Receivers", ts.Receivers);
|
||||
AssertEquals ("Receivers.Count", 0, ts.Receivers.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void Ttl_Negative ()
|
||||
{
|
||||
ts.Ttl = -1;
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (TimestampFormatException))]
|
||||
public void CheckInvalid ()
|
||||
{
|
||||
// default object is incomplete
|
||||
ts.CheckValid ();
|
||||
}
|
||||
|
||||
// Note: All valid (no exception are thrown) but all EXPIRED !
|
||||
[Test]
|
||||
public void CheckValid ()
|
||||
{
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (test1);
|
||||
ts.LoadXml (doc.DocumentElement);
|
||||
ts.CheckValid ();
|
||||
|
||||
doc.LoadXml (test2);
|
||||
ts.LoadXml (doc.DocumentElement);
|
||||
ts.CheckValid ();
|
||||
|
||||
doc.LoadXml (test3);
|
||||
ts.LoadXml (doc.DocumentElement);
|
||||
ts.CheckValid ();
|
||||
|
||||
doc.LoadXml (test4);
|
||||
ts.LoadXml (doc.DocumentElement);
|
||||
ts.CheckValid ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetXml ()
|
||||
{
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
XmlElement xel = ts.GetXml (doc);
|
||||
// minimal XML
|
||||
AssertEquals ("Xml", empty, xel.OuterXml);
|
||||
|
||||
ts.Ttl = 60000; // one minute
|
||||
xel = ts.GetXml (doc);
|
||||
// TTL has no change in XML
|
||||
AssertEquals ("Xml", empty, xel.OuterXml);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void LoadXml_Null ()
|
||||
{
|
||||
ts.LoadXml (null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void LoadXml_BadElement ()
|
||||
{
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
// bad element (Timestamp case is invalid)
|
||||
doc.LoadXml ("<wsu:timeStamp xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2002/07/utility\" />");
|
||||
ts.LoadXml (doc.DocumentElement);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void LoadXml_BadNamespace ()
|
||||
{
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
// bad namespace (invalid year in URL)
|
||||
doc.LoadXml ("<wsu:Timestamp xmlns:wsu=\"http://schemas.xmlsoap.org/ws/2003/07/utility\" />");
|
||||
ts.LoadXml (doc.DocumentElement);
|
||||
}
|
||||
|
||||
// sample taken from http://msdn.microsoft.com/library/en-us/dnglobspec/html/ws-security.asp
|
||||
[Test]
|
||||
public void LoadXml ()
|
||||
{
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (test1);
|
||||
ts.LoadXml (doc.DocumentElement);
|
||||
|
||||
XmlElement xel = ts.GetXml (doc);
|
||||
AssertEquals ("Xml", test1, xel.OuterXml);
|
||||
AssertEquals ("Xml Actor", "", ts.Actor);
|
||||
AssertEquals ("Xml Created", "2001-09-13T08:42:00Z", ts.Created.ToString (WSTimestamp.TimeFormat));
|
||||
AssertEquals ("Xml Expires", "2001-10-13T09:00:00Z", ts.Expires.ToString (WSTimestamp.TimeFormat));
|
||||
AssertEquals ("Xml Receivers.Count", 0, ts.Receivers.Count);
|
||||
AllTests.AssertEquals ("Xml Ttl", 300000, ts.Ttl);
|
||||
}
|
||||
|
||||
// sample taken from http://msdn.microsoft.com/library/en-us/dnglobspec/html/ws-security.asp
|
||||
[Test]
|
||||
public void LoadXmlWithOneIntermediary ()
|
||||
{
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (test2);
|
||||
ts.LoadXml (doc.DocumentElement);
|
||||
|
||||
XmlElement xel = ts.GetXml (doc);
|
||||
AssertEquals ("Xml", test2, xel.OuterXml);
|
||||
AssertEquals ("Xml Actor", "", ts.Actor); // Actor is part of <Received> element
|
||||
AssertEquals ("Xml Created", "2001-09-13T08:42:00Z", ts.Created.ToString (WSTimestamp.TimeFormat));
|
||||
AssertEquals ("Xml Expires", "2001-10-13T09:00:00Z", ts.Expires.ToString (WSTimestamp.TimeFormat));
|
||||
AssertEquals ("Xml Receivers.Count", 1, ts.Receivers.Count);
|
||||
AllTests.AssertEquals ("Xml Ttl", 300000, ts.Ttl);
|
||||
}
|
||||
|
||||
// WSE supports wsu:Id for Created and Expires elements
|
||||
[Test]
|
||||
public void LoadXmlWithCreatedAndExpiresIds ()
|
||||
{
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (test3);
|
||||
ts.LoadXml (doc.DocumentElement);
|
||||
|
||||
XmlElement xel = ts.GetXml (doc);
|
||||
AssertEquals ("Xml", test3, xel.OuterXml);
|
||||
AssertEquals ("Xml Actor", "", ts.Actor); // Actor is part of <Received> element
|
||||
AssertEquals ("Xml Created", "2001-09-13T08:42:00Z", ts.Created.ToString (WSTimestamp.TimeFormat));
|
||||
AssertEquals ("Xml Expires", "2001-10-13T09:00:00Z", ts.Expires.ToString (WSTimestamp.TimeFormat));
|
||||
AssertEquals ("Xml Receivers.Count", 1, ts.Receivers.Count);
|
||||
AllTests.AssertEquals ("Xml Ttl", 300000, ts.Ttl);
|
||||
}
|
||||
|
||||
// WSE _doesn't_ support wsu:Id for Timestamp and Received elements
|
||||
[Test]
|
||||
public void LoadXmlWithAllIds ()
|
||||
{
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (test4);
|
||||
ts.LoadXml (doc.DocumentElement);
|
||||
|
||||
XmlElement xel = ts.GetXml (doc);
|
||||
// FIXME (WSE) AssertEquals ("Xml", test4, xel.OuterXml);
|
||||
AssertEquals ("Xml Actor", "", ts.Actor); // Actor is part of <Received> element
|
||||
AssertEquals ("Xml Created", "2001-09-13T08:42:00Z", ts.Created.ToString (WSTimestamp.TimeFormat));
|
||||
AssertEquals ("Xml Expires", "2001-10-13T09:00:00Z", ts.Expires.ToString (WSTimestamp.TimeFormat));
|
||||
AssertEquals ("Xml Receivers.Count", 1, ts.Receivers.Count);
|
||||
AllTests.AssertEquals ("Xml Ttl", 300000, ts.Ttl);
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+73
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// WSTimestampTest.cs - NUnit Test Cases for WSTimestamp
|
||||
//
|
||||
// Author:
|
||||
// Sebastien Pouliot ([email protected])
|
||||
//
|
||||
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
|
||||
//
|
||||
|
||||
using NUnit.Framework;
|
||||
using Microsoft.Web.Services.Timestamp;
|
||||
using System;
|
||||
|
||||
// note: due to compiler confusion between classes and namespace (like Timestamp)
|
||||
// I renamed the test namespace from "MonoTests.Microsoft.Web.Services.Timestamp"
|
||||
// to "MonoTests.MS.Web.Services.Timestamp".
|
||||
namespace MonoTests.MS.Web.Services.Timestamp {
|
||||
|
||||
[TestFixture]
|
||||
public class WSTimestampTest : Assertion {
|
||||
|
||||
[Test]
|
||||
public void Constructor ()
|
||||
{
|
||||
WSTimestamp wsts = new WSTimestamp ();
|
||||
AssertNotNull ("Constructor", wsts);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PublicConstStrings ()
|
||||
{
|
||||
AssertEquals ("NamespaceURI", "http://schemas.xmlsoap.org/ws/2002/07/utility", WSTimestamp.NamespaceURI);
|
||||
AssertEquals ("Prefix", "wsu", WSTimestamp.Prefix);
|
||||
AssertEquals ("TimeFormat", "yyyy-MM-ddTHH:mm:ssZ", WSTimestamp.TimeFormat);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AttributeNamesConstructor ()
|
||||
{
|
||||
// test constructor
|
||||
WSTimestamp.AttributeNames an = new WSTimestamp.AttributeNames ();
|
||||
AssertNotNull ("AttributeNames Constructor", an);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AttributeNames ()
|
||||
{
|
||||
// test public const strings
|
||||
AssertEquals ("Actor", "Actor", WSTimestamp.AttributeNames.Actor);
|
||||
AssertEquals ("Delay", "Delay", WSTimestamp.AttributeNames.Delay);
|
||||
AssertEquals ("Id", "Id", WSTimestamp.AttributeNames.Id);
|
||||
AssertEquals ("ValueType", "ValueType", WSTimestamp.AttributeNames.ValueType);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ElementNamesConstructor ()
|
||||
{
|
||||
// test constructor
|
||||
WSTimestamp.ElementNames en = new WSTimestamp.ElementNames ();
|
||||
AssertNotNull ("ElementNames Constructor", en);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ElementNames ()
|
||||
{
|
||||
// test public const strings
|
||||
AssertEquals ("Created", "Created", WSTimestamp.ElementNames.Created);
|
||||
AssertEquals ("Expires", "Expires", WSTimestamp.ElementNames.Expires);
|
||||
AssertEquals ("Received", "Received", WSTimestamp.ElementNames.Received);
|
||||
AssertEquals ("Timestamp", "Timestamp", WSTimestamp.ElementNames.Timestamp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,12 @@
|
||||
2003-09-08 Duncan Mak <[email protected]>
|
||||
|
||||
* Mono.Cairo/Surface.cs (PutImage): Removed.
|
||||
|
||||
* Mono.Cairo/Object.cs (Copy): Wrapper for cairo_copy.
|
||||
|
||||
* Mono.Cairo/Cairo.cs (cairo_copy): New API
|
||||
(cairo_surface_put_image): Removed.
|
||||
|
||||
2003-09-05 Duncan Mak <[email protected]>
|
||||
|
||||
* Mono.Cairo/Object.cs (Tolerance): Fix typo.
|
||||
|
||||
@@ -28,6 +28,9 @@ namespace Cairo {
|
||||
[DllImport (CairoImp)]
|
||||
public static extern IntPtr cairo_destroy (IntPtr cr);
|
||||
|
||||
[DllImport (CairoImp)]
|
||||
public static extern IntPtr cairo_copy (IntPtr cr_other);
|
||||
|
||||
[DllImport (CairoImp)]
|
||||
public static extern void cairo_save (IntPtr cr);
|
||||
|
||||
@@ -268,10 +271,6 @@ namespace Cairo {
|
||||
[DllImport (CairoImp)]
|
||||
public static extern void cairo_surface_destroy (IntPtr surface);
|
||||
|
||||
[DllImport (CairoImp)]
|
||||
public static extern Cairo.Status cairo_surface_put_image (
|
||||
IntPtr surface, string data, int width, int height, int stride);
|
||||
|
||||
[DllImport (CairoImp)]
|
||||
public static extern Cairo.Status cairo_surface_set_repeat (
|
||||
IntPtr surface, int repeat);
|
||||
|
||||
@@ -38,6 +38,11 @@ namespace Cairo {
|
||||
{
|
||||
return CairoAPI.cairo_destroy (state);
|
||||
}
|
||||
|
||||
public IntPtr Copy ()
|
||||
{
|
||||
return CairoAPI.cairo_copy (state);
|
||||
}
|
||||
|
||||
public void Save ()
|
||||
{
|
||||
|
||||
@@ -57,11 +57,6 @@ namespace Cairo {
|
||||
CairoAPI.cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
public void PutImage (string data, int width, int height, int stride)
|
||||
{
|
||||
CairoAPI.cairo_surface_put_image (surface, data, width, height, stride);
|
||||
}
|
||||
|
||||
public IntPtr Pointer {
|
||||
get { return surface; }
|
||||
}
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2003-09-08 Duncan Mak <[email protected]>
|
||||
|
||||
* Factories.cs (DefaultImplementationNamespace): Change it from
|
||||
"XrImpl" to "Cairo".
|
||||
|
||||
2003-08-20 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* Color.cs: fixed FromArgb to handle alpha value correctly. Closes
|
||||
|
||||
@@ -17,7 +17,7 @@ using System.Threading;
|
||||
|
||||
namespace System.Drawing {
|
||||
internal class Factories {
|
||||
internal static string DefaultImplementationNamespace = "XrImpl";
|
||||
internal static string DefaultImplementationNamespace = "Cairo";
|
||||
private static string FactoryClassNameBase = "System.Drawing.Win32Impl.";
|
||||
private static Assembly FactoryAssembly;
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
//
|
||||
// (C) 2002/3 Ximian, Inc. http://www.ximian.com
|
||||
// Author: Christian Meyer <[email protected]>
|
||||
// Jason Perkins <[email protected]>
|
||||
// Dennis Hayes <[email protected]>
|
||||
// Alexandre Pigolkine <[email protected]>
|
||||
// Jason Perkins <[email protected]>
|
||||
// Dennis Hayes <[email protected]>
|
||||
// Alexandre Pigolkine <[email protected]>
|
||||
//
|
||||
using System;
|
||||
using System.IO;
|
||||
@@ -62,25 +62,26 @@ namespace System.Drawing.Cairo {
|
||||
|
||||
float horizontalResolution;
|
||||
float verticalResolution;
|
||||
|
||||
|
||||
internal void CommonInit (int width, int height)
|
||||
{
|
||||
CommonInit (width, height, true);
|
||||
}
|
||||
|
||||
internal void CommonInit (int width, int height, bool allocNativeObject)
|
||||
internal void CommonInit (int width, int height, bool allocate_new)
|
||||
{
|
||||
size = new Size (width, height);
|
||||
imageFormat = ImageFormat.Bmp;
|
||||
switch( pixelFormat) {
|
||||
|
||||
switch (pixelFormat) {
|
||||
case PixelFormat.Format32bppArgb:
|
||||
cairo_format = Format.ARGB32;
|
||||
if (allocNativeObject)
|
||||
if (allocate_new)
|
||||
state = Gdk.Pixbuf.New (0, true, 8, width, height);
|
||||
break;
|
||||
case PixelFormat.Format24bppRgb:
|
||||
cairo_format = Format.RGB24;
|
||||
if (allocNativeObject)
|
||||
if (allocate_new)
|
||||
state = Gdk.Pixbuf.New (0, true, 8, width, height);
|
||||
break;
|
||||
default:
|
||||
@@ -89,7 +90,7 @@ namespace System.Drawing.Cairo {
|
||||
|
||||
horizontalResolution = verticalResolution = 96.0F;
|
||||
}
|
||||
|
||||
|
||||
#region constructors
|
||||
/// <summary>
|
||||
/// Constructors
|
||||
@@ -121,7 +122,7 @@ namespace System.Drawing.Cairo {
|
||||
throw new NotImplementedException ();
|
||||
//this.original = original;
|
||||
}
|
||||
|
||||
|
||||
unsafe void InitFromStream (Stream stream)
|
||||
{
|
||||
InternalImageInfo info = System.Drawing.Image.Decode (stream);
|
||||
@@ -150,7 +151,7 @@ namespace System.Drawing.Cairo {
|
||||
//info.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal Bitmap (Stream stream)
|
||||
: this (stream, false)
|
||||
{
|
||||
@@ -224,7 +225,7 @@ namespace System.Drawing.Cairo {
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
|
||||
IBitmap IBitmap.Clone (RectangleF rect, PixelFormat format)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
@@ -278,7 +279,7 @@ namespace System.Drawing.Cairo {
|
||||
horizontalResolution = xDpi;
|
||||
verticalResolution = yDpi;
|
||||
}
|
||||
|
||||
|
||||
//Fixme: gtk should be inherited from Image
|
||||
PixelFormat IImage.PixelFormat {
|
||||
get {
|
||||
@@ -290,7 +291,7 @@ namespace System.Drawing.Cairo {
|
||||
{
|
||||
// nothing to do!
|
||||
}
|
||||
|
||||
|
||||
// properties
|
||||
// needs to be done ###FIXME###
|
||||
|
||||
@@ -301,17 +302,17 @@ namespace System.Drawing.Cairo {
|
||||
protected override void Dispose (bool disposing)
|
||||
{
|
||||
if (selected_into_graphics == null)
|
||||
Gdk.Pixbuf.Finalize (state);
|
||||
Gdk.Helpers.Unref (state);
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
|
||||
//FIXME: included with gtk code. should be inherited from Image.
|
||||
// [MonoTODO]
|
||||
// public override void RotateFlip (RotateFlipType rotateFlipType) {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// [MonoTODO]
|
||||
// public override void RotateFlip (RotateFlipType rotateFlipType) {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
2003-09-08 Duncan Mak <[email protected]>
|
||||
|
||||
* gdk-helpers.cs: Remember to call gdk_init before hand.
|
||||
(gdk_pixbuf_finalize): Removed, as it is no longer available
|
||||
in the current API.
|
||||
(Helpers): New class to contain other misc. helper functions.
|
||||
(Init): Import gdk_init.
|
||||
(Unref): Import g_object_unref. This should be used in place of
|
||||
gdk_pixbuf_finalize.
|
||||
|
||||
* cairo-api.cs: Updated to reflect recent API changes.
|
||||
(cairo_copy): New API.
|
||||
(cairo_surface_put_image): Removed to keep updated with current
|
||||
API.
|
||||
(cairo_current_foo): Renamed from the old cairo_get_foo methods.
|
||||
|
||||
2003-09-03 Alp Toker <[email protected]>
|
||||
|
||||
cairo-api.cs: typos: drawble -> drawable, tolerence -> tolerance
|
||||
|
||||
@@ -28,6 +28,9 @@ namespace System.Drawing.Cairo {
|
||||
[DllImport (CairoImp)]
|
||||
public static extern IntPtr cairo_destroy (IntPtr cr);
|
||||
|
||||
[DllImport (CairoImp)]
|
||||
public static extern IntPtr cairo_copy (IntPtr cr_other);
|
||||
|
||||
[DllImport (CairoImp)]
|
||||
public static extern void cairo_save (IntPtr cr);
|
||||
|
||||
@@ -191,55 +194,55 @@ namespace System.Drawing.Cairo {
|
||||
// query
|
||||
//
|
||||
[DllImport (CairoImp)]
|
||||
public static extern Operator cairo_get_operator (IntPtr cr);
|
||||
public static extern Operator cairo_current_operator (IntPtr cr);
|
||||
|
||||
[DllImport (CairoImp)]
|
||||
public static extern void cairo_get_rgb_color (
|
||||
public static extern void cairo_current_rgb_color (
|
||||
IntPtr cr, out double red, out double green, out double blue);
|
||||
|
||||
[DllImport (CairoImp)]
|
||||
public static extern double cairo_get_alpha (IntPtr cr);
|
||||
public static extern double cairo_current_alpha (IntPtr cr);
|
||||
|
||||
[DllImport (CairoImp)]
|
||||
public static extern double cairo_get_tolerance (IntPtr cr);
|
||||
public static extern double cairo_current_tolerance (IntPtr cr);
|
||||
|
||||
[DllImport (CairoImp)]
|
||||
public static extern void cairo_get_current_point (
|
||||
public static extern void cairo_current_point (
|
||||
IntPtr cr, out double x, out double y);
|
||||
|
||||
[DllImport (CairoImp)]
|
||||
public static extern FillRule cairo_get_fill_rule (IntPtr cr);
|
||||
public static extern FillRule cairo_current_fill_rule (IntPtr cr);
|
||||
|
||||
[DllImport (CairoImp)]
|
||||
public static extern double cairo_get_line_width (IntPtr cr);
|
||||
public static extern double cairo_current_line_width (IntPtr cr);
|
||||
|
||||
[DllImport (CairoImp)]
|
||||
public static extern LineCap cairo_get_line_cap (IntPtr cr);
|
||||
public static extern LineCap cairo_current_line_cap (IntPtr cr);
|
||||
|
||||
[DllImport (CairoImp)]
|
||||
public static extern LineJoin cairo_get_line_join (IntPtr cr);
|
||||
public static extern LineJoin cairo_current_line_join (IntPtr cr);
|
||||
|
||||
[DllImport (CairoImp)]
|
||||
public static extern double cairo_get_miter_limit (IntPtr cr);
|
||||
public static extern double cairo_current_miter_limit (IntPtr cr);
|
||||
|
||||
[DllImport (CairoImp)]
|
||||
public static extern void cairo_get_matrix (
|
||||
public static extern void cairo_current_matrix (
|
||||
IntPtr cr,
|
||||
out double a, out double b,
|
||||
out double c, out double d,
|
||||
out double tx, out double ty);
|
||||
|
||||
[DllImport (CairoImp)]
|
||||
public static extern void cairo_get_target_surface (IntPtr cr);
|
||||
public static extern void cairo_current_target_surface (IntPtr cr);
|
||||
|
||||
//
|
||||
// Error status queries
|
||||
//
|
||||
[DllImport (CairoImp)]
|
||||
public static extern Status cairo_get_status (IntPtr cr);
|
||||
public static extern Status cairo_status (IntPtr cr);
|
||||
|
||||
[DllImport (CairoImp)]
|
||||
public static extern string cairo_get_status_string (IntPtr cr);
|
||||
public static extern string cairo_status_string (IntPtr cr);
|
||||
|
||||
//
|
||||
// Surface Manipulation
|
||||
@@ -267,9 +270,9 @@ namespace System.Drawing.Cairo {
|
||||
[DllImport (CairoImp)]
|
||||
public static extern void cairo_surface_destroy (IntPtr surface);
|
||||
|
||||
[DllImport (CairoImp)]
|
||||
public static extern Status cairo_surface_put_image (
|
||||
IntPtr surface, string data, int width, int height, int stride);
|
||||
// [DllImport (CairoImp)]
|
||||
// public static extern Status cairo_surface_put_image (
|
||||
// IntPtr surface, string data, int width, int height, int stride);
|
||||
|
||||
[DllImport (CairoImp)]
|
||||
public static extern Status cairo_surface_set_repeat (
|
||||
|
||||
@@ -5,21 +5,27 @@ namespace Gdk {
|
||||
|
||||
internal class Pixbuf
|
||||
{
|
||||
const string libgdk_pixbuf = "libgdk_pixbuf-2.0.0.dll";
|
||||
|
||||
static Pixbuf ()
|
||||
{
|
||||
Helpers.Init (0, new IntPtr (0));
|
||||
}
|
||||
|
||||
const string libgdk_pixbuf = "libgdk_pixbuf-2.0-0.dll";
|
||||
|
||||
[DllImport (libgdk_pixbuf, EntryPoint="gdk_pixbuf_new")]
|
||||
internal static extern IntPtr New (
|
||||
int colorspace, bool has_alpha, int bits_per_sample,
|
||||
int width, int height);
|
||||
|
||||
[DllImport(libgdk_pixbuf, EntryPoint = "gdk_pixbuf_new_from_data")]
|
||||
[DllImport (libgdk_pixbuf, EntryPoint = "gdk_pixbuf_new_from_data")]
|
||||
internal static extern IntPtr NewFromData (
|
||||
IntPtr data, Gdk.Colorspace colorspace, bool has_alpha, int bits_per_sample,
|
||||
int width, int height, int rowstride,
|
||||
IntPtr destroy_fn, IntPtr destroy_fn_data);
|
||||
|
||||
[DllImport(libgdk_pixbuf, EntryPoint = "gdk_pixbuf_finalize")]
|
||||
internal static extern void Finalize (IntPtr pixbuf);
|
||||
// [DllImport (libgdk_pixbuf, EntryPoint = "gdk_pixbuf_finalize")]
|
||||
// internal static extern void Finalize (IntPtr pixbuf);
|
||||
|
||||
[DllImport (libgdk_pixbuf, EntryPoint = "gdk_pixbuf_get_pixels")]
|
||||
internal static extern IntPtr GetPixels (IntPtr pixbuf);
|
||||
@@ -28,6 +34,18 @@ namespace Gdk {
|
||||
internal static extern int GetRowstride (IntPtr pixbuf);
|
||||
}
|
||||
|
||||
internal class Helpers
|
||||
{
|
||||
const string gdk = "libgdk-win32-2.0-0.dll";
|
||||
const string gobject = "libgobject-2.0-0.dll";
|
||||
|
||||
[DllImport (gdk, EntryPoint = "gdk_init")]
|
||||
internal static extern void Init (int argc, IntPtr argv);
|
||||
|
||||
[DllImport (gobject, EntryPoint = "g_object_unref")]
|
||||
internal static extern void Unref (IntPtr obj);
|
||||
}
|
||||
|
||||
internal enum Colorspace {
|
||||
Rgb = 0
|
||||
}
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
2003-09-14 Lluis Sanchez Gual <[email protected]>
|
||||
|
||||
* TcpClientChannel.cs: Fixed constructor.
|
||||
|
||||
2003-08-22 Lluis Sanchez Gual <[email protected]>
|
||||
|
||||
* System.Runtime.Remoting_test.dll.sources: Added DelegateCalls.cs test file.
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ namespace System.Runtime.Remoting.Channels.Tcp
|
||||
{
|
||||
priority = 1;
|
||||
|
||||
if (_sinkProvider != null)
|
||||
if (sinkProvider != null)
|
||||
{
|
||||
_sinkProvider = sinkProvider;
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Threading;
|
||||
using NUnit.Framework;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace MonoTests.System.Runtime.Remoting
|
||||
{
|
||||
@@ -30,7 +32,8 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
public delegate string DelegatePrimitiveParams (int a, uint b, char c, string d);
|
||||
public delegate string DelegatePrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2);
|
||||
public delegate Complex DelegateComplexParams (ArrayList a, Complex b, string c);
|
||||
public delegate Complex DelegateComplexParamsInOut (ref ArrayList a, out Complex b, string c);
|
||||
public delegate Complex DelegateComplexParamsInOut (ref ArrayList a, out Complex b, byte[] bytes, StringBuilder sb, string c);
|
||||
public delegate void DelegateProcessContextData ();
|
||||
|
||||
public class AsyncInstanceSurrogate : InstanceSurrogate
|
||||
{
|
||||
@@ -66,13 +69,21 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
return de.EndInvoke (ar);
|
||||
}
|
||||
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c)
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, [In,Out] byte[] bytes, StringBuilder sb, string c)
|
||||
{
|
||||
DelegateComplexParamsInOut de = new DelegateComplexParamsInOut (RemoteObject.ComplexParamsInOut);
|
||||
IAsyncResult ar = de.BeginInvoke (ref a, out b, c,null,null);
|
||||
IAsyncResult ar = de.BeginInvoke (ref a, out b, bytes, sb, c, null,null);
|
||||
AsyncCallTest.DoWork ();
|
||||
return de.EndInvoke (ref a, out b, ar);
|
||||
}
|
||||
|
||||
public override void ProcessContextData ()
|
||||
{
|
||||
DelegateProcessContextData de = new DelegateProcessContextData (RemoteObject.ProcessContextData);
|
||||
IAsyncResult ar = de.BeginInvoke (null,null);
|
||||
AsyncCallTest.DoWork ();
|
||||
de.EndInvoke (ar);
|
||||
}
|
||||
}
|
||||
|
||||
public class AsyncAbstractSurrogate : AbstractSurrogate
|
||||
@@ -109,13 +120,21 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
return de.EndInvoke (ar);
|
||||
}
|
||||
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c)
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, [In,Out] byte[] bytes, StringBuilder sb, string c)
|
||||
{
|
||||
DelegateComplexParamsInOut de = new DelegateComplexParamsInOut (RemoteObject.ComplexParamsInOut);
|
||||
IAsyncResult ar = de.BeginInvoke (ref a, out b, c,null,null);
|
||||
IAsyncResult ar = de.BeginInvoke (ref a, out b, bytes, sb, c, null,null);
|
||||
AsyncCallTest.DoWork ();
|
||||
return de.EndInvoke (ref a, out b, ar);
|
||||
}
|
||||
|
||||
public override void ProcessContextData ()
|
||||
{
|
||||
DelegateProcessContextData de = new DelegateProcessContextData (RemoteObject.ProcessContextData);
|
||||
IAsyncResult ar = de.BeginInvoke (null,null);
|
||||
AsyncCallTest.DoWork ();
|
||||
de.EndInvoke (ar);
|
||||
}
|
||||
}
|
||||
|
||||
public class AsyncInterfaceSurrogate : InterfaceSurrogate
|
||||
@@ -152,12 +171,20 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
return de.EndInvoke (ar);
|
||||
}
|
||||
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c)
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, [In,Out] byte[] bytes, StringBuilder sb, string c)
|
||||
{
|
||||
DelegateComplexParamsInOut de = new DelegateComplexParamsInOut (RemoteObject.ComplexParamsInOut);
|
||||
IAsyncResult ar = de.BeginInvoke (ref a, out b, c,null,null);
|
||||
IAsyncResult ar = de.BeginInvoke (ref a, out b, bytes, sb, c, null,null);
|
||||
AsyncCallTest.DoWork ();
|
||||
return de.EndInvoke (ref a, out b, ar);
|
||||
}
|
||||
|
||||
public override void ProcessContextData ()
|
||||
{
|
||||
DelegateProcessContextData de = new DelegateProcessContextData (RemoteObject.ProcessContextData);
|
||||
IAsyncResult ar = de.BeginInvoke (null,null);
|
||||
AsyncCallTest.DoWork ();
|
||||
de.EndInvoke (ar);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,14 +8,17 @@
|
||||
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Collections;
|
||||
using System.Runtime.Remoting;
|
||||
using System.Runtime.Remoting.Channels;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using System.Runtime.Remoting.Lifetime;
|
||||
using System.Runtime.Remoting.Channels.Tcp;
|
||||
using System.Runtime.Remoting.Activation;
|
||||
using System.Runtime.Remoting.Contexts;
|
||||
using System.Runtime.InteropServices;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.System.Runtime.Remoting
|
||||
@@ -193,6 +196,24 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
RunTestComplexParamsInOut (InternalGetInterfaceSurrogate());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestInstanceProcessContextData ()
|
||||
{
|
||||
RunTestProcessContextData (InternalGetInstanceSurrogate());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAbstractProcessContextData ()
|
||||
{
|
||||
RunTestProcessContextData (InternalGetAbstractSurrogate());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestInterfaceProcessContextData ()
|
||||
{
|
||||
RunTestProcessContextData (InternalGetInterfaceSurrogate());
|
||||
}
|
||||
|
||||
//
|
||||
// The tests runners
|
||||
//
|
||||
@@ -254,9 +275,13 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
ArrayList list = new ArrayList ();
|
||||
list.Add (new Complex (11,"first"));
|
||||
list.Add (new Complex (22,"second"));
|
||||
|
||||
byte[] bytes = new byte [100];
|
||||
for (byte n=0; n<100; n++) bytes[n] = n;
|
||||
StringBuilder sb = new StringBuilder ("hello from client");
|
||||
|
||||
Complex c;
|
||||
Complex r = testerSurrogate.ComplexParamsInOut (ref list, out c, "third");
|
||||
Complex r = testerSurrogate.ComplexParamsInOut (ref list, out c, bytes, sb, "third");
|
||||
|
||||
AssertNotNull ("ReturnValue is null", r);
|
||||
AssertNotNull ("c is null", c);
|
||||
@@ -265,6 +290,8 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
AssertNotNull ("list[0] is null", list[0]);
|
||||
AssertNotNull ("list[1] is null", list[1]);
|
||||
AssertNotNull ("list[2] is null", list[2]);
|
||||
AssertNotNull ("bytes is null", bytes);
|
||||
AssertNotNull ("sb is null", sb);
|
||||
|
||||
AssertEquals ("ReturnValue.Id", 33, r.Id);
|
||||
AssertEquals ("ReturnValue.Name", "third@"+remoteDomId, r.Name);
|
||||
@@ -277,6 +304,39 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
AssertEquals ("list[1].Name", "second", ((Complex)list[1]).Name);
|
||||
AssertEquals ("list[0].Id", 11, ((Complex)list[0]).Id);
|
||||
AssertEquals ("list[0].Name", "first", ((Complex)list[0]).Name);
|
||||
|
||||
AssertEquals ("sb", "hello from client and from server", sb.ToString ());
|
||||
for (int n=0; n<100; n++)
|
||||
AssertEquals ("bytes["+n+"]", n+1, bytes[n]);
|
||||
}
|
||||
|
||||
public void RunTestProcessContextData (IRemoteObject testerSurrogate)
|
||||
{
|
||||
CallContext.FreeNamedDataSlot ("clientData");
|
||||
CallContext.FreeNamedDataSlot ("serverData");
|
||||
CallContext.FreeNamedDataSlot ("mustNotPass");
|
||||
|
||||
ContextData cdata = new ContextData ();
|
||||
cdata.data = "hi from client";
|
||||
cdata.id = 1123;
|
||||
CallContext.SetData ("clientData", cdata);
|
||||
CallContext.SetData ("mustNotPass", "more data");
|
||||
|
||||
testerSurrogate.ProcessContextData ();
|
||||
|
||||
cdata = CallContext.GetData ("clientData") as ContextData;
|
||||
AssertNotNull ("clientData is null", cdata);
|
||||
AssertEquals ("clientData.data", "hi from client", cdata.data);
|
||||
AssertEquals ("clientData.id", 1123, cdata.id);
|
||||
|
||||
cdata = CallContext.GetData ("serverData") as ContextData;
|
||||
AssertNotNull ("serverData is null", cdata);
|
||||
AssertEquals ("serverData.data", "hi from server", cdata.data);
|
||||
AssertEquals ("serverData.id", 3211, cdata.id);
|
||||
|
||||
string mdata = CallContext.GetData ("mustNotPass") as string;
|
||||
AssertNotNull ("mustNotPass is null", mdata);
|
||||
AssertEquals ("mustNotPass", "more data", mdata);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,6 +381,13 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
return Thread.GetDomainID();
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class ContextData : ILogicalThreadAffinative
|
||||
{
|
||||
public string data;
|
||||
public int id;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public abstract class ChannelManager
|
||||
@@ -339,7 +406,8 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
string PrimitiveParams (int a, uint b, char c, string d);
|
||||
string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2);
|
||||
Complex ComplexParams (ArrayList a, Complex b, string c);
|
||||
Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c);
|
||||
Complex ComplexParamsInOut (ref ArrayList a, out Complex b, [In,Out] byte[] bytes, [In,Out] StringBuilder sb, string c);
|
||||
void ProcessContextData ();
|
||||
}
|
||||
|
||||
// Base classes for tester surrogates
|
||||
@@ -351,7 +419,8 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
public abstract string PrimitiveParams (int a, uint b, char c, string d);
|
||||
public abstract string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2);
|
||||
public abstract Complex ComplexParams (ArrayList a, Complex b, string c);
|
||||
public abstract Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c);
|
||||
public abstract Complex ComplexParamsInOut (ref ArrayList a, out Complex b, [In,Out] byte[] bytes, [In,Out] StringBuilder sb, string c);
|
||||
public abstract void ProcessContextData ();
|
||||
}
|
||||
|
||||
public abstract class AbstractSurrogate : IRemoteObject
|
||||
@@ -361,7 +430,8 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
public abstract string PrimitiveParams (int a, uint b, char c, string d);
|
||||
public abstract string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2);
|
||||
public abstract Complex ComplexParams (ArrayList a, Complex b, string c);
|
||||
public abstract Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c);
|
||||
public abstract Complex ComplexParamsInOut (ref ArrayList a, out Complex b, [In,Out] byte[] bytes, [In,Out] StringBuilder sb, string c);
|
||||
public abstract void ProcessContextData ();
|
||||
}
|
||||
|
||||
public abstract class InterfaceSurrogate : IRemoteObject
|
||||
@@ -371,7 +441,8 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
public abstract string PrimitiveParams (int a, uint b, char c, string d);
|
||||
public abstract string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2);
|
||||
public abstract Complex ComplexParams (ArrayList a, Complex b, string c);
|
||||
public abstract Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c);
|
||||
public abstract Complex ComplexParamsInOut (ref ArrayList a, out Complex b, [In,Out] byte[] bytes, [In,Out] StringBuilder sb, string c);
|
||||
public abstract void ProcessContextData ();
|
||||
}
|
||||
|
||||
|
||||
@@ -385,7 +456,8 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
public abstract string PrimitiveParams (int a, uint b, char c, string d);
|
||||
public abstract string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, ref char c1, out char c2, ref string d1, out string d2);
|
||||
public abstract Complex ComplexParams (ArrayList a, Complex b, string c);
|
||||
public abstract Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c);
|
||||
public abstract Complex ComplexParamsInOut (ref ArrayList a, out Complex b, [In,Out] byte[] bytes, [In,Out] StringBuilder sb, string c);
|
||||
public abstract void ProcessContextData ();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -426,12 +498,31 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
return cp;
|
||||
}
|
||||
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c)
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, [In,Out] byte[] bytes, [In,Out] StringBuilder sb, string c)
|
||||
{
|
||||
b = new Complex (33,c+ "@" + Thread.GetDomainID());
|
||||
a.Add (b);
|
||||
for (byte n=0; n<100; n++) bytes[n] = (byte)(bytes[n] + 1);
|
||||
sb.Append (" and from server");
|
||||
return b;
|
||||
}
|
||||
|
||||
public override void ProcessContextData ()
|
||||
{
|
||||
ContextData cdata = CallContext.GetData ("clientData") as ContextData;
|
||||
if (cdata == null)
|
||||
throw new Exception ("server: clientData is null");
|
||||
if (cdata.data != "hi from client" || cdata.id != 1123)
|
||||
throw new Exception ("server: clientData is not valid");
|
||||
|
||||
cdata = new ContextData ();
|
||||
cdata.data = "hi from server";
|
||||
cdata.id = 3211;
|
||||
CallContext.SetData ("serverData", cdata);
|
||||
|
||||
string mdata = CallContext.GetData ("mustNotPass") as string;
|
||||
if (mdata != null) throw new Exception ("mustNotPass is not null");
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
@@ -448,5 +539,3 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
public Complex Child;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2003-09-11 Lluis Sanchez Gual <[email protected]>
|
||||
|
||||
* AsyncCalls.cs BaseCalls.cs DelegateCalls.cs ReflectionCalls.cs SyncCalls.cs:
|
||||
Added tests for CallContext and for parameters with the Out flag.
|
||||
|
||||
2003-09-01 Nick Drochak <[email protected]>
|
||||
|
||||
* AsyncCalls.cs: Fix Build breaker on .NET 1.1.
|
||||
@@ -25,4 +30,3 @@
|
||||
2003-07-23 Lluis Sanchez Gual <[email protected]>
|
||||
|
||||
* ContextsTest.cs, CallSeq.cs, ContextHookAttribute.cs, ServerObject.cs: Added.
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using NUnit.Framework;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace MonoTests.System.Runtime.Remoting
|
||||
{
|
||||
@@ -45,10 +47,16 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
return de (a,b,c);
|
||||
}
|
||||
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c)
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, [In,Out] byte[] bytes, [In,Out] StringBuilder sb, string c)
|
||||
{
|
||||
DelegateComplexParamsInOut de = new DelegateComplexParamsInOut (RemoteObject.ComplexParamsInOut);
|
||||
return de (ref a, out b, c);
|
||||
return de (ref a, out b, bytes, sb, c);
|
||||
}
|
||||
|
||||
public override void ProcessContextData ()
|
||||
{
|
||||
DelegateProcessContextData de = new DelegateProcessContextData (RemoteObject.ProcessContextData);
|
||||
de ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,10 +86,16 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
return de (a,b,c);
|
||||
}
|
||||
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c)
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, [In,Out] byte[] bytes, [In,Out] StringBuilder sb, string c)
|
||||
{
|
||||
DelegateComplexParamsInOut de = new DelegateComplexParamsInOut (RemoteObject.ComplexParamsInOut);
|
||||
return de (ref a, out b, c);
|
||||
return de (ref a, out b, bytes, sb, c);
|
||||
}
|
||||
|
||||
public override void ProcessContextData ()
|
||||
{
|
||||
DelegateProcessContextData de = new DelegateProcessContextData (RemoteObject.ProcessContextData);
|
||||
de ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,10 +125,16 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
return de (a,b,c);
|
||||
}
|
||||
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c)
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, [In,Out] byte[] bytes, [In,Out] StringBuilder sb, string c)
|
||||
{
|
||||
DelegateComplexParamsInOut de = new DelegateComplexParamsInOut (RemoteObject.ComplexParamsInOut);
|
||||
return de (ref a, out b, c);
|
||||
return de (ref a, out b, bytes, sb, c);
|
||||
}
|
||||
|
||||
public override void ProcessContextData ()
|
||||
{
|
||||
DelegateProcessContextData de = new DelegateProcessContextData (RemoteObject.ProcessContextData);
|
||||
de ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,8 @@ using System;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using NUnit.Framework;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace MonoTests.System.Runtime.Remoting
|
||||
{
|
||||
@@ -56,15 +58,21 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
return (Complex) m.Invoke (target, parms);
|
||||
}
|
||||
|
||||
public static Complex ComplexParamsInOut (Type type, object target, ref ArrayList a, out Complex b, string c)
|
||||
public static Complex ComplexParamsInOut (Type type, object target, ref ArrayList a, out Complex b, [In,Out] byte[] bytes, [In,Out] StringBuilder sb, string c)
|
||||
{
|
||||
object[] parms = new object[] {a,null,c};
|
||||
object[] parms = new object[] {a,null,bytes,sb,c};
|
||||
MethodBase m = type.GetMethod ("ComplexParamsInOut");
|
||||
Complex res = (Complex) m.Invoke (target, parms);
|
||||
a = (ArrayList) parms[0];
|
||||
b = (Complex) parms[1];
|
||||
return res;
|
||||
}
|
||||
|
||||
public static void ProcessContextData (Type type, object target)
|
||||
{
|
||||
MethodBase m = type.GetMethod ("ProcessContextData");
|
||||
m.Invoke (target, null);
|
||||
}
|
||||
}
|
||||
|
||||
public class ReflectionInstanceSurrogate : InstanceSurrogate
|
||||
@@ -89,9 +97,14 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
return ReflectionCallTest.ComplexParams (typeof (RemoteObject), RemoteObject, a, b, c);
|
||||
}
|
||||
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c)
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, [In,Out] byte[] bytes, [In,Out] StringBuilder sb, string c)
|
||||
{
|
||||
return ReflectionCallTest.ComplexParamsInOut (typeof (RemoteObject), RemoteObject, ref a, out b, c);
|
||||
return ReflectionCallTest.ComplexParamsInOut (typeof (RemoteObject), RemoteObject, ref a, out b, bytes, sb, c);
|
||||
}
|
||||
|
||||
public override void ProcessContextData ()
|
||||
{
|
||||
ReflectionCallTest.ProcessContextData (typeof (RemoteObject), RemoteObject);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,9 +130,14 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
return ReflectionCallTest.ComplexParams (typeof (AbstractRemoteObject), RemoteObject, a, b, c);
|
||||
}
|
||||
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c)
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, [In,Out] byte[] bytes, [In,Out] StringBuilder sb, string c)
|
||||
{
|
||||
return ReflectionCallTest.ComplexParamsInOut (typeof (AbstractRemoteObject), RemoteObject, ref a, out b, c);
|
||||
return ReflectionCallTest.ComplexParamsInOut (typeof (AbstractRemoteObject), RemoteObject, ref a, out b, bytes, sb, c);
|
||||
}
|
||||
|
||||
public override void ProcessContextData ()
|
||||
{
|
||||
ReflectionCallTest.ProcessContextData (typeof (AbstractRemoteObject), RemoteObject);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,10 +163,14 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
return ReflectionCallTest.ComplexParams (typeof (IRemoteObject), RemoteObject, a, b, c);
|
||||
}
|
||||
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c)
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, [In,Out] byte[] bytes, [In,Out] StringBuilder sb, string c)
|
||||
{
|
||||
return ReflectionCallTest.ComplexParamsInOut (typeof (IRemoteObject), RemoteObject, ref a, out b, c);
|
||||
return ReflectionCallTest.ComplexParamsInOut (typeof (IRemoteObject), RemoteObject, ref a, out b, bytes, sb, c);
|
||||
}
|
||||
|
||||
public override void ProcessContextData ()
|
||||
{
|
||||
ReflectionCallTest.ProcessContextData (typeof (IRemoteObject), RemoteObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using NUnit.Framework;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace MonoTests.System.Runtime.Remoting
|
||||
{
|
||||
@@ -41,9 +43,14 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
return RemoteObject.ComplexParams (a, b, c);
|
||||
}
|
||||
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c)
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, [In,Out] byte[] bytes, [In,Out] StringBuilder sb, string c)
|
||||
{
|
||||
return RemoteObject.ComplexParamsInOut (ref a, out b, c);
|
||||
return RemoteObject.ComplexParamsInOut (ref a, out b, bytes, sb, c);
|
||||
}
|
||||
|
||||
public override void ProcessContextData ()
|
||||
{
|
||||
RemoteObject.ProcessContextData ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,9 +76,14 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
return RemoteObject.ComplexParams (a, b, c);
|
||||
}
|
||||
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c)
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, [In,Out] byte[] bytes, [In,Out] StringBuilder sb, string c)
|
||||
{
|
||||
return RemoteObject.ComplexParamsInOut (ref a, out b, c);
|
||||
return RemoteObject.ComplexParamsInOut (ref a, out b, bytes, sb, c);
|
||||
}
|
||||
|
||||
public override void ProcessContextData ()
|
||||
{
|
||||
RemoteObject.ProcessContextData ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,10 +109,14 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
return RemoteObject.ComplexParams (a, b, c);
|
||||
}
|
||||
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, string c)
|
||||
public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, [In,Out] byte[] bytes, [In,Out] StringBuilder sb, string c)
|
||||
{
|
||||
return RemoteObject.ComplexParamsInOut (ref a, out b, c);
|
||||
return RemoteObject.ComplexParamsInOut (ref a, out b, bytes, sb, c);
|
||||
}
|
||||
|
||||
public override void ProcessContextData ()
|
||||
{
|
||||
RemoteObject.ProcessContextData ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
2003-09-14 Lluis Sanchez Gual <[email protected]>
|
||||
|
||||
* System.Web.Services_test.dll.sources: Added BindingCollectionTest.cs
|
||||
ChangeLog DocumentableItemTest.cs OperationCollectionTest.cs
|
||||
OperationMessageCollectionTest.cs OperationMessageTest.cs
|
||||
PortTypeCollectionTest.cs PortTypeTest.cs ServiceCollectionTest.cs
|
||||
ServiceDescriptionCollectionTest.cs
|
||||
SoapBodyBindingTest.cs SoapOperationBindingTest.cs TypesTest.cs
|
||||
New test files by Erik LeBel.
|
||||
|
||||
2003-08-01 Lluis Sanchez Gual <[email protected]>
|
||||
|
||||
* System.Web.Services.dll.sources: Added ExtensionManager.cs,
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
2003-09-14 Lluis Sanchez Gual <[email protected]>
|
||||
|
||||
* DocumentableItem.cs MimeContentBinding.cs OperationMessage.cs
|
||||
OperationMessageCollection.cs PortCollection.cs PortType.cs
|
||||
PortTypeCollection.cs ServiceCollection.cs ServiceDescriptionCollection.cs
|
||||
SoapBodyBinding.cs SoapOperationBinding.cs: Several fixes by Erik LeBel
|
||||
* ServiceDescriptionImporter.cs:
|
||||
* ServiceDescriptionSerializerBase.cs: regenerated after the changes in
|
||||
the service description changes.
|
||||
* ServiceDescriptionReflector.cs: Fixed generation of message parts in
|
||||
bare format.
|
||||
|
||||
2003-09-11 Lluis Sanchez Gual <[email protected]>
|
||||
|
||||
* ServiceDescriptionImporter.cs, ServiceDescriptionReflector.cs: Added
|
||||
first bits of encoded format support.
|
||||
|
||||
2003-09-04 Lluis Sanchez Gual <[email protected]>
|
||||
|
||||
* ServiceDescription.cs: minor fixes.
|
||||
|
||||
@@ -34,7 +34,12 @@ namespace System.Web.Services.Description {
|
||||
[DefaultValue ("")]
|
||||
public string Documentation {
|
||||
get { return documentation; }
|
||||
set { documentation = value; }
|
||||
set {
|
||||
if (value == null)
|
||||
documentation = String.Empty;
|
||||
else
|
||||
documentation = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // Properties
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
// Copyright (C) Tim Coleman, 2002
|
||||
//
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Web.Services.Configuration;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
@@ -35,6 +36,7 @@ namespace System.Web.Services.Description {
|
||||
|
||||
#region Properties
|
||||
|
||||
[DefaultValue ("")]
|
||||
[XmlAttribute ("part", DataType = "NMTOKEN")]
|
||||
public string Part {
|
||||
get { return part; }
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
using System.Web.Services;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace System.Web.Services.Description {
|
||||
public abstract class OperationMessage : DocumentableItem {
|
||||
@@ -27,8 +26,8 @@ namespace System.Web.Services.Description {
|
||||
|
||||
protected OperationMessage ()
|
||||
{
|
||||
message = null;
|
||||
name = String.Empty;
|
||||
message = XmlQualifiedName.Empty;
|
||||
name = null;
|
||||
operation = null;
|
||||
}
|
||||
|
||||
@@ -42,7 +41,6 @@ namespace System.Web.Services.Description {
|
||||
set { message = value; }
|
||||
}
|
||||
|
||||
[DefaultValue ("")]
|
||||
[XmlAttribute ("name", DataType = "NMTOKEN")]
|
||||
public string Name {
|
||||
get { return name; }
|
||||
@@ -65,4 +63,4 @@ namespace System.Web.Services.Description {
|
||||
|
||||
#endregion // Methods
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
-2
@@ -68,6 +68,13 @@ namespace System.Web.Services.Description {
|
||||
|
||||
#region Methods
|
||||
|
||||
protected override string GetKey (object value)
|
||||
{
|
||||
if (!(value is OperationMessage))
|
||||
throw new InvalidCastException ();
|
||||
return ((OperationMessage) value).Name;
|
||||
}
|
||||
|
||||
public int Add (OperationMessage operationMessage)
|
||||
{
|
||||
Insert (Count, operationMessage);
|
||||
@@ -96,7 +103,12 @@ namespace System.Web.Services.Description {
|
||||
|
||||
protected override void OnInsert (int index, object value)
|
||||
{
|
||||
if (Count > 2 || (Count > 1 && value.GetType () == this [0].GetType ()))
|
||||
if (Count == 0)
|
||||
return;
|
||||
|
||||
if (Count == 1 && value.GetType() != this[0].GetType())
|
||||
return;
|
||||
|
||||
throw new InvalidOperationException ("The operation object can only contain one input and one output message.");
|
||||
}
|
||||
|
||||
@@ -110,7 +122,7 @@ namespace System.Web.Services.Description {
|
||||
protected override void OnValidate (object value)
|
||||
{
|
||||
if (value == null)
|
||||
throw new NullReferenceException ("The message object is a null reference.");
|
||||
throw new ArgumentException("The message object is a null reference.");
|
||||
if (!(value is OperationInput || value is OperationOutput))
|
||||
throw new ArgumentException ("The message object is not an input or an output message.");
|
||||
}
|
||||
|
||||
@@ -32,7 +32,12 @@ namespace System.Web.Services.Description {
|
||||
}
|
||||
|
||||
public Port this [string name] {
|
||||
get { return this [IndexOf ((Port) Table[name])]; }
|
||||
get {
|
||||
int index = IndexOf ((Port) Table[name]);
|
||||
if (index >= 0)
|
||||
return this[index];
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // Properties
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace System.Web.Services.Description {
|
||||
|
||||
public PortType ()
|
||||
{
|
||||
name = String.Empty;
|
||||
name = null;
|
||||
operations = new OperationCollection (this);
|
||||
serviceDescription = null;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,12 @@ namespace System.Web.Services.Description {
|
||||
}
|
||||
|
||||
public PortType this [string name] {
|
||||
get { return this [IndexOf ((PortType) Table[name])]; }
|
||||
get {
|
||||
int index = IndexOf ((PortType) Table[name]);
|
||||
if (index >= 0)
|
||||
return this[index];
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // Properties
|
||||
|
||||
@@ -34,7 +34,12 @@ namespace System.Web.Services.Description {
|
||||
}
|
||||
|
||||
public Service this [string name] {
|
||||
get { return this [IndexOf ((Service) Table[name])]; }
|
||||
get {
|
||||
int index = IndexOf ((Service) Table[name]);
|
||||
if (index >= 0)
|
||||
return this[index];
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // Properties
|
||||
|
||||
+6
-1
@@ -35,7 +35,12 @@ namespace System.Web.Services.Description {
|
||||
}
|
||||
|
||||
public ServiceDescription this [string ns] {
|
||||
get { return this[IndexOf ((ServiceDescription) Table[ns])]; }
|
||||
get {
|
||||
int index = IndexOf ((ServiceDescription) Table[ns]);
|
||||
if (index >= 0)
|
||||
return this[index];
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // Properties
|
||||
|
||||
+44
-19
@@ -29,6 +29,7 @@ namespace System.Web.Services.Description {
|
||||
ServiceDescriptionImportStyle style;
|
||||
CodeIdentifiers classIds;
|
||||
XmlSchemaImporter schemaImporter;
|
||||
SoapSchemaImporter soapSchemaImporter;
|
||||
XmlCodeExporter codeExporter;
|
||||
|
||||
CodeNamespace codeNamespace;
|
||||
@@ -104,6 +105,7 @@ namespace System.Web.Services.Description {
|
||||
warnings = (ServiceDescriptionImportWarnings) 0;
|
||||
|
||||
schemaImporter = new XmlSchemaImporter (schemas);
|
||||
soapSchemaImporter = new SoapSchemaImporter (schemas);
|
||||
codeExporter = new XmlCodeExporter (codeNamespace, codeCompileUnit);
|
||||
|
||||
this.codeNamespace = codeNamespace;
|
||||
@@ -197,12 +199,10 @@ namespace System.Web.Services.Description {
|
||||
|
||||
SoapBodyBinding isbb = oper.Input.Extensions.Find (typeof(SoapBodyBinding)) as SoapBodyBinding;
|
||||
if (isbb == null) throw new Exception ("Soap body binding not found in operation " + oper.Name);
|
||||
if (isbb.Use != SoapBindingUse.Literal) throw new Exception ("Soap binding use not supported");
|
||||
string iname = (oper.Input.Name != "") ? oper.Input.Name : oper.Name;
|
||||
|
||||
SoapBodyBinding osbb = oper.Output.Extensions.Find (typeof(SoapBodyBinding)) as SoapBodyBinding;
|
||||
if (osbb == null) throw new Exception ("Soap body binding not found in operation " + oper.Name);
|
||||
if (osbb.Use != SoapBindingUse.Literal) throw new Exception ("Soap binding use not supported");
|
||||
string oname = (oper.Output.Name != "") ? oper.Output.Name : oper.Name;
|
||||
|
||||
Operation ptoper = FindPortOperation (portType, oper.Name, iname, oname);
|
||||
@@ -213,18 +213,16 @@ namespace System.Web.Services.Description {
|
||||
|
||||
foreach (OperationMessage omsg in ptoper.Messages)
|
||||
{
|
||||
Message msg = serviceDescriptions.GetMessage (omsg.Message);
|
||||
if (msg == null) throw new Exception ("Message not found: " + omsg.Message);
|
||||
|
||||
XmlMembersMapping mems = ImportMembersMapping (msg);
|
||||
if (omsg is OperationInput) inputMembers = mems;
|
||||
else outputMembers = mems;
|
||||
if (omsg is OperationInput)
|
||||
inputMembers = ImportMembersMapping (omsg, ptoper, isbb, soapOper);
|
||||
else
|
||||
outputMembers = ImportMembersMapping (omsg, ptoper, osbb, soapOper);
|
||||
}
|
||||
|
||||
if (inputMembers == null) throw new Exception ("Input message not declared in operation " + oper.Name);
|
||||
if (outputMembers == null) throw new Exception ("Output message not declared in operation " + oper.Name);
|
||||
|
||||
GenerateMethod (codeClass, memberIds, ptoper, soapOper, inputMembers, outputMembers);
|
||||
GenerateMethod (codeClass, memberIds, ptoper, soapOper, isbb, inputMembers, outputMembers);
|
||||
|
||||
codeExporter.ExportMembersMapping (inputMembers);
|
||||
codeExporter.ExportMembersMapping (outputMembers);
|
||||
@@ -236,26 +234,53 @@ namespace System.Web.Services.Description {
|
||||
}
|
||||
}
|
||||
|
||||
XmlMembersMapping ImportMembersMapping (Message msg)
|
||||
XmlMembersMapping ImportMembersMapping (OperationMessage omsg, Operation ptoper, SoapBodyBinding sbb, SoapOperationBinding soapOper)
|
||||
{
|
||||
Message msg = serviceDescriptions.GetMessage (omsg.Message);
|
||||
if (msg == null) throw new Exception ("Message not found: " + omsg.Message);
|
||||
|
||||
XmlQualifiedName elem = null;
|
||||
if (msg.Parts.Count == 1 && msg.Parts[0].Name == "parameters")
|
||||
{
|
||||
// Wrapped parameter style
|
||||
return schemaImporter.ImportMembersMapping (msg.Parts[0].Element);
|
||||
|
||||
MessagePart part = msg.Parts[0];
|
||||
if (sbb.Use == SoapBindingUse.Encoded)
|
||||
{
|
||||
SoapSchemaMember ssm = new SoapSchemaMember ();
|
||||
ssm.MemberName = part.Name;
|
||||
ssm.MemberType = part.Type;
|
||||
return soapSchemaImporter.ImportMembersMapping (ptoper.Name, omsg.Message.Namespace, ssm);
|
||||
}
|
||||
else
|
||||
return schemaImporter.ImportMembersMapping (part.Element);
|
||||
}
|
||||
else
|
||||
{
|
||||
XmlQualifiedName[] pnames = new XmlQualifiedName [msg.Parts.Count];
|
||||
for (int n=0; n<pnames.Length; n++)
|
||||
pnames[n] = msg.Parts[n].Element;
|
||||
|
||||
return schemaImporter.ImportMembersMapping (pnames);
|
||||
if (sbb.Use == SoapBindingUse.Encoded)
|
||||
{
|
||||
SoapSchemaMember[] mems = new SoapSchemaMember [msg.Parts.Count];
|
||||
for (int n=0; n<mems.Length; n++)
|
||||
{
|
||||
SoapSchemaMember mem = new SoapSchemaMember();
|
||||
mem.MemberName = msg.Parts[n].Name;
|
||||
mem.MemberType = msg.Parts[n].Type;
|
||||
mems[n] = mem;
|
||||
}
|
||||
return soapSchemaImporter.ImportMembersMapping (ptoper.Name, omsg.Message.Namespace, mems);
|
||||
}
|
||||
else
|
||||
{
|
||||
XmlQualifiedName[] pnames = new XmlQualifiedName [msg.Parts.Count];
|
||||
for (int n=0; n<pnames.Length; n++)
|
||||
pnames[n] = msg.Parts[n].Element;
|
||||
return schemaImporter.ImportMembersMapping (pnames);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenerateMethod (CodeTypeDeclaration codeClass, CodeIdentifiers memberIds, Operation oper, SoapOperationBinding soapOper, XmlMembersMapping inputMembers, XmlMembersMapping outputMembers)
|
||||
void GenerateMethod (CodeTypeDeclaration codeClass, CodeIdentifiers memberIds, Operation oper, SoapOperationBinding soapOper, SoapBodyBinding bodyBinding, XmlMembersMapping inputMembers, XmlMembersMapping outputMembers)
|
||||
{
|
||||
CodeIdentifiers pids = new CodeIdentifiers ();
|
||||
CodeMemberMethod method = new CodeMemberMethod ();
|
||||
@@ -407,7 +432,7 @@ namespace System.Web.Services.Description {
|
||||
else
|
||||
att.Arguments.Add (GetEnumArg ("ParameterStyle", "System.Web.Services.Protocols.SoapParameterStyle", "Bare"));
|
||||
|
||||
att.Arguments.Add (GetEnumArg ("Use", "System.Web.Services.Description.SoapBindingUse", "Literal"));
|
||||
att.Arguments.Add (GetEnumArg ("Use", "System.Web.Services.Description.SoapBindingUse", bodyBinding.Use.ToString()));
|
||||
AddCustomAttribute (method, att, true);
|
||||
|
||||
att = new CodeAttributeDeclaration ("System.Web.Services.WebMethodAttribute");
|
||||
@@ -481,7 +506,7 @@ namespace System.Web.Services.Description {
|
||||
|
||||
string GetOperMessageName (OperationMessage msg, string operName)
|
||||
{
|
||||
if (msg.Name == "") return operName;
|
||||
if (msg.Name == null) return operName;
|
||||
else return msg.Name;
|
||||
}
|
||||
|
||||
|
||||
+13
-2
@@ -11,6 +11,7 @@
|
||||
using System.Web.Services;
|
||||
using System.Xml.Serialization;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using System.Web.Services.Protocols;
|
||||
|
||||
namespace System.Web.Services.Description {
|
||||
@@ -206,7 +207,9 @@ namespace System.Web.Services.Description {
|
||||
{
|
||||
MessagePart part = new MessagePart ();
|
||||
part.Name = "parameters";
|
||||
part.Element = new XmlQualifiedName (members.ElementName, members.Namespace);
|
||||
XmlQualifiedName qname = new XmlQualifiedName (members.ElementName, members.Namespace);
|
||||
if (method.Use == SoapBindingUse.Literal) part.Element = qname;
|
||||
else part.Type = qname;
|
||||
msg.Parts.Add (part);
|
||||
}
|
||||
else
|
||||
@@ -215,7 +218,15 @@ namespace System.Web.Services.Description {
|
||||
{
|
||||
MessagePart part = new MessagePart ();
|
||||
part.Name = members[n].MemberName;
|
||||
part.Element = new XmlQualifiedName (members[n].ElementName, members.Namespace);
|
||||
|
||||
if (method.Use == SoapBindingUse.Literal) {
|
||||
part.Element = new XmlQualifiedName (members[n].MemberName, members[n].Namespace);
|
||||
}
|
||||
else {
|
||||
string namesp = members[n].TypeNamespace;
|
||||
if (namesp == "") namesp = XmlSchema.Namespace;
|
||||
part.Type = new XmlQualifiedName (members[n].TypeName, namesp);
|
||||
}
|
||||
msg.Parts.Add (part);
|
||||
}
|
||||
}
|
||||
|
||||
+15
-21
@@ -1321,7 +1321,7 @@ namespace System.Web.Services.Description
|
||||
|
||||
if (needType) WriteXsiType("ServiceDescription", "http://schemas.xmlsoap.org/wsdl/");
|
||||
|
||||
WriteAttribute ("name", "", ob.Name.ToString());
|
||||
WriteAttribute ("name", "", ob.Name);
|
||||
WriteAttribute ("targetNamespace", "", ob.TargetNamespace);
|
||||
|
||||
ServiceDescription.WriteExtensions (Writer, ob);
|
||||
@@ -1423,7 +1423,7 @@ namespace System.Web.Services.Description
|
||||
|
||||
if (needType) WriteXsiType("Message", "http://schemas.xmlsoap.org/wsdl/");
|
||||
|
||||
WriteAttribute ("name", "", ob.Name.ToString());
|
||||
WriteAttribute ("name", "", ob.Name);
|
||||
|
||||
if (ob.Parts != null) {
|
||||
for (int n65 = 0; n65 < ob.Parts.Count; n65++) {
|
||||
@@ -1451,7 +1451,7 @@ namespace System.Web.Services.Description
|
||||
|
||||
if (needType) WriteXsiType("PortType", "http://schemas.xmlsoap.org/wsdl/");
|
||||
|
||||
WriteAttribute ("name", "", ob.Name.ToString());
|
||||
WriteAttribute ("name", "", ob.Name);
|
||||
|
||||
if (ob.Operations != null) {
|
||||
for (int n66 = 0; n66 < ob.Operations.Count; n66++) {
|
||||
@@ -1479,7 +1479,7 @@ namespace System.Web.Services.Description
|
||||
|
||||
if (needType) WriteXsiType("Binding", "http://schemas.xmlsoap.org/wsdl/");
|
||||
|
||||
WriteAttribute ("name", "", ob.Name.ToString());
|
||||
WriteAttribute ("name", "", ob.Name);
|
||||
WriteAttribute ("type", "", FromXmlQualifiedName (ob.Type));
|
||||
|
||||
ServiceDescription.WriteExtensions (Writer, ob);
|
||||
@@ -1509,7 +1509,7 @@ namespace System.Web.Services.Description
|
||||
|
||||
if (needType) WriteXsiType("Service", "http://schemas.xmlsoap.org/wsdl/");
|
||||
|
||||
WriteAttribute ("name", "", ob.Name.ToString());
|
||||
WriteAttribute ("name", "", ob.Name);
|
||||
|
||||
if (ob.Ports != null) {
|
||||
for (int n68 = 0; n68 < ob.Ports.Count; n68++) {
|
||||
@@ -1542,7 +1542,7 @@ namespace System.Web.Services.Description
|
||||
|
||||
if (needType) WriteXsiType("MessagePart", "http://schemas.xmlsoap.org/wsdl/");
|
||||
|
||||
WriteAttribute ("name", "", ob.Name.ToString());
|
||||
WriteAttribute ("name", "", ob.Name);
|
||||
WriteAttribute ("element", "", FromXmlQualifiedName (ob.Element));
|
||||
WriteAttribute ("type", "", FromXmlQualifiedName (ob.Type));
|
||||
|
||||
@@ -1567,7 +1567,7 @@ namespace System.Web.Services.Description
|
||||
|
||||
if (needType) WriteXsiType("Operation", "http://schemas.xmlsoap.org/wsdl/");
|
||||
|
||||
WriteAttribute ("name", "", ob.Name.ToString());
|
||||
WriteAttribute ("name", "", ob.Name);
|
||||
if (ob.ParameterOrderString != "") {
|
||||
WriteAttribute ("parameterOrder", "", ob.ParameterOrderString);
|
||||
}
|
||||
@@ -1609,7 +1609,7 @@ namespace System.Web.Services.Description
|
||||
|
||||
if (needType) WriteXsiType("OperationBinding", "http://schemas.xmlsoap.org/wsdl/");
|
||||
|
||||
WriteAttribute ("name", "", ob.Name.ToString());
|
||||
WriteAttribute ("name", "", ob.Name);
|
||||
|
||||
ServiceDescription.WriteExtensions (Writer, ob);
|
||||
if (ob.Faults != null) {
|
||||
@@ -1640,7 +1640,7 @@ namespace System.Web.Services.Description
|
||||
|
||||
if (needType) WriteXsiType("Port", "http://schemas.xmlsoap.org/wsdl/");
|
||||
|
||||
WriteAttribute ("name", "", ob.Name.ToString());
|
||||
WriteAttribute ("name", "", ob.Name);
|
||||
WriteAttribute ("binding", "", FromXmlQualifiedName (ob.Binding));
|
||||
|
||||
ServiceDescription.WriteExtensions (Writer, ob);
|
||||
@@ -1665,9 +1665,7 @@ namespace System.Web.Services.Description
|
||||
|
||||
if (needType) WriteXsiType("OperationFault", "http://schemas.xmlsoap.org/wsdl/");
|
||||
|
||||
if (ob.Name != "") {
|
||||
WriteAttribute ("name", "", ob.Name.ToString());
|
||||
}
|
||||
WriteAttribute ("name", "", ob.Name);
|
||||
WriteAttribute ("message", "", FromXmlQualifiedName (ob.Message));
|
||||
|
||||
if (ob.Documentation != "") {
|
||||
@@ -1691,9 +1689,7 @@ namespace System.Web.Services.Description
|
||||
|
||||
if (needType) WriteXsiType("OperationInput", "http://schemas.xmlsoap.org/wsdl/");
|
||||
|
||||
if (ob.Name != "") {
|
||||
WriteAttribute ("name", "", ob.Name.ToString());
|
||||
}
|
||||
WriteAttribute ("name", "", ob.Name);
|
||||
WriteAttribute ("message", "", FromXmlQualifiedName (ob.Message));
|
||||
|
||||
if (ob.Documentation != "") {
|
||||
@@ -1717,9 +1713,7 @@ namespace System.Web.Services.Description
|
||||
|
||||
if (needType) WriteXsiType("OperationOutput", "http://schemas.xmlsoap.org/wsdl/");
|
||||
|
||||
if (ob.Name != "") {
|
||||
WriteAttribute ("name", "", ob.Name.ToString());
|
||||
}
|
||||
WriteAttribute ("name", "", ob.Name);
|
||||
WriteAttribute ("message", "", FromXmlQualifiedName (ob.Message));
|
||||
|
||||
if (ob.Documentation != "") {
|
||||
@@ -1744,7 +1738,7 @@ namespace System.Web.Services.Description
|
||||
if (needType) WriteXsiType("FaultBinding", "http://schemas.xmlsoap.org/wsdl/");
|
||||
|
||||
if (ob.Name != "") {
|
||||
WriteAttribute ("name", "", ob.Name.ToString());
|
||||
WriteAttribute ("name", "", ob.Name);
|
||||
}
|
||||
|
||||
ServiceDescription.WriteExtensions (Writer, ob);
|
||||
@@ -1770,7 +1764,7 @@ namespace System.Web.Services.Description
|
||||
if (needType) WriteXsiType("InputBinding", "http://schemas.xmlsoap.org/wsdl/");
|
||||
|
||||
if (ob.Name != "") {
|
||||
WriteAttribute ("name", "", ob.Name.ToString());
|
||||
WriteAttribute ("name", "", ob.Name);
|
||||
}
|
||||
|
||||
ServiceDescription.WriteExtensions (Writer, ob);
|
||||
@@ -1796,7 +1790,7 @@ namespace System.Web.Services.Description
|
||||
if (needType) WriteXsiType("OutputBinding", "http://schemas.xmlsoap.org/wsdl/");
|
||||
|
||||
if (ob.Name != "") {
|
||||
WriteAttribute ("name", "", ob.Name.ToString());
|
||||
WriteAttribute ("name", "", ob.Name);
|
||||
}
|
||||
|
||||
ServiceDescription.WriteExtensions (Writer, ob);
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace System.Web.Services.Description {
|
||||
string encoding;
|
||||
string ns;
|
||||
string[] parts;
|
||||
string partsString;
|
||||
SoapBindingUse use;
|
||||
|
||||
#endregion // Fields
|
||||
@@ -31,6 +32,7 @@ namespace System.Web.Services.Description {
|
||||
encoding = String.Empty;
|
||||
ns = String.Empty;
|
||||
parts = null;
|
||||
partsString = null;
|
||||
use = SoapBindingUse.Default;
|
||||
}
|
||||
|
||||
@@ -55,13 +57,25 @@ namespace System.Web.Services.Description {
|
||||
[XmlIgnore]
|
||||
public string[] Parts {
|
||||
get { return parts; }
|
||||
set { parts = value; }
|
||||
set {
|
||||
parts = value;
|
||||
if (value == null)
|
||||
partsString = null;
|
||||
else
|
||||
partsString = String.Join(" ", value);
|
||||
}
|
||||
}
|
||||
|
||||
[XmlAttribute ("parts", DataType = "NMTOKENS")]
|
||||
public string PartsString {
|
||||
get { return (Parts != null) ? String.Join (" ", Parts) : null; }
|
||||
set { Parts = value.Split (' '); }
|
||||
get { return partsString; }
|
||||
set {
|
||||
partsString = value;
|
||||
if (value == null)
|
||||
parts = null;
|
||||
else
|
||||
parts = value.Split(' ');
|
||||
}
|
||||
}
|
||||
|
||||
[DefaultValue (SoapBindingUse.Default)]
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ namespace System.Web.Services.Description {
|
||||
public SoapOperationBinding ()
|
||||
{
|
||||
soapAction = String.Empty;
|
||||
style = SoapBindingStyle.Document;
|
||||
style = SoapBindingStyle.Default;
|
||||
}
|
||||
|
||||
#endregion // Constructors
|
||||
@@ -53,4 +53,4 @@ namespace System.Web.Services.Description {
|
||||
|
||||
#endregion // Properties
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,8 @@
|
||||
2003-09-14 Lluis Sanchez Gual <[email protected]>
|
||||
|
||||
* SoapDocumentationHandler.cs: Added support for on-the-fly proxy
|
||||
code generation in documentation pages.
|
||||
|
||||
2003-09-04 Lluis Sanchez Gual <[email protected]>
|
||||
|
||||
* Methods.cs: Added support for bare parameter style. Fixed some defaults.
|
||||
|
||||
+51
@@ -11,8 +11,12 @@ using System;
|
||||
using System.Web;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using System.Xml.Schema;
|
||||
using System.Web.Services.Description;
|
||||
using System.Web.Services.Configuration;
|
||||
using System.CodeDom;
|
||||
using System.CodeDom.Compiler;
|
||||
using Microsoft.CSharp;
|
||||
|
||||
namespace System.Web.Services.Protocols
|
||||
{
|
||||
@@ -46,6 +50,7 @@ namespace System.Web.Services.Protocols
|
||||
string key = req.QueryString.GetKey(0).ToLower();
|
||||
if (key == "wsdl") GenerateWsdlDocument (context, req.QueryString ["wsdl"]);
|
||||
else if (key == "schema") GenerateSchema (context, req.QueryString ["schema"]);
|
||||
else if (key == "code") GenerateCode (context, req.QueryString ["code"]);
|
||||
else GenerateDocumentationPage (context);
|
||||
}
|
||||
else
|
||||
@@ -81,6 +86,52 @@ namespace System.Web.Services.Protocols
|
||||
outStream.Close ();
|
||||
}
|
||||
|
||||
void GenerateCode (HttpContext context, string langId)
|
||||
{
|
||||
context.Response.ContentType = "text/plain; charset=utf-8";
|
||||
CodeNamespace codeNamespace = new CodeNamespace();
|
||||
CodeCompileUnit codeUnit = new CodeCompileUnit();
|
||||
|
||||
codeUnit.Namespaces.Add (codeNamespace);
|
||||
|
||||
ServiceDescriptionImporter importer = new ServiceDescriptionImporter();
|
||||
|
||||
foreach (ServiceDescription sd in GetDescriptions ())
|
||||
importer.AddServiceDescription(sd, null, null);
|
||||
|
||||
foreach (XmlSchema sc in GetSchemas())
|
||||
importer.Schemas.Add (sc);
|
||||
|
||||
importer.Import(codeNamespace, codeUnit);
|
||||
|
||||
if (langId == null || langId == "") langId = "cs";
|
||||
CodeDomProvider provider = GetProvider (langId);
|
||||
ICodeGenerator generator = provider.CreateGenerator();
|
||||
CodeGeneratorOptions options = new CodeGeneratorOptions();
|
||||
|
||||
StreamWriter writer = new StreamWriter(context.Response.OutputStream);
|
||||
generator.GenerateCodeFromCompileUnit(codeUnit, writer, options);
|
||||
writer.Close ();
|
||||
}
|
||||
|
||||
private CodeDomProvider GetProvider(string langId)
|
||||
{
|
||||
// FIXME these should be loaded dynamically using reflection
|
||||
CodeDomProvider provider;
|
||||
|
||||
switch (langId.ToUpper())
|
||||
{
|
||||
case "CS":
|
||||
provider = new CSharpCodeProvider();
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception("Unknown language: " + langId);
|
||||
}
|
||||
|
||||
return provider;
|
||||
}
|
||||
|
||||
ServiceDescriptionCollection GetDescriptions ()
|
||||
{
|
||||
if (_descriptions == null)
|
||||
|
||||
@@ -2,3 +2,15 @@ System.Web.Services/WebMethodAttributeTest.cs
|
||||
System.Web.Services/WebServiceAttributeTest.cs
|
||||
System.Web.Services.Configuration/XmlFormatExtensionAttributeTest.cs
|
||||
System.Web.Services.Discovery/ContractReferenceTest.cs
|
||||
System.Web.Services.Description/BindingCollectionTest.cs
|
||||
System.Web.Services.Description/DocumentableItemTest.cs
|
||||
System.Web.Services.Description/TypesTest.cs
|
||||
System.Web.Services.Description/OperationCollectionTest.cs
|
||||
System.Web.Services.Description/OperationMessageTest.cs
|
||||
System.Web.Services.Description/OperationMessageCollectionTest.cs
|
||||
System.Web.Services.Description/PortTypeCollectionTest.cs
|
||||
System.Web.Services.Description/PortTypeTest.cs
|
||||
System.Web.Services.Description/ServiceCollectionTest.cs
|
||||
System.Web.Services.Description/ServiceDescriptionCollectionTest.cs
|
||||
System.Web.Services.Description/SoapBodyBindingTest.cs
|
||||
System.Web.Services.Description/SoapOperationBindingTest.cs
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// MonoTests.System.Web.Services.Description.BindingCollectionTest.cs
|
||||
//
|
||||
// Author:
|
||||
// Erik LeBel <[email protected]>
|
||||
//
|
||||
// (C) 2003 Erik LeBel
|
||||
//
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using System;
|
||||
using System.Web.Services.Description;
|
||||
|
||||
namespace MonoTests.System.Web.Services.Description
|
||||
{
|
||||
[TestFixture]
|
||||
public class BindingCollectionTest
|
||||
{
|
||||
BindingCollection bc;
|
||||
|
||||
[SetUp]
|
||||
public void InitializeBindingCollection ()
|
||||
{
|
||||
// workaround for internal constructor
|
||||
ServiceDescription desc = new ServiceDescription ();
|
||||
bc = desc.Bindings;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDefaultProperties()
|
||||
{
|
||||
Assertion.AssertNull (bc["hello"]);
|
||||
Assertion.AssertEquals (0, bc.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddBinding ()
|
||||
{
|
||||
const string bindingName = "testBinding";
|
||||
|
||||
Binding b = new Binding ();
|
||||
b.Name = bindingName;
|
||||
|
||||
bc.Add (b);
|
||||
|
||||
Assertion.AssertEquals (1, bc.Count);
|
||||
Assertion.AssertEquals (b, bc[bindingName]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
2003-09-14 Lluis Sanchez Gual <[email protected]>
|
||||
|
||||
* BindingCollectionTest.cs ChangeLog DocumentableItemTest.cs
|
||||
OperationCollectionTest.cs OperationMessageCollectionTest.cs
|
||||
OperationMessageTest.cs PortTypeCollectionTest.cs PortTypeTest.cs
|
||||
ServiceCollectionTest.cs ServiceDescriptionCollectionTest.cs
|
||||
SoapBodyBindingTest.cs SoapOperationBindingTest.cs TypesTest.cs
|
||||
New test files by Erik LeBel.
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// MonoTests.System.Web.Services.Description.DocumentableItemTest.cs
|
||||
//
|
||||
// Author:
|
||||
// Erik LeBel <[email protected]>
|
||||
//
|
||||
// (C) 2003 Erik LeBel
|
||||
//
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using System;
|
||||
using System.Web.Services.Description;
|
||||
|
||||
namespace MonoTests.System.Web.Services.Description
|
||||
{
|
||||
[TestFixture]
|
||||
public class DocumentableItemTest
|
||||
{
|
||||
DocumentableItem item;
|
||||
|
||||
[SetUp]
|
||||
public void InitializeItem()
|
||||
{
|
||||
// workaround for base class
|
||||
item = new Types();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDefaultProperties()
|
||||
{
|
||||
Assertion.AssertEquals(String.Empty, item.Documentation);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNullDocumentationString()
|
||||
{
|
||||
item.Documentation = null;
|
||||
Assertion.AssertEquals(String.Empty, item.Documentation);
|
||||
}
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// MonoTests.System.Web.Services.Description.OperationCollectionTest.cs
|
||||
//
|
||||
// Author:
|
||||
// Erik LeBel <[email protected]>
|
||||
//
|
||||
// (C) 2003 Erik LeBel
|
||||
//
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using System;
|
||||
using System.Web.Services.Description;
|
||||
|
||||
namespace MonoTests.System.Web.Services.Description
|
||||
{
|
||||
[TestFixture]
|
||||
public class OperationCollectionTest
|
||||
{
|
||||
OperationCollection operations;
|
||||
|
||||
[SetUp]
|
||||
public void InitializeOperations()
|
||||
{
|
||||
// workaround for internal constructor
|
||||
PortType portType = new PortType();
|
||||
operations = portType.Operations;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDefaultProperties()
|
||||
{
|
||||
Assertion.AssertEquals(0, operations.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void TestAddNullObject()
|
||||
{
|
||||
operations.Add(null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddValidOperation()
|
||||
{
|
||||
operations.Add(new Operation());
|
||||
Assertion.AssertEquals(1, operations.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
+133
@@ -0,0 +1,133 @@
|
||||
//
|
||||
// MonoTests.System.Web.Services.Description.OperationMessageCollectionTest.cs
|
||||
//
|
||||
// Author:
|
||||
// Erik LeBel <[email protected]>
|
||||
//
|
||||
// (C) 2003 Erik LeBel
|
||||
//
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using System;
|
||||
using System.Web.Services.Description;
|
||||
using System.Xml;
|
||||
|
||||
namespace MonoTests.System.Web.Services.Description
|
||||
{
|
||||
[TestFixture]
|
||||
public class OperationMessageCollectionTest
|
||||
{
|
||||
OperationMessageCollection operations;
|
||||
|
||||
[SetUp]
|
||||
public void InitializeOperation()
|
||||
{
|
||||
// workaround for internal constructor
|
||||
Operation op = new Operation();
|
||||
operations = op.Messages;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDefaultProperties()
|
||||
{
|
||||
Assertion.AssertEquals(OperationFlow.None, operations.Flow);
|
||||
Assertion.AssertNull(operations.Input);
|
||||
Assertion.AssertNull(operations.Output);
|
||||
Assertion.AssertEquals(0, operations.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddInput()
|
||||
{
|
||||
operations.Add(new OperationInput());
|
||||
|
||||
Assertion.AssertEquals(OperationFlow.OneWay, operations.Flow);
|
||||
Assertion.AssertNotNull(operations.Input);
|
||||
Assertion.AssertNull(operations.Output);
|
||||
Assertion.AssertEquals(1, operations.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddOutput()
|
||||
{
|
||||
operations.Add(new OperationOutput());
|
||||
|
||||
Assertion.AssertEquals(OperationFlow.Notification, operations.Flow);
|
||||
Assertion.AssertNull(operations.Input);
|
||||
Assertion.AssertNotNull(operations.Output);
|
||||
Assertion.AssertEquals(1, operations.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddInputAndOutput()
|
||||
{
|
||||
operations.Add(new OperationInput());
|
||||
operations.Add(new OperationOutput());
|
||||
|
||||
Assertion.AssertEquals(OperationFlow.RequestResponse, operations.Flow);
|
||||
Assertion.AssertNotNull(operations.Input);
|
||||
Assertion.AssertNotNull(operations.Output);
|
||||
Assertion.AssertEquals(2, operations.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddOutputAndInput()
|
||||
{
|
||||
operations.Add(new OperationOutput());
|
||||
operations.Add(new OperationInput());
|
||||
|
||||
Assertion.AssertEquals(OperationFlow.SolicitResponse, operations.Flow);
|
||||
Assertion.AssertNotNull(operations.Input);
|
||||
Assertion.AssertNotNull(operations.Output);
|
||||
Assertion.AssertEquals(2, operations.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void TestAddNull()
|
||||
{
|
||||
operations.Add(null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void TestAddFault()
|
||||
{
|
||||
operations.Add(new OperationFault());
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (InvalidOperationException))]
|
||||
public void TestAddInputAndInput()
|
||||
{
|
||||
operations.Add(new OperationInput());
|
||||
operations.Add(new OperationInput());
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (InvalidOperationException))]
|
||||
public void TestAddOutputAndOutput()
|
||||
{
|
||||
operations.Add(new OperationOutput());
|
||||
operations.Add(new OperationOutput());
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (InvalidOperationException))]
|
||||
public void TestAddThreeOperationMessages()
|
||||
{
|
||||
operations.Add(new OperationOutput());
|
||||
operations.Add(new OperationOutput());
|
||||
operations.Add(new OperationOutput());
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void TestAddInputAndFault()
|
||||
{
|
||||
operations.Add(new OperationInput());
|
||||
operations.Add(new OperationFault());
|
||||
}
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// MonoTests.System.Web.Services.Description.OperationMessageTest.cs
|
||||
//
|
||||
// Author:
|
||||
// Erik LeBel <[email protected]>
|
||||
//
|
||||
// (C) 2003 Erik LeBel
|
||||
//
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using System;
|
||||
using System.Web.Services.Description;
|
||||
using System.Xml;
|
||||
|
||||
namespace MonoTests.System.Web.Services.Description
|
||||
{
|
||||
[TestFixture]
|
||||
public class OperationMessageTest
|
||||
{
|
||||
OperationMessage operation;
|
||||
|
||||
[SetUp]
|
||||
public void InitializeOperation()
|
||||
{
|
||||
// workaround: OperationInput, OperationOutput and OperationFault are all empty derivations of OperationMessage
|
||||
operation = new OperationInput();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDefaultProperties()
|
||||
{
|
||||
Assertion.AssertEquals(String.Empty, operation.Documentation);
|
||||
Assertion.AssertNull(operation.Name);
|
||||
Assertion.AssertEquals(XmlQualifiedName.Empty, operation.Message);
|
||||
Assertion.AssertNull(operation.Operation);
|
||||
}
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// MonoTests.System.Web.Services.Description.PortTypeCollectionTest.cs
|
||||
//
|
||||
// Author:
|
||||
// Erik LeBel <[email protected]>
|
||||
//
|
||||
// (C) 2003 Erik LeBel
|
||||
//
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using System;
|
||||
using System.Web.Services.Description;
|
||||
|
||||
namespace MonoTests.System.Web.Services.Description
|
||||
{
|
||||
[TestFixture]
|
||||
public class PortTypeCollectionTest
|
||||
{
|
||||
PortTypeCollection ptc;
|
||||
|
||||
[SetUp]
|
||||
public void InitializePortTypeCollection ()
|
||||
{
|
||||
// workaround for internal constructor
|
||||
ServiceDescription desc = new ServiceDescription ();
|
||||
ptc = desc.PortTypes;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDefaultProperties()
|
||||
{
|
||||
Assertion.AssertNull (ptc["hello"]);
|
||||
Assertion.AssertEquals (0, ptc.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddPortType ()
|
||||
{
|
||||
const string portTypeName = "testPortType";
|
||||
|
||||
PortType p = new PortType ();
|
||||
p.Name = portTypeName;
|
||||
|
||||
ptc.Add (p);
|
||||
|
||||
Assertion.AssertEquals (1, ptc.Count);
|
||||
Assertion.AssertEquals (p, ptc[portTypeName]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// MonoTests.System.Web.Services.Description.PortTypeTest.cs
|
||||
//
|
||||
// Author:
|
||||
// Erik LeBel <[email protected]>
|
||||
//
|
||||
// (C) 2003 Erik LeBel
|
||||
//
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using System;
|
||||
using System.Web.Services.Description;
|
||||
|
||||
namespace MonoTests.System.Web.Services.Description
|
||||
{
|
||||
[TestFixture]
|
||||
public class PortTypeTest
|
||||
{
|
||||
PortType portType;
|
||||
|
||||
[SetUp]
|
||||
public void InitializePortType()
|
||||
{
|
||||
portType = new PortType();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDefaultProperties()
|
||||
{
|
||||
Assertion.AssertNull(portType.Name);
|
||||
Assertion.AssertNotNull(portType.Operations);
|
||||
Assertion.AssertEquals(0, portType.Operations.Count);
|
||||
Assertion.AssertNull(portType.ServiceDescription);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestEmptyName()
|
||||
{
|
||||
portType.Name = String.Empty;
|
||||
Assertion.AssertEquals(String.Empty, portType.Name);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLongName()
|
||||
{
|
||||
const string LongName = "abcdefghijklmnopqrstuvwxyz";
|
||||
portType.Name = LongName;
|
||||
Assertion.AssertEquals(LongName, portType.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// MonoTests.System.Web.Services.Description.ServiceCollectionTest.cs
|
||||
//
|
||||
// Author:
|
||||
// Erik LeBel <[email protected]>
|
||||
//
|
||||
// (C) 2003 Erik LeBel
|
||||
//
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using System;
|
||||
using System.Web.Services.Description;
|
||||
|
||||
namespace MonoTests.System.Web.Services.Description
|
||||
{
|
||||
[TestFixture]
|
||||
public class ServiceCollectionTest
|
||||
{
|
||||
ServiceCollection sc;
|
||||
|
||||
[SetUp]
|
||||
public void InitializeServiceCollection ()
|
||||
{
|
||||
// workaround for internal constructor
|
||||
ServiceDescription desc = new ServiceDescription ();
|
||||
sc = desc.Services;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDefaultProperties()
|
||||
{
|
||||
Assertion.AssertNull (sc["hello"]);
|
||||
Assertion.AssertEquals (0, sc.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddService ()
|
||||
{
|
||||
const string serviceName = "testService";
|
||||
|
||||
Service s = new Service ();
|
||||
s.Name = serviceName;
|
||||
|
||||
sc.Add (s);
|
||||
|
||||
Assertion.AssertEquals (1, sc.Count);
|
||||
Assertion.AssertEquals (s, sc[serviceName]);
|
||||
}
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// MonoTests.System.Web.Services.Description.ServiceDescriptionCollectionTest.cs
|
||||
//
|
||||
// Author:
|
||||
// Erik LeBel <[email protected]>
|
||||
//
|
||||
// (C) 2003 Erik LeBel
|
||||
//
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using System;
|
||||
using System.Web.Services.Description;
|
||||
|
||||
namespace MonoTests.System.Web.Services.Description
|
||||
{
|
||||
[TestFixture]
|
||||
public class ServiceDescriptionCollectionTest
|
||||
{
|
||||
ServiceDescriptionCollection sdc;
|
||||
|
||||
[SetUp]
|
||||
public void InitializeServiceDescriptionCollection ()
|
||||
{
|
||||
sdc = new ServiceDescriptionCollection ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDefaultProperties()
|
||||
{
|
||||
Assertion.AssertNull (sdc["hello"]);
|
||||
Assertion.AssertEquals (0, sdc.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddServiceDescriptionWithoutTargetNS ()
|
||||
{
|
||||
const string serviceDescriptionNamespace = "testServiceDescription";
|
||||
|
||||
ServiceDescription sd = new ServiceDescription ();
|
||||
sdc.Add (sd);
|
||||
|
||||
Assertion.AssertEquals (1, sdc.Count);
|
||||
Assertion.AssertNull (sdc[serviceDescriptionNamespace]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddServiceDescriptionWithTargetNS ()
|
||||
{
|
||||
const string serviceDescriptionNamespace = "http://some.urn";
|
||||
|
||||
ServiceDescription sd = new ServiceDescription ();
|
||||
sd.TargetNamespace = serviceDescriptionNamespace;
|
||||
|
||||
sdc.Add (sd);
|
||||
|
||||
Assertion.AssertEquals (1, sdc.Count);
|
||||
Assertion.AssertEquals (sd, sdc[serviceDescriptionNamespace]);
|
||||
}
|
||||
}
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
//
|
||||
// MonoTests.System.Web.Services.Description.SoapBodyBindingTest.cs
|
||||
//
|
||||
// Author:
|
||||
// Erik LeBel <[email protected]>
|
||||
//
|
||||
// (C) 2003 Erik LeBel
|
||||
//
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using System;
|
||||
using System.Web.Services.Description;
|
||||
|
||||
namespace MonoTests.System.Web.Services.Description
|
||||
{
|
||||
[TestFixture]
|
||||
public class SoapBodyBindingTest
|
||||
{
|
||||
SoapBodyBinding sbb;
|
||||
|
||||
[SetUp]
|
||||
public void InitializeSoapBodyBinding()
|
||||
{
|
||||
sbb = new SoapBodyBinding();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDefaultProperties()
|
||||
{
|
||||
Assertion.AssertEquals(String.Empty, sbb.Encoding);
|
||||
Assertion.AssertNull(sbb.Parts);
|
||||
Assertion.AssertNull(sbb.PartsString);
|
||||
Assertion.AssertEquals(String.Empty, sbb.Namespace);
|
||||
Assertion.AssertEquals(SoapBindingUse.Default, sbb.Use);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAssignNullPartsString()
|
||||
{
|
||||
sbb.PartsString = null;
|
||||
Assertion.AssertNull(sbb.Parts);
|
||||
Assertion.AssertEquals(null, sbb.PartsString);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAssignEmptyPartsString()
|
||||
{
|
||||
sbb.PartsString = String.Empty;
|
||||
Assertion.AssertNotNull(sbb.Parts);
|
||||
Assertion.AssertEquals(1, sbb.Parts.Length);
|
||||
Assertion.AssertEquals(String.Empty, sbb.PartsString);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAssignSpacesToPartsString()
|
||||
{
|
||||
const string Spaces = " ";
|
||||
sbb.PartsString = Spaces;
|
||||
Assertion.AssertNotNull(sbb.Parts);
|
||||
Assertion.AssertEquals(2, sbb.Parts.Length);
|
||||
Assertion.AssertEquals(Spaces, sbb.PartsString);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAssignNullParts()
|
||||
{
|
||||
sbb.Parts = null;
|
||||
Assertion.AssertNull(sbb.Parts);
|
||||
Assertion.AssertNull(sbb.PartsString);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAssignValueParts()
|
||||
{
|
||||
string[] vals = {"a", "b"};
|
||||
sbb.Parts = vals;
|
||||
Assertion.AssertNotNull(sbb.Parts);
|
||||
Assertion.AssertEquals("a b", sbb.PartsString);
|
||||
}
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// MonoTests.System.Web.Services.Description.SoapOperationBindingTest.cs
|
||||
//
|
||||
// Author:
|
||||
// Erik LeBel <[email protected]>
|
||||
//
|
||||
// (C) 2003 Erik LeBel
|
||||
//
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using System;
|
||||
using System.Web.Services.Description;
|
||||
|
||||
namespace MonoTests.System.Web.Services.Description
|
||||
{
|
||||
[TestFixture]
|
||||
public class SoapOperationBindingTest
|
||||
{
|
||||
SoapOperationBinding sob;
|
||||
|
||||
[SetUp]
|
||||
public void InitializeSoapOperationBinding()
|
||||
{
|
||||
sob = new SoapOperationBinding();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDefaultProperties()
|
||||
{
|
||||
Assertion.AssertEquals(String.Empty, sob.SoapAction);
|
||||
Assertion.AssertEquals(SoapBindingStyle.Default, sob.Style);
|
||||
Assertion.AssertEquals(false, sob.Required);
|
||||
Assertion.AssertNull(sob.Parent);
|
||||
Assertion.AssertEquals(false, sob.Handled);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// MonoTests.System.Web.Services.Description.TypesTest.cs
|
||||
//
|
||||
// Author:
|
||||
// Erik LeBel <[email protected]>
|
||||
//
|
||||
// (C) 2003 Erik LeBel
|
||||
//
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using System;
|
||||
using System.Web.Services.Description;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace MonoTests.System.Web.Services.Description
|
||||
{
|
||||
[TestFixture]
|
||||
public class TypesTest
|
||||
{
|
||||
Types types;
|
||||
|
||||
[SetUp]
|
||||
public void InitializeTypes()
|
||||
{
|
||||
types = new Types();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDefaultProperties()
|
||||
{
|
||||
Assertion.AssertEquals(String.Empty, types.Documentation);
|
||||
Assertion.AssertNotNull(types.Schemas);
|
||||
Assertion.AssertEquals(0, types.Schemas.Count);
|
||||
Assertion.AssertNotNull(types.Extensions);
|
||||
Assertion.AssertEquals(0, types.Extensions.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -408,12 +408,10 @@ namespace System.Web.UI.WebControls
|
||||
|
||||
if (!valid) {
|
||||
RenderBeginTag (writer);
|
||||
if (Text.Trim ().Length > 0 || HasControls ()) {
|
||||
if (Text.Trim ().Length > 0 || HasControls ())
|
||||
RenderContents (writer);
|
||||
RenderEndTag (writer);
|
||||
} else {
|
||||
else
|
||||
writer.Write (ErrorMessage);
|
||||
}
|
||||
RenderEndTag (writer);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
2003-09-14 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* RegularExpressionValidator.cs: fix for EvaluateIsValid by Juraj
|
||||
Skripsky <[email protected]>
|
||||
|
||||
2003-09-13 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* BaseValidator.cs: patch by Juraj Skripsky ([email protected]) that
|
||||
fixes rendering of the end tag.
|
||||
|
||||
2003-08-31 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* Repeater.cs: fix for Items property provided by [email protected]
|
||||
|
||||
@@ -75,12 +75,7 @@ namespace System.Web.UI.WebControls
|
||||
|
||||
bool retVal;
|
||||
try {
|
||||
Match match = Regex.Match (ctrl, ValidationExpression);
|
||||
if (match.Success && match.Index == 0) {
|
||||
retVal = true;
|
||||
} else {
|
||||
retVal = false;
|
||||
}
|
||||
retVal = Regex.IsMatch (ctrl, "^" + ValidationExpression + "$");
|
||||
} catch (Exception) {
|
||||
retVal = true;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2003-09-13 Duncan Mak <[email protected]>
|
||||
|
||||
* TabPage.cs (constructor): added a constructor for constructing
|
||||
tab pages with a title. Patch from Jonathan Hogg
|
||||
<[email protected]>.
|
||||
|
||||
2003-09-01 Dennis Hayes <[email protected]>
|
||||
* Application.cs
|
||||
|
||||
@@ -39,6 +39,10 @@ namespace System.Windows.Forms {
|
||||
imageIndex = -1;
|
||||
}
|
||||
|
||||
public TabPage (string textValue) : this() {
|
||||
text = textValue;
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
public override AnchorStyles Anchor {
|
||||
get { return base.Anchor; }
|
||||
|
||||
@@ -1,3 +1,14 @@
|
||||
2003-09-14 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* DTMXPathNavigator.cs,
|
||||
DTMXPathDocument.cs,
|
||||
DTMXPathDocumentBuilder.cs : Added IXmlLineInfo support. Removed
|
||||
node's extraneous schemaType. Some code reformatting.
|
||||
|
||||
2003-09-13 Ben Maurer <[email protected]>
|
||||
|
||||
* Pattern.cs: Support static context.
|
||||
|
||||
2003-08-25 Ben Maurer <[email protected]>
|
||||
|
||||
* DTMXPathNavigator.cs: Allocate valueBuilder on first use.
|
||||
|
||||
@@ -39,7 +39,8 @@ namespace Mono.Xml.XPath
|
||||
string [] value__,
|
||||
string [] xmlLang__,
|
||||
int [] namespaceNode__,
|
||||
object [] schemaType__,
|
||||
int [] nodeLineNumber__,
|
||||
int [] nodeLinePosition__,
|
||||
int [] ownerElement__,
|
||||
int [] nextAttribute__,
|
||||
string [] attrLocalName__,
|
||||
@@ -47,6 +48,8 @@ namespace Mono.Xml.XPath
|
||||
string [] attrNsUri__,
|
||||
string [] attrValue__,
|
||||
object [] attrSchemaType__,
|
||||
int [] attrLineNumber__,
|
||||
int [] attrLinePosition__,
|
||||
int [] nsDeclaredElement__,
|
||||
int [] nextNsNode__,
|
||||
string [] nsNodeName__,
|
||||
@@ -69,7 +72,8 @@ namespace Mono.Xml.XPath
|
||||
value_ = value__;
|
||||
xmlLang_ = xmlLang__;
|
||||
namespaceNode_ = namespaceNode__;
|
||||
schemaType_ = schemaType__;
|
||||
nodeLineNumber_ = nodeLineNumber__;
|
||||
nodeLinePosition_ = nodeLinePosition__;
|
||||
|
||||
// Attribute
|
||||
ownerElement_ = ownerElement__;
|
||||
@@ -79,6 +83,8 @@ namespace Mono.Xml.XPath
|
||||
attrNsUri_ = attrNsUri__;
|
||||
attrValue_ = attrValue__;
|
||||
attrSchemaType_ = attrSchemaType__;
|
||||
attrLineNumber_ = attrLineNumber__;
|
||||
attrLinePosition_ = attrLinePosition__;
|
||||
|
||||
// NamespaceNode
|
||||
nsDeclaredElement_ = nsDeclaredElement__;
|
||||
@@ -98,7 +104,40 @@ namespace Mono.Xml.XPath
|
||||
public XPathNavigator CreateNavigator ()
|
||||
{
|
||||
if (root == null) {
|
||||
root = new DTMXPathNavigator (this, nameTable, firstChild_, parent_, firstAttribute_, previousSibling_, nextSibling_, depth_, position_, nodeType_, baseUri_, isEmptyElement_, localName_, namespaceUri_, prefix_, value_, xmlLang_, namespaceNode_, schemaType_, ownerElement_, nextAttribute_, attrLocalName_, attrPrefix_, attrNsUri_, attrValue_, attrSchemaType_, nsDeclaredElement_, nextNsNode_, nsNodeName_, nsNodeUri_, idTable_);
|
||||
root = new DTMXPathNavigator (this,
|
||||
nameTable,
|
||||
firstChild_,
|
||||
parent_,
|
||||
firstAttribute_,
|
||||
previousSibling_,
|
||||
nextSibling_,
|
||||
depth_,
|
||||
position_,
|
||||
nodeType_,
|
||||
baseUri_,
|
||||
isEmptyElement_,
|
||||
localName_,
|
||||
namespaceUri_,
|
||||
prefix_,
|
||||
value_,
|
||||
xmlLang_,
|
||||
namespaceNode_,
|
||||
nodeLineNumber_,
|
||||
nodeLinePosition_,
|
||||
ownerElement_,
|
||||
nextAttribute_,
|
||||
attrLocalName_,
|
||||
attrPrefix_,
|
||||
attrNsUri_,
|
||||
attrValue_,
|
||||
attrSchemaType_,
|
||||
attrLineNumber_,
|
||||
attrLinePosition_,
|
||||
nsDeclaredElement_,
|
||||
nextNsNode_,
|
||||
nsNodeName_,
|
||||
nsNodeUri_,
|
||||
idTable_);
|
||||
return root;
|
||||
} else
|
||||
return root.Clone ();
|
||||
@@ -130,7 +169,8 @@ namespace Mono.Xml.XPath
|
||||
string [] value_;
|
||||
string [] xmlLang_;
|
||||
int [] namespaceNode_;
|
||||
object [] schemaType_; // for XPath 2.0
|
||||
int [] nodeLineNumber_;
|
||||
int [] nodeLinePosition_;
|
||||
|
||||
// Attribute
|
||||
int [] ownerElement_;
|
||||
@@ -139,7 +179,9 @@ namespace Mono.Xml.XPath
|
||||
string [] attrPrefix_;
|
||||
string [] attrNsUri_;
|
||||
string [] attrValue_;
|
||||
object [] attrSchemaType_; // for XPath 2.0
|
||||
object [] attrSchemaType_; // for id()
|
||||
int [] attrLineNumber_;
|
||||
int [] attrLinePosition_;
|
||||
|
||||
// NamespaceNode
|
||||
int [] nsDeclaredElement_; // the Element that declares NS, or Root.
|
||||
|
||||
@@ -19,37 +19,39 @@ namespace Mono.Xml.XPath
|
||||
public class DTMXPathDocumentBuilder
|
||||
{
|
||||
public DTMXPathDocumentBuilder (string url)
|
||||
: this (url, XmlSpace.None, false)
|
||||
: this (url, XmlSpace.None, false, 100)
|
||||
{
|
||||
}
|
||||
|
||||
public DTMXPathDocumentBuilder (string url, XmlSpace space)
|
||||
: this (url, space, false)
|
||||
: this (url, space, false, 100)
|
||||
{
|
||||
}
|
||||
|
||||
public DTMXPathDocumentBuilder (string url, XmlSpace space, bool supportID)
|
||||
: this (new XmlTextReader (url), space, supportID)
|
||||
public DTMXPathDocumentBuilder (string url, XmlSpace space, bool supportID, int defaultCapacity)
|
||||
: this (new XmlTextReader (url), space, supportID, defaultCapacity)
|
||||
{
|
||||
}
|
||||
|
||||
public DTMXPathDocumentBuilder (XmlReader reader)
|
||||
: this (reader, XmlSpace.None, false)
|
||||
: this (reader, XmlSpace.None, false, 100)
|
||||
{
|
||||
}
|
||||
|
||||
public DTMXPathDocumentBuilder (XmlReader reader, XmlSpace space)
|
||||
: this (reader, space, false)
|
||||
: this (reader, space, false, 100)
|
||||
{
|
||||
}
|
||||
|
||||
public DTMXPathDocumentBuilder (XmlReader reader, XmlSpace space, bool supportID)
|
||||
public DTMXPathDocumentBuilder (XmlReader reader, XmlSpace space, bool supportID, int defaultCapacity)
|
||||
{
|
||||
this.xmlReader = reader;
|
||||
if (supportID)
|
||||
this.validatingReader = reader as XmlValidatingReader;
|
||||
lineInfo = reader as IXmlLineInfo;
|
||||
this.xmlSpace = xmlSpace;
|
||||
this.nameTable = reader.NameTable;
|
||||
DefaultCapacity = defaultCapacity;
|
||||
Compile ();
|
||||
}
|
||||
|
||||
@@ -58,6 +60,7 @@ namespace Mono.Xml.XPath
|
||||
XmlValidatingReader validatingReader;
|
||||
XmlSpace xmlSpace;
|
||||
XmlNameTable nameTable;
|
||||
IXmlLineInfo lineInfo;
|
||||
int defaultCapacity = 100;
|
||||
public int DefaultCapacity {
|
||||
get { return defaultCapacity; }
|
||||
@@ -86,7 +89,8 @@ namespace Mono.Xml.XPath
|
||||
string [] value_ = new string [0];
|
||||
string [] xmlLang_ = new string [0];
|
||||
int [] namespaceNode_ = new int [0];
|
||||
object [] schemaType_ = new object [0];
|
||||
int [] nodeLineNumber_ = new int [0];
|
||||
int [] nodeLinePosition_ = new int [0];
|
||||
|
||||
// Attribute
|
||||
int [] ownerElement_ = new int [0];
|
||||
@@ -96,6 +100,8 @@ namespace Mono.Xml.XPath
|
||||
string [] attrNsUri_ = new string [0];
|
||||
string [] attrValue_ = new string [0];
|
||||
object [] attrSchemaType_ = new object [0];
|
||||
int [] attrLineNumber_ = new int [0];
|
||||
int [] attrLinePosition_ = new int [0];
|
||||
|
||||
// NamespaceNode
|
||||
int [] nsDeclaredElement_ = new int [100];
|
||||
@@ -131,7 +137,8 @@ namespace Mono.Xml.XPath
|
||||
value_,
|
||||
xmlLang_,
|
||||
namespaceNode_,
|
||||
schemaType_,
|
||||
nodeLineNumber_,
|
||||
nodeLinePosition_,
|
||||
|
||||
// Attribute
|
||||
ownerElement_,
|
||||
@@ -141,6 +148,8 @@ namespace Mono.Xml.XPath
|
||||
attrNsUri_,
|
||||
attrValue_,
|
||||
attrSchemaType_,
|
||||
attrLineNumber_,
|
||||
attrLinePosition_,
|
||||
|
||||
// NamespaceNode
|
||||
nsDeclaredElement_,
|
||||
@@ -158,9 +167,9 @@ namespace Mono.Xml.XPath
|
||||
// index 0 is dummy. No node (including Root) is assigned to this index
|
||||
// So that we can easily compare index != 0 instead of index < 0.
|
||||
// (Difference between jnz or jbe in 80x86.)
|
||||
AddNode (0, 0, 0, 0, 0, 0, XPathNodeType.All, "", false, "", "", "", "", "", 0, null);
|
||||
AddNode (0, 0, 0, 0, 0, 0, XPathNodeType.All, "", false, "", "", "", "", "", 0, 0, 0);
|
||||
nodeIndex++;
|
||||
AddAttribute (0, null, null, null, null, null);
|
||||
AddAttribute (0, null, null, null, null, null, 0, 0);
|
||||
nextAttribute_ [0] = 0;
|
||||
AddNsNode (0, null, null);
|
||||
nsIndex++;
|
||||
@@ -169,7 +178,7 @@ namespace Mono.Xml.XPath
|
||||
nextNsNode_ [1] = 0;
|
||||
|
||||
// add root.
|
||||
AddNode (0, 0, 0, 0, -1, 0, XPathNodeType.Root, xmlReader.BaseURI, false, "", "", "", "", "", 1, null);
|
||||
AddNode (0, 0, 0, 0, -1, 0, XPathNodeType.Root, xmlReader.BaseURI, false, "", "", "", "", "", 1, 0, 0);
|
||||
|
||||
this.nodeIndex = 1;
|
||||
this.requireFirstChildFill = true;
|
||||
@@ -267,7 +276,8 @@ namespace Mono.Xml.XPath
|
||||
value,
|
||||
xmlReader.XmlLang,
|
||||
nsIndex,
|
||||
null); // schemaType
|
||||
lineInfo != null ? lineInfo.LineNumber : 0,
|
||||
lineInfo != null ? lineInfo.LinePosition : 0);
|
||||
// this code is tricky, but after ReadString() invokation,
|
||||
// xmlReader is moved to next node!!
|
||||
if (value == null)
|
||||
@@ -311,7 +321,14 @@ namespace Mono.Xml.XPath
|
||||
} else {
|
||||
// add attribute node.
|
||||
attributeIndex ++;
|
||||
this.AddAttribute (nodeIndex, xmlReader.LocalName, xmlReader.NamespaceURI, xmlReader.Prefix != null ? xmlReader.Prefix : String.Empty, xmlReader.Value, null);
|
||||
this.AddAttribute (nodeIndex,
|
||||
xmlReader.LocalName,
|
||||
xmlReader.NamespaceURI,
|
||||
xmlReader.Prefix != null ? xmlReader.Prefix : String.Empty,
|
||||
xmlReader.Value,
|
||||
null,
|
||||
lineInfo != null ? lineInfo.LineNumber : 0,
|
||||
lineInfo != null ? lineInfo.LinePosition : 0);
|
||||
if (firstAttributeIndex == 0)
|
||||
firstAttributeIndex = attributeIndex;
|
||||
else
|
||||
@@ -349,7 +366,8 @@ namespace Mono.Xml.XPath
|
||||
"", // Element has no internal value.
|
||||
xmlReader.XmlLang,
|
||||
nsIndex,
|
||||
null); // schemaType
|
||||
lineInfo != null ? lineInfo.LineNumber : 0,
|
||||
lineInfo != null ? lineInfo.LinePosition : 0);
|
||||
if (!xmlReader.IsEmptyElement)
|
||||
requireFirstChildFill = true;
|
||||
}
|
||||
@@ -407,7 +425,8 @@ namespace Mono.Xml.XPath
|
||||
SetStringArrayLength (ref value_, size);
|
||||
SetStringArrayLength (ref xmlLang_, size);
|
||||
SetIntArrayLength (ref namespaceNode_, size);
|
||||
SetObjectArrayLength (ref schemaType_, size);
|
||||
SetIntArrayLength (ref nodeLineNumber_, size);
|
||||
SetIntArrayLength (ref nodeLinePosition_, size);
|
||||
}
|
||||
|
||||
private void SetAttributeArraysLength (int size)
|
||||
@@ -419,6 +438,8 @@ namespace Mono.Xml.XPath
|
||||
SetStringArrayLength (ref attrNsUri_, size);
|
||||
SetStringArrayLength (ref attrValue_, size);
|
||||
SetObjectArrayLength (ref attrSchemaType_, size);
|
||||
SetIntArrayLength (ref attrLineNumber_, size);
|
||||
SetIntArrayLength (ref attrLinePosition_, size);
|
||||
}
|
||||
|
||||
private void SetNsArraysLength (int size)
|
||||
@@ -430,7 +451,7 @@ namespace Mono.Xml.XPath
|
||||
}
|
||||
|
||||
// Here followings are skipped: firstChild, nextSibling,
|
||||
public void AddNode (int parent, int firstAttribute, int attributeEnd, int previousSibling, int depth, int position, XPathNodeType nodeType, string baseUri, bool isEmptyElement, string localName, string ns, string prefix, string value, string xmlLang, int namespaceNode, object schemaType)
|
||||
public void AddNode (int parent, int firstAttribute, int attributeEnd, int previousSibling, int depth, int position, XPathNodeType nodeType, string baseUri, bool isEmptyElement, string localName, string ns, string prefix, string value, string xmlLang, int namespaceNode, int lineNumber, int linePosition)
|
||||
{
|
||||
if (firstChild_.Length < nodeIndex + 1) {
|
||||
if (firstChild_.Length >= defaultCapacity)
|
||||
@@ -454,11 +475,12 @@ namespace Mono.Xml.XPath
|
||||
value_ [nodeIndex] = value;
|
||||
xmlLang_ [nodeIndex] = xmlLang;
|
||||
namespaceNode_ [nodeIndex] = namespaceNode;
|
||||
schemaType_ [nodeIndex] = schemaType;
|
||||
nodeLineNumber_ [nodeIndex] = lineNumber;
|
||||
nodeLinePosition_ [nodeIndex] = linePosition;
|
||||
}
|
||||
|
||||
// Followings are skipped: nextAttribute,
|
||||
public void AddAttribute (int ownerElement, string localName, string ns, string prefix, string value, object schemaType)
|
||||
public void AddAttribute (int ownerElement, string localName, string ns, string prefix, string value, object schemaType, int lineNumber, int linePosition)
|
||||
{
|
||||
if (ownerElement_.Length < attributeIndex + 1) {
|
||||
if (ownerElement_.Length >= defaultCapacity)
|
||||
@@ -472,6 +494,8 @@ namespace Mono.Xml.XPath
|
||||
attrPrefix_ [attributeIndex] = prefix;
|
||||
attrValue_ [attributeIndex] = value;
|
||||
attrSchemaType_ [attributeIndex] = schemaType;
|
||||
attrLineNumber_ [attributeIndex] = lineNumber;
|
||||
attrLinePosition_ [attributeIndex] = linePosition;
|
||||
}
|
||||
|
||||
// Followings are skipped: nextNsNode (may be next attribute in the same element, or ancestors' nsNode)
|
||||
|
||||
@@ -15,7 +15,7 @@ using System.Xml.XPath;
|
||||
|
||||
namespace Mono.Xml.XPath
|
||||
{
|
||||
public class DTMXPathNavigator : XPathNavigator
|
||||
public class DTMXPathNavigator : XPathNavigator, IXmlLineInfo
|
||||
{
|
||||
|
||||
#region Copy of XPathDocument
|
||||
@@ -29,10 +29,12 @@ namespace Mono.Xml.XPath
|
||||
string [] localName__, string [] namespaceUri__,
|
||||
string [] prefix__, string [] value__,
|
||||
string [] xmlLang__, int [] namespaceNode__,
|
||||
object [] schemaType__, int [] ownerElement__,
|
||||
int [] nodeLineNumber__, int [] nodeLinePosition__,
|
||||
int [] ownerElement__,
|
||||
int [] nextAttribute__, string [] attrLocalName__,
|
||||
string [] attrPrefix__, string [] attrNsUri__,
|
||||
string [] attrValue__, object [] attrSchemaType__,
|
||||
int [] attrLineNumber__, int [] attrLinePosition__,
|
||||
int [] nsDeclaredElement__, int [] nextNsNode__,
|
||||
string [] nsNodeName__, string [] nsNodeUri__,
|
||||
Hashtable idTable__)
|
||||
@@ -53,7 +55,8 @@ namespace Mono.Xml.XPath
|
||||
value_ = value__;
|
||||
xmlLang_ = xmlLang__;
|
||||
namespaceNode_ = namespaceNode__;
|
||||
schemaType_ = schemaType__;
|
||||
nodeLineNumber_ = nodeLineNumber__;
|
||||
nodeLinePosition_ = nodeLinePosition__;
|
||||
|
||||
// Attribute
|
||||
ownerElement_ = ownerElement__;
|
||||
@@ -63,6 +66,8 @@ namespace Mono.Xml.XPath
|
||||
attrNsUri_ = attrNsUri__;
|
||||
attrValue_ = attrValue__;
|
||||
attrSchemaType_ = attrSchemaType__;
|
||||
attrLineNumber_ = attrLineNumber__;
|
||||
attrLinePosition_ = attrLinePosition__;
|
||||
|
||||
// NamespaceNode
|
||||
nsDeclaredElement_ = nsDeclaredElement__;
|
||||
@@ -85,9 +90,11 @@ namespace Mono.Xml.XPath
|
||||
org.position_, org.nodeType_, org.baseUri_,
|
||||
org.isEmptyElement_, org.localName_, org.namespaceUri_,
|
||||
org.prefix_, org.value_, org.xmlLang_,
|
||||
org.namespaceNode_, org.schemaType_, org.ownerElement_,
|
||||
org.namespaceNode_, org.nodeLineNumber_, org.nodeLinePosition_,
|
||||
org.ownerElement_,
|
||||
org.nextAttribute_, org.attrLocalName_, org.attrPrefix_,
|
||||
org.attrNsUri_, org.attrValue_, org.attrSchemaType_,
|
||||
org.attrLineNumber_, org.attrLinePosition_,
|
||||
org.nsDeclaredElement_, org.nextNsNode_, org.nsNodeName_,
|
||||
org.nsNodeUri_, org.idTable_)
|
||||
{
|
||||
@@ -121,7 +128,8 @@ namespace Mono.Xml.XPath
|
||||
string [] value_;
|
||||
string [] xmlLang_;
|
||||
int [] namespaceNode_;
|
||||
object [] schemaType_; // for XPath 2.0
|
||||
int [] nodeLineNumber_;
|
||||
int [] nodeLinePosition_;
|
||||
|
||||
// Attribute
|
||||
int [] ownerElement_;
|
||||
@@ -130,7 +138,9 @@ namespace Mono.Xml.XPath
|
||||
string [] attrPrefix_;
|
||||
string [] attrNsUri_;
|
||||
string [] attrValue_;
|
||||
object [] attrSchemaType_; // for XPath 2.0
|
||||
object [] attrSchemaType_; // for id()
|
||||
int [] attrLineNumber_;
|
||||
int [] attrLinePosition_;
|
||||
|
||||
// NamespaceNode
|
||||
int [] nsDeclaredElement_; // the Element that declares NS.
|
||||
@@ -182,6 +192,20 @@ namespace Mono.Xml.XPath
|
||||
get { return currentIsNode ? isEmptyElement_ [currentNode] : false; }
|
||||
}
|
||||
|
||||
int IXmlLineInfo.LineNumber {
|
||||
get {
|
||||
return currentIsAttr ? attrLineNumber_ [currentAttr] :
|
||||
nodeLineNumber_ [currentNode];
|
||||
}
|
||||
}
|
||||
|
||||
int IXmlLineInfo.LinePosition {
|
||||
get {
|
||||
return currentIsAttr ? attrLinePosition_ [currentAttr] :
|
||||
nodeLinePosition_ [currentNode];
|
||||
}
|
||||
}
|
||||
|
||||
public override string LocalName {
|
||||
get { return currentIsNode ? localName_ [currentNode] : currentIsAttr ? attrLocalName_ [currentAttr] : nsNodeName_ [currentNs]; }
|
||||
}
|
||||
@@ -347,6 +371,11 @@ namespace Mono.Xml.XPath
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
bool IXmlLineInfo.HasLineInfo ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool IsDescendant (XPathNavigator nav)
|
||||
{
|
||||
DTMXPathNavigator another = nav as DTMXPathNavigator;
|
||||
|
||||
@@ -18,10 +18,11 @@ using System.Xml.Xsl;
|
||||
namespace Mono.Xml.XPath {
|
||||
public abstract class Pattern {
|
||||
|
||||
public static Pattern Compile (string s)
|
||||
internal static Pattern Compile (string s, System.Xml.Xsl.IStaticXsltContext ctx)
|
||||
{
|
||||
Tokenizer tokenizer = new Tokenizer (s);
|
||||
XPathParser parser = new XPathParser ();
|
||||
parser.Context = ctx;
|
||||
Expression expr = (Expression) parser.yyparseSafe (tokenizer);
|
||||
|
||||
return Compile (expr);
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
2003-09-14 Oleg Tkachenko <[email protected]>
|
||||
|
||||
* XslCopyOf.cs - WriteAttributeString instead of
|
||||
WriteStartAttribute/WriteString/WriteEndAttribute.
|
||||
|
||||
2003-09-13 Ben Maurer <[email protected]>
|
||||
|
||||
* XslLiteralElement.cs: reduce enumerator allocation.
|
||||
|
||||
2003-08-30 Oleg Tkachenko <[email protected]>
|
||||
|
||||
* XslAttribute.cs: output is now done to TextOutputter, which outputs
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Mono.Xml.Xsl.Operations {
|
||||
public class XslApplyTemplates : XslCompiledElement {
|
||||
XPathExpression select;
|
||||
XmlQualifiedName mode;
|
||||
ArrayList withParams = new ArrayList ();
|
||||
ArrayList withParams;
|
||||
|
||||
public XslApplyTemplates (Compiler c) : base (c) {}
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace Mono.Xml.Xsl.Operations {
|
||||
switch (c.Input.LocalName)
|
||||
{
|
||||
case "with-param":
|
||||
if (withParams == null) withParams = new ArrayList ();
|
||||
withParams.Add (new XslVariableInformation (c));
|
||||
break;
|
||||
|
||||
@@ -64,19 +65,11 @@ namespace Mono.Xml.Xsl.Operations {
|
||||
}
|
||||
|
||||
public override void Evaluate (XslTransformProcessor p)
|
||||
{
|
||||
Hashtable passedParams = null;
|
||||
|
||||
if (withParams.Count > 0) {
|
||||
passedParams = new Hashtable ();
|
||||
foreach (XslVariableInformation param in withParams)
|
||||
passedParams [param.Name] = param.Evaluate (p);
|
||||
}
|
||||
|
||||
{
|
||||
if (select == null)
|
||||
p.ApplyTemplates (p.CurrentNode.SelectChildren (XPathNodeType.All), mode, passedParams);
|
||||
p.ApplyTemplates (p.CurrentNode.SelectChildren (XPathNodeType.All), mode, withParams);
|
||||
else
|
||||
p.ApplyTemplates (p.Select (select), mode, passedParams);
|
||||
p.ApplyTemplates (p.Select (select), mode, withParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,13 +109,16 @@ namespace Mono.Xml.Xsl.Operations {
|
||||
public string Evaluate (XslTransformProcessor p)
|
||||
{
|
||||
if (simpleString != null) return simpleString;
|
||||
if (avtParts.Count == 1)
|
||||
return ((AvtPart) avtParts [0]).Evaluate (p);
|
||||
|
||||
StringBuilder sb = new StringBuilder ();
|
||||
StringBuilder sb = p.GetAvtStringBuilder ();
|
||||
|
||||
foreach (AvtPart part in avtParts)
|
||||
sb.Append (part.Evaluate (p));
|
||||
|
||||
return sb.ToString ();
|
||||
int len = avtParts.Count;
|
||||
for (int i = 0; i < len; i++)
|
||||
sb.Append (((AvtPart) avtParts [i]).Evaluate (p));
|
||||
|
||||
return p.ReleaseAvtStringBuilder ();
|
||||
}
|
||||
|
||||
// Represents part of an AVT
|
||||
|
||||
@@ -18,7 +18,7 @@ using System.Xml.Xsl;
|
||||
namespace Mono.Xml.Xsl.Operations {
|
||||
public class XslCallTemplate : XslCompiledElement {
|
||||
XmlQualifiedName name;
|
||||
ArrayList withParams = new ArrayList ();
|
||||
ArrayList withParams;
|
||||
public XslCallTemplate (Compiler c) : base (c) {}
|
||||
|
||||
protected override void Compile (Compiler c)
|
||||
@@ -40,6 +40,7 @@ namespace Mono.Xml.Xsl.Operations {
|
||||
switch (c.Input.LocalName)
|
||||
{
|
||||
case "with-param":
|
||||
if (withParams == null) withParams = new ArrayList ();
|
||||
withParams.Add (new XslVariableInformation (c));
|
||||
break;
|
||||
default:
|
||||
@@ -55,16 +56,8 @@ namespace Mono.Xml.Xsl.Operations {
|
||||
}
|
||||
|
||||
public override void Evaluate (XslTransformProcessor p)
|
||||
{
|
||||
Hashtable passedParams = null;
|
||||
|
||||
if (withParams.Count > 0) {
|
||||
passedParams = new Hashtable ();
|
||||
foreach (XslVariableInformation param in withParams)
|
||||
passedParams [param.Name] = param.Evaluate (p);
|
||||
}
|
||||
|
||||
p.CallTemplate (name, passedParams);
|
||||
{
|
||||
p.CallTemplate (name, withParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,10 +58,12 @@ namespace Mono.Xml.Xsl.Operations {
|
||||
|
||||
public override void Evaluate (XslTransformProcessor p)
|
||||
{
|
||||
foreach (XslIf test in conditions) {
|
||||
if (test.EvaluateIfTrue (p))
|
||||
int len = conditions.Count;
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (((XslIf)conditions [i]).EvaluateIfTrue (p))
|
||||
return;
|
||||
}
|
||||
|
||||
if (defaultChoice != null)
|
||||
defaultChoice.Evaluate (p);
|
||||
}
|
||||
|
||||
@@ -48,9 +48,7 @@ namespace Mono.Xml.Xsl.Operations {
|
||||
if (nav.MoveToFirstAttribute())
|
||||
{
|
||||
do {
|
||||
outputter.WriteStartAttribute (nav.Prefix, nav.LocalName, nav.NamespaceURI);
|
||||
outputter.WriteString (nav.Value);
|
||||
outputter.WriteEndAttribute ();
|
||||
outputter.WriteAttributeString (nav.Prefix, nav.LocalName, nav.NamespaceURI, nav.Value);
|
||||
} while (nav.MoveToNextAttribute ());
|
||||
nav.MoveToParent();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Mono.Xml.Xsl.Operations {
|
||||
public class XslLiteralElement : XslCompiledElement {
|
||||
XslOperation children;
|
||||
string localname, prefix, nsUri;
|
||||
ArrayList attrs = new ArrayList ();
|
||||
ArrayList attrs;
|
||||
XmlQualifiedName [] useAttributeSets;
|
||||
Hashtable nsDecls;
|
||||
|
||||
@@ -51,9 +51,11 @@ namespace Mono.Xml.Xsl.Operations {
|
||||
this.localname = c.Input.LocalName;
|
||||
this.useAttributeSets = c.ParseQNameListAttribute ("use-attribute-sets", XsltNamespace);
|
||||
this.nsDecls = c.GetNamespacesToCopy ();
|
||||
if (nsDecls.Count == 0) nsDecls = null;
|
||||
|
||||
if (c.Input.MoveToFirstAttribute ())
|
||||
{
|
||||
attrs = new ArrayList ();
|
||||
do {
|
||||
if (c.Input.NamespaceURI == XsltNamespace)
|
||||
continue; //already handled
|
||||
@@ -71,11 +73,15 @@ namespace Mono.Xml.Xsl.Operations {
|
||||
{
|
||||
p.Out.WriteStartElement (prefix, localname, nsUri);
|
||||
|
||||
foreach (DictionaryEntry de in nsDecls)
|
||||
p.Out.WriteNamespaceDecl ((string)de.Key, (string)de.Value);
|
||||
|
||||
foreach (XslLiteralAttribute a in attrs)
|
||||
a.Evaluate (p);
|
||||
if (nsDecls != null)
|
||||
foreach (DictionaryEntry de in nsDecls)
|
||||
p.Out.WriteNamespaceDecl ((string)de.Key, (string)de.Value);
|
||||
|
||||
if (attrs != null) {
|
||||
int len = attrs.Count;
|
||||
for (int i = 0; i < len; i++)
|
||||
((XslLiteralAttribute)attrs [i]).Evaluate (p);
|
||||
}
|
||||
|
||||
if (useAttributeSets != null)
|
||||
foreach (XmlQualifiedName s in useAttributeSets)
|
||||
|
||||
@@ -136,8 +136,9 @@ namespace Mono.Xml.Xsl.Operations {
|
||||
if (hasStack)
|
||||
p.PushStack (stackSize);
|
||||
|
||||
foreach (XslOperation op in content)
|
||||
op.Evaluate (p);
|
||||
int len = content.Count;
|
||||
for (int i = 0; i < len; i++)
|
||||
((XslOperation) content [i]).Evaluate (p);
|
||||
|
||||
if (hasStack)
|
||||
p.PopStack ();
|
||||
|
||||
@@ -182,4 +182,23 @@ namespace Mono.Xml.Xsl.Operations {
|
||||
|
||||
public override bool IsParam { get { return true; }}
|
||||
}
|
||||
|
||||
internal class XPathVariableBinding : Expression {
|
||||
XslGeneralVariable v;
|
||||
public XPathVariableBinding (XslGeneralVariable v)
|
||||
{
|
||||
this.v = v;
|
||||
}
|
||||
public override String ToString () { return "$" + v.Name.ToString (); }
|
||||
public override XPathResultType ReturnType { get { return XPathResultType.Any; }}
|
||||
public override XPathResultType GetReturnType (BaseIterator iter)
|
||||
{
|
||||
return XPathResultType.Any;
|
||||
}
|
||||
|
||||
public override object Evaluate (BaseIterator iter)
|
||||
{
|
||||
return v.Evaluate (iter.NamespaceManager as XsltContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,18 @@
|
||||
2003-09-14 Oleg Tkachenko <[email protected]>
|
||||
|
||||
* GenericOutputter.cs - fix bug with outputting state.
|
||||
* Emitter.cs, TextEmitter.cs, XmlWriterEmitter.cs, Outputter.cs,
|
||||
* TextOutputter.cs - get rid of WriteStartAttribute/WriteEndAttribute.
|
||||
|
||||
2003-09-13 Ben Maurer <[email protected]>
|
||||
|
||||
* Compiler.cs, XslKey.cs, XslTransformProcessor.cs: dont clone
|
||||
exprs on use, pass to nav.
|
||||
|
||||
2003-09-13 Ben Maurer <[email protected]>
|
||||
|
||||
* Compiler.cs: pass satic context to Pattern ctor.
|
||||
|
||||
2003-08-30 Oleg Tkachenko <[email protected]>
|
||||
|
||||
* New files:
|
||||
|
||||
@@ -22,11 +22,12 @@ using System.IO;
|
||||
|
||||
using Mono.Xml.Xsl.Operations;
|
||||
using Mono.Xml.XPath;
|
||||
using Mono.Xml.Xsl.Functions;
|
||||
|
||||
using QName = System.Xml.XmlQualifiedName;
|
||||
|
||||
namespace Mono.Xml.Xsl {
|
||||
public class CompiledStylesheet {
|
||||
public class CompiledStylesheet {
|
||||
XslStylesheet style;
|
||||
Hashtable globalVariables;
|
||||
Hashtable attrSets;
|
||||
@@ -73,7 +74,7 @@ namespace Mono.Xml.Xsl {
|
||||
}
|
||||
}
|
||||
|
||||
public class Compiler {
|
||||
public class Compiler : IStaticXsltContext {
|
||||
public const string XsltNamespace = "http://www.w3.org/1999/XSL/Transform";
|
||||
|
||||
Stack inputStack = new Stack ();
|
||||
@@ -250,7 +251,7 @@ namespace Mono.Xml.Xsl {
|
||||
public Pattern CompilePattern (string pattern)
|
||||
{
|
||||
if (pattern == null || pattern == "") return null;
|
||||
Pattern p = Pattern.Compile (pattern);
|
||||
Pattern p = Pattern.Compile (pattern, this);
|
||||
|
||||
exprStore.AddPattern (p, this);
|
||||
|
||||
@@ -260,7 +261,7 @@ namespace Mono.Xml.Xsl {
|
||||
public XPathExpression CompileExpression (string expression)
|
||||
{
|
||||
if (expression == null || expression == "") return null;
|
||||
XPathExpression e = Input.Compile (expression);
|
||||
XPathExpression e = Input.Compile (expression, this);
|
||||
|
||||
|
||||
exprStore.AddExpression (e, this);
|
||||
@@ -408,7 +409,44 @@ namespace Mono.Xml.Xsl {
|
||||
decimalFormats [nm] = new XslDecimalFormat (this);
|
||||
}
|
||||
#endregion
|
||||
#region Static XSLT context
|
||||
Expression IStaticXsltContext.TryGetVariable (string nm)
|
||||
{
|
||||
XslLocalVariable var = curVarScope.ResolveStatic (XslNameUtil.FromString (nm, Input));
|
||||
if (var == null) return null;
|
||||
return new XPathVariableBinding (var);
|
||||
}
|
||||
|
||||
Expression IStaticXsltContext.TryGetFunction (QName name, FunctionArguments args)
|
||||
{
|
||||
if (name.Namespace != null && name.Namespace != "")
|
||||
return null;
|
||||
|
||||
switch (name.Name) {
|
||||
case "current": return new XsltCurrent (args);
|
||||
case "unparsed-entity-uri": return new XsltUnparsedEntityUri (args);
|
||||
case "element-available": return new XsltElementAvailable (args, this);
|
||||
case "system-property": return new XsltSystemProperty (args, this);
|
||||
case "function-available": return new XsltFunctionAvailable (args, this);
|
||||
case "generate-id": return new XsltGenerateId (args);
|
||||
case "format-number": return new XsltFormatNumber (args, this);
|
||||
case "key": return new XsltKey (args, this);
|
||||
case "document": return new XsltDocument (args, this);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
QName IStaticXsltContext.LookupQName (string s)
|
||||
{
|
||||
return XslNameUtil.FromString (s, Input);
|
||||
}
|
||||
|
||||
XmlNamespaceManager IStaticXsltContext.GetNsm ()
|
||||
{
|
||||
return new XPathNavigatorNsm (Input);
|
||||
}
|
||||
#endregion
|
||||
public void CompileOutput ()
|
||||
{
|
||||
XPathNavigator n = Input;
|
||||
@@ -454,14 +492,25 @@ namespace Mono.Xml.Xsl {
|
||||
return nextSlot++;
|
||||
}
|
||||
|
||||
public XslLocalVariable ResolveStatic (QName name)
|
||||
{
|
||||
for (VariableScope s = this; s != null; s = s.Parent) {
|
||||
if (s.variables == null) continue;
|
||||
XslLocalVariable v = s.variables [name] as XslLocalVariable;
|
||||
if (v != null) return v;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public XslLocalVariable Resolve (XslTransformProcessor p, QName name)
|
||||
{
|
||||
for (VariableScope s = this; s != null; s = s.Parent)
|
||||
if (s.variables != null && s.variables.Contains (name)) {
|
||||
XslLocalVariable v = (XslLocalVariable)s.variables [name];
|
||||
if (v.IsEvaluated (p))
|
||||
return v;
|
||||
}
|
||||
for (VariableScope s = this; s != null; s = s.Parent) {
|
||||
if (s.variables == null) continue;
|
||||
XslLocalVariable v = s.variables [name] as XslLocalVariable;
|
||||
if (v != null && v.IsEvaluated (p))
|
||||
return v;
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -553,35 +602,21 @@ namespace Mono.Xml.Xsl {
|
||||
}
|
||||
|
||||
public class ExpressionStore {
|
||||
|
||||
Hashtable exprToVarCtx = new Hashtable ();
|
||||
Hashtable exprToSorts = new Hashtable ();
|
||||
Hashtable exprToDocument = new Hashtable ();
|
||||
Hashtable exprToSorts;
|
||||
|
||||
public void AddExpression (XPathExpression e, Compiler c)
|
||||
{
|
||||
exprToVarCtx [e] = c.CurrentVariableScope;
|
||||
|
||||
XPathNavigator nsScope = c.Input.Clone ();
|
||||
if (nsScope.NodeType == XPathNodeType.Attribute)
|
||||
nsScope.MoveToParent ();
|
||||
|
||||
exprToDocument [e] = nsScope;
|
||||
{
|
||||
}
|
||||
|
||||
public void AddPattern (Pattern p, Compiler c)
|
||||
{
|
||||
exprToVarCtx [p] = c.CurrentVariableScope;
|
||||
|
||||
XPathNavigator nsScope = c.Input.Clone ();
|
||||
if (nsScope.NodeType == XPathNodeType.Attribute)
|
||||
nsScope.MoveToParent ();
|
||||
|
||||
exprToDocument [p] = nsScope;
|
||||
}
|
||||
|
||||
public void AddSort (XPathExpression e, Sort s)
|
||||
{
|
||||
if (exprToSorts == null)
|
||||
exprToSorts = new Hashtable ();
|
||||
|
||||
if (exprToSorts.Contains (e))
|
||||
((ArrayList)exprToSorts [e]).Add (s);
|
||||
else {
|
||||
@@ -593,22 +628,19 @@ namespace Mono.Xml.Xsl {
|
||||
|
||||
public XPathExpression PrepForExecution (XPathExpression e, XslTransformProcessor p)
|
||||
{
|
||||
XPathExpression expr = e.Clone ();
|
||||
|
||||
expr.SetContext (new XsltCompiledContext (p, (VariableScope)exprToVarCtx [e], (XPathNavigator)exprToDocument [e]));
|
||||
if (exprToSorts.Contains (e))
|
||||
if (exprToSorts != null && exprToSorts.Contains (e))
|
||||
{
|
||||
XPathExpression expr = e.Clone ();
|
||||
foreach (Sort s in (ArrayList)exprToSorts [e])
|
||||
s.AddToExpr (expr,p);
|
||||
return expr;
|
||||
}
|
||||
return expr;
|
||||
return e;
|
||||
}
|
||||
|
||||
public bool PatternMatches (Pattern p, XslTransformProcessor proc, XPathNavigator n)
|
||||
{
|
||||
XsltContext c = new XsltCompiledContext (proc, (VariableScope)exprToVarCtx [p], (XPathNavigator)exprToDocument [p]);
|
||||
|
||||
return p.Matches (n, c);
|
||||
return p.Matches (n, proc.XPathContext);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -616,6 +648,9 @@ namespace Mono.Xml.Xsl {
|
||||
{
|
||||
public static QName FromString (string name, XPathNavigator current)
|
||||
{
|
||||
if (current.NodeType == XPathNodeType.Attribute)
|
||||
(current = current.Clone ()).MoveToParent ();
|
||||
|
||||
int colon = name.IndexOf (':');
|
||||
if (colon > 0)
|
||||
return new QName (name.Substring (colon+ 1), current.GetNamespace (name.Substring (0, colon)));
|
||||
@@ -649,4 +684,24 @@ namespace Mono.Xml.Xsl {
|
||||
throw new ArgumentException ("Invalid name: " + name);
|
||||
}
|
||||
}
|
||||
|
||||
public class XPathNavigatorNsm : XmlNamespaceManager {
|
||||
XPathNavigator nsScope;
|
||||
|
||||
public XPathNavigatorNsm (XPathNavigator n) : base () {
|
||||
nsScope = n.Clone ();
|
||||
if (nsScope.NodeType == XPathNodeType.Attribute)
|
||||
nsScope.MoveToParent ();
|
||||
}
|
||||
|
||||
public override string DefaultNamespace { get { return String.Empty; }}
|
||||
|
||||
public override string LookupNamespace (string prefix)
|
||||
{
|
||||
if (prefix == "" || prefix == null)
|
||||
return "";
|
||||
|
||||
return nsScope.GetNamespace (prefix);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,9 +22,7 @@ namespace Mono.Xml.Xsl {
|
||||
public abstract void WriteDocType (string type, string publicId, string systemId);
|
||||
public abstract void WriteStartElement (string prefix, string localName, string nsURI);
|
||||
public abstract void WriteEndElement ();
|
||||
public abstract void WriteAttributeString (string prefix, string localName, string nsURI, string value);
|
||||
public abstract void WriteStartAttribute (string prefix, string localName, string nsURI);
|
||||
public abstract void WriteEndAttribute ();
|
||||
public abstract void WriteAttributeString (string prefix, string localName, string nsURI, string value);
|
||||
public abstract void WriteComment (string text);
|
||||
public abstract void WriteProcessingInstruction (string name, string text);
|
||||
public abstract void WriteString (string text);
|
||||
|
||||
@@ -80,11 +80,7 @@ namespace Mono.Xml.Xsl
|
||||
/// when it's appropriate.
|
||||
/// </summary>
|
||||
private void CheckState ()
|
||||
{
|
||||
// this isnt being called at the right place
|
||||
// <a (1)> <b /> (2)</a>
|
||||
// This should be called at 1, but is really being called at 2.
|
||||
#if false
|
||||
{
|
||||
if (_state == WriteState.Element) {
|
||||
//Push scope to allow to unwind namespaces scope back in WriteEndElement
|
||||
//Subject to optimization - avoid redundant push/pop by moving
|
||||
@@ -94,9 +90,10 @@ namespace Mono.Xml.Xsl
|
||||
foreach (XmlQualifiedName qName in _pendingAttrs.Keys) {
|
||||
Attribute attr = (Attribute)_pendingAttrs [qName];
|
||||
_emitter.WriteAttributeString (attr.Prefix, qName.Name, qName.Namespace, attr.Value);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
//Attributes flushed, state is Content now
|
||||
_state = WriteState.Content;
|
||||
}
|
||||
}
|
||||
|
||||
#region Outputter's methods implementation
|
||||
@@ -138,12 +135,7 @@ namespace Mono.Xml.Xsl
|
||||
}
|
||||
|
||||
public override void WriteAttributeString (string prefix, string localName, string nsURI, string value)
|
||||
{
|
||||
|
||||
_emitter.WriteAttributeString (prefix, localName, nsURI, value);
|
||||
|
||||
// See CheckState for why i commented this out
|
||||
#if false
|
||||
{
|
||||
//Put attribute to pending attributes collection, replacing namesake one
|
||||
XmlQualifiedName qName = new XmlQualifiedName (localName, nsURI);
|
||||
Attribute attr = (Attribute)_pendingAttrs [qName];
|
||||
@@ -155,8 +147,7 @@ namespace Mono.Xml.Xsl
|
||||
//Keep prefix (e.g. when literal attribute is overriden by xsl:attribute)
|
||||
if (attr.Prefix == String.Empty && prefix != String.Empty)
|
||||
attr.Prefix = prefix;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteNamespaceDecl (string prefix, string nsUri)
|
||||
@@ -173,19 +164,7 @@ namespace Mono.Xml.Xsl
|
||||
_emitter.WriteAttributeString ("xmlns", prefix, null, nsUri);
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteStartAttribute (string prefix, string localName, string nsURI)
|
||||
{
|
||||
_emitter.WriteStartAttribute (prefix, localName, nsURI);
|
||||
_state = WriteState.Attribute;
|
||||
}
|
||||
|
||||
public override void WriteEndAttribute ()
|
||||
{
|
||||
_emitter.WriteEndAttribute ();
|
||||
_state = WriteState.Element;
|
||||
}
|
||||
|
||||
|
||||
public override void WriteComment (string text)
|
||||
{
|
||||
CheckState ();
|
||||
|
||||
@@ -17,40 +17,31 @@ namespace Mono.Xml.Xsl {
|
||||
/// it further down to real consumers.
|
||||
/// </summary>
|
||||
public abstract class Outputter {
|
||||
public abstract void WriteStartDocument();
|
||||
public abstract void WriteEndDocument();
|
||||
public abstract void WriteStartDocument ();
|
||||
public abstract void WriteEndDocument ();
|
||||
|
||||
public void WriteStartElement(string localName, string nsURI)
|
||||
public void WriteStartElement (string localName, string nsURI)
|
||||
{
|
||||
WriteStartElement (null, localName, nsURI);
|
||||
}
|
||||
|
||||
public abstract void WriteStartElement(string prefix, string localName, string nsURI);
|
||||
public abstract void WriteEndElement();
|
||||
public abstract void WriteStartElement (string prefix, string localName, string nsURI);
|
||||
public abstract void WriteEndElement ();
|
||||
|
||||
public void WriteAttributeString(string localName, string value)
|
||||
public void WriteAttributeString (string localName, string value)
|
||||
{
|
||||
WriteAttributeString ("", localName, "", value);
|
||||
}
|
||||
|
||||
public abstract void WriteAttributeString(string prefix, string localName, string nsURI, string value);
|
||||
public abstract void WriteAttributeString (string prefix, string localName, string nsURI, string value);
|
||||
public abstract void WriteNamespaceDecl (string prefix, string nsUri);
|
||||
|
||||
public abstract void WriteComment (string text);
|
||||
|
||||
public void WriteStartAttribute(string localName, string nsURI)
|
||||
{
|
||||
WriteStartAttribute (null, localName, nsURI);
|
||||
}
|
||||
public abstract void WriteProcessingInstruction (string name, string text);
|
||||
|
||||
//TODO: Seems like we can get rid of these two methods?
|
||||
public abstract void WriteStartAttribute(string prefix, string localName, string nsURI);
|
||||
public abstract void WriteEndAttribute();
|
||||
|
||||
public abstract void WriteComment(string text);
|
||||
|
||||
public abstract void WriteProcessingInstruction(string name, string text);
|
||||
|
||||
public abstract void WriteString(string text);
|
||||
public abstract void WriteRaw(string data);
|
||||
public abstract void WriteString (string text);
|
||||
public abstract void WriteRaw (string data);
|
||||
|
||||
public abstract void Done ();
|
||||
}
|
||||
|
||||
@@ -46,15 +46,7 @@ namespace Mono.Xml.Xsl {
|
||||
public override void WriteAttributeString (string prefix, string localName, string nsURI, string value) {
|
||||
//Do nothing
|
||||
}
|
||||
|
||||
public override void WriteStartAttribute (string prefix, string localName, string nsURI) {
|
||||
//Do nothing
|
||||
}
|
||||
|
||||
public override void WriteEndAttribute () {
|
||||
//Do nothing
|
||||
}
|
||||
|
||||
|
||||
public override void WriteComment (string text) {
|
||||
//Do nothing
|
||||
}
|
||||
|
||||
@@ -20,20 +20,18 @@ namespace Mono.Xml.Xsl {
|
||||
//Current output depth
|
||||
private int _depth;
|
||||
//Ignore nested text nodes
|
||||
private bool _ignoreNestedText;
|
||||
//Attribute value is being outputted flag
|
||||
private bool _inAttribute;
|
||||
private bool _ignoreNestedText;
|
||||
|
||||
public TextOutputter(TextWriter w, bool ignoreNestedText) {
|
||||
public TextOutputter (TextWriter w, bool ignoreNestedText) {
|
||||
_writer = w;
|
||||
_ignoreNestedText = ignoreNestedText;
|
||||
}
|
||||
|
||||
public override void WriteStartDocument() {}
|
||||
public override void WriteStartDocument () {}
|
||||
|
||||
public override void WriteEndDocument() {}
|
||||
public override void WriteEndDocument () {}
|
||||
|
||||
public override void WriteStartElement(string prefix, string localName, string nsURI) {
|
||||
public override void WriteStartElement (string prefix, string localName, string nsURI) {
|
||||
if (_ignoreNestedText) _depth++;
|
||||
}
|
||||
|
||||
@@ -41,32 +39,24 @@ namespace Mono.Xml.Xsl {
|
||||
if (_ignoreNestedText) _depth--;
|
||||
}
|
||||
|
||||
public override void WriteAttributeString(string prefix, string localName, string nsURI, string value) {}
|
||||
|
||||
public override void WriteStartAttribute(string prefix, string localName, string nsURI) {
|
||||
_inAttribute = true;
|
||||
}
|
||||
|
||||
public override void WriteEndAttribute() {
|
||||
_inAttribute = false;
|
||||
}
|
||||
|
||||
public override void WriteAttributeString (string prefix, string localName, string nsURI, string value) {}
|
||||
|
||||
public override void WriteNamespaceDecl (string prefix, string nsUri) {}
|
||||
|
||||
public override void WriteComment(string text) {}
|
||||
public override void WriteComment (string text) {}
|
||||
|
||||
public override void WriteProcessingInstruction(string name, string text) {}
|
||||
public override void WriteProcessingInstruction (string name, string text) {}
|
||||
|
||||
public override void WriteString(string text) {
|
||||
WriteImpl(text);
|
||||
public override void WriteString (string text) {
|
||||
WriteImpl (text);
|
||||
}
|
||||
|
||||
public override void WriteRaw(string data) {
|
||||
WriteImpl(data);
|
||||
public override void WriteRaw (string data) {
|
||||
WriteImpl (data);
|
||||
}
|
||||
|
||||
private void WriteImpl(string text) {
|
||||
if ((!_ignoreNestedText || _depth==0) && !_inAttribute) _writer.Write(text);
|
||||
if (!_ignoreNestedText || _depth==0) _writer.Write (text);
|
||||
}
|
||||
|
||||
public override void Done () {
|
||||
|
||||
@@ -54,17 +54,7 @@ namespace Mono.Xml.Xsl {
|
||||
public override void WriteAttributeString (string prefix, string localName, string nsURI, string value)
|
||||
{
|
||||
writer.WriteAttributeString (prefix, localName, nsURI, value);
|
||||
}
|
||||
|
||||
public override void WriteStartAttribute (string prefix, string localName, string nsURI)
|
||||
{
|
||||
writer.WriteStartAttribute (prefix, localName, nsURI);
|
||||
}
|
||||
|
||||
public override void WriteEndAttribute ()
|
||||
{
|
||||
writer.WriteEndAttribute ();
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteComment (string text) {
|
||||
writer.WriteComment (text);
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace Mono.Xml.Xsl {
|
||||
return value == XPathFunctions.ToString (o);
|
||||
}
|
||||
default:
|
||||
return value == nav.EvaluateString (UsePattern, null);
|
||||
return value == nav.EvaluateString (UsePattern, null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,20 +10,20 @@
|
||||
// (C) 2003 Atsushi Enomoto
|
||||
// (C) 2003 Oleg Tkachenko
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.CodeDom;
|
||||
using System.Collections;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using System.Xml.XPath;
|
||||
|
||||
using System;
|
||||
using System.CodeDom;
|
||||
using System.Collections;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using System.Xml.XPath;
|
||||
using System.Xml.Xsl;
|
||||
using System.Text;
|
||||
|
||||
namespace Mono.Xml.Xsl
|
||||
{
|
||||
using QName = System.Xml.XmlQualifiedName;
|
||||
|
||||
|
||||
namespace Mono.Xml.Xsl
|
||||
{
|
||||
using QName = System.Xml.XmlQualifiedName;
|
||||
|
||||
public enum OutputMethod {
|
||||
XML,
|
||||
HTML,
|
||||
@@ -37,114 +37,114 @@ namespace Mono.Xml.Xsl
|
||||
YES,
|
||||
NO
|
||||
}
|
||||
|
||||
public class XslOutput // also usable for xsl:result-document
|
||||
{
|
||||
string uri;
|
||||
|
||||
public class XslOutput // also usable for xsl:result-document
|
||||
{
|
||||
string uri;
|
||||
QName customMethod;
|
||||
OutputMethod method = OutputMethod.Unknown;
|
||||
string version;
|
||||
Encoding encoding = System.Text.Encoding.UTF8;
|
||||
bool omitXmlDeclaration;
|
||||
StandaloneType standalone = StandaloneType.NONE;
|
||||
string doctypePublic;
|
||||
string doctypeSystem;
|
||||
QName [] cdataSectionElements;
|
||||
bool indent;
|
||||
string mediaType;
|
||||
bool escapeUriAttributes;
|
||||
bool includeContentType;
|
||||
bool normalizeUnicode;
|
||||
bool undeclareNamespaces;
|
||||
QName [] useCharacterMaps;
|
||||
|
||||
// for compilation only.
|
||||
ArrayList cdSectsList = new ArrayList ();
|
||||
|
||||
public XslOutput (string uri)
|
||||
{
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
OutputMethod method = OutputMethod.Unknown;
|
||||
string version;
|
||||
Encoding encoding = System.Text.Encoding.UTF8;
|
||||
bool omitXmlDeclaration;
|
||||
StandaloneType standalone = StandaloneType.NONE;
|
||||
string doctypePublic;
|
||||
string doctypeSystem;
|
||||
QName [] cdataSectionElements;
|
||||
bool indent;
|
||||
string mediaType;
|
||||
bool escapeUriAttributes;
|
||||
bool includeContentType;
|
||||
bool normalizeUnicode;
|
||||
bool undeclareNamespaces;
|
||||
QName [] useCharacterMaps;
|
||||
|
||||
// for compilation only.
|
||||
ArrayList cdSectsList = new ArrayList ();
|
||||
|
||||
public XslOutput (string uri)
|
||||
{
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public OutputMethod Method { get { return method; }}
|
||||
public QName CustomMethod { get { return customMethod; }}
|
||||
|
||||
public string Version {
|
||||
get { return version; }
|
||||
}
|
||||
|
||||
public Encoding Encoding {
|
||||
get { return encoding; }
|
||||
}
|
||||
|
||||
public string Uri {
|
||||
get { return uri; }
|
||||
}
|
||||
|
||||
public bool OmitXmlDeclaration {
|
||||
get { return omitXmlDeclaration; }
|
||||
}
|
||||
|
||||
public StandaloneType Standalone {
|
||||
get { return standalone; }
|
||||
}
|
||||
|
||||
public string DoctypePublic {
|
||||
get { return doctypePublic; }
|
||||
}
|
||||
|
||||
public string DoctypeSystem {
|
||||
get { return doctypeSystem; }
|
||||
}
|
||||
|
||||
public QName [] CdataSectionElements {
|
||||
get {
|
||||
if (cdataSectionElements == null)
|
||||
cdataSectionElements = cdSectsList.ToArray (typeof (QName)) as QName [];
|
||||
return cdataSectionElements;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Indent {
|
||||
get { return indent; }
|
||||
}
|
||||
|
||||
public string MediaType {
|
||||
get { return mediaType; }
|
||||
}
|
||||
|
||||
// Below are introduced in XSLT 2.0 (WD-20030502)
|
||||
public bool EscapeUriAttributes {
|
||||
get { return escapeUriAttributes; }
|
||||
}
|
||||
|
||||
public bool IncludeContentType {
|
||||
get { return includeContentType; }
|
||||
}
|
||||
|
||||
public bool NormalizeUnicode {
|
||||
get { return normalizeUnicode; }
|
||||
}
|
||||
|
||||
public bool UndeclareNamespaces {
|
||||
get { return undeclareNamespaces; }
|
||||
}
|
||||
|
||||
public QName [] UseCharacterMaps {
|
||||
get { return useCharacterMaps; }
|
||||
}
|
||||
|
||||
public void Fill (XPathNavigator nav)
|
||||
{
|
||||
string att;
|
||||
|
||||
|
||||
public string Version {
|
||||
get { return version; }
|
||||
}
|
||||
|
||||
public Encoding Encoding {
|
||||
get { return encoding; }
|
||||
}
|
||||
|
||||
public string Uri {
|
||||
get { return uri; }
|
||||
}
|
||||
|
||||
public bool OmitXmlDeclaration {
|
||||
get { return omitXmlDeclaration; }
|
||||
}
|
||||
|
||||
public StandaloneType Standalone {
|
||||
get { return standalone; }
|
||||
}
|
||||
|
||||
public string DoctypePublic {
|
||||
get { return doctypePublic; }
|
||||
}
|
||||
|
||||
public string DoctypeSystem {
|
||||
get { return doctypeSystem; }
|
||||
}
|
||||
|
||||
public QName [] CdataSectionElements {
|
||||
get {
|
||||
if (cdataSectionElements == null)
|
||||
cdataSectionElements = cdSectsList.ToArray (typeof (QName)) as QName [];
|
||||
return cdataSectionElements;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Indent {
|
||||
get { return indent; }
|
||||
}
|
||||
|
||||
public string MediaType {
|
||||
get { return mediaType; }
|
||||
}
|
||||
|
||||
// Below are introduced in XSLT 2.0 (WD-20030502)
|
||||
public bool EscapeUriAttributes {
|
||||
get { return escapeUriAttributes; }
|
||||
}
|
||||
|
||||
public bool IncludeContentType {
|
||||
get { return includeContentType; }
|
||||
}
|
||||
|
||||
public bool NormalizeUnicode {
|
||||
get { return normalizeUnicode; }
|
||||
}
|
||||
|
||||
public bool UndeclareNamespaces {
|
||||
get { return undeclareNamespaces; }
|
||||
}
|
||||
|
||||
public QName [] UseCharacterMaps {
|
||||
get { return useCharacterMaps; }
|
||||
}
|
||||
|
||||
public void Fill (XPathNavigator nav)
|
||||
{
|
||||
string att;
|
||||
|
||||
// cdata-section-elements
|
||||
// FILL IN
|
||||
// att = nav.GetAttribute ("cdata-section-elements", "");
|
||||
// if (att != null)
|
||||
// cdSectsList.AddRange (XslNameUtil.ParseQNames (att, nav));
|
||||
|
||||
att = nav.GetAttribute ("method", "");
|
||||
// FILL IN
|
||||
// att = nav.GetAttribute ("cdata-section-elements", "");
|
||||
// if (att != null)
|
||||
// cdSectsList.AddRange (XslNameUtil.ParseQNames (att, nav));
|
||||
|
||||
att = nav.GetAttribute ("method", "");
|
||||
|
||||
if (att != String.Empty) {
|
||||
switch (att) {
|
||||
@@ -166,42 +166,42 @@ namespace Mono.Xml.Xsl
|
||||
"'. It must be either 'xml' or 'html' or 'text' or QName."), nav.BaseURI, 1, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
att = nav.GetAttribute ("version", "");
|
||||
if (att != String.Empty)
|
||||
this.version = att;
|
||||
|
||||
att = nav.GetAttribute ("encoding", "");
|
||||
if (att != String.Empty)
|
||||
this.encoding = System.Text.Encoding.GetEncoding (att);
|
||||
|
||||
att = nav.GetAttribute ("standalone", "");
|
||||
}
|
||||
|
||||
att = nav.GetAttribute ("version", "");
|
||||
if (att != String.Empty)
|
||||
this.version = att;
|
||||
|
||||
att = nav.GetAttribute ("encoding", "");
|
||||
if (att != String.Empty)
|
||||
this.encoding = System.Text.Encoding.GetEncoding (att);
|
||||
|
||||
att = nav.GetAttribute ("standalone", "");
|
||||
if (att != String.Empty)
|
||||
//TODO: Should we validate values?
|
||||
this.standalone = att == "yes" ? StandaloneType.YES : StandaloneType.NO;
|
||||
|
||||
|
||||
att = nav.GetAttribute ("doctype-public", "");
|
||||
if (att != String.Empty)
|
||||
this.doctypePublic = att;
|
||||
|
||||
att = nav.GetAttribute ("doctype-system", "");
|
||||
if (att != String.Empty)
|
||||
this.doctypeSystem = att;
|
||||
|
||||
att = nav.GetAttribute ("media-type", "");
|
||||
if (att != String.Empty)
|
||||
this.mediaType = att;
|
||||
|
||||
att = nav.GetAttribute ("omit-xml-declaration", "");
|
||||
if (att != String.Empty)
|
||||
this.omitXmlDeclaration = att == "yes";
|
||||
|
||||
att = nav.GetAttribute ("indent", "");
|
||||
if (att != String.Empty)
|
||||
this.indent = att == "yes";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
att = nav.GetAttribute ("doctype-public", "");
|
||||
if (att != String.Empty)
|
||||
this.doctypePublic = att;
|
||||
|
||||
att = nav.GetAttribute ("doctype-system", "");
|
||||
if (att != String.Empty)
|
||||
this.doctypeSystem = att;
|
||||
|
||||
att = nav.GetAttribute ("media-type", "");
|
||||
if (att != String.Empty)
|
||||
this.mediaType = att;
|
||||
|
||||
att = nav.GetAttribute ("omit-xml-declaration", "");
|
||||
if (att != String.Empty)
|
||||
this.omitXmlDeclaration = att == "yes";
|
||||
|
||||
att = nav.GetAttribute ("indent", "");
|
||||
if (att != String.Empty)
|
||||
this.indent = att == "yes";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -216,7 +216,7 @@ namespace Mono.Xml.Xsl {
|
||||
Pattern match;
|
||||
XmlQualifiedName mode;
|
||||
double priority = double.NaN;
|
||||
Hashtable parameters;
|
||||
ArrayList parameters;
|
||||
XslOperation content;
|
||||
|
||||
static int nextId = 0;
|
||||
@@ -269,10 +269,6 @@ namespace Mono.Xml.Xsl {
|
||||
public double Priority {
|
||||
get { return priority; }
|
||||
}
|
||||
|
||||
public Hashtable Parameters {
|
||||
get { return parameters; }
|
||||
}
|
||||
|
||||
public XslStylesheet Parent {
|
||||
get { return style; }
|
||||
@@ -293,10 +289,9 @@ namespace Mono.Xml.Xsl {
|
||||
{ alldone = false; break; }
|
||||
|
||||
if (this.parameters == null)
|
||||
this.parameters = new Hashtable ();
|
||||
this.parameters = new ArrayList ();
|
||||
|
||||
XslLocalParam p = new XslLocalParam (c);
|
||||
this.parameters [p.Name] = p;
|
||||
parameters.Add (new XslLocalParam (c));
|
||||
|
||||
} while (c.Input.MoveToNext ());
|
||||
if (!alldone)
|
||||
@@ -311,13 +306,18 @@ namespace Mono.Xml.Xsl {
|
||||
|
||||
if (parameters != null) {
|
||||
if (withParams == null) {
|
||||
foreach (XslLocalParam param in parameters.Values)
|
||||
int len = parameters.Count;
|
||||
for (int i = 0; i < len; i++) {
|
||||
XslLocalParam param = (XslLocalParam)parameters [i];
|
||||
param.Evaluate (p);
|
||||
}
|
||||
} else {
|
||||
foreach (XslLocalParam param in parameters.Values)
|
||||
{
|
||||
if (withParams.Contains (param.Name))
|
||||
param.Override (p, withParams [param.Name]);
|
||||
int len = parameters.Count;
|
||||
for (int i = 0; i < len; i++) {
|
||||
XslLocalParam param = (XslLocalParam)parameters [i];
|
||||
object o = withParams [param.Name];
|
||||
if (o != null)
|
||||
param.Override (p, o);
|
||||
else
|
||||
param.Evaluate (p);
|
||||
}
|
||||
|
||||
Loaded 100 of 204 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user