public static int Main() { var t = Type.GetType("Mono.Runtime"); var m = t.GetMethod("GetDisplayName", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static); Console.WriteLine("Mono runtime: " + m.Invoke(null, null)); //Console.WriteLine (BitConverter.IsLittleEndian); /* * var testAssembly = TestAssemblyBuilder.Build(new ExecutorWrapper("Voron.Tests.dll", null, false)); * * var testMethods = testAssembly.EnumerateTestMethods(x => true).ToList(); * if (testMethods.Count == 0) * return 0; * * var callback = new TestMethodRunnerCallback(); * testAssembly.Run(testMethods, callback); * * if (callback.FailedCount > 0) * { * Console.WriteLine("Has failures"); * return 1; * }*/ var x = new InitialSize(); x.WhenInitialFileSizeIsSetTheFileSizeForDataFileAndScratchFileShouldBeSetAccordinglyAndItWillBeRoundedToTheNearestGranularity(); Console.WriteLine("done"); return(0); }
protected InProcessServiceClientContentPerformanceTests ( ILogger logger, InitialSize initialSize, PerformanceResultsFixture resultsFixture, string scenario, ITestOutputHelper output ) : base(logger, initialSize, resultsFixture, output) { _scenario = scenario; }
protected InProcessServiceClientContentPerformanceTests ( ILogger logger, InitialSize initialSize, uint maxConnections, uint connectionsPerSession, PerformanceResultsFixture resultsFixture, string scenario, ITestOutputHelper output ) : base(logger, initialSize, resultsFixture, output) { _maxConnections = maxConnections; _connectionsPerSession = connectionsPerSession; _scenario = scenario; }
protected ContentPerformanceTests ( ILogger logger, InitialSize initialSize, PerformanceResultsFixture resultsFixture, ITestOutputHelper output = null ) : base(() => new PassThroughFileSystem(logger), logger, output) { _context = new Context(Logger); _initialSize = initialSize; _resultsFixture = resultsFixture; var itemCountEnvironmentVariable = Environment.GetEnvironmentVariable(ItemCountEnvironmentVariableName); _itemCount = itemCountEnvironmentVariable == null ? ItemCountDefault : int.Parse(itemCountEnvironmentVariable); _context.Debug($"Using itemCount=[{_itemCount}]"); _prePopulatedRootPath = FileSystem.GetTempPath() / "CloudStore" / "ContentPerformanceTestsPrePopulated"; }
/// <summary> /// Funkcija upisuje u FileSystem.bin datoteku podatke o kreiranom fajlu u vidu jednog zapisa u MFT tabeli /// MFT = Master File Table /// Prepisuje prvu liniju binarne datoteke, zapim upisuje novi zapis, potom prepisuje ostatak sadrzaja datoteke /// </summary> /// <returns>Funkcija vraca true/false u zavisnosti od toga da li je bilo moguće upisati podatke u datoteku</returns> internal bool WriteToMFT() { byte[] content = File.ReadAllBytes("FileSystem.bin"); string mftRecord = "file~" + FileId.ToString() + "~" + FileName + "~" + FilePath + "~" + DateCreated.ToString() + "~" + InitialSize.ToString() + "~" + NumberOfBlocks.ToString(); if (content.Length + mftRecord.Length + 1 > FileSystem.freeSpace) { Console.WriteLine("Greska - nije moguce dodati datoteku jer je memorija fajl sistema popunjena."); return(false); } BinaryWriter writer1 = new BinaryWriter(new FileStream("FileSystem.bin", FileMode.Truncate)); for (int i = 0; i < 51; i++) { writer1.Write(content[i]); } writer1.Close(); StreamWriter writer2 = new StreamWriter(new FileStream("FileSystem.bin", FileMode.Append)); writer2.Write(mftRecord + '\n'); writer2.Close(); BinaryWriter writer3 = new BinaryWriter(new FileStream("FileSystem.bin", FileMode.Append)); for (int i = 51; i < content.Length; i++) { writer3.Write(content[i]); } writer3.Close(); return(true); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (DatasourceName != null) { hashCode = hashCode * 59 + DatasourceName.GetHashCode(); } if (DatasourceSvcPropName != null) { hashCode = hashCode * 59 + DatasourceSvcPropName.GetHashCode(); } if (DriverClassName != null) { hashCode = hashCode * 59 + DriverClassName.GetHashCode(); } if (Url != null) { hashCode = hashCode * 59 + Url.GetHashCode(); } if (Username != null) { hashCode = hashCode * 59 + Username.GetHashCode(); } if (Password != null) { hashCode = hashCode * 59 + Password.GetHashCode(); } if (DefaultAutoCommit != null) { hashCode = hashCode * 59 + DefaultAutoCommit.GetHashCode(); } if (DefaultReadOnly != null) { hashCode = hashCode * 59 + DefaultReadOnly.GetHashCode(); } if (DefaultTransactionIsolation != null) { hashCode = hashCode * 59 + DefaultTransactionIsolation.GetHashCode(); } if (DefaultCatalog != null) { hashCode = hashCode * 59 + DefaultCatalog.GetHashCode(); } if (MaxActive != null) { hashCode = hashCode * 59 + MaxActive.GetHashCode(); } if (MaxIdle != null) { hashCode = hashCode * 59 + MaxIdle.GetHashCode(); } if (MinIdle != null) { hashCode = hashCode * 59 + MinIdle.GetHashCode(); } if (InitialSize != null) { hashCode = hashCode * 59 + InitialSize.GetHashCode(); } if (MaxWait != null) { hashCode = hashCode * 59 + MaxWait.GetHashCode(); } if (MaxAge != null) { hashCode = hashCode * 59 + MaxAge.GetHashCode(); } if (TestOnBorrow != null) { hashCode = hashCode * 59 + TestOnBorrow.GetHashCode(); } if (TestOnReturn != null) { hashCode = hashCode * 59 + TestOnReturn.GetHashCode(); } if (TestWhileIdle != null) { hashCode = hashCode * 59 + TestWhileIdle.GetHashCode(); } if (ValidationQuery != null) { hashCode = hashCode * 59 + ValidationQuery.GetHashCode(); } if (ValidationQueryTimeout != null) { hashCode = hashCode * 59 + ValidationQueryTimeout.GetHashCode(); } if (TimeBetweenEvictionRunsMillis != null) { hashCode = hashCode * 59 + TimeBetweenEvictionRunsMillis.GetHashCode(); } if (MinEvictableIdleTimeMillis != null) { hashCode = hashCode * 59 + MinEvictableIdleTimeMillis.GetHashCode(); } if (ConnectionProperties != null) { hashCode = hashCode * 59 + ConnectionProperties.GetHashCode(); } if (InitSQL != null) { hashCode = hashCode * 59 + InitSQL.GetHashCode(); } if (JdbcInterceptors != null) { hashCode = hashCode * 59 + JdbcInterceptors.GetHashCode(); } if (ValidationInterval != null) { hashCode = hashCode * 59 + ValidationInterval.GetHashCode(); } if (LogValidationErrors != null) { hashCode = hashCode * 59 + LogValidationErrors.GetHashCode(); } if (DatasourceSvcProperties != null) { hashCode = hashCode * 59 + DatasourceSvcProperties.GetHashCode(); } return(hashCode); } }
/// <summary> /// Returns true if OrgApacheSlingDatasourceDataSourceFactoryProperties instances are equal /// </summary> /// <param name="other">Instance of OrgApacheSlingDatasourceDataSourceFactoryProperties to be compared</param> /// <returns>Boolean</returns> public bool Equals(OrgApacheSlingDatasourceDataSourceFactoryProperties other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( DatasourceName == other.DatasourceName || DatasourceName != null && DatasourceName.Equals(other.DatasourceName) ) && ( DatasourceSvcPropName == other.DatasourceSvcPropName || DatasourceSvcPropName != null && DatasourceSvcPropName.Equals(other.DatasourceSvcPropName) ) && ( DriverClassName == other.DriverClassName || DriverClassName != null && DriverClassName.Equals(other.DriverClassName) ) && ( Url == other.Url || Url != null && Url.Equals(other.Url) ) && ( Username == other.Username || Username != null && Username.Equals(other.Username) ) && ( Password == other.Password || Password != null && Password.Equals(other.Password) ) && ( DefaultAutoCommit == other.DefaultAutoCommit || DefaultAutoCommit != null && DefaultAutoCommit.Equals(other.DefaultAutoCommit) ) && ( DefaultReadOnly == other.DefaultReadOnly || DefaultReadOnly != null && DefaultReadOnly.Equals(other.DefaultReadOnly) ) && ( DefaultTransactionIsolation == other.DefaultTransactionIsolation || DefaultTransactionIsolation != null && DefaultTransactionIsolation.Equals(other.DefaultTransactionIsolation) ) && ( DefaultCatalog == other.DefaultCatalog || DefaultCatalog != null && DefaultCatalog.Equals(other.DefaultCatalog) ) && ( MaxActive == other.MaxActive || MaxActive != null && MaxActive.Equals(other.MaxActive) ) && ( MaxIdle == other.MaxIdle || MaxIdle != null && MaxIdle.Equals(other.MaxIdle) ) && ( MinIdle == other.MinIdle || MinIdle != null && MinIdle.Equals(other.MinIdle) ) && ( InitialSize == other.InitialSize || InitialSize != null && InitialSize.Equals(other.InitialSize) ) && ( MaxWait == other.MaxWait || MaxWait != null && MaxWait.Equals(other.MaxWait) ) && ( MaxAge == other.MaxAge || MaxAge != null && MaxAge.Equals(other.MaxAge) ) && ( TestOnBorrow == other.TestOnBorrow || TestOnBorrow != null && TestOnBorrow.Equals(other.TestOnBorrow) ) && ( TestOnReturn == other.TestOnReturn || TestOnReturn != null && TestOnReturn.Equals(other.TestOnReturn) ) && ( TestWhileIdle == other.TestWhileIdle || TestWhileIdle != null && TestWhileIdle.Equals(other.TestWhileIdle) ) && ( ValidationQuery == other.ValidationQuery || ValidationQuery != null && ValidationQuery.Equals(other.ValidationQuery) ) && ( ValidationQueryTimeout == other.ValidationQueryTimeout || ValidationQueryTimeout != null && ValidationQueryTimeout.Equals(other.ValidationQueryTimeout) ) && ( TimeBetweenEvictionRunsMillis == other.TimeBetweenEvictionRunsMillis || TimeBetweenEvictionRunsMillis != null && TimeBetweenEvictionRunsMillis.Equals(other.TimeBetweenEvictionRunsMillis) ) && ( MinEvictableIdleTimeMillis == other.MinEvictableIdleTimeMillis || MinEvictableIdleTimeMillis != null && MinEvictableIdleTimeMillis.Equals(other.MinEvictableIdleTimeMillis) ) && ( ConnectionProperties == other.ConnectionProperties || ConnectionProperties != null && ConnectionProperties.Equals(other.ConnectionProperties) ) && ( InitSQL == other.InitSQL || InitSQL != null && InitSQL.Equals(other.InitSQL) ) && ( JdbcInterceptors == other.JdbcInterceptors || JdbcInterceptors != null && JdbcInterceptors.Equals(other.JdbcInterceptors) ) && ( ValidationInterval == other.ValidationInterval || ValidationInterval != null && ValidationInterval.Equals(other.ValidationInterval) ) && ( LogValidationErrors == other.LogValidationErrors || LogValidationErrors != null && LogValidationErrors.Equals(other.LogValidationErrors) ) && ( DatasourceSvcProperties == other.DatasourceSvcProperties || DatasourceSvcProperties != null && DatasourceSvcProperties.Equals(other.DatasourceSvcProperties) )); }
protected FileSystemContentPerformanceTests( ILogger logger, InitialSize initialSize, PerformanceResultsFixture resultsFixture, ITestOutputHelper output = null) : base(logger, initialSize, resultsFixture, output) { }
public override void DoWindowContents(Rect inRect) { if (first) { Log.Message(InitialSize.ToString()); Log.Message(windowRect.ToString()); } // set up rects Rect pickerRect = new Rect(inRect.xMin, inRect.yMin, _pickerSize, _pickerSize); Rect hueRect = new Rect(pickerRect.xMax + _margin, inRect.yMin, _sliderWidth, _pickerSize); Rect alphaRect = new Rect(hueRect.xMax + _margin, inRect.yMin, _sliderWidth, _pickerSize); Rect previewRect = new Rect(alphaRect.xMax + _margin, inRect.yMin, _previewSize, _previewSize); Rect previewOldRect = new Rect(previewRect.xMax, inRect.yMin, _previewSize, _previewSize); Rect doneRect = new Rect(alphaRect.xMax + _margin, inRect.yMax - _fieldHeight, _previewSize * 2, _fieldHeight); Rect setRect = new Rect(alphaRect.xMax + _margin, inRect.yMax - 2 * _fieldHeight - _margin, _previewSize - _margin / 2, _fieldHeight); Rect cancelRect = new Rect(setRect.xMax + _margin, setRect.yMin, _previewSize - _margin / 2, _fieldHeight); Rect hexRect = new Rect(alphaRect.xMax + _margin, inRect.yMax - 3 * _fieldHeight - 2 * _margin, _previewSize * 2, _fieldHeight); // draw transparency backgrounds GUI.DrawTexture(pickerRect, PickerAlphaBG); GUI.DrawTexture(alphaRect, SliderAlphaBG); GUI.DrawTexture(previewRect, PreviewAlphaBG); GUI.DrawTexture(previewOldRect, PreviewAlphaBG); // draw picker foregrounds GUI.DrawTexture(pickerRect, ColourPickerBG); GUI.DrawTexture(hueRect, HuePickerBG); GUI.DrawTexture(alphaRect, AlphaPickerBG); GUI.DrawTexture(previewRect, TempPreviewBG); GUI.DrawTexture(previewOldRect, PreviewBG); // draw slider handles // TODO: get HSV from RGB for init of handles. Rect hueHandleRect = new Rect(hueRect.xMin - 3f, hueRect.yMin + _huePosition - _handleSize / 2, _sliderWidth + 6f, _handleSize); Rect alphaHandleRect = new Rect(alphaRect.xMin - 3f, alphaRect.yMin + _alphaPosition - _handleSize / 2, _sliderWidth + 6f, _handleSize); Rect pickerHandleRect = new Rect(pickerRect.xMin + _position.x - _handleSize / 2, pickerRect.yMin + _position.y - _handleSize / 2, _handleSize, _handleSize); GUI.DrawTexture(hueHandleRect, TempPreviewBG); GUI.DrawTexture(alphaHandleRect, TempPreviewBG); GUI.DrawTexture(pickerHandleRect, TempPreviewBG); GUI.color = Color.gray; Widgets.DrawBox(hueHandleRect); Widgets.DrawBox(alphaHandleRect); Widgets.DrawBox(pickerHandleRect); GUI.color = Color.white; // reset active control on mouseup if (Input.GetMouseButtonUp(0)) { _activeControl = controls.none; } // colourpicker interaction if (Mouse.IsOver(pickerRect)) { if (Input.GetMouseButtonDown(0)) { _activeControl = controls.colourPicker; } if (_activeControl == controls.colourPicker) { Vector2 MousePosition = Event.current.mousePosition; Vector2 PositionInRect = MousePosition - new Vector2(pickerRect.xMin, pickerRect.yMin); PickerAction(PositionInRect); } } // hue picker interaction if (Mouse.IsOver(hueRect)) { if (Input.GetMouseButtonDown(0)) { _activeControl = controls.huePicker; } if (Event.current.type == EventType.ScrollWheel) { H -= Event.current.delta.y * UnitsPerPixel; _huePosition = Mathf.Clamp(_huePosition + Event.current.delta.y, 0f, _pickerSize); Event.current.Use(); } if (_activeControl == controls.huePicker) { float MousePosition = Event.current.mousePosition.y; float PositionInRect = MousePosition - hueRect.yMin; HueAction(PositionInRect); } } // alpha picker interaction if (Mouse.IsOver(alphaRect)) { if (Input.GetMouseButtonDown(0)) { _activeControl = controls.alphaPicker; } if (Event.current.type == EventType.ScrollWheel) { A -= Event.current.delta.y * UnitsPerPixel; _alphaPosition = Mathf.Clamp(_alphaPosition + Event.current.delta.y, 0f, _pickerSize); Event.current.Use(); } if (_activeControl == controls.alphaPicker) { float MousePosition = Event.current.mousePosition.y; float PositionInRect = MousePosition - alphaRect.yMin; AlphaAction(PositionInRect); } } // buttons and text field // for some reason scrolling sometimes changes text size Text.Font = GameFont.Small; if (Widgets.ButtonText(doneRect, "OK")) { SetColor(); Close(); } if (Widgets.ButtonText(setRect, "Apply")) { SetColor(); } if (Widgets.ButtonText(cancelRect, "Cancel")) { Close(); } if (_hexIn != _hexOut) { Color inputColor = tempColour; if (TryGetColorFromHex(_hexIn, out inputColor)) { tempColour = inputColor; NotifyRGBUpdated(); } else { GUI.color = Color.red; } } _hexIn = Widgets.TextField(hexRect, _hexIn); GUI.color = Color.white; }