Skip to content
Browse files

MemcachedTest now has a membase test.

  • Loading branch information...
1 parent f53b1e7 commit 85c2e54e855e2752777899082ae47d91673906f5 @enyim committed Aug 12, 2010
View
46 MemcachedTest/App.config
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
+ <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
+
<sectionGroup name="enyim.com">
<section name="memcached" type="Enyim.Caching.Configuration.MemcachedClientSection, Enyim.Caching" />
</sectionGroup>
@@ -15,6 +17,9 @@
<section name="validConfig" type="Enyim.Caching.Configuration.MemcachedClientSection, Enyim.Caching" />
<section name="textConfig" type="Enyim.Caching.Configuration.MemcachedClientSection, Enyim.Caching" />
<section name="binaryConfig" type="Enyim.Caching.Configuration.MemcachedClientSection, Enyim.Caching" />
+
+ <section name="northscaleMemcached" type="NorthScale.Store.Configuration.NorthScaleClientSection, NorthScale.Store" />
+ <section name="northscaleMembase" type="NorthScale.Store.Configuration.NorthScaleClientSection, NorthScale.Store" />
</sectionGroup>
</configSections>
<enyim.com>
@@ -27,6 +32,21 @@
</enyim.com>
<test>
+
+ <northscaleMembase>
+ <servers userName="Administrator" password="11111111">
+ <add uri="http://192.168.2.160:8080/pools/default" />
+ <add uri="http://192.168.2.162:8080/pools/default" />
+ </servers>
+ </northscaleMembase>
+
+ <northscaleMemcached>
+ <servers userName="Administrator" password="11111111">
+ <add uri="http://192.168.2.202:8080/pools/default" />
+ <add uri="http://192.168.2.200:8080/pools/default" />
+ </servers>
+ </northscaleMemcached>
+
<!-- type vs factory test -->
<newProviders>
@@ -96,4 +116,30 @@
</servers>
</invalidConfig>-->
</test>
+
+ <log4net>
+ <appender name="TraceAppender" type="log4net.Appender.TraceAppender">
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%date [%thread] %-5level %logger %message%newline" />
+ </layout>
+ </appender>
+
+ <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
+ <layout type="log4net.Layout.PatternLayout,log4net">
+ <param name="ConversionPattern" value="%d [%t] %-5p %c %m%n" />
+ </layout>
+ </appender>
+
+ <appender name="OutputDebugStringAppender" type="log4net.Appender.OutputDebugStringAppender" >
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%date [%thread] %-5level %logger %message%newline" />
+ </layout>
+ </appender>
+
+ <root>
+ <level value="Fatal" />
+ <appender-ref ref="TraceAppender" />
+ </root>
+ </log4net>
+
</configuration>
View
4 MemcachedTest/MemcachedClientTest.cs
@@ -222,9 +222,9 @@ protected string MakeRandomKey(int partCount)
}
[TestCase]
- public void MultiGetTest()
+ public virtual void MultiGetTest()
{
-
+
// note, this test will fail, if memcached version is < 1.2.4
using (var client = GetClient())
View
6 MemcachedTest/MemcachedTest.csproj
@@ -66,6 +66,8 @@
<Compile Include="BinaryMemcachedClientTest.cs" />
<Compile Include="ConfigTest.cs" />
<Compile Include="KetamaTest.cs" />
+ <Compile Include="NorthScaleMembaseClientTest.cs" />
+ <Compile Include="NorthScaleMemcachedClientTest.cs" />
<Compile Include="TextMemcachedClientTest.cs" />
<Compile Include="MemcachedClientTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -76,6 +78,10 @@
<Project>{D438C0B3-A168-40B8-BDDD-61F0939DFF35}</Project>
<Name>Enyim.Caching</Name>
</ProjectReference>
+ <ProjectReference Include="..\Northscale.Store\Northscale.Store.csproj">
+ <Project>{708A2350-A26C-444D-B975-8164263951A7}</Project>
+ <Name>Northscale.Store</Name>
+ </ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
View
53 MemcachedTest/NorthScaleMembaseClientTest.cs
@@ -0,0 +1,53 @@
+using Enyim.Caching;
+using NUnit.Framework;
+
+namespace MemcachedTest
+{
+ /// <summary>
+ ///This is a test class for Enyim.Caching.MemcachedClient and is intended
+ ///to contain all Enyim.Caching.MemcachedClient Unit Tests
+ ///</summary>
+ [TestFixture]
+ public class NorthScaleMembaseClientTest : BinaryMemcachedClientTest
+ {
+ protected override MemcachedClient GetClient()
+ {
+ var client = new NorthScale.Store.NorthScaleClient("test/northscaleMembase", null);
+ client.FlushAll();
+
+ return client;
+ }
+
+ [TestFixtureSetUp]
+ public void Init()
+ {
+ log4net.Config.XmlConfigurator.Configure();
+ }
+
+ [TestCase]
+ public override void MultiGetTest()
+ {
+ base.MultiGetTest();
+ }
+ }
+}
+
+#region [ License information ]
+/* ************************************************************
+ *
+ * Copyright (c) 2010 Attila Kiskó, enyim.com
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ************************************************************/
+#endregion
View
41 MemcachedTest/NorthScaleMemcachedClientTest.cs
@@ -0,0 +1,41 @@
+using Enyim.Caching;
+using NUnit.Framework;
+
+namespace MemcachedTest
+{
+ /// <summary>
+ ///This is a test class for Enyim.Caching.MemcachedClient and is intended
+ ///to contain all Enyim.Caching.MemcachedClient Unit Tests
+ ///</summary>
+ [TestFixture]
+ public class NorthScaleMemcachedClientTest : BinaryMemcachedClientTest
+ {
+ protected override MemcachedClient GetClient()
+ {
+ var client = new NorthScale.Store.NorthScaleClient("test/northscaleMemcached", null);
+ client.FlushAll();
+
+ return client;
+ }
+ }
+}
+
+#region [ License information ]
+/* ************************************************************
+ *
+ * Copyright (c) 2010 Attila Kiskó, enyim.com
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ************************************************************/
+#endregion
View
38 Northscale.Store/NorthScalePool.cs
@@ -1,4 +1,5 @@
-using System;
+#define DISABLE_VBUCKET
+using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
@@ -111,23 +112,26 @@ private void InitNodes(ClusterConfig config)
IMemcachedNodeLocator locator;
IList<IMemcachedNode> nodes;
+#if !DISABLE_VBUCKET
if (config == null || config.vBucketServerMap == null)
{
- // no vbucket config, use the node list and the ports
- var portType = this.configuration.Port;
-
- endpoints = config == null
- ? Enumerable.Empty<IPEndPoint>()
- : (from node in config.nodes
- where node.status == "healthy"
- select new IPEndPoint(
- IPAddress.Parse(node.hostname),
- (portType == BucketPortType.Proxy
- ? node.ports.proxy
- : node.ports.direct)));
-
- locator = this.configuration.CreateNodeLocator() ?? new KetamaNodeLocator();
- nodes = endpoints.Select(ip => new MemcachedNode(ip, this.configuration.SocketPool, auth)).ToArray();
+#endif
+ // no vbucket config, use the node list and the ports
+ var portType = this.configuration.Port;
+
+ endpoints = config == null
+ ? Enumerable.Empty<IPEndPoint>()
+ : (from node in config.nodes
+ where node.status == "healthy"
+ select new IPEndPoint(
+ IPAddress.Parse(node.hostname),
+ (portType == BucketPortType.Proxy
+ ? node.ports.proxy
+ : node.ports.direct)));
+
+ locator = this.configuration.CreateNodeLocator() ?? new KetamaNodeLocator();
+ nodes = endpoints.Select(ip => new MemcachedNode(ip, this.configuration.SocketPool, auth)).ToArray();
+#if !DISABLE_VBUCKET
}
else
{
@@ -149,7 +153,7 @@ private void InitNodes(ClusterConfig config)
nodes = endpoints.Select(ip => new MemcachedNode(ip, this.configuration.SocketPool, auth) { Bucket = Array.IndexOf(buckets, bucketNodeMap[ip].FirstOrDefault()) }).ToArray();
}
-
+#endif
locator.Initialize(nodes);
Interlocked.Exchange(ref this.currentNodes, new ReadOnlyCollection<IMemcachedNode>(nodes));

0 comments on commit 85c2e54

Please sign in to comment.
Something went wrong with that request. Please try again.