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); }
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)); }
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)); }