Merge branch 'master' of https://github.com/SpringSource/spring-net into DocUpdate
This commit is contained in:
20
Spring.build
20
Spring.build
@@ -116,10 +116,10 @@ Commandline Examples:
|
||||
<property name="doc.sdk" value="false"/>
|
||||
|
||||
<!-- turn on all tests if test.full specified -->
|
||||
<property name="test.full" value="false" />
|
||||
<property name="test.integration.data" value="${test.full}" />
|
||||
<property name="test.integration.ems" value="${test.full}" />
|
||||
<property name="test.integration.nms" value="${test.full}" />
|
||||
<property name="test.full" value="false" overwrite="false" />
|
||||
<property name="test.integration.data" value="${test.full}" overwrite="false" />
|
||||
<property name="test.integration.ems" value="${test.full}" overwrite="false" />
|
||||
<property name="test.integration.nms" value="${test.full}" overwrite="false" />
|
||||
|
||||
<!--
|
||||
the line below is for the ccnet build box - see target set-user-overrides for how to change this to your machine values if necessary
|
||||
@@ -1400,9 +1400,9 @@ Commandline Examples:
|
||||
</target>
|
||||
<target name="set-build-namespaces-all">
|
||||
<property name="build.allnamespaces" value="true"/>
|
||||
<property name="test.integration.data" value="false" />
|
||||
<property name="test.integration.ems" value="false" />
|
||||
<property name="test.integration.nms" value="false" />
|
||||
<property name="test.integration.data" value="false" overwrite="false" />
|
||||
<property name="test.integration.ems" value="false" overwrite="false" />
|
||||
<property name="test.integration.nms" value="false" overwrite="false" />
|
||||
<property name="build-aop" value="true" />
|
||||
<property name="build-data" value="true" />
|
||||
<property name="build-services" value="true" />
|
||||
@@ -1439,9 +1439,9 @@ Commandline Examples:
|
||||
</fileset>
|
||||
</target>
|
||||
<target name="set-build-namespaces-release">
|
||||
<property name="test.integration.data" value="false" />
|
||||
<property name="test.integration.ems" value="false" />
|
||||
<property name="test.integration.nms" value="false" />
|
||||
<property name="test.integration.data" value="false" overwrite="false" />
|
||||
<property name="test.integration.ems" value="false" overwrite="false" />
|
||||
<property name="test.integration.nms" value="false" overwrite="false" />
|
||||
<property name="build-aop" value="true"/>
|
||||
<property name="build-data" value="true"/>
|
||||
<property name="build-services" value="true"/>
|
||||
|
||||
@@ -243,6 +243,21 @@
|
||||
<para>The value 'serverAppCalculatorEndpoint' refers to the name of an
|
||||
enpoints in the <client> section of the standard WCF configuration
|
||||
inside of App.config.</para>
|
||||
|
||||
<para>You can also specify the scope of the created channel (default is singleton)
|
||||
and use classic DI to configure the ChannelFactory<T> instance.</para>
|
||||
|
||||
<programlisting language="myxml"><objects xmlns="http://www.springframework.net"
|
||||
xmlns:wcf="http://www.springframework.net/wcf">
|
||||
|
||||
<wcf:channelFactory id="serverAppCalculator"
|
||||
channelType="Spring.WcfQuickStart.ICalculator, Spring.WcfQuickStart.Contracts"
|
||||
endpointConfigurationName="serverAppCalculatorEndpoint">
|
||||
<wcf:property name="IsSingleton" value="false" />
|
||||
<wcf:property name="Credentials.Windows.ClientCredential" value="Domain\Login:Password" />
|
||||
</wcf:channelFactory>
|
||||
|
||||
</objects></programlisting>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
||||
@@ -335,36 +335,5 @@ namespace Spring.Objects.Factory
|
||||
/// If the objects could not be created.
|
||||
/// </exception>
|
||||
IDictionary<string, T> GetObjects<T>(bool includePrototypes, bool includeFactoryObjects);
|
||||
|
||||
/// <summary>
|
||||
/// Return an instance (possibly shared or independent) of the given object name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This method allows an object factory to be used as a replacement for the
|
||||
/// Singleton or Prototype design pattern.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Note that callers should retain references to returned objects. There is no
|
||||
/// guarantee that this method will be implemented to be efficient. For example,
|
||||
/// it may be synchronized, or may need to run an RDBMS query.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Will ask the parent factory if the object cannot be found in this factory
|
||||
/// instance.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <typeparam name="T">The type of the object to return.</typeparam>
|
||||
/// <returns>The instance of the object.</returns>
|
||||
/// <exception cref="Spring.Objects.Factory.NoSuchObjectDefinitionException">
|
||||
/// If there's no such object definition.
|
||||
/// </exception>
|
||||
/// <exception cref="Spring.Objects.Factory.ObjectDefinitionStoreException">
|
||||
/// If there is more than a single object of the requested type defined in the factory.
|
||||
/// </exception>
|
||||
/// <exception cref="Spring.Objects.ObjectsException">
|
||||
/// If the object could not be created.
|
||||
/// </exception>
|
||||
T GetObject<T>();
|
||||
}
|
||||
}
|
||||
@@ -260,6 +260,37 @@ namespace Spring.Objects.Factory
|
||||
#endif
|
||||
object this[string name] { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Return an instance (possibly shared or independent) of the given object name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This method allows an object factory to be used as a replacement for the
|
||||
/// Singleton or Prototype design pattern.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Note that callers should retain references to returned objects. There is no
|
||||
/// guarantee that this method will be implemented to be efficient. For example,
|
||||
/// it may be synchronized, or may need to run an RDBMS query.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Will ask the parent factory if the object cannot be found in this factory
|
||||
/// instance.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <typeparam name="T">The type of the object to return.</typeparam>
|
||||
/// <returns>The instance of the object.</returns>
|
||||
/// <exception cref="Spring.Objects.Factory.NoSuchObjectDefinitionException">
|
||||
/// If there's no such object definition.
|
||||
/// </exception>
|
||||
/// <exception cref="Spring.Objects.Factory.ObjectDefinitionStoreException">
|
||||
/// If there is more than a single object of the requested type defined in the factory.
|
||||
/// </exception>
|
||||
/// <exception cref="Spring.Objects.ObjectsException">
|
||||
/// If the object could not be created.
|
||||
/// </exception>
|
||||
T GetObject<T>();
|
||||
|
||||
/// <summary>
|
||||
/// Return an instance (possibly shared or independent) of the given object name.
|
||||
/// </summary>
|
||||
|
||||
@@ -814,7 +814,8 @@ namespace Spring.Objects.Factory.Support
|
||||
AutowireMode = other.AutowireMode;
|
||||
ResourceDescription = other.ResourceDescription;
|
||||
IsPrimary = other.IsPrimary;
|
||||
|
||||
IsAutowireCandidate = other.IsAutowireCandidate;
|
||||
|
||||
AbstractObjectDefinition aod = other as AbstractObjectDefinition;
|
||||
if (aod != null)
|
||||
{
|
||||
@@ -846,6 +847,7 @@ namespace Spring.Objects.Factory.Support
|
||||
buffer.Append("; Singleton = ").Append(IsSingleton);
|
||||
buffer.Append("; LazyInit = ").Append(IsLazyInit);
|
||||
buffer.Append("; Autowire = ").Append(AutowireMode);
|
||||
buffer.Append("; Autowire-Candidate = ").Append(IsAutowireCandidate);
|
||||
buffer.Append("; Primary = ").Append(IsPrimary);
|
||||
buffer.Append("; DependencyCheck = ").Append(DependencyCheck);
|
||||
buffer.Append("; InitMethodName = ").Append(InitMethodName);
|
||||
|
||||
@@ -1917,6 +1917,38 @@ namespace Spring.Objects.Factory.Support
|
||||
return GetObjectInternal(name, null, null, false);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Return an instance (possibly shared or independent) of the given object name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This method allows an object factory to be used as a replacement for the
|
||||
/// Singleton or Prototype design pattern.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Note that callers should retain references to returned objects. There is no
|
||||
/// guarantee that this method will be implemented to be efficient. For example,
|
||||
/// it may be synchronized, or may need to run an RDBMS query.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Will ask the parent factory if the object cannot be found in this factory
|
||||
/// instance.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <typeparam name="T">The type of the object to return.</typeparam>
|
||||
/// <returns>The instance of the object.</returns>
|
||||
/// <exception cref="Spring.Objects.Factory.NoSuchObjectDefinitionException">
|
||||
/// If there's no such object definition.
|
||||
/// </exception>
|
||||
/// <exception cref="Spring.Objects.Factory.ObjectDefinitionStoreException">
|
||||
/// If there is more than a single object of the requested type defined in the factory.
|
||||
/// </exception>
|
||||
/// <exception cref="Spring.Objects.ObjectsException">
|
||||
/// If the object could not be created.
|
||||
/// </exception>
|
||||
public abstract T GetObject<T>();
|
||||
|
||||
/// <summary>
|
||||
/// Return an instance (possibly shared or independent) of the given object name.
|
||||
/// </summary>
|
||||
|
||||
@@ -949,20 +949,41 @@ namespace Spring.Objects.Factory.Support
|
||||
/// <exception cref="Spring.Objects.ObjectsException">
|
||||
/// If the object could not be created.
|
||||
/// </exception>
|
||||
public T GetObject<T>()
|
||||
public override T GetObject<T>()
|
||||
{
|
||||
IList<string> objectNamesForType = GetObjectNamesForType(typeof(T));
|
||||
|
||||
if (objectNamesForType.Count > 1)
|
||||
{
|
||||
IList<string> autowireCandidates = new List<string>();
|
||||
foreach (var objectName in objectNamesForType)
|
||||
{
|
||||
if (GetObjectDefinition(objectName).IsAutowireCandidate)
|
||||
autowireCandidates.Add(objectName);
|
||||
|
||||
}
|
||||
if (autowireCandidates.Count > 0)
|
||||
objectNamesForType = autowireCandidates;
|
||||
}
|
||||
|
||||
if ((objectNamesForType == null) || (objectNamesForType.Count == 0))
|
||||
{
|
||||
throw new NoSuchObjectDefinitionException(typeof(T).FullName, "Requested Type not Defined in the Context.");
|
||||
}
|
||||
|
||||
if (objectNamesForType.Count > 1)
|
||||
if (objectNamesForType.Count == 1)
|
||||
{
|
||||
throw new ObjectDefinitionStoreException(string.Format("More than one definition for {0} found in the Context.", typeof(T).FullName));
|
||||
return (T)GetObject(objectNamesForType[0]);
|
||||
}
|
||||
else if (objectNamesForType.Count == 0 && ParentObjectFactory != null)
|
||||
{
|
||||
return ParentObjectFactory.GetObject<T>();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NoSuchObjectDefinitionException(typeof(T), "expected single bean but found " +
|
||||
objectNamesForType.Count + ": " + StringUtils.ArrayToCommaDelimitedString(objectNamesForType));
|
||||
}
|
||||
|
||||
return (T)GetObject(objectNamesForType[0]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -336,6 +336,28 @@ namespace Spring.Objects.Factory.Support
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the autowire candidate value for this definition.
|
||||
/// </summary>
|
||||
/// <param name="autowireCandidate">The autowire candidate value</param>
|
||||
/// <returns></returns>
|
||||
public ObjectDefinitionBuilder SetAutowireCandidate(bool autowireCandidate)
|
||||
{
|
||||
objectDefinition.IsAutowireCandidate = autowireCandidate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the primary value for this definition.
|
||||
/// </summary>
|
||||
/// <param name="primary">If object is primary</param>
|
||||
/// <returns></returns>
|
||||
public ObjectDefinitionBuilder SetPrimary(bool primary)
|
||||
{
|
||||
objectDefinition.IsPrimary = primary;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the dependency check mode for this definition.
|
||||
/// </summary>
|
||||
|
||||
@@ -33,6 +33,9 @@ namespace Spring.Objects.Factory.Xml
|
||||
private string dependencyCheck;
|
||||
private string lazyInit;
|
||||
private string merge;
|
||||
private string initMethod;
|
||||
private string destroyMethod;
|
||||
private string autowireCandidates;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the autowire setting for the document that's currently parsed.
|
||||
@@ -73,5 +76,35 @@ namespace Spring.Objects.Factory.Xml
|
||||
get { return merge; }
|
||||
set { merge = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get or sets the init method for the document that's currently parsed.
|
||||
/// </summary>
|
||||
/// <value>The init method</value>
|
||||
public string InitMethod
|
||||
{
|
||||
get { return initMethod; }
|
||||
set { initMethod = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the destroy method for the document that's currently parsed.
|
||||
/// </summary>
|
||||
/// <value>The destroy methood</value>
|
||||
public string DestroyMethod
|
||||
{
|
||||
get { return destroyMethod; }
|
||||
set { destroyMethod = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets autowire candidates for the document that's currently parsed
|
||||
/// </summary>
|
||||
/// <value>The Autowire Candidates</value>
|
||||
public string AutowireCandidates
|
||||
{
|
||||
get { return autowireCandidates; }
|
||||
set { autowireCandidates = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,12 @@ namespace Spring.Objects.Factory.Xml
|
||||
/// </remarks>
|
||||
public const string TrueValue = "true";
|
||||
|
||||
/// <summary>
|
||||
/// Value of a boolean attribute that represents
|
||||
/// <see langword="false"/>.
|
||||
/// </summary>
|
||||
public const string FalseValue = "false";
|
||||
|
||||
/// <summary>
|
||||
/// Signifies that a default value is to be applied.
|
||||
/// </summary>
|
||||
@@ -90,11 +96,25 @@ namespace Spring.Objects.Factory.Xml
|
||||
/// </summary>
|
||||
public const string DefaultAutowireAttribute = "default-autowire";
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the default autowire candidates.
|
||||
/// </summary>
|
||||
public const string DefaultAutowireCandidatesAttribute = "default-autowire-candidates";
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the default collection merge mode.
|
||||
/// </summary>
|
||||
public const string DefaultMergeAttribute = "default-merge";
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the default init method.
|
||||
/// </summary>
|
||||
public const string DefaultInitMethodAttribute = "default-init-method";
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the default destroy method.
|
||||
/// </summary>
|
||||
public const string DefaultDestroyMethodAttribute = "default-destroy-method";
|
||||
|
||||
/// <summary>
|
||||
/// Defines a single named object.
|
||||
@@ -586,6 +606,11 @@ namespace Spring.Objects.Factory.Xml
|
||||
/// </summary>
|
||||
public const string AutowireAttribute = "autowire";
|
||||
|
||||
/// <summary>
|
||||
/// The autowiring mode for an individual object definition.
|
||||
/// </summary>
|
||||
public const string AutowireCandidateAttribute = "autowire-candidate";
|
||||
|
||||
/// <summary>
|
||||
/// Attribute element to farther deifne the qualifier of an object
|
||||
/// </summary>
|
||||
|
||||
@@ -175,6 +175,77 @@ namespace Spring.Objects.Factory.Xml
|
||||
|
||||
#endregion
|
||||
|
||||
ddd.AutowireCandidates = GetAttributeValue(root, ObjectDefinitionConstants.DefaultAutowireCandidatesAttribute);
|
||||
|
||||
#region Instrumentation
|
||||
|
||||
if (log.IsDebugEnabled)
|
||||
{
|
||||
log.Debug(
|
||||
string.Format(
|
||||
"Default init method '{0}'.",
|
||||
ddd.InitMethod));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
ddd.DestroyMethod = GetAttributeValue(root, ObjectDefinitionConstants.DefaultDestroyMethodAttribute);
|
||||
|
||||
#region Instrumentation
|
||||
|
||||
if (log.IsDebugEnabled)
|
||||
{
|
||||
log.Debug(
|
||||
string.Format(
|
||||
"Default destroy method '{0}'.",
|
||||
ddd.DestroyMethod));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
ddd.AutowireCandidates = GetAttributeValue(root, ObjectDefinitionConstants.DefaultAutowireCandidatesAttribute);
|
||||
|
||||
#region Instrumentation
|
||||
|
||||
if (log.IsDebugEnabled)
|
||||
{
|
||||
log.Debug(
|
||||
string.Format(
|
||||
"Default autowire candidates '{0}'.",
|
||||
ddd.AutowireCandidates));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
ddd.InitMethod = GetAttributeValue(root, ObjectDefinitionConstants.DefaultInitMethodAttribute);
|
||||
|
||||
#region Instrumentation
|
||||
|
||||
if (log.IsDebugEnabled)
|
||||
{
|
||||
log.Debug(
|
||||
string.Format(
|
||||
"Default init method '{0}'.",
|
||||
ddd.InitMethod));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
ddd.DestroyMethod = GetAttributeValue(root, ObjectDefinitionConstants.DefaultDestroyMethodAttribute);
|
||||
|
||||
#region Instrumentation
|
||||
|
||||
if (log.IsDebugEnabled)
|
||||
{
|
||||
log.Debug(
|
||||
string.Format(
|
||||
"Default destroy method '{0}'.",
|
||||
ddd.DestroyMethod));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
defaults = ddd;
|
||||
}
|
||||
|
||||
|
||||
@@ -481,21 +481,49 @@ namespace Spring.Objects.Factory.Xml
|
||||
autowire = childParserContext.ParserHelper.Defaults.Autowire;
|
||||
}
|
||||
od.AutowireMode = GetAutowireMode(autowire);
|
||||
string primary = GetAttributeValue(element, ObjectDefinitionConstants.PrimaryAttribute);
|
||||
if (primary == null)
|
||||
|
||||
string autowireCandidates = GetAttributeValue(element, ObjectDefinitionConstants.AutowireCandidateAttribute);
|
||||
if (string.IsNullOrEmpty(autowireCandidates) || ObjectDefinitionConstants.DefaultValue.Equals(autowireCandidates))
|
||||
{
|
||||
primary = "false";
|
||||
if (!string.IsNullOrEmpty(childParserContext.ParserHelper.Defaults.AutowireCandidates))
|
||||
{
|
||||
string[] patterns = childParserContext.ParserHelper.Defaults.AutowireCandidates.Split(',');
|
||||
od.IsAutowireCandidate = PatternMatchUtils.SimpleMatch(patterns, id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
od.IsAutowireCandidate = ObjectDefinitionConstants.TrueValue.Equals(autowireCandidates);
|
||||
}
|
||||
string primary = GetAttributeValue(element, ObjectDefinitionConstants.PrimaryAttribute);
|
||||
if (string.IsNullOrEmpty(primary))
|
||||
{
|
||||
primary = ObjectDefinitionConstants.FalseValue;
|
||||
}
|
||||
od.IsPrimary = IsTrueStringValue(primary);
|
||||
string initMethodName = GetAttributeValue(element, ObjectDefinitionConstants.InitMethodAttribute);
|
||||
if (StringUtils.HasText(initMethodName))
|
||||
if (initMethodName != null)
|
||||
{
|
||||
od.InitMethodName = initMethodName;
|
||||
if (StringUtils.HasText(initMethodName))
|
||||
od.InitMethodName = initMethodName;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (StringUtils.HasText(childParserContext.ParserHelper.Defaults.InitMethod))
|
||||
od.InitMethodName = childParserContext.ParserHelper.Defaults.InitMethod;
|
||||
}
|
||||
string destroyMethodName = GetAttributeValue(element, ObjectDefinitionConstants.DestroyMethodAttribute);
|
||||
if (StringUtils.HasText(destroyMethodName))
|
||||
if (destroyMethodName != null)
|
||||
{
|
||||
od.DestroyMethodName = destroyMethodName;
|
||||
if (StringUtils.HasText(destroyMethodName))
|
||||
{
|
||||
od.DestroyMethodName = destroyMethodName;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (StringUtils.HasText(childParserContext.ParserHelper.Defaults.DestroyMethod))
|
||||
od.DestroyMethodName = childParserContext.ParserHelper.Defaults.DestroyMethod;
|
||||
}
|
||||
if (element.HasAttribute(ObjectDefinitionConstants.SingletonAttribute))
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<xsd:schema xmlns="http://www.springframework.net" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:vs="http://schemas.microsoft.com/Visual-Studio-Intellisense" targetNamespace="http://www.springframework.net" elementFormDefault="qualified" attributeFormDefault="unqualified" vs:friendlyname="Spring.NET Configuration" vs:ishtmlschema="false" vs:iscasesensitive="true" vs:requireattributequotes="true" vs:defaultnamespacequalifier="" vs:defaultnsprefix="">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
<![CDATA[
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
<![CDATA[
|
||||
Spring Objects XML Schema Definition
|
||||
Based on Spring Beans DTD, authored by Rod Johnson & Juergen Hoeller
|
||||
|
||||
@@ -29,61 +29,61 @@
|
||||
|
||||
There is also support for lists, dictionaries, and sets.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<!-- base types -->
|
||||
<xsd:complexType name="identifiedType" abstract="true">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[The unique identifier for a bean. The scope of the identifier is the enclosing object factory.]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:attribute name="id" type="xsd:ID">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[The unique identifier for an object.]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
<!-- base types -->
|
||||
<xsd:complexType name="identifiedType" abstract="true">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[The unique identifier for a bean. The scope of the identifier is the enclosing object factory.]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:attribute name="id" type="xsd:ID">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[The unique identifier for an object.]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:simpleType name="nonNullString">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Defines a base type for any required string. Defines a string with a minimum length of 0</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:minLength value="0"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
<xsd:simpleType name="description">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Element containing informative text describing the purpose of the enclosing
|
||||
element. Always optional.
|
||||
Used primarily for user documentation of XML object definition documents.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:restriction base="nonNullString"/>
|
||||
</xsd:simpleType>
|
||||
<xsd:complexType name="valueObject">
|
||||
<xsd:simpleContent>
|
||||
<xsd:extension base="xsd:string">
|
||||
<xsd:attribute name="type" type="nonNullString" use="optional"/>
|
||||
</xsd:extension>
|
||||
</xsd:simpleContent>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="expression">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="property" type="property" minOccurs="0" maxOccurs="2"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="value" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
<!--
|
||||
<xsd:simpleType name="nonNullString">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Defines a base type for any required string. Defines a string with a minimum length of 0</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:minLength value="0"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
<xsd:simpleType name="description">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Element containing informative text describing the purpose of the enclosing
|
||||
element. Always optional.
|
||||
Used primarily for user documentation of XML object definition documents.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:restriction base="nonNullString"/>
|
||||
</xsd:simpleType>
|
||||
<xsd:complexType name="valueObject">
|
||||
<xsd:simpleContent>
|
||||
<xsd:extension base="xsd:string">
|
||||
<xsd:attribute name="type" type="nonNullString" use="optional"/>
|
||||
</xsd:extension>
|
||||
</xsd:simpleContent>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="expression">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="property" type="property" minOccurs="0" maxOccurs="2"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="value" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
<!--
|
||||
Defines a reference to another object in this factory or an external
|
||||
factory (parent or included factory).
|
||||
-->
|
||||
<xsd:complexType name="objectReference">
|
||||
<xsd:attribute name="object" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="local" type="xsd:IDREF" use="optional"/>
|
||||
<xsd:attribute name="parent" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
<xsd:complexType name="objectReference">
|
||||
<xsd:attribute name="object" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="local" type="xsd:IDREF" use="optional"/>
|
||||
<xsd:attribute name="parent" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
References must specify a name of the target object.
|
||||
The "object" attribute can reference any name from any object in the context,
|
||||
to be checked at runtime.
|
||||
@@ -91,68 +91,68 @@
|
||||
they can be checked by this DTD, thus should be preferred for references
|
||||
within the same object factory XML file.
|
||||
-->
|
||||
</xsd:complexType>
|
||||
<!-- Defines a reference to another object or a type. -->
|
||||
<xsd:complexType name="objectOrClassReference">
|
||||
<xsd:attribute name="object" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="local" type="xsd:IDREF" use="optional"/>
|
||||
<xsd:attribute name="type" type="nonNullString" use="optional"/>
|
||||
</xsd:complexType>
|
||||
<xsd:group name="objectList">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="description" type="description" minOccurs="0"/>
|
||||
<xsd:choice>
|
||||
<xsd:element name="object" type="vanillaObject"/>
|
||||
<!--
|
||||
</xsd:complexType>
|
||||
<!-- Defines a reference to another object or a type. -->
|
||||
<xsd:complexType name="objectOrClassReference">
|
||||
<xsd:attribute name="object" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="local" type="xsd:IDREF" use="optional"/>
|
||||
<xsd:attribute name="type" type="nonNullString" use="optional"/>
|
||||
</xsd:complexType>
|
||||
<xsd:group name="objectList">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="description" type="description" minOccurs="0"/>
|
||||
<xsd:choice>
|
||||
<xsd:element name="object" type="vanillaObject"/>
|
||||
<!--
|
||||
Defines a reference to another object in this factory or an external
|
||||
factory (parent or included factory).
|
||||
-->
|
||||
<xsd:element name="ref" type="objectReference"/>
|
||||
<!--
|
||||
<xsd:element name="ref" type="objectReference"/>
|
||||
<!--
|
||||
Defines a string property value, which must also be the id of another
|
||||
object in this factory or an external factory (parent or included factory).
|
||||
While a regular 'value' element could instead be used for the same effect,
|
||||
using idref in this case allows validation of local object ids by the xml
|
||||
parser, and name completion by helper tools.
|
||||
-->
|
||||
<xsd:element name="idref" type="objectReference"/>
|
||||
<!--
|
||||
<xsd:element name="idref" type="objectReference"/>
|
||||
<!--
|
||||
A objectList can contain multiple inner object, ref, collection, or value elements.
|
||||
Lists are untyped, pending generics support, although references will be
|
||||
strongly typed.
|
||||
A objectList can also map to an array type. The necessary conversion
|
||||
is automatically performed by AbstractObjectFactory.
|
||||
-->
|
||||
<xsd:element name="list">
|
||||
<xsd:complexType>
|
||||
<xsd:group ref="objectList" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xsd:attribute name="element-type" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="merge" type="xsd:boolean" use="optional" default="false"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<!--
|
||||
<xsd:element name="list">
|
||||
<xsd:complexType>
|
||||
<xsd:group ref="objectList" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xsd:attribute name="element-type" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="merge" type="xsd:boolean" use="optional" default="false"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<!--
|
||||
A set can contain multiple inner object, ref, collection, or value elements.
|
||||
Sets are untyped, pending generics support, although references will be
|
||||
strongly typed.
|
||||
-->
|
||||
<xsd:element name="set">
|
||||
<xsd:complexType>
|
||||
<xsd:group ref="objectList" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xsd:attribute name="element-type" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="merge" type="xsd:boolean" use="optional" default="false"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<!--
|
||||
<xsd:element name="set">
|
||||
<xsd:complexType>
|
||||
<xsd:group ref="objectList" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<xsd:attribute name="element-type" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="merge" type="xsd:boolean" use="optional" default="false"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<!--
|
||||
A Spring map is a mapping from a string key to object (a .NET IDictionary).
|
||||
Maps may be empty.
|
||||
-->
|
||||
<xsd:element name="dictionary" type="objectMap"/>
|
||||
<!--
|
||||
<xsd:element name="dictionary" type="objectMap"/>
|
||||
<!--
|
||||
Name-values elements differ from map elements in that values must be strings.
|
||||
Name-values may be empty.
|
||||
-->
|
||||
<xsd:element name="name-values" type="objectNameValues"/>
|
||||
<!--
|
||||
<xsd:element name="name-values" type="objectNameValues"/>
|
||||
<!--
|
||||
Contains a string representation of a property value.
|
||||
The property may be a string, or may be converted to the
|
||||
required type using the System.ComponentModel.TypeConverter
|
||||
@@ -164,220 +164,220 @@
|
||||
Configure more complex objects by setting properties to references
|
||||
to other objects.
|
||||
-->
|
||||
<xsd:element name="value" type="valueObject"/>
|
||||
<!--
|
||||
<xsd:element name="value" type="valueObject"/>
|
||||
<!--
|
||||
Contains a string representation of an expression.
|
||||
-->
|
||||
<xsd:element name="expression" type="expression"/>
|
||||
<!--
|
||||
<xsd:element name="expression" type="expression"/>
|
||||
<!--
|
||||
Denotes a .NET null value. Necessary because an empty "value" tag
|
||||
will resolve to an empty String, which will not be resolved to a
|
||||
null value unless a special TypeConverter does so.
|
||||
-->
|
||||
<xsd:element name="null" />
|
||||
<xsd:any namespace="##other" processContents="strict" />
|
||||
</xsd:choice>
|
||||
</xsd:sequence>
|
||||
</xsd:group>
|
||||
<xsd:complexType name="objectNameValues">
|
||||
<xsd:sequence>
|
||||
<!--
|
||||
<xsd:element name="null" />
|
||||
<xsd:any namespace="##other" processContents="strict" />
|
||||
</xsd:choice>
|
||||
</xsd:sequence>
|
||||
</xsd:group>
|
||||
<xsd:complexType name="objectNameValues">
|
||||
<xsd:sequence>
|
||||
<!--
|
||||
The "value" attribute is the string value of the property. The "key"
|
||||
attribute is the name of the property.
|
||||
-->
|
||||
<xsd:element name="add" minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:complexType mixed="true">
|
||||
<xsd:attribute name="key" type="nonNullString" use="required"/>
|
||||
<xsd:attribute name="value" use="required" type="xsd:string"/>
|
||||
<xsd:attribute name="delimiters" use="optional" type="xsd:string"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="merge" type="xsd:boolean" use="optional" default="false"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="importElement">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Import an external file containing object definitions into this file.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:attribute name="resource" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="aliasElement">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Defines an additional alias name for an object definition.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:attribute name="name" type="nonNullString" use="required"/>
|
||||
<xsd:attribute name="alias" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="objectMap">
|
||||
<xsd:sequence>
|
||||
<xsd:element type="mapEntryElement" name="entry" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="key-type" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="value-type" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="merge" type="xsd:boolean" use="optional" default="false"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="mapEntryElement">
|
||||
<xsd:sequence>
|
||||
<xsd:element type="mapKeyElement" name="key" minOccurs="0" maxOccurs="1"/>
|
||||
<xsd:group ref="objectList" minOccurs="0" maxOccurs="1"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="key" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="value" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="expression" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="key-ref" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="value-ref" type="nonNullString" use="optional"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="mapKeyElement">
|
||||
<xsd:group ref="objectList" minOccurs="1"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="lookupMethod">
|
||||
<xsd:attribute name="name" type="nonNullString" use="required"/>
|
||||
<xsd:attribute name="object" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="constructorArgument">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Defines constructor argument.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:group ref="objectList" minOccurs="0"/>
|
||||
<!--
|
||||
<xsd:element name="add" minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:complexType mixed="true">
|
||||
<xsd:attribute name="key" type="nonNullString" use="required"/>
|
||||
<xsd:attribute name="value" use="required" type="xsd:string"/>
|
||||
<xsd:attribute name="delimiters" use="optional" type="xsd:string"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="merge" type="xsd:boolean" use="optional" default="false"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="importElement">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Import an external file containing object definitions into this file.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:attribute name="resource" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="aliasElement">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Defines an additional alias name for an object definition.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:attribute name="name" type="nonNullString" use="required"/>
|
||||
<xsd:attribute name="alias" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="objectMap">
|
||||
<xsd:sequence>
|
||||
<xsd:element type="mapEntryElement" name="entry" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="key-type" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="value-type" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="merge" type="xsd:boolean" use="optional" default="false"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="mapEntryElement">
|
||||
<xsd:sequence>
|
||||
<xsd:element type="mapKeyElement" name="key" minOccurs="0" maxOccurs="1"/>
|
||||
<xsd:group ref="objectList" minOccurs="0" maxOccurs="1"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="key" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="value" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="expression" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="key-ref" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="value-ref" type="nonNullString" use="optional"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="mapKeyElement">
|
||||
<xsd:group ref="objectList" minOccurs="1"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="lookupMethod">
|
||||
<xsd:attribute name="name" type="nonNullString" use="required"/>
|
||||
<xsd:attribute name="object" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="constructorArgument">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Defines constructor argument.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:group ref="objectList" minOccurs="0"/>
|
||||
<!--
|
||||
The constructor-arg tag can have an optional named parameter attribute,
|
||||
to specify a named parameter in the constructor argument list.
|
||||
-->
|
||||
<xsd:attribute name="name" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
<xsd:attribute name="name" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
The constructor-arg tag can have an optional index attribute,
|
||||
to specify the exact index in the constructor argument list. Only needed
|
||||
to avoid ambiguities, e.g. in case of 2 arguments of the same type.
|
||||
-->
|
||||
<xsd:attribute name="index" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
<xsd:attribute name="index" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
The constructor-arg tag can have an optional type attribute,
|
||||
to specify the exact type of the constructor argument. Only needed
|
||||
to avoid ambiguities, e.g. in case of 2 single argument constructors
|
||||
that can both be converted from a String.
|
||||
-->
|
||||
<xsd:attribute name="type" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="value" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="expression" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="ref" type="nonNullString" use="optional"/>
|
||||
</xsd:complexType>
|
||||
<xsd:attribute name="type" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="value" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="expression" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="ref" type="nonNullString" use="optional"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="property">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Defines property.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:group ref="objectList" minOccurs="0"/>
|
||||
<!-- The property name attribute is the name of the objects property. -->
|
||||
<xsd:attribute name="name" type="nonNullString" use="required"/>
|
||||
<xsd:attribute name="value" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="expression" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="ref" type="nonNullString" use="optional"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="property">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Defines property.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:group ref="objectList" minOccurs="0"/>
|
||||
<!-- The property name attribute is the name of the objects property. -->
|
||||
<xsd:attribute name="name" type="nonNullString" use="required"/>
|
||||
<xsd:attribute name="value" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="expression" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="ref" type="nonNullString" use="optional"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="metaType">
|
||||
<xsd:attribute name="key" type="nonNullString" use="required">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
<![CDATA[
|
||||
The key name of the metadata attribute being defined.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="value" type="nonNullString" use="required">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
<![CDATA[
|
||||
The value of the metadata attribute being defined (as a simple String).
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="qualifierType">
|
||||
<xsd:complexType name="metaType">
|
||||
<xsd:attribute name="key" type="nonNullString" use="required">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
<![CDATA[
|
||||
The key name of the metadata attribute being defined.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="value" type="nonNullString" use="required">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
<![CDATA[
|
||||
The value of the metadata attribute being defined (as a simple String).
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="qualifierType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
<![CDATA[
|
||||
Object definitions can provide qualifiers to match against attributes
|
||||
on a field or parameter for fine-grained autowire candidate resolution.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="attribute" type="metaType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="type" type="nonNullString" default="Spring.Objects.Factory.Attributes.QualifierAttribute"/>
|
||||
<xsd:attribute name="value" type="nonNullString" use="optional"/>
|
||||
</xsd:complexType>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="attribute" type="metaType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="type" type="nonNullString" default="Spring.Objects.Factory.Attributes.QualifierAttribute"/>
|
||||
<xsd:attribute name="value" type="nonNullString" use="optional"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="vanillaObject">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Defines a single named object.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="description" type="description" minOccurs="0" maxOccurs="1"/>
|
||||
<!--
|
||||
<xsd:complexType name="vanillaObject">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Defines a single named object.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="description" type="description" minOccurs="0" maxOccurs="1"/>
|
||||
<!--
|
||||
Object definitions can specify zero or more constructor arguments.
|
||||
They correspond to either a specific index of the constructor argument list
|
||||
or are supposed to be matched generically by type.
|
||||
This is an alternative to "autowire constructor".
|
||||
-->
|
||||
<xsd:element name="constructor-arg" type="constructorArgument" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<!--
|
||||
<xsd:element name="constructor-arg" type="constructorArgument" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<!--
|
||||
Object definitions can have zero or more properties.
|
||||
Spring supports primitives, references to other objects in the same or
|
||||
related factories, lists, dictionaries and properties.
|
||||
-->
|
||||
<xsd:element name="property" type="property" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<!--
|
||||
<xsd:element name="property" type="property" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<!--
|
||||
Object definitions can specify zero or more lookup-methods.
|
||||
-->
|
||||
<xsd:element name="lookup-method" type="lookupMethod" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<!-- Object definitions can have zero or more replaced-methods. -->
|
||||
<xsd:element name="replaced-method" minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="arg-type" minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="match" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="nonNullString" use="required"/>
|
||||
<xsd:attribute name="replacer" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
<xsd:element name="lookup-method" type="lookupMethod" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<!-- Object definitions can have zero or more replaced-methods. -->
|
||||
<xsd:element name="replaced-method" minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="arg-type" minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="match" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<!-- Object definitions can have zero or more subscriptions. -->
|
||||
<xsd:element name="listener" minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="ref" type="objectOrClassReference" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
<!-- The event(s) the object is interested in. -->
|
||||
<xsd:attribute name="event" type="nonNullString" use="optional"/>
|
||||
<!-- The name or name pattern of the method that will handle the event(s). -->
|
||||
<xsd:attribute name="method" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<!-- Object definition can have zero or more meta attribute definitions used for autowiring dependencies -->
|
||||
<xsd:element name="meta" type="metaType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<!-- Object definition can have zero or more qualifier definition used for autowiring dependencies -->
|
||||
<xsd:element name="qualifier" type="qualifierType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
<!--
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="nonNullString" use="required"/>
|
||||
<xsd:attribute name="replacer" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<!-- Object definitions can have zero or more subscriptions. -->
|
||||
<xsd:element name="listener" minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="ref" type="objectOrClassReference" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
<!-- The event(s) the object is interested in. -->
|
||||
<xsd:attribute name="event" type="nonNullString" use="optional"/>
|
||||
<!-- The name or name pattern of the method that will handle the event(s). -->
|
||||
<xsd:attribute name="method" type="nonNullString" use="required"/>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<!-- Object definition can have zero or more meta attribute definitions used for autowiring dependencies -->
|
||||
<xsd:element name="meta" type="metaType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<!-- Object definition can have zero or more qualifier definition used for autowiring dependencies -->
|
||||
<xsd:element name="qualifier" type="qualifierType" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
<!--
|
||||
Objects can be identified by an id, to enable reference checking.
|
||||
There are constraints on a valid XML id: if you want to reference your object
|
||||
in .NET code using a name that's illegal as an XML id, use the optional
|
||||
"name" attribute. If neither given, the object type name is used as id.
|
||||
-->
|
||||
<xsd:attribute name="id" type="xsd:ID" use="optional"/>
|
||||
<!--
|
||||
<xsd:attribute name="id" type="xsd:ID" use="optional"/>
|
||||
<!--
|
||||
Optional. Can be used to create one or more aliases illegal in an id.
|
||||
Multiple aliases can be separated by any number of spaces or commas.
|
||||
-->
|
||||
<xsd:attribute name="name" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
<xsd:attribute name="name" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
Each object definition must specify the full, assembly qualified of the type,
|
||||
or the name of the parent object from which the type can be worked out.
|
||||
|
||||
@@ -386,16 +386,16 @@
|
||||
singleton status. It will inherit all of the parent's other parameters
|
||||
like lazy initialization or autowire settings.
|
||||
-->
|
||||
<xsd:attribute name="type" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="parent" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
<xsd:attribute name="type" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="parent" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
Is this object "abstract", i.e. not meant to be instantiated itself but
|
||||
rather just serving as parent for concrete child object definitions?
|
||||
Default is false. Specify true to tell the object factory to not try to
|
||||
instantiate that particular object in any case.
|
||||
-->
|
||||
<xsd:attribute name="abstract" type="xsd:boolean" use="optional" default="false"/>
|
||||
<!--
|
||||
<xsd:attribute name="abstract" type="xsd:boolean" use="optional" default="false"/>
|
||||
<!--
|
||||
Is this object a "singleton" (one shared instance, which will
|
||||
be returned by all calls to GetObject() with the id),
|
||||
or a "prototype" (independent instance resulting from each call to
|
||||
@@ -404,8 +404,8 @@
|
||||
Singletons are most commonly used, and are ideal for multi-threaded
|
||||
service objects.
|
||||
-->
|
||||
<xsd:attribute name="singleton" type="xsd:boolean" use="optional" default="true"/>
|
||||
<!--
|
||||
<xsd:attribute name="singleton" type="xsd:boolean" use="optional" default="true"/>
|
||||
<!--
|
||||
Optional attribute controlling the scope of singleton instances. It is
|
||||
only applicable to ASP.Net web applications and it has no effect on prototype
|
||||
objects. Applications other than ASP.Net web applications simply ignore this attribute.
|
||||
@@ -426,30 +426,30 @@
|
||||
Server.Transfer method, they can easily share the state by configuring dependency to the same
|
||||
request-scoped object.
|
||||
-->
|
||||
<xsd:attribute name="scope" use="optional" default="application">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="application"/>
|
||||
<xsd:enumeration value="session"/>
|
||||
<xsd:enumeration value="request"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<!--
|
||||
<xsd:attribute name="scope" use="optional" default="application">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="application"/>
|
||||
<xsd:enumeration value="session"/>
|
||||
<xsd:enumeration value="request"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<!--
|
||||
Is this object to be lazily initialized?
|
||||
If false, it will get instantiated on startup by object factories
|
||||
that perform eager initialization of singletons.
|
||||
-->
|
||||
<xsd:attribute name="lazy-init" use="optional" default="default">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="true"/>
|
||||
<xsd:enumeration value="false"/>
|
||||
<xsd:enumeration value="default"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<!--
|
||||
<xsd:attribute name="lazy-init" use="optional" default="default">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="true"/>
|
||||
<xsd:enumeration value="false"/>
|
||||
<xsd:enumeration value="default"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<!--
|
||||
Optional attribute controlling whether to "autowire" object properties.
|
||||
This is an automagical process in which object references don't need to be coded
|
||||
explicitly in the XML object definition file, but Spring works out dependencies.
|
||||
@@ -487,23 +487,38 @@
|
||||
always override autowiring. Autowire behaviour can be combined with dependency
|
||||
checking, which will be performed after all autowiring has been completed.
|
||||
-->
|
||||
<xsd:attribute name="autowire" use="optional" default="default">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="no"/>
|
||||
<xsd:enumeration value="byName"/>
|
||||
<xsd:enumeration value="byType"/>
|
||||
<xsd:enumeration value="constructor"/>
|
||||
<xsd:enumeration value="autodetect"/>
|
||||
<xsd:enumeration value="default"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<!--
|
||||
Is this object the rpimary object if type resolving during Autowiring
|
||||
-->
|
||||
<xsd:attribute name="primary" type="xsd:boolean" use="optional" default="false"/>
|
||||
<!--
|
||||
<xsd:attribute name="autowire" use="optional" default="default">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="no"/>
|
||||
<xsd:enumeration value="byName"/>
|
||||
<xsd:enumeration value="byType"/>
|
||||
<xsd:enumeration value="constructor"/>
|
||||
<xsd:enumeration value="autodetect"/>
|
||||
<xsd:enumeration value="default"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<!--
|
||||
Indicates whether or not this object should be considered when looking
|
||||
for matching candidates to satisfy another object's autowiring requirements.
|
||||
Note that this does not affect explicit references by name, which will get
|
||||
resolved even if the specified bean is not marked as an autowire candidate.
|
||||
-->
|
||||
<xsd:attribute name="autowire-candidate" use="optional" default="default">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="default"/>
|
||||
<xsd:enumeration value="true"/>
|
||||
<xsd:enumeration value="false"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<!--
|
||||
Is this object the rpimary object if type resolving during Autowiring
|
||||
-->
|
||||
<xsd:attribute name="primary" type="xsd:boolean" use="optional" default="false"/>
|
||||
<!--
|
||||
Optional attribute controlling whether to check whether all this
|
||||
objects dependencies, expressed in its properties, are satisfied.
|
||||
Default is no dependency checking.
|
||||
@@ -512,18 +527,18 @@
|
||||
"object" includes collaborators (other objects in the factory)
|
||||
"all" includes both types of dependency checking
|
||||
-->
|
||||
<xsd:attribute name="dependency-check" use="optional" default="default">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="none"/>
|
||||
<xsd:enumeration value="objects"/>
|
||||
<xsd:enumeration value="simple"/>
|
||||
<xsd:enumeration value="all"/>
|
||||
<xsd:enumeration value="default"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<!--
|
||||
<xsd:attribute name="dependency-check" use="optional" default="default">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="none"/>
|
||||
<xsd:enumeration value="objects"/>
|
||||
<xsd:enumeration value="simple"/>
|
||||
<xsd:enumeration value="all"/>
|
||||
<xsd:enumeration value="default"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<!--
|
||||
The names of the objects that this object depends on being initialized.
|
||||
The object factory will guarantee that these objects get initialized before.
|
||||
|
||||
@@ -531,65 +546,92 @@
|
||||
constructor arguments. This property should just be necessary for other kinds
|
||||
of dependencies like statics (*ugh*) or database preparation on startup.
|
||||
-->
|
||||
<xsd:attribute name="depends-on" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
<xsd:attribute name="depends-on" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
Optional attribute for the name of the custom initialization method
|
||||
to invoke after setting object properties. The method must have no arguments,
|
||||
but may throw any exception.
|
||||
-->
|
||||
<xsd:attribute name="init-method" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
<xsd:attribute name="init-method" type="nonNullString" use="optional"/>
|
||||
<!--
|
||||
Optional attribute for the name of the custom destroy method to invoke
|
||||
on object factory shutdown. The method must have no arguments,
|
||||
but may throw any exception. Note: Only invoked on singleton objects!
|
||||
-->
|
||||
<xsd:attribute name="destroy-method" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="factory-method" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="factory-object" type="nonNullString" use="optional"/>
|
||||
</xsd:complexType>
|
||||
<xsd:attribute name="destroy-method" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="factory-method" type="nonNullString" use="optional"/>
|
||||
<xsd:attribute name="factory-object" type="nonNullString" use="optional"/>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:element name="objects">
|
||||
<xsd:element name="objects">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>The document root. At least one object definition is required.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="description" type="description"
|
||||
minOccurs="0" maxOccurs="1" />
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:element name="import" type="importElement" />
|
||||
<xsd:element name="alias" type="aliasElement" />
|
||||
<xsd:element name="object" type="vanillaObject" />
|
||||
<xsd:any namespace="##other"
|
||||
processContents="strict" />
|
||||
</xsd:choice>
|
||||
</xsd:sequence>
|
||||
<!--
|
||||
Default values for all object definitions. Can be overridden at
|
||||
the "object" level. See those attribute definitions for details.
|
||||
-->
|
||||
<xsd:attribute name="default-lazy-init" type="xsd:boolean"
|
||||
use="optional" default="false" />
|
||||
<xsd:attribute name="default-merge" type="xsd:boolean"
|
||||
use="optional" default="false" />
|
||||
<xsd:attribute name="default-dependency-check"
|
||||
use="optional" default="none">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="none" />
|
||||
<xsd:enumeration value="objects" />
|
||||
<xsd:enumeration value="simple" />
|
||||
<xsd:enumeration value="all" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="default-autowire" use="optional"
|
||||
default="no">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="no" />
|
||||
<xsd:enumeration value="byName" />
|
||||
<xsd:enumeration value="byType" />
|
||||
<xsd:enumeration value="constructor" />
|
||||
<xsd:enumeration value="autodetect" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="default-init-method" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>The document root. At least one object definition is required.</xsd:documentation>
|
||||
<xsd:documentation>
|
||||
<![CDATA[
|
||||
The default 'init-method' value; see the documentation for the
|
||||
'init-method' attribute of the 'object' element.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="description" type="description" minOccurs="0" maxOccurs="1"/>
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:element name="import" type="importElement"/>
|
||||
<xsd:element name="alias" type="aliasElement"/>
|
||||
<xsd:element name="object" type="vanillaObject"/>
|
||||
<xsd:any namespace="##other" processContents="strict"/>
|
||||
</xsd:choice>
|
||||
</xsd:sequence>
|
||||
<!--
|
||||
Default values for all object definitions. Can be overridden at
|
||||
the "object" level. See those attribute definitions for details.
|
||||
-->
|
||||
<xsd:attribute name="default-lazy-init" type="xsd:boolean" use="optional" default="false"/>
|
||||
<xsd:attribute name="default-merge" type="xsd:boolean" use="optional" default="false"/>
|
||||
<xsd:attribute name="default-dependency-check" use="optional" default="none">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="none"/>
|
||||
<xsd:enumeration value="objects"/>
|
||||
<xsd:enumeration value="simple"/>
|
||||
<xsd:enumeration value="all"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="default-autowire" use="optional" default="no">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="no"/>
|
||||
<xsd:enumeration value="byName"/>
|
||||
<xsd:enumeration value="byType"/>
|
||||
<xsd:enumeration value="constructor"/>
|
||||
<xsd:enumeration value="autodetect"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="default-destroy-method" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
<![CDATA[
|
||||
The default 'destroy-method' value; see the documentation for the
|
||||
'destroy-method' attribute of the 'object' element.
|
||||
]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="default-autowire-candidates" type="xsd:string" use="optional" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
</xsd:schema>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
<!-- TODO select form system db all errors that have 'incorrect syntax' at the start of the error string-->
|
||||
<property name="ErrorCodes.BadSqlGrammarCodes">
|
||||
<value>156,170,207,208</value>
|
||||
<value>102,156,170,207,208</value>
|
||||
</property>
|
||||
<property name="ErrorCodes.PermissionDeniedCodes">
|
||||
<value>229</value>
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
<!-- TODO select form system db all errors that have 'incorrect syntax' at the start of the error string-->
|
||||
<property name="ErrorCodes.BadSqlGrammarCodes">
|
||||
<value>156,170,207,208</value>
|
||||
<value>102,156,170,207,208</value>
|
||||
</property>
|
||||
<property name="ErrorCodes.PermissionDeniedCodes">
|
||||
<value>229</value>
|
||||
@@ -112,7 +112,7 @@
|
||||
|
||||
<!-- TODO select form system db all errors that have 'incorrect syntax' at the start of the error string-->
|
||||
<property name="ErrorCodes.BadSqlGrammarCodes">
|
||||
<value>156,170,207,208</value>
|
||||
<value>102,156,170,207,208</value>
|
||||
</property>
|
||||
<property name="ErrorCodes.PermissionDeniedCodes">
|
||||
<value>229</value>
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Spring.Transaction.Support
|
||||
//TODO Refactoring to sync with Spring 2.0 for nt/enums for various default values.
|
||||
|
||||
private TransactionPropagation _transactionPropagation = TransactionPropagation.Required;
|
||||
private IsolationLevel _transactionIsolationLevel = IsolationLevel.ReadCommitted;
|
||||
private IsolationLevel _transactionIsolationLevel = IsolationLevel.Unspecified;
|
||||
private int _timeout = DefaultTransactionDefinition.TIMEOUT_DEFAULT;
|
||||
private bool _readOnly = false;
|
||||
private string _name = null;
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace Spring.Messaging.Ems.Connections
|
||||
protected override void DoBegin(object transaction, ITransactionDefinition definition)
|
||||
{
|
||||
//This is the default value defined in DefaultTransactionDefinition
|
||||
if (definition.TransactionIsolationLevel != IsolationLevel.ReadCommitted)
|
||||
if (definition.TransactionIsolationLevel != IsolationLevel.Unspecified)
|
||||
{
|
||||
throw new InvalidIsolationLevelException("EMS does not support an isoliation level concept");
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace Spring.Messaging.Nms.Connections
|
||||
protected override void DoBegin(object transaction, ITransactionDefinition definition)
|
||||
{
|
||||
//This is the default value defined in DefaultTransactionDefinition
|
||||
if (definition.TransactionIsolationLevel != IsolationLevel.ReadCommitted)
|
||||
if (definition.TransactionIsolationLevel != IsolationLevel.Unspecified)
|
||||
{
|
||||
throw new InvalidIsolationLevelException("NMS does not support an isoliation level concept");
|
||||
}
|
||||
|
||||
@@ -31,18 +31,47 @@ namespace Spring.Core.TypeConversion
|
||||
/// This class contains tests for TypeConversionUtils
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack</author>
|
||||
/// <author>Andreas Kluth</author>
|
||||
[TestFixture]
|
||||
public class TypeConversionUtilsTests
|
||||
{
|
||||
|
||||
#if NET_2_0
|
||||
[Test]
|
||||
public void NullAbleTest()
|
||||
{
|
||||
object o = TypeConversionUtils.ConvertValueIfNecessary(typeof(DateTime?), "", "bla");
|
||||
Assert.IsNull(o);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
[SetCulture( "en-US" )]
|
||||
public void ConvertValueForDecimalMarkWithPointReturnsValue()
|
||||
{
|
||||
object o = TypeConversionUtils.ConvertValueIfNecessary( typeof( Double ), "1.2", "foo" );
|
||||
Assert.That( o, Is.EqualTo( 1.2 ) );
|
||||
}
|
||||
|
||||
[Test]
|
||||
[SetCulture( "en-US" )]
|
||||
public void ConvertValueForDecimalMarkWithCommaFails()
|
||||
{
|
||||
TestDelegate testDelegate = () => TypeConversionUtils.ConvertValueIfNecessary( typeof( Double ), "1,2", "foo" );
|
||||
Assert.Throws<TypeMismatchException>( testDelegate );
|
||||
}
|
||||
|
||||
[Test]
|
||||
[SetCulture( "nl-NL" )]
|
||||
public void ConvertValueWithDutchCultureForDecimalMarkWithPointReturnsValue()
|
||||
{
|
||||
object o = TypeConversionUtils.ConvertValueIfNecessary( typeof( Double ), "1.2", "foo" );
|
||||
Assert.That( o, Is.EqualTo( 1.2 ) );
|
||||
}
|
||||
|
||||
[Test]
|
||||
[SetCulture( "nl-NL" )]
|
||||
public void ConvertValueWithDutchCultureForDecimalMarkWithCommaReturnsValue()
|
||||
{
|
||||
object o = TypeConversionUtils.ConvertValueIfNecessary( typeof( Double ), "1,2", "foo" );
|
||||
Assert.That( o, Is.EqualTo( 1.2 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<objects xmlns="http://www.springframework.net"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd"
|
||||
default-destroy-method="CustomDestroy">
|
||||
|
||||
<object id="destroy-method1"
|
||||
type="Spring.Objects.Factory.Xml.XmlObjectFactoryTests+DefaultDestroyer, Spring.Core.Tests"
|
||||
lazy-init="true" />
|
||||
|
||||
<object id="destroy-method2"
|
||||
type="Spring.Objects.Factory.Xml.XmlObjectFactoryTests+DefaultDestroyer, Spring.Core.Tests"
|
||||
lazy-init="true"
|
||||
destroy-method="" />
|
||||
|
||||
</objects>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<objects xmlns="http://www.springframework.net"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd"
|
||||
default-init-method="Init">
|
||||
|
||||
<object id="init-method1"
|
||||
type="Spring.Objects.Factory.Xml.XmlObjectFactoryTests+DoubleInitializer, Spring.Core.Tests">
|
||||
<property name="num">
|
||||
<value>7</value>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
<object id="init-method2"
|
||||
type="Spring.Objects.Factory.Xml.XmlObjectFactoryTests+DoubleInitializer, Spring.Core.Tests"
|
||||
init-method="">
|
||||
<property name="num">
|
||||
<value>7</value>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
</objects>
|
||||
@@ -1608,6 +1608,36 @@ namespace Spring.Objects.Factory
|
||||
Assert.AreEqual(ExpectedAge, child.Age);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetObjectByTypeWithAmbiguity()
|
||||
{
|
||||
DefaultListableObjectFactory lbf = new DefaultListableObjectFactory();
|
||||
RootObjectDefinition bd1 = new RootObjectDefinition(typeof(TestObject));
|
||||
RootObjectDefinition bd2 = new RootObjectDefinition(typeof(TestObject));
|
||||
lbf.RegisterObjectDefinition("bd1", bd1);
|
||||
lbf.RegisterObjectDefinition("bd2", bd2);
|
||||
|
||||
Assert.That(delegate { lbf.GetObject<TestObject>(); }, Throws.Exception.TypeOf<NoSuchObjectDefinitionException>());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetObjectByTypeFiltersOutNonAutowireCandidates()
|
||||
{
|
||||
DefaultListableObjectFactory lbf = new DefaultListableObjectFactory();
|
||||
RootObjectDefinition bd1 = new RootObjectDefinition(typeof(TestObject));
|
||||
RootObjectDefinition bd2 = new RootObjectDefinition(typeof(TestObject));
|
||||
RootObjectDefinition na1 = new RootObjectDefinition(typeof(TestObject));
|
||||
na1.IsAutowireCandidate = false;
|
||||
|
||||
lbf.RegisterObjectDefinition("bd1", bd1);
|
||||
lbf.RegisterObjectDefinition("na1", na1);
|
||||
TestObject actual = lbf.GetObject<TestObject>(); // na1 was filtered
|
||||
Assert.That(lbf.GetObject("bd1", typeof(TestObject)), Is.SameAs(actual));
|
||||
|
||||
lbf.RegisterObjectDefinition("bd2", bd2);
|
||||
Assert.That(delegate { lbf.GetObject<TestObject>(); }, Throws.Exception.TypeOf<NoSuchObjectDefinitionException>());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetObjectDefinitionResolvesAliases()
|
||||
{
|
||||
|
||||
@@ -354,5 +354,37 @@ namespace Spring.Objects.Factory.Xml
|
||||
Assert.AreEqual("test1", od2.DependsOn[0]);
|
||||
Assert.AreEqual(DependencyCheckingMode.Simple, od2.DependencyCheck);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ParsesAutowireCandidate()
|
||||
{
|
||||
DefaultListableObjectFactory of = new DefaultListableObjectFactory();
|
||||
XmlObjectDefinitionReader reader = new XmlObjectDefinitionReader(of);
|
||||
reader.LoadObjectDefinitions(new StringResource(
|
||||
@"<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<objects xmlns='http://www.springframework.net' default-autowire-candidates='test1*,test4*'>
|
||||
<object id='test1' type='Spring.Objects.TestObject, Spring.Core.Tests' />
|
||||
<object id='test2' type='Spring.Objects.TestObject, Spring.Core.Tests' autowire-candidate='false' />
|
||||
<object id='test3' type='Spring.Objects.TestObject, Spring.Core.Tests' autowire-candidate='true' />
|
||||
<object id='test4' type='Spring.Objects.TestObject, Spring.Core.Tests' autowire-candidate='default' />
|
||||
<object id='test5' type='Spring.Objects.TestObject, Spring.Core.Tests' autowire-candidate='default' />
|
||||
</objects>
|
||||
"));
|
||||
var od = (AbstractObjectDefinition)of.GetObjectDefinition("test1");
|
||||
Assert.That(od.IsAutowireCandidate, Is.True, "No attribute set should default to true");
|
||||
|
||||
od = (AbstractObjectDefinition)of.GetObjectDefinition("test2");
|
||||
Assert.That(od.IsAutowireCandidate, Is.False, "Specifically attribute set to false should set to false");
|
||||
|
||||
od = (AbstractObjectDefinition)of.GetObjectDefinition("test3");
|
||||
Assert.That(od.IsAutowireCandidate, Is.True, "Specifically attribute set to true should set to false");
|
||||
|
||||
od = (AbstractObjectDefinition)of.GetObjectDefinition("test4");
|
||||
Assert.That(od.IsAutowireCandidate, Is.True, "Attribute set to default should check pattern and return true");
|
||||
|
||||
od = (AbstractObjectDefinition)of.GetObjectDefinition("test5");
|
||||
Assert.That(od.IsAutowireCandidate, Is.False, "Attribute set to default should check pattern and return false");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -884,6 +884,26 @@ namespace Spring.Objects.Factory.Xml
|
||||
Assert.AreEqual(14, in_Renamed.Num);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DefaultInitMethodIsInvoked()
|
||||
{
|
||||
IResource resource = new ReadOnlyXmlTestResource("default-initializers.xml", GetType());
|
||||
XmlObjectFactory xof = new XmlObjectFactory(resource);
|
||||
DoubleInitializer in_Renamed = (DoubleInitializer)xof.GetObject("init-method1");
|
||||
// Initializer should have doubled value
|
||||
Assert.AreEqual(14, in_Renamed.Num);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DefaultInitMethodDisabled()
|
||||
{
|
||||
IResource resource = new ReadOnlyXmlTestResource("default-initializers.xml", GetType());
|
||||
XmlObjectFactory xof = new XmlObjectFactory(resource);
|
||||
DoubleInitializer in_Renamed = (DoubleInitializer)xof.GetObject("init-method2");
|
||||
// Initializer should have doubled value
|
||||
Assert.AreEqual(7, in_Renamed.Num);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test that if a custom initializer throws an exception, it's handled correctly.
|
||||
/// </summary>
|
||||
@@ -935,6 +955,30 @@ namespace Spring.Objects.Factory.Xml
|
||||
Assert.IsTrue(iib.destroyed && iib.customDestroyed);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DefaultDestroyMethodInvoked()
|
||||
{
|
||||
IResource resource = new ReadOnlyXmlTestResource("default-destroy-methods.xml", GetType());
|
||||
XmlObjectFactory xof = new XmlObjectFactory(resource);
|
||||
xof.PreInstantiateSingletons();
|
||||
DefaultDestroyer dd = (DefaultDestroyer)xof.GetObject("destroy-method1");
|
||||
Assert.IsTrue(!dd.customDestroyed);
|
||||
xof.Dispose();
|
||||
Assert.IsTrue(dd.customDestroyed);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DefaultDestroyMethodDisabled()
|
||||
{
|
||||
IResource resource = new ReadOnlyXmlTestResource("default-destroy-methods.xml", GetType());
|
||||
XmlObjectFactory xof = new XmlObjectFactory(resource);
|
||||
xof.PreInstantiateSingletons();
|
||||
DefaultDestroyer dd = (DefaultDestroyer)xof.GetObject("destroy-method2");
|
||||
Assert.IsTrue(!dd.customDestroyed);
|
||||
xof.Dispose();
|
||||
Assert.IsTrue(!dd.customDestroyed);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MultiThreadedLazyInit()
|
||||
{
|
||||
@@ -1942,6 +1986,16 @@ namespace Spring.Objects.Factory.Xml
|
||||
}
|
||||
}
|
||||
|
||||
public class DefaultDestroyer
|
||||
{
|
||||
public bool customDestroyed;
|
||||
|
||||
public void CustomDestroy()
|
||||
{
|
||||
customDestroyed = true;
|
||||
}
|
||||
}
|
||||
|
||||
public class InitAndIB : IInitializingObject, IDisposable
|
||||
{
|
||||
public static bool constructed;
|
||||
|
||||
@@ -265,6 +265,7 @@
|
||||
<Compile Include="Core\TypeConversion\StreamConverterTests.cs" />
|
||||
<Compile Include="Core\TypeConversion\StringArrayConverterTests.cs" />
|
||||
<Compile Include="Core\TypeConversion\TimeSpanConverterTests.cs" />
|
||||
<Compile Include="Core\TypeConversion\TypeConversionUtilsTests.cs" />
|
||||
<Compile Include="Core\TypeConversion\TypeConverterRegistryTests.cs" />
|
||||
<Compile Include="Core\TypeConversion\UriConverterTests.cs" />
|
||||
<Compile Include="Core\TypeResolution\CachedTypeResolverTests.cs" />
|
||||
|
||||
@@ -267,6 +267,7 @@
|
||||
<Compile Include="Core\TypeConversion\StreamConverterTests.cs" />
|
||||
<Compile Include="Core\TypeConversion\StringArrayConverterTests.cs" />
|
||||
<Compile Include="Core\TypeConversion\TimeSpanConverterTests.cs" />
|
||||
<Compile Include="Core\TypeConversion\TypeConversionUtilsTests.cs" />
|
||||
<Compile Include="Core\TypeConversion\TypeConverterRegistryTests.cs" />
|
||||
<Compile Include="Core\TypeConversion\UriConverterTests.cs" />
|
||||
<Compile Include="Core\TypeResolution\CachedTypeResolverTests.cs" />
|
||||
@@ -839,6 +840,8 @@
|
||||
<Content Include="Data\Spring\Objects\Factory\Xml\collectionMergingGeneric.xml" />
|
||||
<Content Include="Data\Spring\Objects\Factory\Xml\collectionMerging.xml" />
|
||||
<Content Include="Data\Spring\Objects\Factory\Xml\collectionConversionGeneric.xml" />
|
||||
<Content Include="Data\Spring\Objects\Factory\Xml\default-destroy-methods.xml" />
|
||||
<Content Include="Data\Spring\Objects\Factory\Xml\default-initializers.xml" />
|
||||
<Content Include="Data\Spring\Objects\Factory\Xml\ctor-args.xml" />
|
||||
<Content Include="Data\Spring\Objects\Factory\Xml\objectNameGeneration.xml" />
|
||||
<Content Include="Data\Spring\Objects\Factory\Xml\simple-constructor-arg.xml" />
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Spring.Data
|
||||
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Ignore("Sanity-Check tests intended for verification of base-class behavior only")]
|
||||
[Test]
|
||||
public void SimpleCreate()
|
||||
{
|
||||
@@ -68,7 +68,7 @@ namespace Spring.Data
|
||||
dao.Create("John", 44);
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Ignore("Sanity-Check tests intended for verification of base-class behavior only")]
|
||||
[Test]
|
||||
public void SimpleDao()
|
||||
{
|
||||
@@ -87,7 +87,7 @@ namespace Spring.Data
|
||||
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Ignore("Sanity-Check tests intended for verification of base-class behavior only")]
|
||||
[Test]
|
||||
public void SimpleDao2()
|
||||
{
|
||||
@@ -99,7 +99,7 @@ namespace Spring.Data
|
||||
Assert.AreEqual(1, dao.GetCountByDelegate());
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Ignore("Sanity-Check tests intended for verification of base-class behavior only")]
|
||||
[Test]
|
||||
public void DaoOperations()
|
||||
{
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
CREATE PROCEDURE CreateTestObject
|
||||
{
|
||||
@Age int,
|
||||
@Name varchar(15)
|
||||
} AS
|
||||
|
||||
INSERT INTO into TestObjects(Age, Name) VALUES (@Age, @Name)
|
||||
@@ -1,51 +0,0 @@
|
||||
USE [CreditsAndDebits]
|
||||
CREATE TABLE [Credits](
|
||||
[CreditID] [int] IDENTITY NOT NULL,
|
||||
[CreditAmount] [float] NOT NULL,
|
||||
CONSTRAINT [PK_CreditID] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[CreditID] ASC
|
||||
) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
|
||||
USE [CreditsAndDebits]
|
||||
GO
|
||||
CREATE TABLE [Debits](
|
||||
[DebitID] [int] IDENTITY NOT NULL,
|
||||
[DebitAmount] [float] NOT NULL,
|
||||
CONSTRAINT [PK_DebitID] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[DebitID] ASC
|
||||
) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
|
||||
|
||||
USE [Credits]
|
||||
GO
|
||||
CREATE TABLE [Credits](
|
||||
[CreditID] [int] IDENTITY NOT NULL,
|
||||
[CreditAmount] [float] NOT NULL,
|
||||
CONSTRAINT [PK_CreditID] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[CreditID] ASC
|
||||
) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
|
||||
USE [Debits]
|
||||
GO
|
||||
CREATE TABLE [Debits](
|
||||
[DebitID] [int] IDENTITY NOT NULL,
|
||||
[DebitAmount] [float] NOT NULL,
|
||||
CONSTRAINT [PK_DebitID] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[DebitID] ASC
|
||||
) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
|
||||
<object id="DbProvider" type="Spring.Data.Support.SqlProvider, Spring.Data">
|
||||
<property name="ConnectionString"
|
||||
value="Data Source=NYCSUMPOLLL;Initial Catalog=Credits;Integrated Security=True"/>
|
||||
value="Data Source=SPRINGQA;Initial Catalog=Credits;Integrated Security=false;User Id=springqa;Password=springqa"/>
|
||||
</object>
|
||||
|
||||
|
||||
<object id="DebitDbProvider" type="Spring.Data.Support.SqlProvider, Spring.Data">
|
||||
<property name="ConnectionString"
|
||||
value="Data Source=NYCSUMPOLLL;Initial Catalog=Debits;Integrated Security=True"/>
|
||||
value="Data Source=SPRINGQA;Initial Catalog=Debits;Integrated Security=false;User Id=springqa;Password=springqa"/>
|
||||
</object>
|
||||
|
||||
|
||||
|
||||
@@ -11,16 +11,16 @@
|
||||
|
||||
<d:provider id="DebitDbProvider"
|
||||
provider="SqlServer-2.0"
|
||||
connectionString="Data Source=MARKT60\SQL2005;Initial Catalog=Debits;Persist Security Info=True;User ID=springqa;Password=springqa"/>
|
||||
connectionString="Data Source=SPRINGQA;Initial Catalog=Debits;Persist Security Info=True;User ID=springqa;Password=springqa"/>
|
||||
<!--
|
||||
connectionString="Data Source=NYCSUMPOLLL\SQLEXPRESS;Initial Catalog=Debits;Integrated Security=True;Pooling=False"/>
|
||||
connectionString="Data Source=SPRINGQA\SQLEXPRESS;Initial Catalog=Debits;Integrated Security=True;Pooling=False"/>
|
||||
-->
|
||||
|
||||
<d:provider id="DbProvider"
|
||||
provider="SqlServer-2.0"
|
||||
connectionString="Data Source=MARKT60\SQL2005;Initial Catalog=Credits;Persist Security Info=True;User ID=springqa;Password=springqa"/>
|
||||
connectionString="Data Source=SPRINGQA;Initial Catalog=Credits;Persist Security Info=True;User ID=springqa;Password=springqa"/>
|
||||
<!--
|
||||
connectionString="Data Source=NYCSUMPOLLL\SQLEXPRESS;Initial Catalog=Credits;Integrated Security=True;Pooling=False"/>
|
||||
connectionString="Data Source=SPRINGQA\SQLEXPRESS;Initial Catalog=Credits;Integrated Security=True;Pooling=False"/>
|
||||
-->
|
||||
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
<!-- Database Providers -->
|
||||
<d:provider id="DbProvider"
|
||||
provider="SqlServer-2.0"
|
||||
connectionString="Data Source=NYCSUMPOLLL\SQLEXPRESS;Initial Catalog=Credits;Integrated Security=True;Pooling=False"/>
|
||||
connectionString="Data Source=SPRINGQA;Initial Catalog=Credits;Integrated Security=false;User Id=springqa;Password=springqa;Pooling=False"/>
|
||||
|
||||
<d:provider id="DbProvider"
|
||||
<d:provider id="DebitDbProvider"
|
||||
provider="SqlServer-2.0"
|
||||
connectionString="Data Source=NYCSUMPOLLL\SQLEXPRESS;Initial Catalog=Debits;Integrated Security=True;Pooling=False"/>
|
||||
connectionString="Data Source=SPRINGQA;Initial Catalog=Debits;Integrated Security=false;User Id=springqa;Password=springqa;Pooling=False"/>
|
||||
|
||||
|
||||
<!-- Transaction Manager -->
|
||||
|
||||
@@ -44,41 +44,63 @@ namespace Spring.Data.Generic
|
||||
"assembly://Spring.Data.Integration.Tests/Spring.Data.Generic/GenericAdoTemplateTests.xml");
|
||||
|
||||
adoTemplate = ctx["adoTemplate"] as AdoTemplate;
|
||||
|
||||
RemoveTestData();
|
||||
PopulateTestData();
|
||||
}
|
||||
|
||||
private void PopulateTestData()
|
||||
{
|
||||
adoTemplate.ExecuteScalar(CommandType.Text, "insert into TestObjects values (10, 'Jack')");
|
||||
adoTemplate.ExecuteScalar(CommandType.Text, "insert into TestObjects values (20, 'Jill')");
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
RemoveTestData();
|
||||
}
|
||||
|
||||
private void RemoveTestData()
|
||||
{
|
||||
adoTemplate.ExecuteNonQuery(CommandType.Text, "delete TestObjects");
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void CommandDelegateUsage()
|
||||
{
|
||||
string postalCode = "1010";
|
||||
string name = "Jack";
|
||||
int count = adoTemplate.Execute<int>(delegate(DbCommand command)
|
||||
{
|
||||
command.CommandText =
|
||||
"select count(*) from Customers where PostalCode = @PostalCode";
|
||||
"select count(*) from TestObjects where Name = @Name";
|
||||
|
||||
DbParameter p = command.CreateParameter();
|
||||
p.ParameterName = "@PostalCode";
|
||||
p.Value = postalCode;
|
||||
p.ParameterName = "@Name";
|
||||
p.Value = name;
|
||||
command.Parameters.Add(p);
|
||||
|
||||
return (int) command.ExecuteScalar();
|
||||
});
|
||||
Assert.AreEqual(3, count);
|
||||
Assert.AreEqual(1, count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CommandDelegateUsageDownCast()
|
||||
{
|
||||
string postalCode = "1010";
|
||||
string name = "Jack";
|
||||
int count = adoTemplate.Execute<int>(delegate(DbCommand command)
|
||||
{
|
||||
SqlCommand sqlCommand = command as SqlCommand;
|
||||
command.CommandText =
|
||||
"select count(*) from Customers where PostalCode = @PostalCode";
|
||||
"select count(*) from TestObjects where Name = @Name";
|
||||
|
||||
sqlCommand.Parameters.AddWithValue("@PostalCode", postalCode);
|
||||
sqlCommand.Parameters.AddWithValue("@Name", name);
|
||||
|
||||
return (int) command.ExecuteScalar();
|
||||
});
|
||||
Assert.AreEqual(3, count);
|
||||
Assert.AreEqual(1, count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<db:provider id="dbProvider"
|
||||
provider="SqlServer-1.1"
|
||||
connectionString="Data Source=MARKT60\SQL2005;Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
|
||||
connectionString="Data Source=SPRINGQA;Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
|
||||
|
||||
<object id="transactionManager" type="Spring.Data.Core.AdoPlatformTransactionManager, Spring.Data">
|
||||
<property name="DbProvider" ref="dbProvider"/>
|
||||
|
||||
@@ -7,5 +7,7 @@ namespace Spring.Data
|
||||
void SaveTwoTestObjects(TestObject to1, TestObject to2);
|
||||
|
||||
void DeleteTwoTestObjects(string name1, string name2);
|
||||
|
||||
void DeleteAllTestObjects();
|
||||
}
|
||||
}
|
||||
@@ -27,73 +27,97 @@ using NUnit.Framework;
|
||||
using Spring.Context;
|
||||
using Spring.Context.Support;
|
||||
using Spring.Data.Common;
|
||||
using Spring.Objects;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Test a MappingAdoQuery implementation
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack (.NET)</author>
|
||||
[TestFixture]
|
||||
public class MappingAdoQueryTests
|
||||
{
|
||||
#region Fields
|
||||
IDbProvider dbProvider;
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Test a MappingAdoQuery implementation
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack (.NET)</author>
|
||||
[TestFixture]
|
||||
public class MappingAdoQueryTests
|
||||
{
|
||||
#region Fields
|
||||
IDbProvider dbProvider;
|
||||
#endregion
|
||||
|
||||
#region Constants
|
||||
#region Constants
|
||||
|
||||
/// <summary>
|
||||
/// The shared ILog instance for this class (and derived classes).
|
||||
/// </summary>
|
||||
protected static readonly ILog log =
|
||||
LogManager.GetLogger(typeof (MappingAdoQueryTests));
|
||||
/// <summary>
|
||||
/// The shared ILog instance for this class (and derived classes).
|
||||
/// </summary>
|
||||
protected static readonly ILog log =
|
||||
LogManager.GetLogger(typeof(MappingAdoQueryTests));
|
||||
|
||||
#endregion
|
||||
private IApplicationContext ctx;
|
||||
|
||||
#region Constructor (s)
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MappingAdoQueryTests"/> class.
|
||||
/// </summary>
|
||||
public MappingAdoQueryTests()
|
||||
{
|
||||
#endregion
|
||||
|
||||
}
|
||||
#region Constructor (s)
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MappingAdoQueryTests"/> class.
|
||||
/// </summary>
|
||||
public MappingAdoQueryTests()
|
||||
{
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region Properties
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
#region Properties
|
||||
|
||||
#region Methods
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
[SetUp]
|
||||
public void CreateDbProvider()
|
||||
{
|
||||
IApplicationContext ctx =
|
||||
new XmlApplicationContext("assembly://Spring.Data.Integration.Tests/Spring.Data/adoTemplateTests.xml");
|
||||
ctx = new XmlApplicationContext("assembly://Spring.Data.Integration.Tests/Spring.Data/adoTemplateTests.xml");
|
||||
Assert.IsNotNull(ctx);
|
||||
dbProvider = ctx["DbProvider"] as IDbProvider;
|
||||
Assert.IsNotNull(dbProvider);
|
||||
|
||||
DeleteTestData();
|
||||
PopulateTestData();
|
||||
}
|
||||
|
||||
private void PopulateTestData()
|
||||
{
|
||||
ITestObjectManager testObjectManager = ctx["testObjectManager"] as ITestObjectManager;
|
||||
testObjectManager.SaveTwoTestObjects(new TestObject("Jack", 10), new TestObject("Jill", 20));
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void _TestTearDown()
|
||||
{
|
||||
DeleteTestData();
|
||||
}
|
||||
|
||||
private void DeleteTestData()
|
||||
{
|
||||
ITestObjectManager testObjectManager = ctx["testObjectManager"] as ITestObjectManager;
|
||||
testObjectManager.DeleteAllTestObjects();
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void MappingAdoQuery()
|
||||
{
|
||||
TestObjectQuery testObjectQuery = new TestObjectQuery(dbProvider);
|
||||
IDictionary inParams = new Hashtable();
|
||||
inParams.Add("@Name", "Jack");
|
||||
IList testObjectList = testObjectQuery.QueryByNamedParam(inParams);
|
||||
Assert.AreEqual(1, testObjectList.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MappingAdoQuery()
|
||||
{
|
||||
TestObjectQuery testObjectQuery = new TestObjectQuery(dbProvider);
|
||||
IDictionary inParams = new Hashtable();
|
||||
inParams.Add("UName", "George");
|
||||
IList testObjectList = testObjectQuery.QueryByNamedParam(inParams);
|
||||
Assert.AreEqual(2, testObjectList.Count);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,10 +31,10 @@ using Spring.Context.Support;
|
||||
|
||||
namespace Spring.Data
|
||||
{
|
||||
[TestFixture]
|
||||
public class NativeAdoTests
|
||||
{
|
||||
[Test]
|
||||
[TestFixture]
|
||||
public class NativeAdoTests
|
||||
{
|
||||
[Test]
|
||||
public void SimpleUsage()
|
||||
{
|
||||
IApplicationContext ctx =
|
||||
@@ -45,21 +45,18 @@ namespace Spring.Data
|
||||
dao.Create("John", 45);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Helloworld()
|
||||
{
|
||||
string connString =
|
||||
@"Data Source=MARKT60\SQL2005;Initial Catalog=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False";
|
||||
[Test]
|
||||
public void Helloworld()
|
||||
{
|
||||
string connString =
|
||||
@"Data Source=SPRINGQA;Initial Catalog=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False";
|
||||
|
||||
SqlConnection conn = new SqlConnection(connString);
|
||||
conn.Open();
|
||||
SqlConnection conn = new SqlConnection(connString);
|
||||
conn.Open();
|
||||
//conn.BeginTransaction(IsolationLevel.Unspecified);
|
||||
SqlTransaction trans = conn.BeginTransaction();
|
||||
Console.WriteLine(trans.IsolationLevel);
|
||||
//conn.BeginTransaction(IsolationLevel.Unspecified);
|
||||
SqlTransaction trans = conn.BeginTransaction();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Assert.That(trans.IsolationLevel, Is.EqualTo(IsolationLevel.ReadCommitted));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Spring.Data
|
||||
public void TxTemplate()
|
||||
{
|
||||
IDbProvider dbProvider = DbProviderFactory.GetDbProvider("System.Data.SqlClient");
|
||||
dbProvider.ConnectionString = @"Data Source=MARKT60\SQL2005;Initial Catalog=CreditsAndDebits;User ID=springqa; Password=springqa";
|
||||
dbProvider.ConnectionString = @"Data Source=SPRINGQA;Initial Catalog=CreditsAndDebits;User ID=springqa; Password=springqa";
|
||||
//IPlatformTransactionManager tm = new ServiceDomainPlatformTransactionManager();
|
||||
//IPlatformTransactionManager tm = new TxScopeTransactionManager();
|
||||
IPlatformTransactionManager tm = new AdoPlatformTransactionManager(dbProvider);
|
||||
@@ -95,7 +95,7 @@ namespace Spring.Data
|
||||
using (SqlConnection cn2005 = new SqlConnection())
|
||||
{
|
||||
cn2005.ConnectionString =
|
||||
@"Data Source=MARKT60\SQL2005;Initial Catalog=CreditsAndDebits;User ID=springqa; Password=springqa";
|
||||
@"Data Source=SPRINGQA;Initial Catalog=CreditsAndDebits;User ID=springqa; Password=springqa";
|
||||
SqlCommand cmd = new SqlCommand(updateSql1, cn2005);
|
||||
cn2005.Open();
|
||||
cmd.ExecuteNonQuery();
|
||||
@@ -118,7 +118,7 @@ namespace Spring.Data
|
||||
System.Transactions.Transaction.Current.TransactionInformation.LocalIdentifier);
|
||||
using (SqlConnection cn2005 = new SqlConnection())
|
||||
{
|
||||
cn2005.ConnectionString = @"Data Source=MARKT60\SQL2005;Initial Catalog=CreditsAndDebits;User ID=springqa; Password=springqa";
|
||||
cn2005.ConnectionString = @"Data Source=SPRINGQA;Initial Catalog=CreditsAndDebits;User ID=springqa; Password=springqa";
|
||||
SqlCommand cmd = new SqlCommand(updateSql2, cn2005);
|
||||
cn2005.Open();
|
||||
cmd.ExecuteNonQuery();
|
||||
@@ -153,7 +153,7 @@ namespace Spring.Data
|
||||
|
||||
using (SqlConnection cn2005 = new SqlConnection())
|
||||
{
|
||||
cn2005.ConnectionString = @"Data Source=MARKT60\SQL2005;Initial Catalog=CreditsAndDebits;User ID=springqa; Password=springqa";
|
||||
cn2005.ConnectionString = @"Data Source=SPRINGQA;Initial Catalog=CreditsAndDebits;User ID=springqa; Password=springqa";
|
||||
SqlCommand cmd = new SqlCommand(updateSql2, cn2005);
|
||||
cn2005.Open();
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Spring.Data.Northwind
|
||||
|
||||
public Shipper Create(string name, string phone)
|
||||
{
|
||||
string connectionString = "Data Source=NYCSUMPOLLL;Initial Catalog=Northwind;Persist Security Info=True;User ID=springqa";
|
||||
string connectionString = "Data Source=SPRINGQA;Initial Catalog=Northwind;Persist Security Info=True;User ID=springqa;Password=springqa";
|
||||
int id = 0;
|
||||
using (SqlConnection connection = new SqlConnection(connectionString))
|
||||
{
|
||||
@@ -66,7 +66,7 @@ namespace Spring.Data.Northwind
|
||||
|
||||
public Shipper CreateShorter(string name, string phone)
|
||||
{
|
||||
string connectionString = "Data Source=NYCSUMPOLLL;Initial Catalog=Northwind;Persist Security Info=True;User ID=springqa";
|
||||
string connectionString = "Data Source=SPRINGQA;Initial Catalog=Northwind;Persist Security Info=True;User ID=springqa";
|
||||
int id = 0;
|
||||
using (SqlConnection connection = new SqlConnection(connectionString))
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Reflection;
|
||||
using NUnit.Framework;
|
||||
using Spring.Data.Common;
|
||||
@@ -41,11 +42,64 @@ namespace Spring.Data.Objects.Generic
|
||||
[TestFixture]
|
||||
public class StoredProcedureTests
|
||||
{
|
||||
private IDbProvider _dbProvider;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_dbProvider = DbProviderFactory.GetDbProvider("System.Data.SqlClient");
|
||||
_dbProvider.ConnectionString =
|
||||
@"Data Source=SPRINGQA;Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False";
|
||||
|
||||
IDbCommand command = _dbProvider.CreateCommand();
|
||||
command.Connection = _dbProvider.CreateConnection();
|
||||
|
||||
ClearTestData(command);
|
||||
CreateTestData(command);
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
IDbCommand command = _dbProvider.CreateCommand();
|
||||
command.Connection = _dbProvider.CreateConnection();
|
||||
|
||||
ClearTestData(command);
|
||||
}
|
||||
|
||||
private void CreateTestData(IDbCommand command)
|
||||
{
|
||||
command.Connection.Open();
|
||||
|
||||
command.CommandText = "insert into TestObjects(Name,Age) values ('Jack', 10)";
|
||||
command.ExecuteNonQuery();
|
||||
|
||||
command.CommandText = "insert into TestObjects(Name,Age) values ('Jill', 20)";
|
||||
command.ExecuteNonQuery();
|
||||
|
||||
command.CommandText = "insert into Vacations(FirstName,LastName,EmployeeId,StartDate,EndDate) values ('Jack', 'Doe', 200, '1/1/2010', '1/15/2010')";
|
||||
command.ExecuteNonQuery();
|
||||
|
||||
command.CommandText = "insert into Vacations(FirstName,LastName,EmployeeId,StartDate,EndDate) values ('Jack', 'Doe', 200, '2/1/2010', '2/15/2010')";
|
||||
command.ExecuteNonQuery();
|
||||
|
||||
command.Connection.Close();
|
||||
}
|
||||
|
||||
private void ClearTestData(IDbCommand command)
|
||||
{
|
||||
command.Connection.Open();
|
||||
|
||||
command.CommandText = "truncate table TestObjects";
|
||||
command.ExecuteNonQuery();
|
||||
|
||||
command.CommandText = "truncate table Vacations";
|
||||
command.ExecuteNonQuery();
|
||||
|
||||
command.Connection.Close();
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void TestReflection()
|
||||
{
|
||||
@@ -102,36 +156,38 @@ namespace Spring.Data.Objects.Generic
|
||||
MethodInfo methodInfo = rowMapperclosedType.GetMethod("MapRow", BINDING_FLAGS);
|
||||
|
||||
//MethodInfo genMethodInfo = methodInfo.MakeGenericMethod(genericArgumentType);
|
||||
object retVal = methodInfo.Invoke(rowmapper, new object[] { null, null});
|
||||
object retVal = methodInfo.Invoke(rowmapper, new object[] { null, null });
|
||||
Console.WriteLine("return val = " + retVal);
|
||||
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
public void SingleTableStoredProcedure_ReturnsResult()
|
||||
{
|
||||
IDbProvider dbProvider = DbProviderFactory.GetDbProvider("System.Data.SqlClient");
|
||||
dbProvider.ConnectionString =
|
||||
@"Data Source=MARKT60\SQL2005;Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False";
|
||||
TestObjectStoredProc sp = new TestObjectStoredProc(_dbProvider);
|
||||
IList<TestObject> testObjectList = sp.GetByName("Jack");
|
||||
|
||||
TestObjectStoredProc sp = new TestObjectStoredProc(dbProvider);
|
||||
IList<TestObject> testObjectList = sp.GetByName("George");
|
||||
|
||||
Assert.IsNotNull(testObjectList);
|
||||
|
||||
TestObjectandVacationStoredProc vsp = new TestObjectandVacationStoredProc(dbProvider);
|
||||
|
||||
System.Collections.IDictionary outParams = vsp.ExecStoreProc("George");
|
||||
Assert.That(testObjectList, Is.Not.Null);
|
||||
Assert.That(testObjectList, Has.Count.EqualTo(1));
|
||||
}
|
||||
|
||||
|
||||
testObjectList = outParams["testObjectRowMapper"] as IList<TestObject>;
|
||||
[Test]
|
||||
public void MultipleTableStoredProcedure_ReturnsResult()
|
||||
{
|
||||
TestObjectandVacationStoredProc vsp = new TestObjectandVacationStoredProc(_dbProvider);
|
||||
|
||||
IDictionary outParams = vsp.ExecStoreProc("Jack");
|
||||
|
||||
IList<TestObject> testObjectList = testObjectList = outParams["testObjectRowMapper"] as IList<TestObject>;
|
||||
Assert.IsNotNull(testObjectList);
|
||||
Assert.AreEqual(1, testObjectList.Count);
|
||||
|
||||
IList<Vacation> vacationList = outParams["vacationRowMapper"] as IList<Vacation>;
|
||||
Assert.IsNotNull(vacationList);
|
||||
Assert.AreEqual(2, vacationList.Count);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -153,14 +209,14 @@ namespace Spring.Data.Objects.Generic
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class TestObjectStoredProc : StoredProcedure
|
||||
{
|
||||
public TestObjectStoredProc(IDbProvider dbProvider)
|
||||
: base(dbProvider, "SelectByName")
|
||||
{
|
||||
{
|
||||
DeriveParameters();
|
||||
AddRowMapper("testObjectRowMapper", new TestObjectRowMapper() );
|
||||
AddRowMapper("testObjectRowMapper", new TestObjectRowMapper());
|
||||
Compile();
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace Spring.Data
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack (.NET)</author>
|
||||
[TestFixture]
|
||||
[Ignore("ORACLE-dependent tests disabled for integration runs")]
|
||||
public class OracleAdoTemplateTests
|
||||
{
|
||||
#region Setup/Teardown
|
||||
|
||||
@@ -53,43 +53,45 @@ namespace Spring.Data
|
||||
public void SqlServerTest()
|
||||
{
|
||||
string errorCode = "544";
|
||||
string[] errorCodes = new string[4] {"544", "2627", "8114", "8115"};
|
||||
string[] errorCodes = new string[4] { "544", "2627", "8114", "8115" };
|
||||
//Array.IndexOf()
|
||||
//Array.Sort(errorCodes);
|
||||
foreach (string code in errorCodes)
|
||||
{
|
||||
Console.WriteLine(code);
|
||||
}
|
||||
//if (Array.BinarySearch(errorCodes, errorCode) >= 0)
|
||||
//if (Array.BinarySearch(errorCodes, errorCode) >= 0)
|
||||
if (Array.IndexOf(errorCodes, errorCode) >= 0)
|
||||
{
|
||||
Console.WriteLine("yes");
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Fail("did not find error code");
|
||||
}
|
||||
{
|
||||
Console.WriteLine("yes");
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Fail("did not find error code");
|
||||
}
|
||||
IDbProvider dbProvider = DbProviderFactory.GetDbProvider("System.Data.SqlClient");
|
||||
dbProvider.ConnectionString =
|
||||
@"Data Source=MARKT60\SQL2005;Initial Catalog=Spring;Persist Security Info=True;User ID=springqa;Password=springqa";
|
||||
@"Data Source=SPRINGQA;Initial Catalog=Spring;Persist Security Info=True;User ID=springqa;Password=springqa";
|
||||
AdoTemplate adoTemplate = new AdoTemplate(dbProvider);
|
||||
try
|
||||
{
|
||||
adoTemplate.ExecuteNonQuery(CommandType.Text, "insert into Vacation (id) values (1)");
|
||||
} catch (Exception e)
|
||||
adoTemplate.ExecuteNonQuery(CommandType.Text, "insert into Vacations (FirstName,LastName) values ('Jack','Doe')");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.Write(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[Test]
|
||||
[Ignore("ORACLE-dependent tests disabled for integration runs")]
|
||||
public void OracleTest()
|
||||
{
|
||||
//Data Source=XE;User ID=hr;Unicode=True
|
||||
IDbProvider dbProvider = DbProviderFactory.GetDbProvider("System.Data.OracleClient");
|
||||
dbProvider.ConnectionString = "Data Source=XE;User ID=hr;Password=hr;Unicode=True";
|
||||
AdoTemplate adoTemplate = new AdoTemplate(dbProvider);
|
||||
decimal count = (decimal) adoTemplate.ExecuteScalar(CommandType.Text, "select count(*) from emp");
|
||||
decimal count = (decimal)adoTemplate.ExecuteScalar(CommandType.Text, "select count(*) from emp");
|
||||
Assert.AreEqual(14, count);
|
||||
|
||||
EmpProc empProc = new EmpProc(dbProvider);
|
||||
@@ -107,6 +109,7 @@ namespace Spring.Data
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("ODBC-dependent tests disabled for integration runs")]
|
||||
public void Test()
|
||||
{
|
||||
//IDbProvider dbProvider = DbProviderFactory.GetDbProvider("SybaseAse1.15");
|
||||
@@ -127,52 +130,53 @@ namespace Spring.Data
|
||||
}
|
||||
Assert.IsTrue(authorList.Count > 0);
|
||||
}
|
||||
/*
|
||||
[Test]
|
||||
public void StoredProc()
|
||||
{
|
||||
//IDbProvider dbProvider = DbProviderFactory.GetDbProvider("SybaseAse1.15");
|
||||
//dbProvider.ConnectionString = "Data Source='MARKT60';Port='5000';UID='sa';PWD='';Database='pubs2';";
|
||||
|
||||
|
||||
//IDbProvider dbProvider = DbProviderFactory.GetDbProvider("Odbc-2.0");
|
||||
//dbProvider.ConnectionString =
|
||||
// "Driver={Adaptive Server Enterprise};server=MARKT60;port=5000;Database=pubs2;uid=sa;pwd=;";
|
||||
|
||||
IDbProvider dbProvider = DbProviderFactory.GetDbProvider("SybaseAse-15");
|
||||
dbProvider.ConnectionString = "Data Source='MARKT60';Port='5000';UID='sa';PWD='';Database='pubs2';";
|
||||
HelloProc proc = new HelloProc(dbProvider);
|
||||
IDictionary dict = proc.GetResults();
|
||||
|
||||
Assert.AreEqual("Go Sybase", dict["@inoutParam"]);
|
||||
Assert.AreEqual("Hello mango", dict["@outParam"]);
|
||||
Assert.AreEqual(101, (int) dict["RETURN_VALUE"]);
|
||||
foreach (DictionaryEntry entry in dict)
|
||||
{
|
||||
Console.WriteLine("Key = " + entry.Key + ", Value = " + entry.Value);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void StordProcAdoTemplate()
|
||||
{
|
||||
IDbProvider dbProvider = DbProviderFactory.GetDbProvider("SybaseAse-15");
|
||||
dbProvider.ConnectionString = "Data Source='MARKT60';Port='5000';UID='sa';PWD='';Database='pubs2';";
|
||||
AdoTemplate adoTemplate = new AdoTemplate(dbProvider);
|
||||
IDbParameters parameters = new DbParameters(dbProvider);
|
||||
parameters.Add("inParam", AseDbType.VarChar, 32).Value = "mango";
|
||||
parameters.AddInOut("inoutParam", AseDbType.VarChar, 64).Value = "Sybase";
|
||||
parameters.AddOut("outParam", AseDbType.VarChar, 64);
|
||||
parameters.AddReturn("retValue", AseDbType.Integer);
|
||||
adoTemplate.ExecuteNonQuery(CommandType.StoredProcedure, "sp_hello", parameters);
|
||||
|
||||
|
||||
Assert.AreEqual("Go Sybase", parameters["@inoutParam"].Value);
|
||||
Assert.AreEqual("Hello mango", parameters[2].Value);
|
||||
Assert.AreEqual(101, (int) parameters[3].Value);
|
||||
}
|
||||
*/
|
||||
/*
|
||||
[Test]
|
||||
public void StoredProc()
|
||||
{
|
||||
//IDbProvider dbProvider = DbProviderFactory.GetDbProvider("SybaseAse1.15");
|
||||
//dbProvider.ConnectionString = "Data Source='MARKT60';Port='5000';UID='sa';PWD='';Database='pubs2';";
|
||||
|
||||
|
||||
//IDbProvider dbProvider = DbProviderFactory.GetDbProvider("Odbc-2.0");
|
||||
//dbProvider.ConnectionString =
|
||||
// "Driver={Adaptive Server Enterprise};server=MARKT60;port=5000;Database=pubs2;uid=sa;pwd=;";
|
||||
|
||||
IDbProvider dbProvider = DbProviderFactory.GetDbProvider("SybaseAse-15");
|
||||
dbProvider.ConnectionString = "Data Source='MARKT60';Port='5000';UID='sa';PWD='';Database='pubs2';";
|
||||
HelloProc proc = new HelloProc(dbProvider);
|
||||
IDictionary dict = proc.GetResults();
|
||||
|
||||
Assert.AreEqual("Go Sybase", dict["@inoutParam"]);
|
||||
Assert.AreEqual("Hello mango", dict["@outParam"]);
|
||||
Assert.AreEqual(101, (int) dict["RETURN_VALUE"]);
|
||||
foreach (DictionaryEntry entry in dict)
|
||||
{
|
||||
Console.WriteLine("Key = " + entry.Key + ", Value = " + entry.Value);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void StordProcAdoTemplate()
|
||||
{
|
||||
IDbProvider dbProvider = DbProviderFactory.GetDbProvider("SybaseAse-15");
|
||||
dbProvider.ConnectionString = "Data Source='MARKT60';Port='5000';UID='sa';PWD='';Database='pubs2';";
|
||||
AdoTemplate adoTemplate = new AdoTemplate(dbProvider);
|
||||
IDbParameters parameters = new DbParameters(dbProvider);
|
||||
parameters.Add("inParam", AseDbType.VarChar, 32).Value = "mango";
|
||||
parameters.AddInOut("inoutParam", AseDbType.VarChar, 64).Value = "Sybase";
|
||||
parameters.AddOut("outParam", AseDbType.VarChar, 64);
|
||||
parameters.AddReturn("retValue", AseDbType.Integer);
|
||||
adoTemplate.ExecuteNonQuery(CommandType.StoredProcedure, "sp_hello", parameters);
|
||||
|
||||
|
||||
Assert.AreEqual("Go Sybase", parameters["@inoutParam"].Value);
|
||||
Assert.AreEqual("Hello mango", parameters[2].Value);
|
||||
Assert.AreEqual(101, (int) parameters[3].Value);
|
||||
}
|
||||
*/
|
||||
[Test]
|
||||
[Ignore("SYBASE-ASE-dependent tests disabled for integration runs")]
|
||||
public void DeriveParams()
|
||||
{
|
||||
IDbProvider dbProvider = DbProviderFactory.GetDbProvider("SybaseAse-15");
|
||||
@@ -190,25 +194,26 @@ namespace Spring.Data
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
[Test]
|
||||
public void RawDeriveParams()
|
||||
{
|
||||
using (
|
||||
AseConnection conn =
|
||||
new AseConnection("Data Source='MARKT60';Port='5000';UID='sa';PWD='';Database='pubs2';"))
|
||||
{
|
||||
using (AseCommand cmd = new AseCommand("@sp_hello", conn))
|
||||
/*
|
||||
[Test]
|
||||
public void RawDeriveParams()
|
||||
{
|
||||
conn.Open();
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
AseCommandBuilder.DeriveParameters(cmd);
|
||||
Console.WriteLine("Number of parameters = " + cmd.Parameters.Count);
|
||||
using (
|
||||
AseConnection conn =
|
||||
new AseConnection("Data Source='MARKT60';Port='5000';UID='sa';PWD='';Database='pubs2';"))
|
||||
{
|
||||
using (AseCommand cmd = new AseCommand("@sp_hello", conn))
|
||||
{
|
||||
conn.Open();
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
AseCommandBuilder.DeriveParameters(cmd);
|
||||
Console.WriteLine("Number of parameters = " + cmd.Parameters.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
*/
|
||||
[Test]
|
||||
[Ignore("SYBASE-ASE-dependent tests disabled for integration runs")]
|
||||
public void QueryWithMapper()
|
||||
{
|
||||
IDbProvider dbProvider = DbProviderFactory.GetDbProvider("SybaseAse-15");
|
||||
@@ -219,6 +224,7 @@ namespace Spring.Data
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("ODBC-dependent tests disabled for integration runs")]
|
||||
public void QueryWithMapperODBC()
|
||||
{
|
||||
IDbProvider dbProvider = DbProviderFactory.GetDbProvider("Odbc-2.0");
|
||||
@@ -230,6 +236,7 @@ namespace Spring.Data
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("SYBASE-ASE-dependent tests disabled for integration runs")]
|
||||
public void QueryRawODBC()
|
||||
{
|
||||
using (
|
||||
@@ -267,17 +274,17 @@ namespace Spring.Data
|
||||
{
|
||||
return AdoTemplate.QueryWithRowMapperDelegate<Sale>(CommandType.StoredProcedure, "history_proc",
|
||||
delegate(IDataReader dataReader, int rowNum)
|
||||
{
|
||||
Sale sale = new Sale();
|
||||
sale.Date = dataReader.GetDateTime(0);
|
||||
sale.OrderNumber = dataReader.GetString(1);
|
||||
sale.Quantity = dataReader.GetInt32(2);
|
||||
sale.Title = dataReader.GetString(3);
|
||||
sale.Discount = dataReader.GetFloat(4);
|
||||
sale.Price = dataReader.GetFloat(5);
|
||||
sale.Total = dataReader.GetFloat(6);
|
||||
return sale;
|
||||
}, "stor_id",
|
||||
{
|
||||
Sale sale = new Sale();
|
||||
sale.Date = dataReader.GetDateTime(0);
|
||||
sale.OrderNumber = dataReader.GetString(1);
|
||||
sale.Quantity = dataReader.GetInt32(2);
|
||||
sale.Title = dataReader.GetString(3);
|
||||
sale.Discount = dataReader.GetFloat(4);
|
||||
sale.Price = dataReader.GetFloat(5);
|
||||
sale.Total = dataReader.GetFloat(6);
|
||||
return sale;
|
||||
}, "stor_id",
|
||||
DbType.String, 0, storeId);
|
||||
}
|
||||
}
|
||||
@@ -335,27 +342,28 @@ namespace Spring.Data
|
||||
set { total = value; }
|
||||
}
|
||||
}
|
||||
/*
|
||||
public class HelloProc : StoredProcedure
|
||||
{
|
||||
public HelloProc(IDbProvider provider) : base(provider, "sp_hello")
|
||||
/*
|
||||
public class HelloProc : StoredProcedure
|
||||
{
|
||||
DeclaredParameters.Add("inParam", AseDbType.VarChar, 32).Value = "mango";
|
||||
DeclaredParameters.AddInOut("inoutParam", AseDbType.VarChar, 64).Value = "Sybase";
|
||||
DeclaredParameters.AddOut("outParam", AseDbType.VarChar, 64);
|
||||
DeclaredParameters.AddReturn("retValue", AseDbType.Integer);
|
||||
Compile();
|
||||
}
|
||||
public HelloProc(IDbProvider provider) : base(provider, "sp_hello")
|
||||
{
|
||||
DeclaredParameters.Add("inParam", AseDbType.VarChar, 32).Value = "mango";
|
||||
DeclaredParameters.AddInOut("inoutParam", AseDbType.VarChar, 64).Value = "Sybase";
|
||||
DeclaredParameters.AddOut("outParam", AseDbType.VarChar, 64);
|
||||
DeclaredParameters.AddReturn("retValue", AseDbType.Integer);
|
||||
Compile();
|
||||
}
|
||||
|
||||
public IDictionary GetResults()
|
||||
{
|
||||
return Query("mango", "Sybase");
|
||||
public IDictionary GetResults()
|
||||
{
|
||||
return Query("mango", "Sybase");
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
*/
|
||||
public class EmpProc : StoredProcedure
|
||||
{
|
||||
public EmpProc(IDbProvider provider) : base(provider, "TEST.Get1CurOut")
|
||||
public EmpProc(IDbProvider provider)
|
||||
: base(provider, "TEST.Get1CurOut")
|
||||
{
|
||||
//DeriveParameters();
|
||||
DeclaredParameters.AddOut("P_CURSOR1", OracleType.Cursor);
|
||||
@@ -365,7 +373,7 @@ namespace Spring.Data
|
||||
|
||||
public IDictionary GetEmployees()
|
||||
{
|
||||
for (int i=0; i< DeclaredParameters.Count; i++)
|
||||
for (int i = 0; i < DeclaredParameters.Count; i++)
|
||||
{
|
||||
Console.WriteLine("decarled parameter name = " + DeclaredParameters[i].ParameterName + ", type = " + DeclaredParameters[i].DbType);
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -33,58 +33,60 @@ using Spring.Data.Core;
|
||||
|
||||
namespace Spring.Data.Support
|
||||
{
|
||||
[TestFixture]
|
||||
public class SimpleExceptionTranslationTests
|
||||
{
|
||||
#region Fields
|
||||
private IDbProvider dbProvider;
|
||||
private IAdoOperations adoOperations;
|
||||
#endregion
|
||||
[TestFixture]
|
||||
public class SimpleExceptionTranslationTests
|
||||
{
|
||||
#region Fields
|
||||
private IDbProvider dbProvider;
|
||||
private IAdoOperations adoOperations;
|
||||
#endregion
|
||||
|
||||
#region Constants
|
||||
#region Constants
|
||||
|
||||
/// <summary>
|
||||
/// The shared ILog instance for this class (and derived classes).
|
||||
/// </summary>
|
||||
protected static readonly ILog log =
|
||||
LogManager.GetLogger(typeof (SimpleExceptionTranslationTests));
|
||||
/// <summary>
|
||||
/// The shared ILog instance for this class (and derived classes).
|
||||
/// </summary>
|
||||
protected static readonly ILog log =
|
||||
LogManager.GetLogger(typeof(SimpleExceptionTranslationTests));
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
#region Methods
|
||||
|
||||
[SetUp]
|
||||
[SetUp]
|
||||
public void CreateAdoTemplate()
|
||||
{
|
||||
IApplicationContext ctx =
|
||||
IApplicationContext ctx =
|
||||
new XmlApplicationContext("assembly://Spring.Data.Integration.Tests/Spring.Data/adoTemplateTests.xml");
|
||||
Assert.IsNotNull(ctx);
|
||||
dbProvider = ctx["DbProvider"] as IDbProvider;
|
||||
Assert.IsNotNull(dbProvider);
|
||||
adoOperations = new AdoTemplate(dbProvider);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void ExecuteNonQueryText()
|
||||
{
|
||||
|
||||
|
||||
string badSql = "insert into TestObjects(Age, Name) VALS (33, 'foo')";
|
||||
try
|
||||
{
|
||||
adoOperations.ExecuteNonQuery(CommandType.Text, badSql);
|
||||
} catch (BadSqlGrammarException e)
|
||||
}
|
||||
catch (BadSqlGrammarException e)
|
||||
{
|
||||
|
||||
|
||||
log.Error("caught correct exception", e);
|
||||
} catch (Exception e)
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.Error("caught incorrect exception ", e);
|
||||
|
||||
Assert.Fail("did not throw exception of type BadSqlGrammerException");
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#region Imports
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Common.Logging;
|
||||
using Spring.Objects;
|
||||
using Spring.Transaction.Interceptor;
|
||||
@@ -82,7 +83,20 @@ namespace Spring.Data
|
||||
testObjectDao.Delete(name2);
|
||||
}
|
||||
|
||||
#endregion
|
||||
public void DeleteAllTestObjects()
|
||||
{
|
||||
IList objects = testObjectDao.FindAll();
|
||||
|
||||
foreach (object testObject in objects)
|
||||
{
|
||||
if (testObject is ITestObject)
|
||||
{
|
||||
testObjectDao.Delete(((ITestObject)testObject).Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Spring.Data
|
||||
/// <author>Mark Pollack (.NET)</author>
|
||||
public class TestObjectQuery : MappingAdoQuery
|
||||
{
|
||||
private static string sql = "select TestObjectNo, Age, Name from TestObjects where Name = @UName";
|
||||
private static string sql = "select TestObjectNo, Age, Name from TestObjects where Name = @Name";
|
||||
|
||||
public TestObjectQuery(IDbProvider dbProvider)
|
||||
: base(dbProvider, sql)
|
||||
@@ -44,7 +44,7 @@ namespace Spring.Data
|
||||
//DeclaredParameters = new DbParameters(dbProvider);
|
||||
try
|
||||
{
|
||||
DeclaredParameters.Add("UName", SqlDbType.VarChar, 50);
|
||||
DeclaredParameters.Add("Name", SqlDbType.VarChar, 50);
|
||||
} catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<db:provider id="DbProvider"
|
||||
provider="SqlServer-2.0"
|
||||
connectionString="Data Source=MARKT60\SQL2005;Initial Catalog=Spring;Persist Security Info=True;User ID=springqa;Password=springqa"/>
|
||||
connectionString="Data Source=SPRINGQA;Initial Catalog=Spring;Persist Security Info=True;User ID=springqa;Password=springqa"/>
|
||||
|
||||
|
||||
<object id="adoTemplate" type="Spring.Data.Core.AdoTemplate, Spring.Data">
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace Spring.Data
|
||||
using (SqlConnection cn2005 = new SqlConnection())
|
||||
{
|
||||
cn2005.ConnectionString =
|
||||
@"Data Source=MARKT60\SQL2005;Initial Catalog=CreditsAndDebits;User ID=springqa; Password=springqa";
|
||||
@"Data Source=SPRINGQA;Initial Catalog=CreditsAndDebits;User ID=springqa; Password=springqa";
|
||||
SqlCommand cmd = new SqlCommand(updateSql2, cn2005);
|
||||
cn2005.Open();
|
||||
Console.WriteLine("Isolation level = " + System.Transactions.Transaction.Current.IsolationLevel);
|
||||
|
||||
@@ -35,21 +35,21 @@ using Spring.Transaction.Support;
|
||||
|
||||
namespace Spring.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Integration tests for transaction template functionality
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack</author>
|
||||
[TestFixture]
|
||||
public class TransactionTemplateTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Integration tests for transaction template functionality
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack</author>
|
||||
[TestFixture]
|
||||
public class TransactionTemplateTests
|
||||
{
|
||||
|
||||
private IDbProvider dbProvider;
|
||||
|
||||
private IPlatformTransactionManager transactionManager;
|
||||
|
||||
private IApplicationContext ctx;
|
||||
|
||||
private IAdoOperations adoOperations;
|
||||
|
||||
private IAdoOperations adoOperations;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
@@ -57,9 +57,20 @@ namespace Spring.Data
|
||||
ctx =
|
||||
new XmlApplicationContext("assembly://Spring.Data.Integration.Tests/Spring.Data/templateTests.xml");
|
||||
dbProvider = ctx["DbProvider"] as IDbProvider;
|
||||
transactionManager = ctx["adoTransactionManager"] as IPlatformTransactionManager;
|
||||
transactionManager = ctx["transactionManager"] as IPlatformTransactionManager;
|
||||
adoOperations = ctx["adoTemplate"] as IAdoOperations;
|
||||
|
||||
|
||||
ITestObjectManager testObjectManager = ctx["testObjectManager"] as ITestObjectManager;
|
||||
testObjectManager.DeleteAllTestObjects();
|
||||
testObjectManager.SaveTwoTestObjects(new TestObject("Jack", 10), new TestObject("Jill", 20));
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
ITestObjectManager testObjectManager = ctx["testObjectManager"] as ITestObjectManager;
|
||||
testObjectManager.DeleteTwoTestObjects("Jack", "Jill");
|
||||
testObjectManager.DeleteAllTestObjects();
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +84,7 @@ namespace Spring.Data
|
||||
[Test]
|
||||
public void DeclarativeViaAutoProxyCreator()
|
||||
{
|
||||
ITestObjectManager mgr = ctx["testObjectManager"] as ITestObjectManager;
|
||||
ITestObjectManager mgr = ctx["testObjectManager"] as ITestObjectManager;
|
||||
TestObjectDao dao = (TestObjectDao)ctx["testObjectDao"];
|
||||
PerformOperations(mgr, dao);
|
||||
}
|
||||
@@ -88,7 +99,7 @@ namespace Spring.Data
|
||||
[Test]
|
||||
public void DeclarativeViaTransactionProxyFactoryObject()
|
||||
{
|
||||
ITestObjectManager mgr = ctx["testObjectManagerTP"] as ITestObjectManager;
|
||||
ITestObjectManager mgr = ctx["testObjectManagerTP"] as ITestObjectManager;
|
||||
ITestObjectDao dao = (ITestObjectDao)ctx["testObjectDao"];
|
||||
PerformOperations(mgr, dao);
|
||||
}
|
||||
@@ -102,7 +113,7 @@ namespace Spring.Data
|
||||
public void DeclarativeViaProxyFactoryObject()
|
||||
{
|
||||
ITestObjectManager mgr = ctx["testObjectManagerPF"] as ITestObjectManager;
|
||||
TestObjectDao dao = (TestObjectDao)ctx["testObjectDao"];
|
||||
TestObjectDao dao = (TestObjectDao)ctx["testObjectDao"];
|
||||
PerformOperations(mgr, dao);
|
||||
|
||||
}
|
||||
@@ -121,35 +132,35 @@ namespace Spring.Data
|
||||
coordinator.TestObjectManager.DeleteTwoTestObjects("Jack", "Jill");
|
||||
}
|
||||
|
||||
public static void PerformOperations(ITestObjectManager mgr,
|
||||
public static void PerformOperations(ITestObjectManager mgr,
|
||||
ITestObjectDao dao)
|
||||
{
|
||||
Assert.IsNotNull(mgr);
|
||||
TestObject to1 = new TestObject();
|
||||
to1.Name = "Jack";
|
||||
to1.Age = 7;
|
||||
TestObject to2 = new TestObject();
|
||||
to2.Name = "Jill";
|
||||
to2.Age = 8;
|
||||
mgr.SaveTwoTestObjects(to1, to2);
|
||||
|
||||
TestObject to = dao.FindByName("Jack");
|
||||
Assert.IsNotNull(to);
|
||||
|
||||
to = dao.FindByName("Jill");
|
||||
Assert.IsNotNull(to);
|
||||
Assert.AreEqual("Jill", to.Name);
|
||||
|
||||
mgr.DeleteTwoTestObjects("Jack", "Jill");
|
||||
|
||||
to = dao.FindByName("Jack");
|
||||
Assert.IsNull(to);
|
||||
|
||||
to = dao.FindByName("Jill");
|
||||
Assert.IsNull(to);
|
||||
}
|
||||
{
|
||||
Assert.IsNotNull(mgr);
|
||||
TestObject to1 = new TestObject();
|
||||
to1.Name = "Jack";
|
||||
to1.Age = 7;
|
||||
TestObject to2 = new TestObject();
|
||||
to2.Name = "Jill";
|
||||
to2.Age = 8;
|
||||
mgr.SaveTwoTestObjects(to1, to2);
|
||||
|
||||
[Test]
|
||||
TestObject to = dao.FindByName("Jack");
|
||||
Assert.IsNotNull(to);
|
||||
|
||||
to = dao.FindByName("Jill");
|
||||
Assert.IsNotNull(to);
|
||||
Assert.AreEqual("Jill", to.Name);
|
||||
|
||||
mgr.DeleteTwoTestObjects("Jack", "Jill");
|
||||
|
||||
to = dao.FindByName("Jack");
|
||||
Assert.IsNull(to);
|
||||
|
||||
to = dao.FindByName("Jill");
|
||||
Assert.IsNull(to);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ExecuteTemplate()
|
||||
{
|
||||
TransactionTemplate tt = new TransactionTemplate(transactionManager);
|
||||
@@ -164,7 +175,7 @@ namespace Spring.Data
|
||||
def.PropagationBehavior = TransactionPropagation.Required;
|
||||
|
||||
ITransactionStatus status = transactionManager.GetTransaction(def);
|
||||
|
||||
|
||||
int iCount = 0;
|
||||
try
|
||||
{
|
||||
@@ -176,7 +187,8 @@ namespace Spring.Data
|
||||
*/
|
||||
|
||||
//other AdoCommands can be executed within same tx.
|
||||
} catch (Exception e)
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
transactionManager.Rollback(status);
|
||||
throw e;
|
||||
@@ -186,12 +198,12 @@ namespace Spring.Data
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private class SimpleTransactionCallback : ITransactionCallback
|
||||
{
|
||||
private IDbProvider dbProvider;
|
||||
|
||||
public SimpleTransactionCallback(IDbProvider dbp)
|
||||
public SimpleTransactionCallback(IDbProvider dbp)
|
||||
{
|
||||
dbProvider = dbp;
|
||||
}
|
||||
@@ -207,10 +219,10 @@ namespace Spring.Data
|
||||
return adoTemplate.Execute(new TestCommandCallback());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class TestCommandCallback : ICommandCallback
|
||||
{
|
||||
|
||||
|
||||
public Object DoInCommand(IDbCommand cmd)
|
||||
{
|
||||
cmd.CommandText = "SELECT COUNT(*) FROM TestObjects";
|
||||
@@ -223,5 +235,5 @@ namespace Spring.Data
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,17 +3,25 @@
|
||||
xmlns:db="http://www.springframework.net/database">
|
||||
|
||||
|
||||
|
||||
<db:provider id="DbProvider"
|
||||
provider="SqlServer-2.0"
|
||||
|
||||
<db:provider id="DbProvider"
|
||||
provider="SqlServer-2.0"
|
||||
connectionString="Data Source=SPRINGQA;Database=Spring;Trusted_Connection=False;User ID=springqa;Password=springqa"/>
|
||||
|
||||
<!-- connectionString="Data Source=MARKT60\SQL2005;Initial Catalog=Spring;Persist Security Info=True;User ID=springqa;Password=springqa"/> -->
|
||||
|
||||
|
||||
<object id="adoTemplate" type="Spring.Data.Core.AdoTemplate, Spring.Data">
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
</object>
|
||||
|
||||
<object id="testObjectDao"
|
||||
type="Spring.Data.TestObjectDao, Spring.Data.Integration.Tests">
|
||||
|
||||
<property name="AdoTemplate" ref="adoTemplate"/>
|
||||
</object>
|
||||
|
||||
<object id="testObjectManager"
|
||||
type="Spring.Data.TestObjectManager, Spring.Data.Integration.Tests">
|
||||
|
||||
<property name="TestObjectDao" ref="testObjectDao"/>
|
||||
</object>
|
||||
|
||||
</objects>
|
||||
@@ -7,12 +7,12 @@
|
||||
<!--
|
||||
<d:provider id="DbProvider"
|
||||
provider="SqlServer-2.0"
|
||||
connectionString="Data Source=MARKT60\SQL2005;Initial Catalog=Spring;Persist Security Info=True;User ID=springqa;Password=springqa"/>
|
||||
connectionString="Data Source=SPRINGQA;Initial Catalog=Spring;Persist Security Info=True;User ID=springqa;Password=springqa"/>
|
||||
-->
|
||||
|
||||
<db:provider id="DbProvider"
|
||||
provider="SqlServer-1.1"
|
||||
connectionString="Data Source=MARKT60\SQL2005;Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
|
||||
connectionString="Data Source=SPRINGQA;Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
|
||||
<object id="adoTransactionManager"
|
||||
type="Spring.Data.Core.AdoPlatformTransactionManager, Spring.Data">
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<db:provider id="DbProvider"
|
||||
provider="SqlServer-2.0"
|
||||
connectionString="Data Source=MARKT60\SQL2005;Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
|
||||
connectionString="Data Source=SPRINGQA;Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
|
||||
|
||||
<object id="adoTemplate" type="Spring.Data.Core.AdoTemplate, Spring.Data">
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<object id="testObjectDao"
|
||||
type="Spring.Data.NativeAdoTestObjectDao, Spring.Data.Integration.Tests">
|
||||
<property name="ConnectionString" value="Data Source=MARKT60\SQL2005;Initial Catalog=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
|
||||
<property name="ConnectionString" value="Data Source=SPRINGQA;Initial Catalog=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
|
||||
</object>
|
||||
|
||||
</objects>
|
||||
@@ -1,65 +0,0 @@
|
||||
|
||||
|
||||
USE Spring
|
||||
CREATE TABLE TestObjects
|
||||
(
|
||||
TestObjectNo int IDENTITY NOT NULL,
|
||||
Age int,
|
||||
Name varchar(50)
|
||||
)
|
||||
|
||||
|
||||
CREATE PROCEDURE SelectByName
|
||||
(
|
||||
@Name varchar(50)
|
||||
|
||||
)
|
||||
|
||||
as
|
||||
select TestObjectNo, Age,Name from TestObjects where Name = @Name
|
||||
|
||||
return
|
||||
|
||||
CREATE PROCEDURE SelectByNameWithReturnValue
|
||||
(
|
||||
@Name varchar(50)
|
||||
|
||||
)
|
||||
|
||||
as
|
||||
select * from TestObjects where Name = @Name
|
||||
|
||||
return 5
|
||||
|
||||
|
||||
CREATE PROCEDURE SelectByNameWithReturnAndOutValue
|
||||
(
|
||||
@Name varchar(50),
|
||||
@Count int output
|
||||
|
||||
)
|
||||
|
||||
as
|
||||
select * from TestObjects where Name = @Name
|
||||
set @Count = 10
|
||||
return 5
|
||||
|
||||
|
||||
CREATE PROCEDURE CreateTestObject
|
||||
(
|
||||
@Name varchar(50),
|
||||
@Age int
|
||||
)
|
||||
|
||||
as
|
||||
insert into TestObjects(Name, Age) Values (@Name, @Age)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
INSERT INTO TestObjects
|
||||
(Age, Name)
|
||||
VALUES
|
||||
(1, 'Gabriel')
|
||||
|
||||
@@ -177,7 +177,9 @@
|
||||
<EmbeddedResource Include="Data\declarativeServices.xml" />
|
||||
<EmbeddedResource Include="Data\DTCAppContext.xml" />
|
||||
<EmbeddedResource Include="Data\autoDeclarativeServices.xml" />
|
||||
<EmbeddedResource Include="Data\DTCAppContextNoInterfaces.xml" />
|
||||
<EmbeddedResource Include="Data\DTCAppContextNoInterfaces.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Data\Generic\GenericAdoTemplateTests.xml" />
|
||||
<EmbeddedResource Include="Data\nativeAdoTests.xml" />
|
||||
<EmbeddedResource Include="Data\oracleAdoTemplateTests.xml" />
|
||||
@@ -193,10 +195,11 @@
|
||||
<EmbeddedResource Include="Data\TestTxIsolationLevel.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Data\CreateTestObject.sql" />
|
||||
<Content Include="Data\CreditsDebitsSchema.sql" />
|
||||
<Content Include="Data\DTC1.1AppContext.xml" />
|
||||
<Content Include="Data\testobjects-sqlserver.sql" />
|
||||
<Content Include="Data\Spring.Data.Integration.Tests_CreditsAndDebits_database.sql" />
|
||||
<Content Include="Data\Spring.Data.Integration.Tests_Credits_database.sql" />
|
||||
<Content Include="Data\Spring.Data.Integration.Tests_Debits_database.sql" />
|
||||
<Content Include="Data\Spring.Data.Integration.Tests_Spring_database.sql" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
<sources failonempty="true">
|
||||
<include name="**/*.cs" />
|
||||
</sources>
|
||||
<resources basedir="Resources">
|
||||
<include name="**/*" />
|
||||
</resources>
|
||||
<resources prefix="Spring" dynamicprefix="true" failonempty="true">
|
||||
<include name="**/*.xml" />
|
||||
</resources>
|
||||
<references basedir="${current.bin.dir}">
|
||||
<include name="*.dll" />
|
||||
<include name="System.Data.dll" if="${nant.settings.currentframework=='mono-2.0'}" />
|
||||
@@ -43,7 +43,6 @@
|
||||
</csc>
|
||||
</target>
|
||||
<target name="test" depends="build">
|
||||
<!-- skipping running of tests for now -->
|
||||
<!-- call target="common.run-tests" if="${test.integration.data}" / -->
|
||||
<call target="common.run-tests" if="${test.integration.data}" />
|
||||
</target>
|
||||
</project>
|
||||
|
||||
@@ -45,6 +45,7 @@ namespace Spring.Data
|
||||
public class AdoPlatformTransactionManagerTests
|
||||
{
|
||||
private MockRepository mocks;
|
||||
private IsolationLevel _defaultIsolationLevel = IsolationLevel.Unspecified;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
@@ -74,7 +75,7 @@ namespace Spring.Data
|
||||
Expect.Call(dbProvider.CreateConnection()).Return(connection);
|
||||
connection.Open();
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
Expect.Call(connection.BeginTransaction(IsolationLevel.ReadCommitted)).Return(transaction);
|
||||
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
|
||||
//standard tx timeout.
|
||||
transaction.Commit();
|
||||
LastCall.On(transaction).Repeat.Once();
|
||||
@@ -115,7 +116,7 @@ namespace Spring.Data
|
||||
Expect.Call(dbProvider.CreateConnection()).Return(connection);
|
||||
connection.Open();
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
Expect.Call(connection.BeginTransaction(IsolationLevel.ReadCommitted)).Return(transaction);
|
||||
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
|
||||
//standard tx timeout.
|
||||
transaction.Rollback();
|
||||
LastCall.On(transaction).Repeat.Once();
|
||||
@@ -165,7 +166,7 @@ namespace Spring.Data
|
||||
Expect.Call(dbProvider.CreateConnection()).Return(connection);
|
||||
connection.Open();
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
Expect.Call(connection.BeginTransaction(IsolationLevel.ReadCommitted)).Return(transaction);
|
||||
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
|
||||
//standard tx timeout.
|
||||
transaction.Rollback();
|
||||
LastCall.On(transaction).Repeat.Once();
|
||||
@@ -237,7 +238,7 @@ namespace Spring.Data
|
||||
Expect.Call(dbProvider.CreateConnection()).Return(connection).Repeat.Twice();
|
||||
connection.Open();
|
||||
LastCall.On(connection).Repeat.Twice();
|
||||
Expect.Call(connection.BeginTransaction(IsolationLevel.ReadCommitted)).Return(transaction).Repeat.Twice();
|
||||
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction).Repeat.Twice();
|
||||
//standard tx timeout.
|
||||
transaction.Rollback();
|
||||
LastCall.On(transaction).Repeat.Once();
|
||||
@@ -279,7 +280,7 @@ namespace Spring.Data
|
||||
Expect.Call(dbProvider.CreateConnection()).Return(connection);
|
||||
connection.Open();
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
Expect.Call(connection.BeginTransaction(IsolationLevel.ReadCommitted)).Return(transaction);
|
||||
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
|
||||
transaction.Commit();
|
||||
LastCall.On(transaction).Repeat.Once();
|
||||
connection.Dispose();
|
||||
@@ -291,7 +292,7 @@ namespace Spring.Data
|
||||
Expect.Call(dbProvider2.CreateConnection()).Return(connection2);
|
||||
connection2.Open();
|
||||
LastCall.On(connection2).Repeat.Once();
|
||||
Expect.Call(connection2.BeginTransaction(IsolationLevel.ReadCommitted)).Return(transaction2);
|
||||
Expect.Call(connection2.BeginTransaction(_defaultIsolationLevel)).Return(transaction2);
|
||||
transaction2.Rollback();
|
||||
LastCall.On(transaction2).Repeat.Once();
|
||||
connection2.Dispose();
|
||||
@@ -334,7 +335,7 @@ namespace Spring.Data
|
||||
Expect.Call(dbProvider.CreateConnection()).Return(connection);
|
||||
connection.Open();
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
Expect.Call(connection.BeginTransaction(IsolationLevel.ReadCommitted)).Return(transaction);
|
||||
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
|
||||
transaction.Rollback();
|
||||
LastCall.On(transaction).Repeat.Once();
|
||||
connection.Dispose();
|
||||
@@ -394,7 +395,7 @@ namespace Spring.Data
|
||||
Expect.Call(dbProvider.CreateConnection()).Return(connection);
|
||||
connection.Open();
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
Expect.Call(connection.BeginTransaction(IsolationLevel.ReadCommitted)).Return(transaction);
|
||||
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
|
||||
//standard tx timeout.
|
||||
transaction.Commit();
|
||||
LastCall.On(transaction).Repeat.Once();
|
||||
@@ -430,7 +431,7 @@ namespace Spring.Data
|
||||
Expect.Call(dbProvider.CreateConnection()).Return(connection);
|
||||
connection.Open();
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
Expect.Call(connection.BeginTransaction(IsolationLevel.ReadCommitted)).Return(transaction);
|
||||
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
|
||||
//standard tx timeout.
|
||||
transaction.Rollback();
|
||||
LastCall.On(transaction).Repeat.Once();
|
||||
@@ -481,7 +482,7 @@ namespace Spring.Data
|
||||
Expect.Call(dbProvider.CreateConnection()).Return(connection2);
|
||||
connection2.Open();
|
||||
LastCall.On(connection2).Repeat.Once();
|
||||
Expect.Call(connection2.BeginTransaction(IsolationLevel.ReadCommitted)).Return(transaction2);
|
||||
Expect.Call(connection2.BeginTransaction(_defaultIsolationLevel)).Return(transaction2);
|
||||
transaction2.Commit();
|
||||
LastCall.On(transaction2).Repeat.Once();
|
||||
connection2.Dispose();
|
||||
@@ -572,7 +573,7 @@ namespace Spring.Data
|
||||
connection.Open();
|
||||
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
Expect.Call(connection.BeginTransaction(IsolationLevel.ReadCommitted)).Return(transaction);
|
||||
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
|
||||
Expect.Call(connection.CreateCommand()).Return(command);
|
||||
command.CommandText = "some SQL statement";
|
||||
LastCall.On(command).Repeat.Once();
|
||||
@@ -673,7 +674,7 @@ namespace Spring.Data
|
||||
Expect.Call(dbProvider.CreateConnection()).Return(connection);
|
||||
connection.Open();
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
Expect.Call(connection.BeginTransaction(IsolationLevel.ReadCommitted)).Return(transaction);
|
||||
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
|
||||
//standard tx timeout.
|
||||
transaction.Commit();
|
||||
LastCall.On(transaction).Throw(new TestSqlException("Cannot commit", "314"));
|
||||
@@ -716,7 +717,7 @@ namespace Spring.Data
|
||||
Expect.Call(dbProvider.CreateConnection()).Return(connection);
|
||||
connection.Open();
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
Expect.Call(connection.BeginTransaction(IsolationLevel.ReadCommitted)).Return(transaction);
|
||||
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
|
||||
transaction.Commit();
|
||||
LastCall.On(transaction).Throw(new TestSqlException("Cannot commit", "314"));
|
||||
|
||||
@@ -762,7 +763,7 @@ namespace Spring.Data
|
||||
Expect.Call(dbProvider.CreateConnection()).Return(connection);
|
||||
connection.Open();
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
Expect.Call(connection.BeginTransaction(IsolationLevel.ReadCommitted)).Return(transaction);
|
||||
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
|
||||
//standard tx timeout.
|
||||
transaction.Rollback();
|
||||
LastCall.On(transaction).Throw(new TestSqlException("Cannot commit", "314"));
|
||||
@@ -876,7 +877,7 @@ namespace Spring.Data
|
||||
Expect.Call(dbProvider.CreateConnection()).Return(connection);
|
||||
connection.Open();
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
Expect.Call(connection.BeginTransaction(IsolationLevel.ReadCommitted)).Return(transaction);
|
||||
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
|
||||
|
||||
transaction.Rollback();
|
||||
LastCall.On(transaction).Repeat.Once();
|
||||
@@ -922,7 +923,7 @@ namespace Spring.Data
|
||||
Expect.Call(dbProvider.CreateConnection()).Return(connection);
|
||||
connection.Open();
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
Expect.Call(connection.BeginTransaction(IsolationLevel.ReadCommitted)).Return(transaction);
|
||||
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
|
||||
//standard tx timeout.
|
||||
transaction.Commit();
|
||||
LastCall.On(transaction).Repeat.Once();
|
||||
@@ -970,7 +971,7 @@ namespace Spring.Data
|
||||
Expect.Call(dbProvider.CreateConnection()).Return(connection);
|
||||
connection.Open();
|
||||
LastCall.On(connection).Repeat.Once();
|
||||
Expect.Call(connection.BeginTransaction(IsolationLevel.ReadCommitted)).Return(transaction);
|
||||
Expect.Call(connection.BeginTransaction(_defaultIsolationLevel)).Return(transaction);
|
||||
transaction.Rollback();
|
||||
LastCall.On(transaction).Repeat.Once();
|
||||
connection.Dispose();
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace Spring.Data.Core
|
||||
// inner tx
|
||||
ConfigureServiceConfig(serviceConfig, false);
|
||||
serviceConfig.TransactionOption = TransactionOption.RequiresNew;
|
||||
serviceConfig.IsolationLevel = TransactionIsolationLevel.ReadCommitted;
|
||||
serviceConfig.IsolationLevel = TransactionIsolationLevel.Any;
|
||||
txAdapter.Enter(serviceConfig);
|
||||
Expect.Call(txAdapter.IsInTransaction).Return(true);
|
||||
txAdapter.SetAbort();
|
||||
@@ -204,7 +204,7 @@ namespace Spring.Data.Core
|
||||
if (standardIsolationAndProp)
|
||||
{
|
||||
serviceConfig.TransactionOption = TransactionOption.Required;
|
||||
serviceConfig.IsolationLevel = TransactionIsolationLevel.ReadCommitted;
|
||||
serviceConfig.IsolationLevel = TransactionIsolationLevel.Any;
|
||||
}
|
||||
return serviceConfig;
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace Spring.Data.Core
|
||||
{
|
||||
Expect.Call(txAdapter.IsExistingTransaction).Return(false);
|
||||
TransactionOptions txOptions = new TransactionOptions();
|
||||
txOptions.IsolationLevel = IsolationLevel.ReadCommitted;
|
||||
txOptions.IsolationLevel = IsolationLevel.Unspecified;
|
||||
txAdapter.CreateTransactionScope(TransactionScopeOption.Required, txOptions, EnterpriseServicesInteropOption.None);
|
||||
|
||||
Expect.Call(txAdapter.RollbackOnly).Return(false);
|
||||
@@ -94,7 +94,7 @@ namespace Spring.Data.Core
|
||||
{
|
||||
Expect.Call(txAdapter.IsExistingTransaction).Return(false);
|
||||
TransactionOptions txOptions = new TransactionOptions();
|
||||
txOptions.IsolationLevel = IsolationLevel.ReadCommitted;
|
||||
txOptions.IsolationLevel = IsolationLevel.Unspecified;
|
||||
txAdapter.CreateTransactionScope(TransactionScopeOption.Required, txOptions, EnterpriseServicesInteropOption.None);
|
||||
txAdapter.Dispose();
|
||||
}
|
||||
@@ -141,7 +141,7 @@ namespace Spring.Data.Core
|
||||
{
|
||||
Expect.Call(txAdapter.IsExistingTransaction).Return(false);
|
||||
TransactionOptions txOptions = new TransactionOptions();
|
||||
txOptions.IsolationLevel = IsolationLevel.ReadCommitted;
|
||||
txOptions.IsolationLevel = IsolationLevel.Unspecified;
|
||||
txAdapter.CreateTransactionScope(TransactionScopeOption.RequiresNew, txOptions, EnterpriseServicesInteropOption.None);
|
||||
|
||||
//inner tx actions
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Spring.Transaction.Interceptor
|
||||
public void ToStringTests()
|
||||
{
|
||||
DefaultTransactionAttribute dta = new DefaultTransactionAttribute();
|
||||
Assert.AreEqual( "PROPAGATION_Required,ISOLATION_ReadCommitted,-System.Exception", dta.ToString());
|
||||
Assert.AreEqual( "PROPAGATION_Required,ISOLATION_Unspecified,-System.Exception", dta.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Spring.Transaction.Interceptor
|
||||
ITransactionAttribute ta = editor.Value;
|
||||
Assert.IsTrue( ta != null );
|
||||
Assert.IsTrue( ta.PropagationBehavior == TransactionPropagation.Required );
|
||||
Assert.IsTrue( ta.TransactionIsolationLevel == IsolationLevel.ReadCommitted );
|
||||
Assert.IsTrue( ta.TransactionIsolationLevel == IsolationLevel.Unspecified );
|
||||
Assert.IsFalse( ta.ReadOnly );
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Spring.Transaction.Interceptor
|
||||
{
|
||||
ITransactionAttribute ta = tas.ReturnTransactionAttribute( method, null );
|
||||
Assert.IsTrue( ta != null );
|
||||
Assert.IsTrue( ta.TransactionIsolationLevel == IsolationLevel.ReadCommitted );
|
||||
Assert.IsTrue( ta.TransactionIsolationLevel == IsolationLevel.Unspecified );
|
||||
Assert.IsTrue( ta.PropagationBehavior == transactionPropagation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,12 +23,18 @@ namespace Spring.Transaction.Support
|
||||
Assert.IsTrue( true == def.ReadOnly );
|
||||
}
|
||||
[Test]
|
||||
public void IsolationLeveNonDefaultl()
|
||||
public void PropogationBehaviorDefault()
|
||||
{
|
||||
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
||||
Assert.IsTrue( def.PropagationBehavior == TransactionPropagation.Required );
|
||||
}
|
||||
[Test]
|
||||
[Test]
|
||||
public void IsolationLevelDefault()
|
||||
{
|
||||
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
||||
Assert.IsTrue(def.TransactionIsolationLevel == IsolationLevel.Unspecified);
|
||||
}
|
||||
[Test]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public void InvalidTimeout()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user