Skip to content

Commit

Permalink
Backported NHibernate 1.2, changed other files only where necessary t…
Browse files Browse the repository at this point in the history
…o ensure compile/working tests

SVN: branches/1.2.x@3119
  • Loading branch information
phatcher committed Nov 19, 2007
1 parent 1442af8 commit edfcfca
Show file tree
Hide file tree
Showing 102 changed files with 12,889 additions and 5 deletions.
3 changes: 3 additions & 0 deletions default.build
Expand Up @@ -37,6 +37,8 @@
<include name="NHibernate.Mapping.Attributes/NHibernate.Mapping.Attributes.build" /> <include name="NHibernate.Mapping.Attributes/NHibernate.Mapping.Attributes.build" />
<include name="NHibernate.Mapping.Attributes.Test/NHibernate.Mapping.Attributes.Test.build" /> <include name="NHibernate.Mapping.Attributes.Test/NHibernate.Mapping.Attributes.Test.build" />
<include name="NHibernate.Tasks/NHibernate.Tasks.build" /> <include name="NHibernate.Tasks/NHibernate.Tasks.build" />
<include name="NHibernate.Search/NHibernate.Search.build" />
<include name="NHibernate.Search.Tests/NHibernate.Search.Tests.build" />
<include name="NHibernate.Tool.hbm2net/NHibernate.Tool.hbm2net.build" /> <include name="NHibernate.Tool.hbm2net/NHibernate.Tool.hbm2net.build" />
<include name="NHibernate.Tool.hbm2net.Console/NHibernate.Tool.hbm2net.Console.build" /> <include name="NHibernate.Tool.hbm2net.Console/NHibernate.Tool.hbm2net.Console.build" />
<include name="NHibernate.Tool.hbm2net.Tests/NHibernate.Tool.hbm2net.Tests.build" /> <include name="NHibernate.Tool.hbm2net.Tests/NHibernate.Tool.hbm2net.Tests.build" />
Expand All @@ -56,6 +58,7 @@
<include name="NHibernate.Caches.SysCache.Tests/NHibernate.Caches.SysCache.Tests.build" /> <include name="NHibernate.Caches.SysCache.Tests/NHibernate.Caches.SysCache.Tests.build" />
<include name="NHibernate.Caches.Prevalence.Tests/NHibernate.Caches.Prevalence.Tests.build" /> <include name="NHibernate.Caches.Prevalence.Tests/NHibernate.Caches.Prevalence.Tests.build" />
<include name="NHibernate.Mapping.Attributes.Test/NHibernate.Mapping.Attributes.Test.build" /> <include name="NHibernate.Mapping.Attributes.Test/NHibernate.Mapping.Attributes.Test.build" />
<include name="NHibernate.Search.Tests/NHibernate.Search.Tests.build" />
<include name="NHibernate.Tool.hbm2net.Tests/NHibernate.Tool.hbm2net.Tests.build" /> <include name="NHibernate.Tool.hbm2net.Tests/NHibernate.Tool.hbm2net.Tests.build" />
<include name="NHibernate.UserTypes.Tests/NHibernate.UserTypes.Tests.build" /> <include name="NHibernate.UserTypes.Tests/NHibernate.UserTypes.Tests.build" />
<include name="Nullables.Tests/Nullables.Tests.build" /> <include name="Nullables.Tests/Nullables.Tests.build" />
Expand Down
Binary file added lib/net/2.0/Lucene.Net.dll
Binary file not shown.
6,740 changes: 6,740 additions & 0 deletions lib/net/2.0/Lucene.Net.xml

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions src/NHibernate.Everything-2.0.sln
Expand Up @@ -195,6 +195,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHibernate.Caches.SysCache2
Release.AspNetCompiler.Debug = "False" Release.AspNetCompiler.Debug = "False"
EndProjectSection EndProjectSection
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHibernate.Search", "NHibernate.Search\NHibernate.Search.csproj", "{CC25D767-990D-4CE0-9F64-3426E244403B}"
ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.Debug = "False"
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHibernate.Search.Tests", "NHibernate.Search.Tests\NHibernate.Search.Tests.csproj", "{71560152-A693-4F66-99CF-570685A33169}"
ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.Debug = "False"
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|.NET = Debug|.NET Debug|.NET = Debug|.NET
Expand Down Expand Up @@ -486,6 +498,26 @@ Global
{2AE716DC-D909-4100-8ED5-09B701EF2E14}.Release|Any CPU.Build.0 = Release|Any CPU {2AE716DC-D909-4100-8ED5-09B701EF2E14}.Release|Any CPU.Build.0 = Release|Any CPU
{2AE716DC-D909-4100-8ED5-09B701EF2E14}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {2AE716DC-D909-4100-8ED5-09B701EF2E14}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{2AE716DC-D909-4100-8ED5-09B701EF2E14}.Release|Mixed Platforms.Build.0 = Release|Any CPU {2AE716DC-D909-4100-8ED5-09B701EF2E14}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{CC25D767-990D-4CE0-9F64-3426E244403B}.Debug|.NET.ActiveCfg = Debug|Any CPU
{CC25D767-990D-4CE0-9F64-3426E244403B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CC25D767-990D-4CE0-9F64-3426E244403B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CC25D767-990D-4CE0-9F64-3426E244403B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{CC25D767-990D-4CE0-9F64-3426E244403B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{CC25D767-990D-4CE0-9F64-3426E244403B}.Release|.NET.ActiveCfg = Release|Any CPU
{CC25D767-990D-4CE0-9F64-3426E244403B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CC25D767-990D-4CE0-9F64-3426E244403B}.Release|Any CPU.Build.0 = Release|Any CPU
{CC25D767-990D-4CE0-9F64-3426E244403B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{CC25D767-990D-4CE0-9F64-3426E244403B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{71560152-A693-4F66-99CF-570685A33169}.Debug|.NET.ActiveCfg = Debug|Any CPU
{71560152-A693-4F66-99CF-570685A33169}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{71560152-A693-4F66-99CF-570685A33169}.Debug|Any CPU.Build.0 = Debug|Any CPU
{71560152-A693-4F66-99CF-570685A33169}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{71560152-A693-4F66-99CF-570685A33169}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{71560152-A693-4F66-99CF-570685A33169}.Release|.NET.ActiveCfg = Release|Any CPU
{71560152-A693-4F66-99CF-570685A33169}.Release|Any CPU.ActiveCfg = Release|Any CPU
{71560152-A693-4F66-99CF-570685A33169}.Release|Any CPU.Build.0 = Release|Any CPU
{71560152-A693-4F66-99CF-570685A33169}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{71560152-A693-4F66-99CF-570685A33169}.Release|Mixed Platforms.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
Expand Down
100 changes: 100 additions & 0 deletions src/NHibernate.Search.Tests/App.config
@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>

<connectionStrings>
<add name="TestConnectionString" connectionString="TestConnectionString-TestConnectionString" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"
applies-to="v1.1.4322">
<qualifyAssembly partialName="System.Web"
fullName="System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"
applies-to="v2.0.50727">
<qualifyAssembly partialName="System.Web"
fullName="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</assemblyBinding>
</runtime>

<nhibernate>
<add key="hibernate.connection.provider" value="NHibernate.Test.DebugConnectionProvider, NHibernate.Test" />
<add key="hibernate.connection.isolation" value="ReadCommitted" />
<add key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver" />
<add key="hibernate.dialect" value="NHibernate.Dialect.MsSql2000Dialect" />
<add key="hibernate.connection.connection_string" value="Server=(local);initial catalog=nhibernate;Integrated Security=SSPI" />
<add key="hibernate.query.substitutions" value="true 1, false 0, yes 'Y', no 'N'" />
<add key="hibernate.adonet.batch_size" value="10" />
<add key="hibernate.prepare_sql" value="false" />
<add key="hibernate.cache.provider_class" value="NHibernate.Cache.HashtableCacheProvider, NHibernate" />
<add key="hibernate.cache.use_query_cache" value="true" />
</nhibernate>

<!-- This section contains the log4net configuration settings -->
<log4net debug="false">

<!-- Define some output appenders -->
<appender name="trace"
type="log4net.Appender.TraceAppender, log4net">
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern"
value="%d{ABSOLUTE} %-5p %c{1}:%L - %m%n" />
</layout>
</appender>

<appender name="console"
type="log4net.Appender.ConsoleAppender, log4net">
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern"
value="%d{ABSOLUTE} %-5p %c{1}:%L - %m%n" />
</layout>
</appender>

<appender name="rollingFile"
type="log4net.Appender.RollingFileAppender,log4net" >

<param name="File"
value="log.txt" />
<param name="AppendToFile"
value="false" />
<param name="RollingStyle"
value="Date" />
<param name="DatePattern"
value="yyyy.MM.dd" />
<param name="StaticLogFileName"
value="true" />

<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern"
value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>

<!-- Setup the root category, add the appenders and set the default priority -->

<root>
<priority value="WARN" />
<appender-ref ref="console" />
</root>

<logger name="NHibernate.Bytecode.CodeDom">
<priority value="OFF" />
</logger>

<logger name="NHibernate.SQL">
<level value="OFF" />
</logger>

<logger name="NHibernate.Tool.hbm2ddl.SchemaExport">
<level value="WARN" />
</logger>
</log4net>


</configuration>


144 changes: 144 additions & 0 deletions src/NHibernate.Search.Tests/Bridge/BridgeTestCase.cs
@@ -0,0 +1,144 @@
using System;
using System.Collections;
using Lucene.Net.Analysis;
using Lucene.Net.Analysis.Standard;
using Lucene.Net.QueryParsers;
using Lucene.Net.Search;
using NHibernate.Cfg;
using NUnit.Framework;

namespace NHibernate.Search.Tests.Bridge
{
[TestFixture]
public class BridgeTest : SearchTestCase
{
[Test]
public void DefaultAndNullBridges()
{
Cloud cloud = new Cloud();
cloud.DateTime = null;
cloud.Double1 = (null);
cloud.Double2 = (2.1d);
cloud.Int1 = (null);
cloud.Int2 = (2);
cloud.Float1 = (null);
cloud.Float2 = (2.1f);
cloud.Long1 = (null);
cloud.Long2 = (2L);
cloud.String1 = (null);
cloud.Type = (CloudType.Dog);
cloud.Storm = (false);
ISession s = OpenSession();
ITransaction tx = s.BeginTransaction();
s.Save(cloud);
s.Flush();
tx.Commit();

tx = s.BeginTransaction();
IFullTextSession session = Search.CreateFullTextSession(s);
QueryParser parser = new QueryParser("id", new StandardAnalyzer());
Query query;
IList result;

query = parser.Parse("Double2:[2 TO 2.1] AND Float2:[2 TO 2.1] " +
"AND Int2:[2 TO 2.1] AND Long2:[2 TO 2.1] AND Type:\"Dog\" AND Storm:false");

result = session.CreateFullTextQuery(query).List();
Assert.AreEqual(1, result.Count, "find primitives and do not fail on null");

query = parser.Parse("Double1:[2 TO 2.1] OR Float1:[2 TO 2.1] OR Int1:[2 TO 2.1] OR Long1:[2 TO 2.1]");
result = session.CreateFullTextQuery(query).List();
Assert.AreEqual(0, result.Count, "null elements should not be stored"); //the query is dumb because restrictive

s.Delete(s.Get(typeof(Cloud), cloud.Id));
tx.Commit();
s.Close();
}

[Test]
public void CustomBridges()
{
Cloud cloud = new Cloud();
cloud.CustomFieldBridge = ("This is divided by 2");
cloud.CustomStringBridge = ("This is div by 4");
ISession s = OpenSession();
ITransaction tx = s.BeginTransaction();
s.Save(cloud);
s.Flush();
tx.Commit();

tx = s.BeginTransaction();
IFullTextSession session = Search.CreateFullTextSession(s);
QueryParser parser = new QueryParser("id", new SimpleAnalyzer());
Query query;
IList result;

query = parser.Parse("CustomFieldBridge:This AND CustomStringBridge:This");
result = session.CreateFullTextQuery(query).List();
Assert.AreEqual(1, result.Count, "Properties not mapped");

query = parser.Parse("CustomFieldBridge:by AND CustomStringBridge:is");
result = session.CreateFullTextQuery(query).List();
Assert.AreEqual(0, result.Count, "Custom types not taken into account");

s.Delete(s.Get(typeof(Cloud), cloud.Id));
tx.Commit();
s.Close();
}

[Test]
public void DateTimeBridge()
{
Cloud cloud = new Cloud();


DateTime date = new DateTime(2000, 12, 15, 3, 43, 2);
cloud.DateTime = (date); //5 millisecond
cloud.DateTimeDay = (date);
cloud.DateTimeHour = (date);
cloud.DateTimeMillisecond = (date);
cloud.DateTimeMinute = (date);
cloud.DateTimeMonth = (date);
cloud.DateTimeSecond = (date);
cloud.DateTimeYear = (date);
ISession s = OpenSession();
ITransaction tx = s.BeginTransaction();
s.Save(cloud);
s.Flush();
tx.Commit();

tx = s.BeginTransaction();
IFullTextSession session = Search.CreateFullTextSession(s);
QueryParser parser = new QueryParser("id", new StandardAnalyzer());
Query query;
IList result;

query = parser.Parse("DateTime:[19900101 TO 20060101]"
+ " AND DateTimeDay:[20001214 TO 2000121501]"
+ " AND DateTimeMonth:[200012 TO 20001201]"
+ " AND DateTimeYear:[2000 TO 200001]"
+ " AND DateTimeHour:[20001214 TO 2000121503]"
+ " AND DateTimeMinute:[20001214 TO 200012150343]"
+ " AND DateTimeSecond:[20001214 TO 20001215034302]"
+ " AND DateTimeMillisecond:[20001214 TO 20001215034302005]"
);
result = session.CreateFullTextQuery(query).List();
Assert.AreEqual(1, result.Count, "DateTime not found or not property truncated");

s.Delete(s.Get(typeof(Cloud), cloud.Id));
tx.Commit();
s.Close();
}

protected override void Configure(Configuration configuration)
{
base.Configure(configuration);
configuration.SetProperty(Environment.AnalyzerClass, typeof(SimpleAnalyzer).AssemblyQualifiedName);
}

protected override IList Mappings
{
get { return new string[] { "Bridge.Cloud.hbm.xml" }; }
}
}
}

0 comments on commit edfcfca

Please sign in to comment.