Esempio n. 1
0
        public static SimulacronCluster CreateNew(SimulacronOptions options)
        {
            var simulacronManager = SimulacronManager.Instance;

            simulacronManager.Start();
            var path = string.Format(CreateClusterPathFormat, options.Nodes, options.GetCassandraVersion(), options.GetDseVersion(), options.Name,
                                     options.ActivityLog, options.NumberOfTokens);
            var data    = TaskHelper.WaitToComplete(Post(path, null));
            var cluster = new SimulacronCluster(data["id"].ToString());

            cluster.Data        = data;
            cluster.DataCenters = new List <SimulacronDataCenter>();
            var dcs = (JArray)cluster.Data["data_centers"];

            foreach (var dc in dcs)
            {
                var dataCenter = new SimulacronDataCenter(cluster.Id + "/" + dc["id"]);
                cluster.DataCenters.Add(dataCenter);
                dataCenter.Nodes = new List <SimulacronNode>();
                var nodes = (JArray)dc["nodes"];
                foreach (var nodeJObject in nodes)
                {
                    var node = new SimulacronNode(dataCenter.Id + "/" + nodeJObject["id"]);
                    dataCenter.Nodes.Add(node);
                    node.ContactPoint = nodeJObject["address"].ToString();
                }
            }
            return(cluster);
        }
Esempio n. 2
0
        public static async Task <SimulacronCluster> CreateNewAsync(SimulacronManager simulacronManager, SimulacronOptions options)
        {
            var path = string.Format(CreateClusterPathFormat, options.Nodes, options.GetCassandraVersion(),
                                     options.GetDseVersion(), options.Name, options.ActivityLog, options.NumberOfTokens);
            var data = await Post(simulacronManager, path, null).ConfigureAwait(false);

            return(CreateFromData(simulacronManager, data));
        }
Esempio n. 3
0
        public static SimulacronCluster CreateNew(SimulacronOptions options)
        {
            var simulacronManager = SimulacronManager.Instance;

            simulacronManager.Start();
            var path = string.Format(CreateClusterPathFormat, options.Nodes, options.GetCassandraVersion(),
                                     options.GetDseVersion(), options.Name, options.ActivityLog, options.NumberOfTokens);
            var data = TaskHelper.WaitToComplete(Post(path, null));

            return(CreateFromData(data));
        }