Skip to content

Commit

Permalink
Merge pull request akkadotnet#1591 from Horusiath/akka-cluster-shardi…
Browse files Browse the repository at this point in the history
…ng-wip

Preparations before Akka.Cluster.Tools and Akka.Cluster.Sharding packaging
  • Loading branch information
Aaronontheweb committed Jan 4, 2016
2 parents 0de812d + 80d2f25 commit 02cf74d
Show file tree
Hide file tree
Showing 37 changed files with 4,621 additions and 4,352 deletions.
2 changes: 2 additions & 0 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ Target "CopyOutput" <| fun _ ->
"contrib/testkits/Akka.TestKit.NUnit"
"contrib/testkits/Akka.TestKit.Xunit2"
"contrib/serializers/Akka.Serialization.Wire"
"contrib/cluster/Akka.Cluster.Tools"
"contrib/cluster/Akka.Cluster.Sharding"
]
|> List.iter copyOutput

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using Akka.Persistence.Journal;
using Akka.Remote.TestKit;
using Akka.Remote.Transport;
using Xunit;

namespace Akka.Cluster.Sharding.Tests
{
Expand Down Expand Up @@ -276,7 +275,7 @@ public void ClusterSharding_with_flaky_journal_should_recover_after_journal_fail
region.Tell(new Add("11", 1));

//Test the Shard passivate works during a journal failure
shard2.Tell(new ShardRegion.Passivate(PoisonPill.Instance), entity21);
shard2.Tell(new Passivate(PoisonPill.Instance), entity21);
region.Tell(new Add("21", 1));

region.Tell(new Get("21"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected override void OnReceive(object message)
if (message.Equals("leave"))
{
Context.Watch(_region);
_region.Tell(ShardRegion.GracefulShutdown.Instance);
_region.Tell(GracefulShutdown.Instance);
}
else if ((terminated = message as Terminated) != null && terminated.ActorRef.Equals(_region))
{
Expand Down Expand Up @@ -214,7 +214,7 @@ public void ClusterSharding_should_gracefully_shutdown_a_region()

RunOn(() =>
{
_region.Value.Tell(ShardRegion.GracefulShutdown.Instance);
_region.Value.Tell(GracefulShutdown.Instance);
}, _second);

RunOn(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
//-----------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using Akka.Cluster.Sharding;
using Akka.Configuration;
using Akka.Persistence;
using Akka.Remote.TestKit;
Expand Down Expand Up @@ -189,7 +187,7 @@ protected override bool ReceiveCommand(object message)
.With<Increment>(_ => Persist(new CounterChanged(1), UpdateState))
.With<Increment>(_ => Persist(new CounterChanged(-1), UpdateState))
.With<Get>(_ => Sender.Tell(_count))
.With<ReceiveTimeout>(_ => Context.Parent.Tell(new ShardRegion.Passivate(Stop.Instance)))
.With<ReceiveTimeout>(_ => Context.Parent.Tell(new Passivate(Stop.Instance)))
.With<Stop>(_ => Context.Stop(Self))
.WasHandled;
}
Expand Down Expand Up @@ -383,8 +381,8 @@ public void ClusterSharding_should_work_in_single_node_cluster()
r.Tell(new Counter.Get(1));

ExpectMsg(2);
r.Tell(ShardRegion.GetCurrentRegions.Instance);
ExpectMsg<ShardRegion.CurrentRegions>(m => m.Regions.Length == 1 && m.Regions[0].Equals(Cluster.SelfAddress));
r.Tell(GetCurrentRegions.Instance);
ExpectMsg<CurrentRegions>(m => m.Regions.Length == 1 && m.Regions[0].Equals(Cluster.SelfAddress));
}, _first);

EnterBarrier("after-2");
Expand Down Expand Up @@ -445,8 +443,8 @@ public void ClusterSharding_should_use_second_node()
ExpectMsg(3);
Assert.Equal(r.Path / "2" / "2", LastSender.Path);

r.Tell(ShardRegion.GetCurrentRegions.Instance);
ExpectMsg<ShardRegion.CurrentRegions>(x => x.Regions.Length == 2
r.Tell(GetCurrentRegions.Instance);
ExpectMsg<CurrentRegions>(x => x.Regions.Length == 2
&& x.Regions[0].Equals(Cluster.SelfAddress)
&& x.Regions[1].Equals(Node(_first).Address));
}, _second);
Expand Down Expand Up @@ -906,7 +904,7 @@ public void Persistent_cluster_shards_should_permanently_stop_entities_which_pas

//Send the shard the passivate message from the counter
Watch(counter1);
shard.Tell(new ShardRegion.Passivate(Counter.Stop.Instance), counter1);
shard.Tell(new Passivate(Counter.Stop.Instance), counter1);

// watch for the Terminated message
ExpectTerminated(counter1, TimeSpan.FromSeconds(5));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@
<Compile Include="PersistentShardCoordinator.cs" />
<Compile Include="PersistentShardCoordinator.Messages.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Serialization\ClusterShardingMessageSerializer.cs" />
<Compile Include="Serialization\Proto\ClusterShardingMessages.cs" />
<Compile Include="Shard.cs" />
<Compile Include="ShardAllocationStrategy.cs" />
<Compile Include="ShardingMessages.cs" />
<Compile Include="ShardRegion.cs" />
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -90,8 +92,10 @@
<EmbeddedResource Include="reference.conf" />
</ItemGroup>
<ItemGroup>
<None Include="Akka.Cluster.Sharding.nuspec" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>@project@</id>
<title>@project@@title@</title>
<version>@build.number@</version>
<authors>@authors@</authors>
<owners>@authors@</owners>
<description>Sharded actors with managed lifecycle for Akka.NET cluster</description>
<licenseUrl>https://github.com/akkadotnet/akka.net/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/akkadotnet/akka.net</projectUrl>
<iconUrl>http://getakka.net/images/AkkaNetLogo.Normal.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<releaseNotes>@releaseNotes@</releaseNotes>
<copyright>@copyright@</copyright>
<tags>@tags@ cluster sharding</tags>
@dependencies@
@references@
</metadata>
</package>
Loading

0 comments on commit 02cf74d

Please sign in to comment.