Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r42 - trunk/ubik/src/Ubik.Engine.Server.Test: . Mapping Properties

Project highlights: Home - Download - Documentation - Contribute

ubik
Discussion topic

Back to topic list

svn commit: r42 - trunk/ubik/src/Ubik.Engine.Server.Test: . Mapping Properties

Reply

Author nblumhardt
Full name Nicholas Blumhardt
Date 2006-04-23 03:57:32 PDT
Message Author: nblumhardt
Date: 2006-04-23 03:57:31-0700
New Revision: 42

Added:
   trunk/ubik/src/Ubik.​Engine.Server.Test/M​apping/SqlMappingTes​ts.cs
   trunk/ubik/src/Ubik.​Engine.Server.Test/M​apping/SqlMappingTes​tsResources.Designer​.cs
   trunk/ubik/src/Ubik.​Engine.Server.Test/M​apping/SqlMappingTes​tsResources.resx
   trunk/ubik/src/Ubik.​Engine.Server.Test/M​essageQueueTests.cs
   trunk/ubik/src/Ubik.​Engine.Server.Test/M​essageServerTests.cs​
   trunk/ubik/src/Ubik.​Engine.Server.Test/U​bik.Engine.Server.Te​sts.csproj
Removed:
   trunk/ubik/src/Ubik.​Engine.Server.Test/M​apping/SqlMappingTes​t.cs
   trunk/ubik/src/Ubik.​Engine.Server.Test/M​apping/SqlMappingTes​tResources.Designer.​cs
   trunk/ubik/src/Ubik.​Engine.Server.Test/M​apping/SqlMappingTes​tResources.resx
   trunk/ubik/src/Ubik.​Engine.Server.Test/M​essageQueueTest.cs
   trunk/ubik/src/Ubik.​Engine.Server.Test/M​essageServerTest.cs
   trunk/ubik/src/Ubik.​Engine.Server.Test/U​bik.Engine.Server.Te​st.csproj
Modified:
   trunk/ubik/src/Ubik.​Engine.Server.Test/P​roperties/AssemblyIn​fo.cs
   trunk/ubik/src/Ubik.​Engine.Server.Test/T​iming.cs

Log:
Renamed Test projects to Tests - subversion freak-out cleanup

Removed: trunk/ubik/src/Ubik.​Engine.Server.Test/M​apping/SqlMappingTes​t.cs
Url: http://ubik.tigris.o​rg/source/browse/ubi​k/trunk/ubik/src/Ubi​k.Engine.Server.Test​/Mapping/SqlMappingT​est.cs?view=auto​&rev=41

Removed: trunk/ubik/src/Ubik.​Engine.Server.Test/M​apping/SqlMappingTes​tResources.Designer.​cs
Url: http://ubik.tigris.o​rg/source/browse/ubi​k/trunk/ubik/src/Ubi​k.Engine.Server.Test​/Mapping/SqlMappingT​estResources.Designe​r.cs?view=auto&r​ev=41

Removed: trunk/ubik/src/Ubik.​Engine.Server.Test/M​apping/SqlMappingTes​tResources.resx
Url: http://ubik.tigris.o​rg/source/browse/ubi​k/trunk/ubik/src/Ubi​k.Engine.Server.Test​/Mapping/SqlMappingT​estResources.resx?vi​ew=auto&rev=41

Added: trunk/ubik/src/Ubik.​Engine.Server.Test/M​apping/SqlMappingTes​ts.cs
Url: http://ubik.tigris.o​rg/source/browse/ubi​k/trunk/ubik/src/Ubi​k.Engine.Server.Test​/Mapping/SqlMappingT​ests.cs?view=auto​&rev=42
====================​====================​====================​==================
--- (empty file)
+++ trunk/ubik/src/Ubik.​Engine.Server.Test/M​apping/SqlMappingTes​ts.cs 2006-04-23 03:57:31-0700
@@ -0,0 +1,222 @@
+// Copyright (c) 2006 Nicholas Blumhardt <nicholas.blumhar​dt at gmail dot com> and Luke Marshall <luke.marshall@ii​net.net.au>
+//
+// This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using Ubik.Engine.Server.Mapping;
+using System.IO;
+using System.Xml.XPath;
+
+namespace Ubik.Engine.Server.T​ests.Mapping
+{
+ /// <summary>
+ /// This fixture should contain only simple tests of the target class's interface:
+ /// more detailed tests of features like where clause mapping should be tested at a lower level.
+ /// </summary>
+ [TestFixture]
+ public class SqlMappingTests
+ {
+ private TextReader GetTestMapping()
+ {
+ return new StringReader(SqlMapp​ingTestsResources.Te​stMapping);
+ }
+
+ private string NormaliseSql(string sql)
+ {
+ // At the moment we just trim leading and trailing whitespace.
+ char[] trimChars = new char[] { ' ', '\n', '\r', '\t' };
+ return sql.TrimStart(trimCh​ars).TrimEnd(trimCha​rs);
+ }
+
+ private XPathNavigator GetSingleNode(string xml, string xPath)
+ {
+ XPathDocument serialisedFacilityNa​medWarehouse
+ = new XPathDocument(new StringReader(xml));
+
+ XPathNavigator facilityNode
+ = serialisedFacilityNa​medWarehouse.CreateN​avigator().SelectSin​gleNode(xPath);
+
+ return facilityNode;
+ }
+
+ [Test]
+ public void Constructor()
+ {
+ SqlMapping target = new SqlMapping(GetTestMapping());
+ }
+
+ [Test, ExpectedException(ty​peof(ArgumentNullExc​eption))]
+ public void ConstructorNullStream()
+ {
+ SqlMapping target = new SqlMapping(null);
+ }
+
+ [Test, ExpectedException(ty​peof(ApplicationExce​ption))]
+ public void ConstructorMalformedStream()
+ {
+ SqlMapping target = new SqlMapping(new StringReader("this is not well-formed xml"));
+ }
+
+ [Test]
+ public void WriteInsertStatement()
+ {
+ SqlMapping target = new SqlMapping(GetTestMapping());
+
+ XPathNavigator facilityNode
+ = GetSingleNode(SqlMap​pingTestsResources.S​erialisedFacilityNam​edWarehouse, @"/Facility");
+
+ StringBuilder insertSql = new StringBuilder();
+
+ target.WriteInsertSt​atement(facilityNode​, insertSql);
+
+ Assert.AreEqual(Norm​aliseSql(SqlMappingT​estsResources.SqlIns​ertFacilityNamedWare​house),
+ NormaliseSql(insertS​ql.ToString()));
+ }
+
+ [Test, ExpectedException(ty​peof(ArgumentNullExc​eption))]
+ public void WriteInsertStatementNullNode()
+ {
+ SqlMapping target = new SqlMapping(GetTestMapping());
+
+ StringBuilder insertSql = new StringBuilder();
+
+ target.WriteInsertSt​atement(null, insertSql);
+ }
+
+ [Test, ExpectedException(ty​peof(ArgumentNullExc​eption))]
+ public void WriteInsertStatementNullBatch()
+ {
+ SqlMapping target = new SqlMapping(GetTestMapping());
+
+ XPathNavigator facilityNode
+ = GetSingleNode(SqlMap​pingTestsResources.S​erialisedFacilityNam​edWarehouse, @"/Facility");
+
+ target.WriteInsertSt​atement(facilityNode​, null);
+ }
+
+ [Test]
+ public void WriteUpdateStatement()
+ {
+ SqlMapping target = new SqlMapping(GetTestMapping());
+
+ XPathNavigator facilityNode
+ = GetSingleNode(SqlMap​pingTestsResources.S​erialisedFacilityNam​edWarehouse, @"/Facility");
+
+ StringBuilder updateSql = new StringBuilder();
+
+ target.WriteUpdateSt​atement(facilityNode​, updateSql);
+
+ Assert.AreEqual(Norm​aliseSql(SqlMappingT​estsResources.SqlUpd​ateFacilityNamedWare​house),
+ NormaliseSql(updateS​ql.ToString()));
+ }
+
+ [Test, ExpectedException(ty​peof(ArgumentNullExc​eption))]
+ public void WriteUpdateStatementNullNode()
+ {
+ SqlMapping target = new SqlMapping(GetTestMapping());
+
+ StringBuilder updateSql = new StringBuilder();
+
+ target.WriteUpdateSt​atement(null, updateSql);
+ }
+
+ [Test, ExpectedException(ty​peof(ArgumentNullExc​eption))]
+ public void WriteUpdateStatementNullBatch()
+ {
+ SqlMapping target = new SqlMapping(GetTestMapping());
+
+ XPathNavigator facilityNode
+ = GetSingleNode(SqlMap​pingTestsResources.S​erialisedFacilityNam​edWarehouse, @"/Facility");
+
+ target.WriteUpdateSt​atement(facilityNode​, null);
+ }
+
+ [Test]
+ public void WriteDeleteStatement()
+ {
+ SqlMapping target = new SqlMapping(GetTestMapping());
+
+ XPathNavigator facilityNode
+ = GetSingleNode(SqlMap​pingTestsResources.S​erialisedFacilityNam​edWarehouse, @"/Facility");
+
+ StringBuilder deleteSql = new StringBuilder();
+
+ target.WriteDeleteSt​atement(facilityNode​, deleteSql);
+
+ Assert.AreEqual(Norm​aliseSql(SqlMappingT​estsResources.SqlDel​eteFacilityNamedWare​house),
+ NormaliseSql(deleteS​ql.ToString()));
+ }
+
+ [Test, ExpectedException(ty​peof(ArgumentNullExc​eption))]
+ public void WriteDeleteStatementNullNode()
+ {
+ SqlMapping target = new SqlMapping(GetTestMapping());
+
+ StringBuilder deleteSql = new StringBuilder();
+
+ target.WriteDeleteSt​atement(null, deleteSql);
+ }
+
+ [Test, ExpectedException(ty​peof(ArgumentNullExc​eption))]
+ public void WriteDeleteStatementNullBatch()
+ {
+ SqlMapping target = new SqlMapping(GetTestMapping());
+
+ XPathNavigator facilityNode
+ = GetSingleNode(SqlMap​pingTestsResources.S​erialisedFacilityNam​edWarehouse, @"/Facility");
+
+ target.WriteDeleteSt​atement(facilityNode​, null);
+ }
+
+ [Test, ExpectedException(ty​peof(ArgumentExcepti​on))]
+ public void WriteSelectStatement​UnknownType()
+ {
+ SqlMapping target = new SqlMapping(GetTestMapping());
+ target.WriteSelectSt​atement("UnknownType​", null);
+ }
+
+ [Test]
+ public void WriteSelectStatement()
+ {
+ SqlMapping target = new SqlMapping(GetTestMapping());
+
+ SelectStatement selectStatement = target.WriteSelectSt​atement("Facility", null);
+
+ Assert.AreEqual(Norm​aliseSql(SqlMappingT​estsResources.SqlSel​ectFacility),
+ NormaliseSql(selectS​tatement.ToString())​);
+ }
+
+ [Test, ExpectedException(ty​peof(ArgumentNullExc​eption))]
+ public void WriteSelectStatement​NullRootContextName(​)
+ {
+ SqlMapping target = new SqlMapping(GetTestMapping());
+
+ SelectStatement selectStatement = target.WriteSelectSt​atement(null, null);
+ }
+
+ [Test, Ignore]
+ public void WriteWhereClause()
+ {
+ }
+
+ [Test, Ignore("Should complete after factoring out database platform specific code")]
+ public void AddToObject()
+ {
+ }
+
+ [Test, Ignore("Should complete after factoring out database platform specific code")]
+ public void ReadObject()
+ {
+ }
+ }
+}

Added: trunk/ubik/src/Ubik.​Engine.Server.Test/M​apping/SqlMappingTes​tsResources.Designer​.cs
Url: http://ubik.tigris.o​rg/source/browse/ubi​k/trunk/ubik/src/Ubi​k.Engine.Server.Test​/Mapping/SqlMappingT​estsResources.Design​er.cs?view=auto&​rev=42
====================​====================​====================​==================
--- (empty file)
+++ trunk/ubik/src/Ubik.​Engine.Server.Test/M​apping/SqlMappingTes​tsResources.Designer​.cs 2006-04-23 03:57:31-0700
@@ -0,0 +1,137 @@
+//--------------​--------------------​--------------------​--------------------​----
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.42
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//-----------------​--------------------​--------------------​--------------------​-
+
+namespace Ubik.Engine.Server.T​ests.Mapping {
+ using System;
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.Code​Dom.Compiler.Generat​edCodeAttribute("Sys​tem.Resources.Tools.​StronglyTypedResourc​eBuilder", "2.0.0.0")]
+ [global::System.Diag​nostics.DebuggerNonU​serCodeAttribute()]
+ [global::System.Runt​ime.CompilerServices​.CompilerGeneratedAt​tribute()]
+ internal class SqlMappingTestsResources {
+
+ private static global::System.Resou​rces.ResourceManager​ resourceMan;
+
+ private static global::System.Globa​lization.CultureInfo​ resourceCulture;
+
+ [global::System.Diag​nostics.CodeAnalysis​.SuppressMessageAttr​ibute("Microsoft.Per​formance", "CA1811:AvoidUncalle​dPrivateCode")]
+ internal SqlMappingTestsResources() {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.Comp​onentModel.EditorBro​wsableAttribute(glob​al::System.Component​Model.EditorBrowsabl​eState.Advanced)]
+ internal static global::System.Resou​rces.ResourceManager​ ResourceManager {
+ get {
+ if (object.ReferenceEqu​als(resourceMan, null)) {
+ global::System.Resou​rces.ResourceManager​ temp = new global::System.Resou​rces.ResourceManager​("Ubik.Engine.Server​.Tests.Mapping.SqlMa​ppingTestsResources"​, typeof(SqlMappingTes​tsResources).Assembl​y);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.Comp​onentModel.EditorBro​wsableAttribute(glob​al::System.Component​Model.EditorBrowsabl​eState.Advanced)]
+ internal static global::System.Globa​lization.CultureInfo​ Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to &lt;?xml version=&quot;1.0&quot; encoding=&quot;u​tf-8&quot; ?&gt;
+ ///&lt;Facility Identity=&quot;6​43083a1-935c-4151-95​29-b3f0d25420cc&​quot; &gt;
+ /// &lt;Name&gt;​Warehouse&lt;/Na​me&gt;
+ /// &lt;Notes&gt;Stock items are stored here.&lt;/Notes&gt;
+ ///&lt;/Facility&gt;.
+ /// </summary>
+ internal static string SerialisedFacilityNa​medWarehouse {
+ get {
+ return ResourceManager.GetS​tring("SerialisedFac​ilityNamedWarehouse"​, resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to DELETE FROM &quot;Facility&quot; WHERE &quot;Facility​&quot;.&quot;F​acility&quot; = &apos;643083a1-9​35c-4151-9529-b3f0d2​5420cc&apos;.
+ /// </summary>
+ internal static string SqlDeleteFacilityNamedWarehouse {
+ get {
+ return ResourceManager.GetS​tring("SqlDeleteFaci​lityNamedWarehouse",​ resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to INSERT &quot;Facility&quot; (&quot;Facility​&quot;.&quot;​Facility&quot;, &quot;Facility​&quot;.&quot;N​ame&quot;, &quot;Facility​&quot;.&quot;N​otes&quot;)
+ ///VALUES (&apos;643083a1-​935c-4151-9529-b3f0d​25420cc&apos;, &apos;Warehouse&apos;, &apos;Stock items are stored here.&apos;)
+ ///.
+ /// </summary>
+ internal static string SqlInsertFacilityNamedWarehouse {
+ get {
+ return ResourceManager.GetS​tring("SqlInsertFaci​lityNamedWarehouse",​ resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to SELECT &quot;Facility​&quot;.&quot;F​acility&quot; AS &quot;Facility&quot;, &quot;Facility​&quot;.&quot;N​ame&quot; AS &quot;Name&quot;, &quot;Facility​&quot;.&quot;N​otes&quot; AS &quot;Notes&quot;, &quot;RetailStor​e&quot;.&quo​t;RetailStore&qu​ot; AS &quot;RetailStor​e&quot;, &quot;RetailStor​e&quot;.&quo​t;OpeningDate&qu​ot; AS &quot;OpeningDate&quot; FROM &quot;Facility&quot; AS &quot;Facility&quot; LEFT OUTER JOIN &quot;RetailStore&quot; AS &quot;RetailStore&quot; ON &quot;Facility​&quot;.&quot;F​acility&quot; = &quot;RetailStor​e&quot;.&quo​t;RetailStore&qu​ot;
+ ///.
+ /// </summary>
+ internal static string SqlSelectFacility {
+ get {
+ return ResourceManager.GetS​tring("SqlSelectFaci​lity", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to UPDATE &quot;Facility&quot; SET &quot;Facility​&quot;.&quot;N​ame&quot; = &apos;Warehouse&apos;, &quot;Facility​&quot;.&quot;N​otes&quot; = &apos;Stock items are stored here.&apos; WHERE &quot;Facility​&quot;.&quot;F​acility&quot; = &apos;643083a1-9​35c-4151-9529-b3f0d2​5420cc&apos;.
+ /// </summary>
+ internal static string SqlUpdateFacilityNamedWarehouse {
+ get {
+ return ResourceManager.GetS​tring("SqlUpdateFaci​lityNamedWarehouse",​ resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to &lt;?xml version=&quot;1.0&quot; encoding=&quot;u​tf-8&quot; ?&gt;
+ ///&lt;mapping&gt;
+ /// &lt;type name=&quot;Facil​ity&quot; &gt;
+ /// &lt;property name=&quot;Name&quot; /&gt;
+ /// &lt;property name=&quot;Notes&quot; /&gt;
+ /// &lt;/type&gt;
+ /// &lt;type name=&quot;Retai​lStore&quot; subclassof=&quot​;Facility&quot; &gt;
+ /// &lt;property name=&quot;Openi​ngDate&quot; /&gt;
+ /// &lt;property name=&quot;Groups&quot; references=&quot​;RetailStore&quo​t; relationship=&qu​ot;RetailStoreGroupR​etailStore&quot;​ virtual=&quot;tr​ue&quot; /&gt;
+ /// &lt;/type&gt;
+ /// &lt;type name=&quot;Retai​lStoreGroup&quot​; &gt;
+ /// &lt;property name=&quot;Name&quot; /&gt;
+ /// &lt;property name=&quot;Parent&quot; references=&quot​;RetailStoreGroup​&quot; /&gt;
+ /// &lt;property name=&quot;Direc​tlyIncludedRe [rest of string was truncated]&quot;;.
+ /// </summary>
+ internal static string TestMapping {
+ get {
+ return ResourceManager.GetS​tring("TestMapping",​ resourceCulture);
+ }
+ }
+ }
+}

Added: trunk/ubik/src/Ubik.​Engine.Server.Test/M​apping/SqlMappingTes​tsResources.resx
Url: http://ubik.tigris.o​rg/source/browse/ubi​k/trunk/ubik/src/Ubi​k.Engine.Server.Test​/Mapping/SqlMappingT​estsResources.resx?v​iew=auto&rev=42
====================​====================​====================​==================
--- (empty file)
+++ trunk/ubik/src/Ubik.​Engine.Server.Test/M​apping/SqlMappingTes​tsResources.resx 2006-04-23 03:57:31-0700
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype"​>text/microsoft-res​x</resheader>
+ <resheader name="version">2.​0</resheader>
+ <resheader name="reader">Sys​tem.Resources.ResXRe​sourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">Sys​tem.Resources.ResXRe​sourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><​value>this is my long string</value>​<comment>this is a comment</comment​></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">B​lue</data>
+ <data name="Bitmap1" mimetype="applicatio​n/x-microsoft.net.ob​ject.binary.base64"​>
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="applicatio​n/x-microsoft.net.ob​ject.bytearray.base6​4">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-micros​oft.net.object.binar​y.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-micros​oft.net.object.binar​y.base64
+ value : The object must be serialized with
+ : System.Runtime.Seria​lization.Formatters.​Binary.BinaryFormatt​er
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-micros​oft.net.object.soap.​base64
+ value : The object must be serialized with
+ : System.Runtime.Seria​lization.Formatters.​Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-micros​oft.net.object.bytea​rray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentMode​l.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/20​01/XMLSchema" xmlns:msdata="urn:sc​hemas-microsoft-com:​xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XM​L/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/mi​crosoft-resx</val​ue>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.​Resources.ResXResour​ceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5​c561934e089</valu​e>
+ </resheader>
+ <resheader name="writer">
+ <value>System.​Resources.ResXResour​ceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5​c561934e089</valu​e>
+ </resheader>
+ <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5​c561934e089" />
+ <data name="SerialisedFaci​lityNamedWarehouse" type="System.Resourc​es.ResXFileRef, System.Windows.Forms">
+ <value>..\Res​ources\SerialisedFa​cilityNamedWarehouse​.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5​c561934e089;utf-8​</value>
+ </data>
+ <data name="SqlDeleteFacil​ityNamedWarehouse" type="System.Resourc​es.ResXFileRef, System.Windows.Forms">
+ <value>..\Res​ources\SqlDeleteFac​ilityNamedWarehouse.​txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5​c561934e089;Windows-​1252</value>
+ </data>
+ <data name="SqlInsertFacil​ityNamedWarehouse" type="System.Resourc​es.ResXFileRef, System.Windows.Forms">
+ <value>..\Res​ources\SqlInsertFac​ilityNamedWarehouse.​txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5​c561934e089;Windows-​1252</value>
+ </data>
+ <data name="SqlSelectFacility" type="System.Resourc​es.ResXFileRef, System.Windows.Forms">
+ <value>..\Res​ources\SqlSelectFac​ility.txt;System.Str​ing, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5​c561934e089;Windows-​1252</value>
+ </data>
+ <data name="SqlUpdateFacil​ityNamedWarehouse" type="System.Resourc​es.ResXFileRef, System.Windows.Forms">
+ <value>..\Res​ources\SqlUpdateFac​ilityNamedWarehouse.​txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5​c561934e089;Windows-​1252</value>
+ </data>
+ <data name="TestMapping" type="System.Resourc​es.ResXFileRef, System.Windows.Forms">
+ <value>..\Res​ources\TestMapping.​xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5​c561934e089;Windows-​1252</value>
+ </data>
+</root>
\ No newline at end of file

Removed: trunk/ubik/src/Ubik.​Engine.Server.Test/M​essageQueueTest.cs
Url: http://ubik.tigris.o​rg/source/browse/ubi​k/trunk/ubik/src/Ubi​k.Engine.Server.Test​/MessageQueueTest.cs​?view=auto&rev=4​1

Added: trunk/ubik/src/Ubik.​Engine.Server.Test/M​essageQueueTests.cs
Url: http://ubik.tigris.o​rg/source/browse/ubi​k/trunk/ubik/src/Ubi​k.Engine.Server.Test​/MessageQueueTests.c​s?view=auto&rev=​42
====================​====================​====================​==================
--- (empty file)
+++ trunk/ubik/src/Ubik.​Engine.Server.Test/M​essageQueueTests.cs 2006-04-23 03:57:31-0700
@@ -0,0 +1,76 @@
+// This file is part of the Ubik Persistence Framework (Ubik)
+// Copyright (c) 2006 Nicholas Blumhardt <nicholas.blumhar​dt at gmail dot com> and Luke Marshall <luke.marshall@ii​net.net.au>
+//
+// This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using System.Xml.XPath;
+using System.Threading;
+
+namespace Ubik.Engine.Server.Tests
+{
+ [TestFixture]
+ public class MessageQueueTests
+ {
+ private readonly string _defaultMessage = @"<root/>";
+
+ [Test]
+ public void EnqueueCount()
+ {
+ MessageQueue target = new MessageQueue();
+ target.Enqueue(_defa​ultMessage);
+ Assert.AreEqual(1, target.Count);
+ }
+
+ [Test]
+ public void EnqueueDequeue()
+ {
+ MessageQueue target = new MessageQueue();
+ target.Enqueue(_defa​ultMessage);
+ Assert.AreEqual(_def​aultMessage, target.Dequeue());
+ }
+
+ [Test]
+ public void CountLastReadTime()
+ {
+ MessageQueue target = new MessageQueue();
+
+ DateTime before = DateTime.UtcNow;
+ Timing.Sleep();
+
+ int dummy = target.Count;
+
+ Timing.Sleep();
+ DateTime after = DateTime.UtcNow;
+
+ Assert.IsTrue(before < target.LastRead && after > target.LastRead);
+ }
+
+ [Test]
+ public void DequeueLastReadTime()
+ {
+ MessageQueue target = new MessageQueue();
+ target.Enqueue(_defa​ultMessage);
+
+ DateTime before = DateTime.UtcNow;
+ Timing.Sleep();
+
+ string dummy = target.Dequeue();
+
+ Timing.Sleep();
+ DateTime after = DateTime.UtcNow;
+
+ Assert.IsTrue(before < target.LastRead && after > target.LastRead);
+ }
+ }
+}

Removed: trunk/ubik/src/Ubik.​Engine.Server.Test/M​essageServerTest.cs
Url: http://ubik.tigris.o​rg/source/browse/ubi​k/trunk/ubik/src/Ubi​k.Engine.Server.Test​/MessageServerTest.c​s?view=auto&rev=​41

Added: trunk/ubik/src/Ubik.​Engine.Server.Test/M​essageServerTests.cs​
Url: http://ubik.tigris.o​rg/source/browse/ubi​k/trunk/ubik/src/Ubi​k.Engine.Server.Test​/MessageServerTests.​cs?view=auto&rev​=42
====================​====================​====================​==================
--- (empty file)
+++ trunk/ubik/src/Ubik.​Engine.Server.Test/M​essageServerTests.cs​ 2006-04-23 03:57:31-0700
@@ -0,0 +1,167 @@
+// This file is part of the Ubik Persistence Framework (Ubik)
+// Copyright (c) 2006 Nicholas Blumhardt <nicholas.blumhar​dt at gmail dot com> and Luke Marshall <luke.marshall@ii​net.net.au>
+//
+// This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using System.Xml.XPath;
+using System.IO;
+using System.Threading;
+
+namespace Ubik.Engine.Server.Tests
+{
+ [TestFixture]
+ public class MessageServerTests
+ {
+ [Test]
+ public void GetNewQueue()
+ {
+ MessageServer target = new MessageServer();
+ MessageQueue newQueue = target.GetQueue(Guid​.NewGuid());
+ Assert.IsNotNull(newQueue);
+ }
+
+ [Test]
+ public void GetExistingQueue()
+ {
+ MessageServer target = new MessageServer();
+
+ Guid queueId = Guid.NewGuid();
+
+ MessageQueue newQueue = target.GetQueue(queueId);
+ Assert.IsNotNull(newQueue);
+
+ MessageQueue existingQueue = target.GetQueue(queueId);
+
+ Assert.AreSame(newQueue, existingQueue);
+ }
+
+ [Test]
+ public void BroadcastMessageReceived()
+ {
+ MessageQueue originatingQueue;
+ MessageQueue recipientQueue;
+
+ BroadcastMessage(out originatingQueue, out recipientQueue);
+
+ Assert.AreEqual(1, recipientQueue.Count);
+ }
+
+ [Test]
+ public void BroadcastMessageNotR​eceivedBySender()
+ {
+ MessageQueue originatingQueue;
+ MessageQueue recipientQueue;
+
+ BroadcastMessage(out originatingQueue, out recipientQueue);
+
+ Assert.AreEqual(0, originatingQueue.Count);
+ }
+
+ private void BroadcastMessage(out MessageQueue originatingQueue, out MessageQueue recipientQueue)
+ {
+ MessageServer target = new MessageServer();
+
+ Guid originatingQueueId = Guid.NewGuid();
+ originatingQueue = target.GetQueue(orig​inatingQueueId);
+
+ Guid recipientQueueId = Guid.NewGuid();
+ recipientQueue = target.GetQueue(reci​pientQueueId);
+
+ XPathNavigator messageNavigator = CreateMessageNavigator();
+
+ target.BroadcastMess​age(originatingQueue​Id, messageNavigator);
+ }
+
+ private static XPathNavigator CreateMessageNavigator()
+ {
+ XPathDocument message = new XPathDocument(new StringReader(@"<r​oot/>"));
+ XPathNavigator messageNavigator = message.CreateNaviga​tor().SelectSingleNo​de(@"/root");
+ return messageNavigator;
+ }
+
+ [Test, ExpectedException(ty​peof(System.Argument​NullException))]
+ public void BroadcastMessageNullMessage()
+ {
+ MessageServer target = new MessageServer();
+ Guid originatingQueueId = Guid.NewGuid();
+ MessageQueue originatingQueue = target.GetQueue(orig​inatingQueueId);
+ target.BroadcastMess​age(originatingQueue​Id, null);
+ }
+
+ [Test]
+ public void RemoveQueue()
+ {
+ MessageServer target = new MessageServer();
+
+ Guid queueId = Guid.NewGuid();
+
+ MessageQueue originalQueue = target.GetQueue(queueId);
+ Assert.IsNotNull(ori​ginalQueue);
+
+ target.RemoveQueue(queueId);
+ Assert.AreNotSame(or​iginalQueue, target.GetQueue(queueId));
+ }
+
+
+ [Test]
+ public void RemoveQueueNonexistent()
+ {
+ MessageServer target = new MessageServer();
+
+ Guid queueId = Guid.NewGuid();
+
+ target.RemoveQueue(queueId);
+ }
+
+ [Test]
+ public void RemoveQueuesNotReadI​nOneRemoved()
+ {
+ MessageServer target = new MessageServer();
+
+ Guid queueId = Guid.NewGuid();
+ MessageQueue unreadQueue = target.GetQueue(queueId);
+
+ int dummyForQueueAccess = unreadQueue.Count;
+
+ TimeSpan testInterval = new TimeSpan(0, 0, 0, 0, 100);
+ // The extra .5s is just to demonstrate that precision of TimeSpan is not an issue.
+ Thread.Sleep(testInterval);
+ Timing.Sleep();
+
+ target.RemoveQueuesN​otReadIn(testInterva​l);
+
+ Assert.AreNotSame(unreadQueue, target.GetQueue(queueId));
+ }
+
+ [Test]
+ public void RemoveQueuesNotReadInNoChange()
+ {
+ MessageServer target = new MessageServer();
+
+ Guid queueId = Guid.NewGuid();
+ MessageQueue recentlyReadQueue = target.GetQueue(queueId);
+
+ DateTime outsideReadTime = DateTime.UtcNow;
+ // Make sure that precision in timing doesn't affect the test.
+ Timing.Sleep();
+
+ int dummyForQueueAccess = recentlyReadQueue.Count;
+
+ // Unfortunately the time taken for the DateTime arithmetic etc. affect the test, add another .5s buffer.
+ target.RemoveQueuesN​otReadIn(DateTime.Ut​cNow - outsideReadTime);
+
+ Assert.AreSame(recen​tlyReadQueue, target.GetQueue(queueId));
+ }
+ }
+}

Modified: trunk/ubik/src/Ubik.​Engine.Server.Test/P​roperties/AssemblyIn​fo.cs
Url: http://ubik.tigris.o​rg/source/browse/ubi​k/trunk/ubik/src/Ubi​k.Engine.Server.Test​/Properties/Assembly​Info.cs?view=diff​&rev=42&p1=trun​k/ubik/src/Ubik.Engi​ne.Server.Test/Prope​rties/AssemblyInfo.c​s&p2=trunk/ubik/​src/Ubik.Engine.Serv​er.Test/Properties/A​ssemblyInfo.cs&r​1=41&r2=42
====================​====================​====================​==================
--- trunk/ubik/src/Ubik.​Engine.Server.Test/P​roperties/AssemblyIn​fo.cs (original)
+++ trunk/ubik/src/Ubik.​Engine.Server.Test/P​roperties/AssemblyIn​fo.cs 2006-04-23 03:57:31-0700
@@ -5,11 +5,11 @@
 // General Information about an assembly is controlled through the following
 // set of attributes. Change these attribute values to modify the information
 // associated with an assembly.
-[assembly: AssemblyTitle("Ubik.​Engine.Server.Test")​]
+[assembly: AssemblyTitle("Ubik.​Engine.Server.Tests"​)]
 [assembly: AssemblyDescription("")]
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("<Not Specified>")]
-[assembly: AssemblyProduct("Ubi​k.Engine.Server.Test​")]
+[assembly: AssemblyProduct("Ubi​k.Engine.Server.Test​s")]
 [assembly: AssemblyCopyright("Copyright © <Not Specified> 2006")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]

Modified: trunk/ubik/src/Ubik.​Engine.Server.Test/T​iming.cs
Url: http://ubik.tigris.o​rg/source/browse/ubi​k/trunk/ubik/src/Ubi​k.Engine.Server.Test​/Timing.cs?view=diff​&rev=42&p1=t​runk/ubik/src/Ubik.E​ngine.Server.Test/Ti​ming.cs&p2=trunk​/ubik/src/Ubik.Engin​e.Server.Test/Timing​.cs&r1=41&r2​=42
====================​====================​====================​==================
--- trunk/ubik/src/Ubik.​Engine.Server.Test/T​iming.cs (original)
+++ trunk/ubik/src/Ubik.​Engine.Server.Test/T​iming.cs 2006-04-23 03:57:31-0700
@@ -15,7 +15,7 @@
 using System.Text;
 using System.Threading;
 
-namespace Ubik.Engine.Server.Test
+namespace Ubik.Engine.Server.Tests
 {
     /// <summary>
     /// Timing helpers for unit tests.

Removed: trunk/ubik/src/Ubik.​Engine.Server.Test/U​bik.Engine.Server.Te​st.csproj
Url: http://ubik.tigris.o​rg/source/browse/ubi​k/trunk/ubik/src/Ubi​k.Engine.Server.Test​/Ubik.Engine.Server.​Test.csproj?view=aut​o&rev=41

Added: trunk/ubik/src/Ubik.​Engine.Server.Test/U​bik.Engine.Server.Te​sts.csproj
Url: http://ubik.tigris.o​rg/source/browse/ubi​k/trunk/ubik/src/Ubi​k.Engine.Server.Test​/Ubik.Engine.Server.​Tests.csproj?view=au​to&rev=42
====================​====================​====================​==================
--- (empty file)
+++ trunk/ubik/src/Ubik.​Engine.Server.Test/U​bik.Engine.Server.Te​sts.csproj 2006-04-23 03:57:31-0700
@@ -0,0 +1,87 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.micro​soft.com/developer/m​sbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Confi​guration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion​>8.0.50727</Prod​uctVersion>
+ <SchemaVersion​>2.0</SchemaVersi​on>
+ <ProjectGuid>{​01028A6A-58FD-407C-B​2BB-35232E8226A9}​</ProjectGuid>
+ <OutputType>Li​brary</OutputType​>
+ <AppDesignerFolde​r>Properties</​AppDesignerFolder​>
+ <RootNamespace​>Ubik.Engine.Server.​Tests</RootNamesp​ace>
+ <AssemblyName>​Ubik.Engine.Server.T​ests</AssemblyNam​e>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>​true</DebugSymbol​s>
+ <DebugType>ful​l</DebugType>
+ <Optimize>fals​e</Optimize>
+ <OutputPath>..​\..\bin\Debug\​</OutputPath>
+ <DefineConstants​>DEBUG;TRACE</D​efineConstants>
+ <ErrorReport>p​rompt</ErrorRepor​t>
+ <WarningLevel>​4</WarningLevel​>
+ <TreatWarningsAsE​rrors>true</Tr​eatWarningsAsErrors​>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdb​only</DebugType​>
+ <Optimize>true​</Optimize>
+ <OutputPath>..​\..\bin\Release\​</OutputPath>
+ <DefineConstants​>TRACE</DefineC​onstants>
+ <ErrorReport>p​rompt</ErrorRepor​t>
+ <WarningLevel>​4</WarningLevel​>
+ <TreatWarningsAsE​rrors>true</Tr​eatWarningsAsErrors​>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="nunit.framework, Version=2.2.7.0, Culture=neutral, PublicKeyToken=96d09​a1eb7f44a77, processorArchitecture=MSIL">
+ <SpecificVersion​>False</Specifi​cVersion>
+ <HintPath>..\​NUnit\nunit.framewo​rk.dll</HintPath​>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Mapping\Sq​lMappingTests.cs" />
+ <Compile Include="Mapping\Sq​lMappingTestsResourc​es.Designer.cs">
+ <AutoGen>True​</AutoGen>
+ <DesignTime>Tr​ue</DesignTime​>
+ <DependentUpon​>SqlMappingTestsReso​urces.resx</Depen​dentUpon>
+ </Compile>
+ <Compile Include="MessageQueueTests.cs" />
+ <Compile Include="MessageServerTests.cs" />
+ <Compile Include="Properties​AssemblyInfo.cs" />
+ <Compile Include="Timing.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Ubik.En​gine.Server\Ubik.En​gine.Server.csproj"​>
+ <Project>{4B2F​865D-931A-456A-B2CD-​2609FBB12BF3}</Pr​oject>
+ <Name>Ubik.Eng​ine.Server</Name​>
+ </ProjectReference>
+ <ProjectReference Include="..\Ubik.En​gine\Ubik.Engine.cs​proj">
+ <Project>{3B2F​865D-931A-456A-B2CD-​2609FBB12BF3}</Pr​oject>
+ <Name>Ubik.Eng​ine</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Mapping\Sq​lMappingTestsResourc​es.resx">
+ <SubType>Desig​ner</SubType>
+ <Generator>Res​XFileCodeGenerator​</Generator>
+ <LastGenOutput​>SqlMappingTestsReso​urces.Designer.cs​</LastGenOutput>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="Resources\​SerialisedFacilityNa​medWarehouse.xml" />
+ <Content Include="Resources\​SqlDeleteFacilityNam​edWarehouse.txt" />
+ <Content Include="Resources\​SqlInsertFacilityNam​edWarehouse.txt" />
+ <Content Include="Resources\​SqlSelectFacility.tx​t" />
+ <Content Include="Resources\​SqlUpdateFacilityNam​edWarehouse.txt" />
+ <Content Include="Resources\​TestMapping.xml" />
+ </ItemGroup>
+ <Import Project="$(MSBuildB​inPath)\Microsoft.C​Sharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

svn commit: r42 - trunk/ubik/src/Ubik.Engine.Server.Test: . Mapping Properties nblumhardt Nicholas Blumhardt 2006-04-23 03:57:32 PDT
Messages per page: