public FullConfig(int threads, int records, ErrorRateConfig errorRate, List <FieldAttributes> fields) { this.threads_count = threads; this.records_count = records; this.error_rate = errorRate; this.fields = fields; }
public static IRecordGenerator ApplyError(IRecordGenerator gen, ErrorRateConfig config) { IRecordGenerator gen1 = ApplyErrorHelper(config.badValue, "Bad value", gen); IRecordGenerator gen2 = ApplyErrorHelper(config.missingField, "Missing field", gen1); IRecordGenerator gen3 = ApplyErrorHelper(config.additionalField, "Additional field", gen2); return(gen3); }
public static FullConfig?ParseConfig(JObject jConfig) { List <FieldAttributes> fields = new List <FieldAttributes>(); foreach (JObject fieldConfig in (JArray)jConfig["dimension_attributes"]) { string typeID = (string)fieldConfig["type"]; fields.Add(configToFieldsTranslator.CaseAt(typeID, fieldConfig)); } // TESTING: try { int threads_count = (int)jConfig["threads_count"]; int records_count = (int)jConfig["records_count"] < 2147483647 ? (int)jConfig["records_count"] : 2147483647; ErrorRateConfig error_rate = new ErrorRateConfig { missingField = (double)jConfig["error_rate"]["missing_field"], badValue = (double)jConfig["error_rate"]["bad_value"], additionalField = (double)jConfig["error_rate"]["additional_field"] }; FullConfig fullConfig = new FullConfig( threads_count, records_count, error_rate, fields ); return(fullConfig); } catch (Exception e) { //Console.WriteLine("Type casting error in thread or record or error_rate."); return(null); } }
public Producer(int amount, List <FieldAttributes> fields, ErrorRateConfig errorRate) { this.Amount = amount; this.recordGenerator = Util.ApplyError(new RecordGenerator(fields), errorRate); }