public JoinWithOfflineSeedNodeConfig()
        {
            Seed = Role("seed");
            NonSeed = Role("nonseed");

            CommonConfig = DebugConfig(false).WithFallback(MultiNodeClusterSpec.ClusterConfig());
        }
예제 #2
0
 public void DeployOn(RoleName role, string deployment)
 {
     ImmutableList<string> roleDeployments;
     _deployments.TryGetValue(role, out roleDeployments);
     _deployments = _deployments.SetItem(role,
         roleDeployments == null ? ImmutableList.Create(deployment) : roleDeployments.Add(deployment));
 }
        public ConsistentHashingRouterMultiNodeConfig()
        {
            _first = Role("first");
            _second = Role("second");
            _third = Role("third");

            CommonConfig = MultiNodeLoggingConfig.LoggingConfig.WithFallback(DebugConfig(true))
                .WithFallback(ConfigurationFactory.ParseString(@"
                    common-router-settings = {
                        router = consistent-hashing-pool
                        nr-of-instances = 10
                        cluster {
                            enabled = on
                            max-nr-of-instances-per-node = 2
                        }
                    }
                    akka.actor.deployment {
                    /router1 = ${common-router-settings}
                    /router3 = ${common-router-settings}
                    /router4 = ${common-router-settings}
                    }
                    akka.cluster.publish-stats-interval = 5s
                "))
                .WithFallback(MultiNodeClusterSpec.ClusterConfig());
        }
예제 #4
0
        public RoundRobinMultiNodeConfig()
        {
            First = Role("first");
            Second = Role("second");
            Third = Role("third");
            Fourth = Role("fourth");

            CommonConfig = DebugConfig(true);

            DeployOnAll(@"
      /service-hello {
        router = round-robin-pool
        nr-of-instances = 3
        target.nodes = [""@first@"", ""@second@"", ""@third@""]
      }
      /service-hello2 {
        router = round-robin-pool
        target.nodes = [""@first@"", ""@second@"", ""@third@""]
      }
      /service-hello3 {
        router = round-robin-group
        routees.paths = [
          ""@first@/user/target-first"",
          ""@second@/user/target-second"",
          ""@third@/user/target-third""]
      }
           ");
        }
예제 #5
0
        public ClusterClientSpecConfig()
        {
            Client = Role("client");
            First = Role("first");
            Second = Role("second");
            Third = Role("third");
            Fourth = Role("fourth");

            CommonConfig = ConfigurationFactory.ParseString(@"
                akka.loglevel = DEBUG
                akka.actor.provider = ""Akka.Cluster.ClusterActorRefProvider, Akka.Cluster""
                akka.remote.log-remote-lifecycle-events = off
                akka.cluster.auto-down-unreachable-after = 0s
                akka.cluster.client.heartbeat-interval = 1s
                akka.cluster.client.acceptable-heartbeat-pause = 3s
                akka.cluster.client.refresh-contacts-interval = 1s
                # number-of-contacts must be >= 4 because we shutdown all but one in the end
                akka.cluster.client.receptionist.number-of-contacts = 4
                akka.cluster.client.receptionist.heartbeat-interval = 10s
                akka.cluster.client.receptionist.acceptable-heartbeat-pause = 10s
                akka.cluster.client.receptionist.failure-detection-interval = 1s
                akka.test.filter-leeway = 10s
            ")
            .WithFallback(ClusterClientReceptionist.DefaultConfig())
            .WithFallback(DistributedPubSub.DefaultConfig());

            TestTransport = true;
        }
예제 #6
0
 public RoleName Role(string name)
 {
     if (_roles.Exists(r => r.Name == name)) throw new ArgumentException("non-unique role name " + name);
     var roleName = new RoleName(name);
     _roles = _roles.Add(roleName);
     return roleName;
 }
        public LookupRemoteActorMultiNetSpec()
        {
            CommonConfig = DebugConfig(false);

            Master = Role("master");
            Slave = Role("slave");
        }
예제 #8
0
 public TestConductorSpecConfig()
 {
     Master = Role("master");
     Slave = Role("slave");
     CommonConfig = DebugConfig(true);
     TestTransport = true;
 }
예제 #9
0
        public NodeUpConfig()
        {
            First = Role("first");
            Second = Role("second");

            CommonConfig = DebugConfig(false)
                .WithFallback(MultiNodeClusterSpec.ClusterConfigWithFailureDetectorPuppet());
        }
 private void Join(RoleName from, RoleName to)
 {
     RunOn(() =>
     {
         Cluster.Join(Node(to).Address);
         CreateSingleton();
     }, from);
 }
예제 #11
0
        public NodeMembershipSpecConfig()
        {
            First = Role("first");
            Second = Role("second");
            Third = Role("third");

            CommonConfig = MultiNodeClusterSpec.ClusterConfigWithFailureDetectorPuppet();
        }
예제 #12
0
 private void Join(RoleName from, RoleName to)
 {
     RunOn(() =>
     {
         Cluster.Join(Node(to).Address);
         ClusterClientReceptionist.Get(Sys);
     }, from);
     EnterBarrier(from.Name + "-joined");
 }
        public MembershipChangeListenerUpConfig()
        {
            First = Role("first");
            Second = Role("second");
            Third = Role("third");

            CommonConfig = DebugConfig(false)
                .WithFallback(MultiNodeClusterSpec.ClusterConfigWithFailureDetectorPuppet());
        }
예제 #14
0
 /// <summary>
 /// Excludes the role.
 /// </summary>
 /// <param name="query">The query.</param>
 /// <param name="roleName">Name of the role.</param>
 /// <returns></returns>
 public static IQueryable<User> ExcludeRole(this IQueryable<User> query, RoleName? roleName)
 {
     if (roleName.HasValue)
     {
         var exclude = new string[] { roleName.Value.ToString() };
         query = query.Where(u => u.UserRoles.Select(ur => ur.Role.RoleName).Except(exclude).Any());
     }
     return query;
 }
        public ClientDowningNodeThatIsUnreachableMultiNodeConfig(bool failureDetectorPuppet)
        {
            First = Role("first");
            Second = Role("second");
            Third = Role("third");
            Fourth = Role("fourth");

            CommonConfig= DebugConfig(false).WithFallback(MultiNodeClusterSpec.ClusterConfig(failureDetectorPuppet));
        }
        public ClusterConsistentHashingGroupSpecConfig()
        {
            First = Role("first");
            Second = Role("second");
            Third = Role("third");

            CommonConfig = DebugConfig(false)
                .WithFallback(MultiNodeClusterSpec.ClusterConfig());
        }
예제 #17
0
        public MinMembersBeforeUpSpecConfig()
        {
            First = Role("first");
            Second = Role("second");
            Third = Role("third");

            CommonConfig = ConfigurationFactory.ParseString(@"
                akka.cluster.min-nr-of-members = 3
            ").WithFallback(MultiNodeClusterSpec.ClusterConfigWithFailureDetectorPuppet());
        }
예제 #18
0
        public RestartNodeSpecConfig()
        {
            First = Role("first");
            Second = Role("second");
            Third = Role("third");

            CommonConfig = DebugConfig(true)
                .WithFallback(ConfigurationFactory.ParseString(@"akka.cluster.auto-down-unreachable-after = 5s"))
                .WithFallback(MultiNodeClusterSpec.ClusterConfig());
        }
        public NodeDowningAndBeingRemovedSpecSpecConfig()
        {
            First = Role("first");
            Second = Role("second");
            Third = Role("third");

            CommonConfig = DebugConfig(false)
                .WithFallback(ConfigurationFactory.ParseString("akka.cluster.auto-down-unreachable-after = off"))
                .WithFallback(MultiNodeClusterSpec.ClusterConfig());
        }
 public UnreachableNodeJoinsAgainConfig()
 {
     First = Role("first");
     Second = Role("second");
     Third = Role("third");
     Fourth = Role("fourth");
     CommonConfig = ConfigurationFactory.ParseString("akka.remote.log-remote-lifecycle-events = off")
         .WithFallback(DebugConfig(false)).WithFallback(MultiNodeClusterSpec.ClusterConfig());
     TestTransport = true; // need to use the throttler and blackhole
 }
        public LeaderDowningNodeThatIsUnreachableConfig(bool failureDectectorPuppet)
        {
            First = Role("first");
            Second = Role("second");
            Third = Role("third");
            Fourth = Role("fourth");

            CommonConfig = DebugConfig(false)
                .WithFallback(ConfigurationFactory.ParseString(@"akka.cluster.auto-down-unreachable-after = 2s"))
                .WithFallback(MultiNodeClusterSpec.ClusterConfig(failureDectectorPuppet));
        }
예제 #22
0
        public LeaderElectionSpecConfig(bool failureDectectorPuppet)
        {
            Controller = Role("controller");
            First = Role("first");
            Second = Role("second");
            Third = Role("third");
            Forth = Role("forth");

            CommonConfig = DebugConfig(false)
                .WithFallback(MultiNodeClusterSpec.ClusterConfig(failureDectectorPuppet));
        }
        public AttemptSysMsgRedeliverySpecConfig()
        {
            First = Role("first");
            Second = Role("second");
            Third = Role("third");

            CommonConfig = DebugConfig(false)
                .WithFallback(MultiNodeClusterSpec.ClusterConfig());

            TestTransport = true;
        }
        public DisallowJoinOfTwoClusterSpecConfig()
        {
            a1 = Role("a1");
            a2 = Role("a2");
            b1 = Role("b1");
            b2 = Role("b2");
            c1 = Role("c1");

            CommonConfig = ConfigurationFactory.ParseString("")
                .WithFallback(MultiNodeClusterSpec.ClusterConfigWithFailureDetectorPuppet());
        }
        protected ClusterSingletonManagerLeaveSpec(ClusterSingletonManagerLeaveSpecConfig config) : base(config)
        {
            _first = config.First;
            _second = config.Second;
            _third = config.Third;

            _echoProxy = new Lazy<IActorRef>(() => Sys.ActorOf(ClusterSingletonProxy.Props(
                singletonManagerPath: "/user/echo",
                settings: ClusterSingletonProxySettings.Create(Sys)),
                "echoProxy"));
        }
        public ClusterConsistentHashingGroupSpecConfig()
        {
            _first = Role("first");
            _second = Role("second");
            _third = Role("third");

            CommonConfig = MultiNodeLoggingConfig.LoggingConfig.WithFallback(DebugConfig(false))
                .WithFallback(ConfigurationFactory.ParseString(@"
                    akka.cluster.publish-stats-interval = 5s
                "))
                .WithFallback(MultiNodeClusterSpec.ClusterConfig());
        }
예제 #27
0
        public SingletonClusterConfig(bool failureDetectorPuppet)
        {
            First = Role("first");
            Second = Role("second");

            CommonConfig = DebugConfig(false)
                .WithFallback(ConfigurationFactory.ParseString(@"
                    akka.cluster.auto-down-unreachable-after = 0s
                    akka.cluster.failure-detector.threshold = 4
                "))
                .WithFallback(MultiNodeClusterSpec.ClusterConfig(failureDetectorPuppet));
        }
예제 #28
0
        public LeaderLeavingSpecConfig()
        {
            _first = Role("first");
            _second = Role("second");
            _third = Role("third");

            CommonConfig = MultiNodeLoggingConfig.LoggingConfig
                .WithFallback(DebugConfig(true))
                .WithFallback(@"akka.cluster.auto-down-unreachable-after = 0s
akka.cluster.publish-stats-interval = 25 s")
                .WithFallback(MultiNodeClusterSpec.ClusterConfigWithFailureDetectorPuppet());
        }
예제 #29
0
        public JoinSeedNodeConfig()
        {
            _seed1 = Role("seed1");
            _seed2 = Role("seed2");
            _seed3 = Role("seed3");
            _ordinary1 = Role("ordinary1");
            _ordinary2 = Role("ordinary2");

            CommonConfig = MultiNodeLoggingConfig.LoggingConfig.WithFallback(DebugConfig(true))
                .WithFallback(ConfigurationFactory.ParseString(@"akka.cluster.publish-stats-interval = 25s"))
                .WithFallback(MultiNodeClusterSpec.ClusterConfig());
        }
예제 #30
0
        public PiercingShouldKeepQuarantineMultiNodeConfig()
        {
            First = Role("first");
            Second = Role("second");

            CommonConfig = DebugConfig(true)
                .WithFallback(ConfigurationFactory.ParseString(@"
    akka.loglevel = INFO
    akka.remote.log-remote-lifecycle-events = INFO
    akka.remote.retry-gate-closed-for = 10s
                "));
        }
예제 #31
0
 public NoAbstractClassesConfig()
 {
     Dummy = Role("dummy");
 }
예제 #32
0
 public async Task <IdentityResult> AddToRoleAsync(string id, RoleName role) => await UserManager.AddToRoleAsync(id, role);
예제 #33
0
 public async Task <bool> AdmitRole(RoleName roleName, User user)
 => user == null ? false : (await userManager.AddToRoleAsync(user, Utils.EnumToString(roleName))).Succeeded;
 protected IEnumerable <RoleName> AllBut(RoleName roleName, IEnumerable <RoleName> roles)
 {
     return(roles.Where(x => !x.Equals(roleName)));
 }
예제 #35
0
 private UserRoleVM GetUserRole(RoleName role, IEnumerable <RoleName> userRoles)
 {
     //return new UserRoleVM(role.ToString(), Resx<Resources.Views>.Localizer[role.ToString()], userRoles.Contains(role));
     throw new NotImplementedException();
 }
예제 #36
0
        public async Task <bool> IsPermitted(RoleName roleName, int userId)
        {
            var user = await userManager.FindByIdAsync(userId.ToString());

            return(user == null ? false : await userManager.IsInRoleAsync(user, Utils.EnumToString(roleName)));
        }
예제 #37
0
 private IActorRef Identify(RoleName role, string actorName)
 {
     Sys.ActorSelection(Node(role) / "user" / actorName).Tell(new Identify(actorName));
     return(ExpectMsg <ActorIdentity>().Subject);
 }
예제 #38
0
 protected Bugfix4353Spec(Bugfix4353SpecsConfig config) : base(config, typeof(Bugfix4353Spec))
 {
     First  = config.First;
     Second = config.Second;
     Third  = config.Third;
 }
 public static bool IsInRole(this ApplicationUser user, RoleName roleName)
 {
     return(user.Roles.Any(x => x.Role.Name == RoleName.TeamManagement));
 }
예제 #40
0
 public Role(RoleName name, RoleName food)
 {
     Name = name;
     Food = food;
 }
예제 #41
0
 public async Task <string> GetRoleId(RoleName roleName)
 => (await database.RoleRepository.Find(r => r.Name.ToLower() == Utils.EnumToString <RoleName>(roleName).ToLower()))?.Id;
예제 #42
0
파일: Role.cs 프로젝트: ItsMoShehab/CUC
        /// <summary>
        ///  Adds a role assignment to a user.  Returns a failure response if that user already has the role assigned to them.
        /// </summary>
        /// <param name="pConnectionServer" type="Cisco.UnityConnection.RestFunctions.ConnectionServerRest">
        /// Connection server that the user being edited lives on.
        /// </param>
        /// <param name="pUserObjectId" type="string">
        /// Unique ID of the user to add the role to
        /// </param>
        /// <param name="pRoleName" type="string">
        /// value from the RoleName enum representing the role to add to the user
        /// </param>
        /// <returns>
        /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface.
        /// </returns>
        public static WebCallResult AddRoleToUser(ConnectionServerRest pConnectionServer, string pUserObjectId, RoleName pRoleName)
        {
            string strRoleName = GetRoleName(pRoleName);

            if (string.IsNullOrEmpty(strRoleName))
            {
                WebCallResult res = new WebCallResult
                {
                    Success   = false,
                    ErrorText = "Invalid role enum value passed to AddRoleToUser:"******"Could not find role ObjectId by name in AddRoleToUser:" + strRoleName
                };
                return(res);
            }
            return(AddRoleToUser(pConnectionServer, pUserObjectId, strRoleObjectId));
        }
예제 #43
0
 public async Task <bool> RevokeRole(RoleName roleName, User user)
 => RevokeRole(await GetRoleId(roleName), user);
예제 #44
0
 public async Task <bool> AdmitRole(RoleName roleName, User user)
 => AdmitRole(await GetRoleId(roleName), user);
예제 #45
0
 protected DistributedPubSubMediatorSpec(DistributedPubSubMediatorSpecConfig config) : base(config, typeof(DistributedPubSubMediatorSpec))
 {
     _first  = config.First;
     _second = config.Second;
     _third  = config.Third;
 }
예제 #46
0
        private string GetDistinctString(bool ShowPathInfo)
        {
            LoadUpperRef();
            string str = String.Format(@"{0}.{1}", (UpperRef != null && ShowPathInfo ? UpperRef.GetFullEntityPath(".") : ""), RoleName.Trim());

            str = str.Trim(".".ToCharArray());
            return(str);
        }
 protected IEnumerable <RoleName> AllBut(RoleName roleName)
 {
     return(AllBut(roleName, Roles));
 }
예제 #48
0
 public override int GetHashCode()
 {
     return((ActivityId.ToString() + "|" + RoleName.ToString()).GetHashCode());
 }
예제 #49
0
 private void Join(RoleName from, RoleName to)
 {
     RunOn(() => cluster.Join(Node(to).Address), from);
     EnterBarrier(from.Name + "-joined");
 }
예제 #50
0
 private ActorSelection Echo(RoleName oldest)
 {
     return(Sys.ActorSelection(new RootActorPath(GetAddress(oldest)) / "user" / "echo" / "singleton"));
 }
예제 #51
0
 public bool IsInRole(string userId, RoleName role)
 => GetUserRoles(userId).Contains(role);
 private ActorSelection GetConsumer(RoleName oldest)
 {
     return(Sys.ActorSelection(new RootActorPath(Node(oldest).Address) / "user" / "consumer" / "singleton"));
 }
예제 #53
0
 public async Task <bool> RevokeRole(RoleName roleName, User user)
 => user == null ? false : (await userManager.RemoveFromRoleAsync(user, Utils.EnumToString(roleName))).Succeeded;
예제 #54
0
 private void Apply(NewClientAdded create)
 {
     _name           = new RoleName(create.Name);
     _normalizedName = new RoleNormalizedName(create.NormalizedName);
     SetConcurrencyCheckStamp(create.ConcurrencyCheckStamp);
 }
예제 #55
0
 public static Role Create(int roleId, RoleName roleName, RoleDescription roleDescription, bool isActive)
 {
     return(new Role {
         Id = roleId, RoleName = roleName, RoleDescription = roleDescription, IsActive = isActive
     });
 }
예제 #56
0
 private void Apply(RoleRenamed rename)
 {
     _name           = new RoleName(rename.Name);
     _normalizedName = new RoleNormalizedName(rename.NormalizedName);
 }
예제 #57
0
 public DeeplyInheritedConfig()
 {
     DeeplyInheritedChildRole = Role("DeeplyInheritedChildRole");
 }
예제 #58
0
 public bool IsPermitted(RoleName roleName, User user)
 => user.UserRoles.Any(ur => ur.Role.Name == Utils.EnumToString(roleName));
예제 #59
0
 public async Task <bool> RoleExists(RoleName roleName) => await GetRoleId(roleName) != null;
예제 #60
0
파일: Role.cs 프로젝트: ItsMoShehab/CUC
        /// <summary>
        ///  Removes a role assignment from a user.  Returns a failure response if that user does not have the role assigned to them.
        /// </summary>
        /// <param name="pConnectionServer" type="Cisco.UnityConnection.RestFunctions.ConnectionServerRest">
        /// Connection server that the user being edited lives on.
        /// </param>
        /// <param name="pUserObjectId" type="string">
        /// Unique ID of the user to remove the role from
        /// </param>
        /// <param name="pRoleName" type="string">
        /// value from the RoleName enum representing the role to add to the user
        /// </param>
        /// <returns>
        /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface.
        /// </returns>

        public static WebCallResult RemoveRoleFromUser(ConnectionServerRest pConnectionServer, string pUserObjectId, RoleName pRoleName)
        {
            WebCallResult res = new WebCallResult
            {
                Success = false
            };
            string strRoleName = GetRoleName(pRoleName);

            if (string.IsNullOrEmpty(strRoleName))
            {
                res.ErrorText = "Invalid role enum value passed to RemoveRoleFromUser:"******"Role not assigned to user";
            return(res);
        }