<commit_before>﻿//-----------------------------------------------------------------------
// <copyright file="CoordinatedShutdownShardingSpec.cs" company="Akka.NET Project">
//     Copyright (C) 2009-2019 Lightbend Inc. <http://www.lightbend.com>
//     Copyright (C) 2013-2019 .NET Foundation <https://github.com/akkadotnet/akka.net>
// </copyright>
//-----------------------------------------------------------------------

using System;
using System.Linq;
using System.Threading.Tasks;
using Akka.Actor;
using Akka.Cluster.Tools.Singleton;
using Akka.Configuration;
using Akka.TestKit;
using FluentAssertions;
using Xunit;
using Xunit.Abstractions;

namespace Akka.Cluster.Sharding.Tests
{
    public class CoordinatedShutdownShardingSpec : AkkaSpec
    {
        private readonly ActorSystem _sys1;
        private readonly ActorSystem _sys2;
        private readonly ActorSystem _sys3;

        private readonly IActorRef _region1;
        private readonly IActorRef _region2;
        private readonly IActorRef _region3;

        private readonly TestProbe _probe1;
        private readonly TestProbe _probe2;
        private readonly TestProbe _probe3;

        private static readonly Config SpecConfig;

        private class EchoActor : ReceiveActor
        {
            public EchoActor()
            {
                ReceiveAny(_ => Sender.Tell(_));
            }
        }

        private readonly ExtractEntityId _extractEntityId = message => (message.ToString(), message);

        private readonly ExtractShardId _extractShard = message => (message.GetHashCode() % 10).ToString();

        static CoordinatedShutdownShardingSpec()
        {
            SpecConfig = ConfigurationFactory.ParseString(@"
                akka.loglevel = DEBUG
                akka.actor.provider = cluster<commit_msg>#3786 - make CoordinatedShutdownShardingSpec use murmur hash for shard distributions (#4186)<commit_after>﻿//-----------------------------------------------------------------------
// <copyright file="CoordinatedShutdownShardingSpec.cs" company="Akka.NET Project">
//     Copyright (C) 2009-2019 Lightbend Inc. <http://www.lightbend.com>
//     Copyright (C) 2013-2019 .NET Foundation <https://github.com/akkadotnet/akka.net>
// </copyright>
//-----------------------------------------------------------------------

using System;
using System.Linq;
using System.Threading.Tasks;
using Akka.Actor;
using Akka.Cluster.Tools.Singleton;
using Akka.Configuration;
using Akka.TestKit;
using Akka.Util;
using FluentAssertions;
using Xunit;
using Xunit.Abstractions;

namespace Akka.Cluster.Sharding.Tests
{
    public class CoordinatedShutdownShardingSpec : AkkaSpec
    {
        private readonly ActorSystem _sys1;
        private readonly ActorSystem _sys2;
        private readonly ActorSystem _sys3;

        private readonly IActorRef _region1;
        private readonly IActorRef _region2;
        private readonly IActorRef _region3;

        private readonly TestProbe _probe1;
        private readonly TestProbe _probe2;
        private readonly TestProbe _probe3;

        private static readonly Config SpecConfig;

        private class EchoActor : ReceiveActor
        {
            public EchoActor()
            {
                ReceiveAny(_ => Sender.Tell(_));
            }
        }

        private readonly ExtractEntityId _extractEntityId = message => (message.ToString(), message);

        private readonly ExtractShardId _extractShard = message => (MurmurHash.StringHash(message.ToString())).ToString();

        static CoordinatedShutdownShardingSpec()
        {
            SpecConfig = ConfigurationFactory.ParseString(@"
                akka.loglevel = DEBUG
                akka.actor.provider = cluster
{'fraction_non_alphanumeric': 0.15308576008549293, 'fraction_numerical': 0.016029922522041145, 'mean_word_length': 2.1568296795952784, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4267694', 'n_tokens_mistral': 996, 'n_tokens_neox': 920, 'n_words': 239}