Skip to content

Commit a8ad6d6

Browse files
authored
Allow git to handle line endings (#118)
* Add .gitattributes * Allow git to handle line endings
1 parent 35f6590 commit a8ad6d6

File tree

93 files changed

+8908
-8879
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+8908
-8879
lines changed

.gitattributes

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text=auto
3+
4+
# Explicitly declare text files you want to always be normalized and converted
5+
# to native line endings on checkout.
6+
*.cs text diff=csharp
7+
*.xaml text
8+
*.txt text
9+
*.tt text
10+
*.ps1 text
11+
*.cmd text
12+
*.msbuild text
13+
*.md text
14+
15+
*.sln text eol=crlf
16+
*.csproj text eol=crlf
17+
*.vbproj text eol=crlf
18+
*.fsproj text eol=crlf
19+
*.dbproj text eol=crlf
20+
21+
# Resharper DotSettings files are in Unix format
22+
*.DotSettings text eol=lf
23+
24+
# Binary files
25+
*.png binary
26+
*.jpg binary
27+
*.dll binary
28+
*.exe binary
29+
Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,57 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<configuration>
3-
<configSections>
4-
<sectionGroup name="enyim.com">
5-
<section name="memcached" type="Enyim.Caching.Configuration.MemcachedClientSection, Enyim.Caching"/>
6-
7-
</sectionGroup>
8-
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"/>
9-
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
10-
</configSections>
11-
12-
<enyim.com>
13-
<memcached>
14-
<servers>
15-
<add address="localhost" port="11211"/>
16-
17-
</servers>
18-
<socketPool minPoolSize="5" maxPoolSize="20" connectionTimeout="00:00:10" deadTimeout="00:02:00"/>
19-
</memcached>
20-
</enyim.com>
21-
22-
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
23-
<session-factory>
24-
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider, NHibernate</property>
25-
<property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
26-
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
27-
<property name="connection.connection_string">
28-
Server=localhost;initial catalog=nhibernate;Integrated Security=SSPI
29-
30-
</property>
31-
<property name="connection.isolation">ReadCommitted</property>
32-
<property name="cache.provider_class">NHibernate.Caches.MemCache.Enyim.MemCacheProvider,NHibernate.Caches.MemCache</property>
33-
</session-factory>
34-
</hibernate-configuration>
35-
36-
<log4net>
37-
<appender name="rollingFile" type="log4net.Appender.RollingFileAppender,log4net">
38-
<param name="File" value="log.txt"/>
39-
<param name="AppendToFile" value="true"/>
40-
<param name="RollingStyle" value="Date"/>
41-
<param name="DatePattern" value="yyyy.MM.dd"/>
42-
<param name="StaticLogFileName" value="true"/>
43-
<layout type="log4net.Layout.PatternLayout,log4net">
44-
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] &lt;%X{auth}&gt; - %m%n"/>
45-
</layout>
46-
</appender>
47-
<root>
48-
<priority value="ALL"/>
49-
<appender-ref ref="rollingFile"/>
50-
</root>
51-
<logger name="Enyim.Caching.Memcached.PooledSocket">
52-
<priority value="ALL"/>
53-
<appender-ref ref="rollingFile"/>
54-
</logger>
55-
</log4net>
56-
57-
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<configSections>
4+
<sectionGroup name="enyim.com">
5+
<section name="memcached" type="Enyim.Caching.Configuration.MemcachedClientSection, Enyim.Caching"/>
6+
7+
</sectionGroup>
8+
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"/>
9+
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
10+
</configSections>
11+
12+
<enyim.com>
13+
<memcached>
14+
<servers>
15+
<add address="localhost" port="11211"/>
16+
17+
</servers>
18+
<socketPool minPoolSize="5" maxPoolSize="20" connectionTimeout="00:00:10" deadTimeout="00:02:00"/>
19+
</memcached>
20+
</enyim.com>
21+
22+
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
23+
<session-factory>
24+
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider, NHibernate</property>
25+
<property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
26+
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
27+
<property name="connection.connection_string">
28+
Server=localhost;initial catalog=nhibernate;Integrated Security=SSPI
29+
30+
</property>
31+
<property name="connection.isolation">ReadCommitted</property>
32+
<property name="cache.provider_class">NHibernate.Caches.MemCache.Enyim.MemCacheProvider,NHibernate.Caches.MemCache</property>
33+
</session-factory>
34+
</hibernate-configuration>
35+
36+
<log4net>
37+
<appender name="rollingFile" type="log4net.Appender.RollingFileAppender,log4net">
38+
<param name="File" value="log.txt"/>
39+
<param name="AppendToFile" value="true"/>
40+
<param name="RollingStyle" value="Date"/>
41+
<param name="DatePattern" value="yyyy.MM.dd"/>
42+
<param name="StaticLogFileName" value="true"/>
43+
<layout type="log4net.Layout.PatternLayout,log4net">
44+
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] &lt;%X{auth}&gt; - %m%n"/>
45+
</layout>
46+
</appender>
47+
<root>
48+
<priority value="ALL"/>
49+
<appender-ref ref="rollingFile"/>
50+
</root>
51+
<logger name="Enyim.Caching.Memcached.PooledSocket">
52+
<priority value="ALL"/>
53+
<appender-ref ref="rollingFile"/>
54+
</logger>
55+
</log4net>
56+
57+
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
Lines changed: 78 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,78 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Threading;
4-
using log4net.Config;
5-
using NHibernate.Cache;
6-
using NHibernate.Caches.Common.Tests;
7-
using NUnit.Framework;
8-
9-
namespace NHibernate.Caches.EnyimMemcached.Tests
10-
{
11-
[TestFixture]
12-
public partial class MemCacheFixture : CacheFixture
13-
{
14-
protected override bool SupportsDistinguishingKeysWithSameStringRepresentationAndHashcode => false;
15-
16-
protected override void Configure(Dictionary<string, string> defaultProperties)
17-
{
18-
XmlConfigurator.Configure();
19-
base.Configure(defaultProperties);
20-
defaultProperties.Add("compression_enabled", "false");
21-
}
22-
23-
protected override Func<ICacheProvider> ProviderBuilder =>
24-
() => new MemCacheProvider();
25-
26-
[Test]
27-
public void TestDefaultConstructor()
28-
{
29-
Assert.That(() => new MemCacheClient(), Throws.Nothing);
30-
}
31-
32-
[Test]
33-
public void TestNoPropertiesConstructor()
34-
{
35-
Assert.That(() => new MemCacheClient("TestNoPropertiesConstructor"), Throws.Nothing);
36-
}
37-
38-
[Test]
39-
public void TestRemove144()
40-
{
41-
string key = "keyTestRemove144";
42-
string value = "value";
43-
44-
//memcached 1.4+ drops support for expiration time specified for Delete operations
45-
//therefore if you install memcached 1.4.4 this test will fail unless corresponding fix is implemented in MemCacheClient.cs
46-
//the test will fail because Remove won't actually delete the item from the cache!
47-
//the error you will see in the log is: "Error deleting key: nunit@key1. Server response: CLIENT_ERROR bad command line format. Usage: delete <key> [noreply]"
48-
49-
//Now, Memcached.ClientLibrary incorrectly divides expiration time for Delete operation by 1000
50-
//(for Add and Set operations the expiration time is calculated correctly)
51-
//that's why we need to set expiration to 20000, otherwise it will be treated as 20ms which is too small to be sent to server (the minimum value is 1 second)
52-
var props = GetDefaultProperties();
53-
props["expiration"] = "20000";
54-
55-
//disabling lingering delete will cause the item to get immediately deleted
56-
//this parameter is NEW and the code to make it work is part of the proposed fix
57-
props.Add("lingering_delete_disabled", "true");
58-
59-
var cache = DefaultProvider.BuildCache("TestRemove144", props);
60-
Assert.That(cache, Is.Not.Null, "no cache returned");
61-
62-
// add the item
63-
cache.Put(key, value);
64-
Thread.Sleep(1000);
65-
66-
// make sure it's there
67-
var item = cache.Get(key);
68-
Assert.That(item, Is.Not.Null, "item just added is not there");
69-
70-
// remove it
71-
cache.Remove(key);
72-
73-
// make sure it's not there
74-
item = cache.Get(key);
75-
Assert.That(item, Is.Null, "item still exists in cache");
76-
}
77-
}
78-
}
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Threading;
4+
using log4net.Config;
5+
using NHibernate.Cache;
6+
using NHibernate.Caches.Common.Tests;
7+
using NUnit.Framework;
8+
9+
namespace NHibernate.Caches.EnyimMemcached.Tests
10+
{
11+
[TestFixture]
12+
public partial class MemCacheFixture : CacheFixture
13+
{
14+
protected override bool SupportsDistinguishingKeysWithSameStringRepresentationAndHashcode => false;
15+
16+
protected override void Configure(Dictionary<string, string> defaultProperties)
17+
{
18+
XmlConfigurator.Configure();
19+
base.Configure(defaultProperties);
20+
defaultProperties.Add("compression_enabled", "false");
21+
}
22+
23+
protected override Func<ICacheProvider> ProviderBuilder =>
24+
() => new MemCacheProvider();
25+
26+
[Test]
27+
public void TestDefaultConstructor()
28+
{
29+
Assert.That(() => new MemCacheClient(), Throws.Nothing);
30+
}
31+
32+
[Test]
33+
public void TestNoPropertiesConstructor()
34+
{
35+
Assert.That(() => new MemCacheClient("TestNoPropertiesConstructor"), Throws.Nothing);
36+
}
37+
38+
[Test]
39+
public void TestRemove144()
40+
{
41+
string key = "keyTestRemove144";
42+
string value = "value";
43+
44+
//memcached 1.4+ drops support for expiration time specified for Delete operations
45+
//therefore if you install memcached 1.4.4 this test will fail unless corresponding fix is implemented in MemCacheClient.cs
46+
//the test will fail because Remove won't actually delete the item from the cache!
47+
//the error you will see in the log is: "Error deleting key: nunit@key1. Server response: CLIENT_ERROR bad command line format. Usage: delete <key> [noreply]"
48+
49+
//Now, Memcached.ClientLibrary incorrectly divides expiration time for Delete operation by 1000
50+
//(for Add and Set operations the expiration time is calculated correctly)
51+
//that's why we need to set expiration to 20000, otherwise it will be treated as 20ms which is too small to be sent to server (the minimum value is 1 second)
52+
var props = GetDefaultProperties();
53+
props["expiration"] = "20000";
54+
55+
//disabling lingering delete will cause the item to get immediately deleted
56+
//this parameter is NEW and the code to make it work is part of the proposed fix
57+
props.Add("lingering_delete_disabled", "true");
58+
59+
var cache = DefaultProvider.BuildCache("TestRemove144", props);
60+
Assert.That(cache, Is.Not.Null, "no cache returned");
61+
62+
// add the item
63+
cache.Put(key, value);
64+
Thread.Sleep(1000);
65+
66+
// make sure it's there
67+
var item = cache.Get(key);
68+
Assert.That(item, Is.Not.Null, "item just added is not there");
69+
70+
// remove it
71+
cache.Remove(key);
72+
73+
// make sure it's not there
74+
item = cache.Get(key);
75+
Assert.That(item, Is.Null, "item still exists in cache");
76+
}
77+
}
78+
}
Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Reflection;
4-
using log4net.Config;
5-
using NHibernate.Cache;
6-
using NHibernate.Caches.Common.Tests;
7-
using NUnit.Framework;
8-
9-
namespace NHibernate.Caches.EnyimMemcached.Tests
10-
{
11-
[TestFixture]
12-
public class MemCacheProviderFixture : CacheProviderFixture
13-
{
14-
protected override void Configure(Dictionary<string, string> defaultProperties)
15-
{
16-
XmlConfigurator.Configure();
17-
base.Configure(defaultProperties);
18-
}
19-
20-
protected override Func<ICacheProvider> ProviderBuilder =>
21-
() => new MemCacheProvider();
22-
23-
[Test]
24-
public void TestBuildCacheFromConfig()
25-
{
26-
var cache = DefaultProvider.BuildCache("foo", null);
27-
Assert.That(cache, Is.Not.Null, "pre-configured cache not found");
28-
}
29-
30-
protected override void OnOneTimeTearDown()
31-
{
32-
var clientField = typeof(MemCacheProvider).GetField("clientInstance", BindingFlags.NonPublic | BindingFlags.Static);
33-
Assert.That(clientField, Is.Not.Null, "Unable to locate client field");
34-
Assert.That(clientField.GetValue(null), Is.Null, "Provider was not stopped");
35-
}
36-
}
37-
}
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Reflection;
4+
using log4net.Config;
5+
using NHibernate.Cache;
6+
using NHibernate.Caches.Common.Tests;
7+
using NUnit.Framework;
8+
9+
namespace NHibernate.Caches.EnyimMemcached.Tests
10+
{
11+
[TestFixture]
12+
public class MemCacheProviderFixture : CacheProviderFixture
13+
{
14+
protected override void Configure(Dictionary<string, string> defaultProperties)
15+
{
16+
XmlConfigurator.Configure();
17+
base.Configure(defaultProperties);
18+
}
19+
20+
protected override Func<ICacheProvider> ProviderBuilder =>
21+
() => new MemCacheProvider();
22+
23+
[Test]
24+
public void TestBuildCacheFromConfig()
25+
{
26+
var cache = DefaultProvider.BuildCache("foo", null);
27+
Assert.That(cache, Is.Not.Null, "pre-configured cache not found");
28+
}
29+
30+
protected override void OnOneTimeTearDown()
31+
{
32+
var clientField = typeof(MemCacheProvider).GetField("clientInstance", BindingFlags.NonPublic | BindingFlags.Static);
33+
Assert.That(clientField, Is.Not.Null, "Unable to locate client field");
34+
Assert.That(clientField.GetValue(null), Is.Null, "Provider was not stopped");
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)