Skip to content

Commit b5d045e

Browse files
author
Elad Zelingher
committed
Ensuring session id is unique
Ensuring session id is unique
1 parent e252966 commit b5d045e

File tree

29 files changed

+258
-114
lines changed

29 files changed

+258
-114
lines changed

src/mono/WampSharp.WAMP1/WampSharp.WAMP1.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@
151151
<Compile Include="..\..\net45\WampSharp.WAMP1\WAMP1\V1\Core\Listener\IWampSessionIdGenerator.cs">
152152
<Link>WAMP1\V1\Core\Listener\IWampSessionIdGenerator.cs</Link>
153153
</Compile>
154+
<Compile Include="..\..\net45\WampSharp.WAMP1\WAMP1\V1\Core\Listener\WampClientContainer.cs">
155+
<Link>WAMP1\V1\Core\Listener\WampClientContainer.cs</Link>
156+
</Compile>
154157
<Compile Include="..\..\net45\WampSharp.WAMP1\WAMP1\V1\Core\Listener\WampListener.cs">
155158
<Link>WAMP1\V1\Core\Listener\WampListener.cs</Link>
156159
</Compile>

src/mono/WampSharp/WampSharp.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,9 @@
234234
<Compile Include="..\..\net45\WampSharp\Core\Utilities\GenericTypeExtensions.cs">
235235
<Link>Core\Utilities\GenericTypeExtensions.cs</Link>
236236
</Compile>
237+
<Compile Include="..\..\net45\WampSharp\Core\Utilities\IdMapperBase.cs">
238+
<Link>Core\Utilities\IdMapperBase.cs</Link>
239+
</Compile>
237240
<Compile Include="..\..\net45\WampSharp\Core\Utilities\Method.cs">
238241
<Link>Core\Utilities\Method.cs</Link>
239242
</Compile>
@@ -348,6 +351,9 @@
348351
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\Client\Session\WampAuthenticationNotImplementedException.cs">
349352
<Link>WAMP2\V2\Client\Session\WampAuthenticationNotImplementedException.cs</Link>
350353
</Compile>
354+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\Core\Listener\WampClientContainer.cs">
355+
<Link>WAMP2\V2\Core\Listener\WampClientContainer.cs</Link>
356+
</Compile>
351357
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\PCL\CodeGeneration\CalleeProxyCodeGenerator.cs">
352358
<Link>WAMP2\V2\PCL\CodeGeneration\CalleeProxyCodeGenerator.cs</Link>
353359
</Compile>

src/net40/WampSharp.WAMP1/WampSharp.WAMP1.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@
152152
<Compile Include="..\..\net45\WampSharp.WAMP1\WAMP1\V1\Core\Listener\IWampSessionIdGenerator.cs">
153153
<Link>WAMP1\V1\Core\Listener\IWampSessionIdGenerator.cs</Link>
154154
</Compile>
155+
<Compile Include="..\..\net45\WampSharp.WAMP1\WAMP1\V1\Core\Listener\WampClientContainer.cs">
156+
<Link>WAMP1\V1\Core\Listener\WampClientContainer.cs</Link>
157+
</Compile>
155158
<Compile Include="..\..\net45\WampSharp.WAMP1\WAMP1\V1\Core\Listener\WampListener.cs">
156159
<Link>WAMP1\V1\Core\Listener\WampListener.cs</Link>
157160
</Compile>

src/net40/WampSharp/WampSharp.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,9 @@
238238
<Compile Include="..\..\net45\WampSharp\Core\Utilities\GenericTypeExtensions.cs">
239239
<Link>Core\Utilities\GenericTypeExtensions.cs</Link>
240240
</Compile>
241+
<Compile Include="..\..\net45\WampSharp\Core\Utilities\IdMapperBase.cs">
242+
<Link>Core\Utilities\IdMapperBase.cs</Link>
243+
</Compile>
241244
<Compile Include="..\..\net45\WampSharp\Core\Utilities\Method.cs">
242245
<Link>Core\Utilities\Method.cs</Link>
243246
</Compile>
@@ -352,6 +355,9 @@
352355
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\Client\Session\WampAuthenticationNotImplementedException.cs">
353356
<Link>WAMP2\V2\Client\Session\WampAuthenticationNotImplementedException.cs</Link>
354357
</Compile>
358+
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\Core\Listener\WampClientContainer.cs">
359+
<Link>WAMP2\V2\Core\Listener\WampClientContainer.cs</Link>
360+
</Compile>
355361
<Compile Include="..\..\net45\WampSharp\WAMP2\V2\PCL\CodeGeneration\CalleeProxyCodeGenerator.cs">
356362
<Link>WAMP2\V2\PCL\CodeGeneration\CalleeProxyCodeGenerator.cs</Link>
357363
</Compile>

src/net45/Tests/WampSharp.Tests.Wampv2/TestHelpers/Integration/WampClientPlayground.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
using WampSharp.V2;
66
using WampSharp.V2.Binding;
77
using WampSharp.V2.Client;
8-
using WampSharp.V2.Core;
98
using WampSharp.V2.Core.Contracts;
9+
using WampSharp.V2.Core.Listener;
1010
using WampSharp.V2.Core.Listener.ClientBuilder;
1111

1212
namespace WampSharp.Tests.TestHelpers.Integration
@@ -51,13 +51,12 @@ private static void BuildServerMockHandler<TMessage>(IWampServer<TMessage> serve
5151
{
5252
WampClientBuilderFactory<TMessage> factory =
5353
new WampClientBuilderFactory<TMessage>
54-
(new WampIdGenerator(),
55-
new WampOutgoingRequestSerializer<TMessage>(binding.Formatter),
54+
(new WampOutgoingRequestSerializer<TMessage>(binding.Formatter),
5655
new WampOutgoingMessageHandlerBuilder<TMessage>(),
5756
binding);
5857

59-
WampClientContainer<TMessage, IWampClientProxy<TMessage>> container =
60-
new WampClientContainer<TMessage, IWampClientProxy<TMessage>>(factory);
58+
WampClientContainer<TMessage> container =
59+
new WampClientContainer<TMessage>(factory);
6160

6261
WampIncomingMessageHandler<TMessage, IWampClientProxy<TMessage>> incomingMessageHandler =
6362
new WampIncomingMessageHandler<TMessage, IWampClientProxy<TMessage>>

src/net45/Tests/WampSharp.Tests/ClientServerIntegrationTests.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,9 @@ private WampListener<JToken> GetListener(IWampConnectionListener<JToken> listene
190190
return new WampListener<JToken>
191191
(listener,
192192
handler,
193-
new WampClientContainer<JToken, IWampClient>
193+
new WampClientContainer<JToken>
194194
(new WampClientBuilderFactory<JToken>
195-
(new WampSessionIdGenerator(),
196-
new WampOutgoingRequestSerializer<JToken>(mFormatter),
195+
(new WampOutgoingRequestSerializer<JToken>(mFormatter),
197196
new WampOutgoingMessageHandlerBuilder<JToken>())));
198197
}
199198

src/net45/Tests/WampSharp.Tests/ListenerTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using WampSharp.Newtonsoft;
1010
using WampSharp.V1.Core.Contracts;
1111
using WampSharp.V1.Core.Listener;
12+
using WampSharp.V1.Core.Listener.ClientBuilder;
1213

1314
namespace WampSharp.Tests
1415
{
@@ -64,7 +65,7 @@ private WampListener<JToken> GetListener(IWampConnectionListener<JToken> listene
6465
return new WampListener<JToken>
6566
(listener,
6667
handler,
67-
new WampClientContainer<JToken, IWampClient>(factory.Object));
68+
new WampClientContainer<JToken>(factory.Object));
6869
}
6970

7071
private IWampIncomingMessageHandler<JToken, IWampClient> GetHandler(IWampServer<JToken> wampServer)

src/net45/Tests/WampSharp.Tests/Proxy/Helpers/MockClientContainer.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,10 @@ public bool TryGetClient(IWampConnection<MockRaw> connection, out IWampClient cl
2626
{
2727
throw new System.NotImplementedException();
2828
}
29+
30+
public object GenerateClientId(IWampClient client)
31+
{
32+
return "v59mbCGDXZ7WTyxB";
33+
}
2934
}
3035
}

src/net45/Tests/WampSharp.Tests/Proxy/WampClientBuilderTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ public void Setup()
2525
mOutgoingMessageHandler = new MockOutgoingMessageHandler(mFormatter);
2626

2727
mBuilder =
28-
new WampClientBuilder<MockRaw>(new MockSessionGuidGenerator(),
29-
new WampOutgoingRequestSerializer<MockRaw>(formatter),
28+
new WampClientBuilder<MockRaw>(new WampOutgoingRequestSerializer<MockRaw>(formatter),
3029
new MockOutgoingMessageHandlerBuilder(mOutgoingMessageHandler),
3130
new MockClientContainer());
3231

src/net45/WampSharp.WAMP1/WAMP1/V1/Api/Server/WampHost.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ private static WampListener<TMessage> GetWampListener(IWampConnectionListener<TM
4444
GetWampClientBuilder(formatter);
4545

4646
IWampClientContainer<TMessage, IWampClient> clientContainer =
47-
new WampClientContainer<TMessage, IWampClient>(clientBuilderFactory);
47+
new WampClientContainer<TMessage>(clientBuilderFactory);
4848

4949
IWampRequestMapper<TMessage> requestMapper =
5050
new WampRequestMapper<TMessage>(server.GetType(),
@@ -66,18 +66,14 @@ private static WampListener<TMessage> GetWampListener(IWampConnectionListener<TM
6666

6767
private static WampClientBuilderFactory<TMessage> GetWampClientBuilder(IWampFormatter<TMessage> formatter)
6868
{
69-
WampSessionIdGenerator wampSessionIdGenerator =
70-
new WampSessionIdGenerator();
71-
7269
WampOutgoingRequestSerializer<TMessage> wampOutgoingRequestSerializer =
7370
new WampOutgoingRequestSerializer<TMessage>(formatter);
7471

7572
WampOutgoingMessageHandlerBuilder<TMessage> wampOutgoingMessageHandlerBuilder =
7673
new WampOutgoingMessageHandlerBuilder<TMessage>();
77-
74+
7875
return new WampClientBuilderFactory<TMessage>
79-
(wampSessionIdGenerator,
80-
wampOutgoingRequestSerializer,
76+
(wampOutgoingRequestSerializer,
8177
wampOutgoingMessageHandlerBuilder);
8278
}
8379

0 commit comments

Comments
 (0)