private static WatchdogObject CreateFileRepresentationObject(FileInteractionInterval fileInteractionInterval) { var doc = new WatchdogObject(); doc.Properties.Add("pn", String(WatchdogUtils.Sha1Hash(fileInteractionInterval.Project))); doc.Properties.Add("fn", String(WatchdogUtils.Sha1Hash(Path.GetFileName(fileInteractionInterval.FileName)))); doc.Properties.Add("sloc", Int(0)); doc.Properties.Add( "dt", String(WatchdogUtils.GetSerializedDocumentTypeName(fileInteractionInterval.FileType))); return(doc); }
private static WatchdogObject ConvertBasicInterval(Interval interval) { var obj = new WatchdogObject(); obj.Properties.Add("it", String(WatchdogUtils.GetSerializedIntervalTypeName(interval))); obj.Properties.Add("ts", Wrapped("$numberLong", interval.StartTime.AsUtcTimestamp())); obj.Properties.Add("te", Wrapped("$numberLong", (interval.StartTime + interval.Duration).AsUtcTimestamp())); obj.Properties.Add("ss", String(WatchdogUtils.Sha1Hash(interval.IDESessionId))); obj.Properties.Add("wdv", String("KaVE " + (interval.KaVEVersion ?? "?"))); obj.Properties.Add("ide", String("vs")); obj.Properties.Add("userId", String(WatchdogUtils.Sha1Hash(interval.UserId))); obj.Properties.Add("projectId", String(WatchdogUtils.Sha1Hash(interval.Project))); obj.Properties.Add("ip", String("0.0.0.0")); obj.Properties.Add("regDate", Wrapped("$date", interval.CreationTime.ToIsoDate())); return(obj); }
private static WatchdogObject CreateUserObject(Interval interval) { var obj = new WatchdogObject(); obj.Properties.Add("email", String("")); obj.Properties.Add("organization", String("Unknown")); obj.Properties.Add("programmingExperience", String("Unknown")); obj.Properties.Add("mayContactUser", Literal("false")); obj.Properties.Add("localRegistrationDate", Wrapped("$numberLong", interval.StartTime.AsUtcTimestamp())); obj.Properties.Add("operatingSystem", String("Unknown")); obj.Properties.Add("wdv", String("KaVE")); obj.Properties.Add("ide", String("vs")); obj.Properties.Add("id", String(WatchdogUtils.Sha1Hash(interval.UserId))); obj.Properties.Add("country", String("Unknown")); obj.Properties.Add("city", String("Unknown")); obj.Properties.Add("postCode", Literal("null")); obj.Properties.Add("ip", String("0.0.0.0")); obj.Properties.Add("regDate", Wrapped("$date", DateTimeOffset.Now.ToIsoDate())); return(obj); }
private static WatchdogObject ConvertTestRunInterval(TestRunInterval testRunInterval) { var obj = ConvertBasicInterval(testRunInterval); var projectObject = new WatchdogObject(); obj.Properties.Add("je", projectObject); projectObject.Properties.Add("p", String(WatchdogUtils.Sha1Hash(testRunInterval.ProjectName))); projectObject.Properties.Add("d", Double(testRunInterval.Duration.TotalSeconds)); projectObject.Properties.Add("r", String(testRunInterval.Result.ToSerializedName())); var testClassArray = new WatchdogArray(); projectObject.Properties.Add("c", testClassArray); foreach (var testClass in testRunInterval.TestClasses) { var testClassObject = new WatchdogObject(); testClassArray.Elements.Add(testClassObject); testClassObject.Properties.Add("t", String(WatchdogUtils.Sha1Hash(testClass.TestClassName))); testClassObject.Properties.Add("d", Double(testClass.Duration.TotalSeconds)); testClassObject.Properties.Add("r", String(testClass.Result.ToSerializedName())); var testMethodArray = new WatchdogArray(); testClassObject.Properties.Add("c", testMethodArray); foreach (var testMethod in testClass.TestMethods) { var testMethodObject = new WatchdogObject(); testMethodArray.Elements.Add(testMethodObject); testMethodObject.Properties.Add("m", String(WatchdogUtils.Sha1Hash(testMethod.TestMethodName))); testMethodObject.Properties.Add("d", Double(testMethod.Duration.TotalSeconds)); testMethodObject.Properties.Add("r", String(testMethod.Result.ToSerializedName())); } } return(obj); }
private static WatchdogObject CreateProjectObject(Interval interval) { var obj = new WatchdogObject(); obj.Properties.Add("name", String(interval.Project)); obj.Properties.Add("belongToASingleSoftware", Literal("true")); obj.Properties.Add("usesContinuousIntegration", String("Unknown")); obj.Properties.Add("usesJunit", String("No")); obj.Properties.Add("usesOtherTestingFrameworks", String("Unknown")); obj.Properties.Add("usesOtherTestingForms", String("Unknown")); obj.Properties.Add("productionPercentage", Int(0)); obj.Properties.Add("useJunitOnlyForUnitTesting", String("No")); obj.Properties.Add("followTestDrivenDesign", String("Unknown")); obj.Properties.Add("localRegistrationDate", Wrapped("$numberLong", interval.CreationTime.AsUtcTimestamp())); obj.Properties.Add("userId", String(WatchdogUtils.Sha1Hash(interval.UserId))); obj.Properties.Add("website", String("")); obj.Properties.Add("wdv", String("KaVE")); obj.Properties.Add("ide", String("vs")); obj.Properties.Add("id", String(WatchdogUtils.Sha1Hash(interval.Project))); obj.Properties.Add("ip", String("0.0.0.0")); obj.Properties.Add("regDate", Wrapped("$date", DateTimeOffset.Now.ToIsoDate())); return(obj); }