Skip to content

Commit

Permalink
Merge branch 'master' into update-readme
Browse files Browse the repository at this point in the history
  • Loading branch information
emreyigit authored Oct 9, 2024
2 parents 1b1c4db + 2a5e1ec commit 5d13453
Show file tree
Hide file tree
Showing 19 changed files with 1,608 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/create-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ jobs:
# see https://github.com/marketplace/actions/codecov
- name: Publish to Codecov
if: inputs.coverage && inputs.conclusion == 'success' && (steps.unzip.outputs.coverage == 'true' || steps.move.outputs.coverage == 'true')
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./temp/test-coverage/windows/cover-net6.0.xml
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright (c) 2008-2024, Hazelcast, Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
namespace Hazelcast.Tests.Models
{
using NUnit.Framework;
using Hazelcast.Models;
using Hazelcast.Core;
using Hazelcast.Serialization;

[TestFixture]
public class CacheSimpleEntryListenerOptionsTests
{
[Test]
public void DefaultConstructor_SetsPropertiesToDefault()
{
var options = new CacheSimpleEntryListenerOptions();

Assert.IsNull(options.CacheEntryListenerFactory);
Assert.IsNull(options.CacheEntryEventFilterFactory);
Assert.IsFalse(options.OldValueRequired);
Assert.IsFalse(options.Synchronous);
}

[Test]
public void Constructor_WithCacheSimpleEntryListenerOptionsArgument_CopiesProperties()
{
var originalOptions = new CacheSimpleEntryListenerOptions
{
CacheEntryListenerFactory = "TestFactory",
CacheEntryEventFilterFactory = "TestFilterFactory",
OldValueRequired = true,
Synchronous = true
};
var copiedOptions = new CacheSimpleEntryListenerOptions(originalOptions);

Assert.AreEqual(originalOptions.CacheEntryListenerFactory, copiedOptions.CacheEntryListenerFactory);
Assert.AreEqual(originalOptions.CacheEntryEventFilterFactory, copiedOptions.CacheEntryEventFilterFactory);
Assert.AreEqual(originalOptions.OldValueRequired, copiedOptions.OldValueRequired);
Assert.AreEqual(originalOptions.Synchronous, copiedOptions.Synchronous);
}

[Test]
public void ToString_ReturnsExpectedFormat()
{
var options = new CacheSimpleEntryListenerOptions
{
CacheEntryListenerFactory = "TestFactory",
CacheEntryEventFilterFactory = "TestFilterFactory",
OldValueRequired = true,
Synchronous = true
};

var result = options.ToString();

StringAssert.Contains("cacheEntryListenerFactory='TestFactory'", result);
StringAssert.Contains("cacheEntryEventFilterFactory='TestFilterFactory'", result);
StringAssert.Contains("oldValueRequired=True", result);
StringAssert.Contains("synchronous=True", result);
}
}
}
80 changes: 80 additions & 0 deletions src/Hazelcast.Net.Tests/Models/DataPersistenceOptionsTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// Copyright (c) 2008-2024, Hazelcast, Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using Hazelcast.Core;
using NUnit.Framework;
using Hazelcast.Models;
using Hazelcast.Serialization;
using NSubstitute;
namespace Hazelcast.Tests.Models
{
[TestFixture]
public class DataPersistenceOptionsTests
{
[Test]
public void Constructor_WithValidParameters_InitializesPropertiesCorrectly()
{
var enabled = true;
var fsync = true;

var dataPersistenceOptions = new DataPersistenceOptions
{
Enabled = enabled,
Fsync = fsync
};

Assert.AreEqual(enabled, dataPersistenceOptions.Enabled);
Assert.AreEqual(fsync, dataPersistenceOptions.Fsync);
}

[Test]
public void WriteData_ReadData_WritesAndReadsDataCorrectly()
{
var enabled = true;
var fsync = true;

var dataPersistenceOptions = new DataPersistenceOptions
{
Enabled = enabled,
Fsync = fsync
};

var output = new ObjectDataOutput(1024, null, Endianness.LittleEndian);
dataPersistenceOptions.WriteData(output);

var input = new ObjectDataInput(output.Buffer, null, Endianness.LittleEndian);
var readDataPersistenceOptions = new DataPersistenceOptions();
readDataPersistenceOptions.ReadData(input);

Assert.AreEqual(dataPersistenceOptions.Enabled, readDataPersistenceOptions.Enabled);
Assert.AreEqual(dataPersistenceOptions.Fsync, readDataPersistenceOptions.Fsync);
}

[Test]
public void ToString_ReturnsCorrectFormat()
{
var enabled = true;
var fsync = true;

var dataPersistenceOptions = new DataPersistenceOptions
{
Enabled = enabled,
Fsync = fsync
};

var expectedString = $"DataPersistenceConfig{{enabled={enabled}, fsync={fsync}}}";

Assert.AreEqual(expectedString, dataPersistenceOptions.ToString());
}
}
}
66 changes: 66 additions & 0 deletions src/Hazelcast.Net.Tests/Models/DiskTierOptionsTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright (c) 2008-2024, Hazelcast, Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using Hazelcast.Core;
using NUnit.Framework;
using Hazelcast.Models;
using Hazelcast.Serialization;
using NSubstitute;
namespace Hazelcast.Tests.Models
{
[TestFixture]
public class DiskTierOptionsTests
{
[Test]
public void Constructor_WithValidParameters_InitializesPropertiesCorrectly()
{
var enabled = true;
var deviceName = "TestDevice";

var diskTierOptions = new DiskTierOptions { Enabled = enabled, DeviceName = deviceName };

Assert.AreEqual(enabled, diskTierOptions.Enabled);
Assert.AreEqual(deviceName, diskTierOptions.DeviceName);
}

[Test]
public void WriteData_ReadData_WritesAndReadsDataCorrectly()
{
var enabled = true;
var deviceName = "TestDevice";
var diskTierOptions = new DiskTierOptions { Enabled = enabled, DeviceName = deviceName };

var output = new ObjectDataOutput(1024, null, Endianness.LittleEndian);
diskTierOptions.WriteData(output);

var input = new ObjectDataInput(output.Buffer, null, Endianness.LittleEndian);
var readDiskTierOptions = new DiskTierOptions();
readDiskTierOptions.ReadData(input);

Assert.AreEqual(diskTierOptions.Enabled, readDiskTierOptions.Enabled);
Assert.AreEqual(diskTierOptions.DeviceName, readDiskTierOptions.DeviceName);
}

[Test]
public void ToString_ReturnsCorrectFormat()
{
var enabled = true;
var deviceName = "TestDevice";
var diskTierOptions = new DiskTierOptions { Enabled = enabled, DeviceName = deviceName };

var expectedString = $"DiskTierConfig{{enabled={enabled}, deviceName='{deviceName}'}}";

Assert.AreEqual(expectedString, diskTierOptions.ToString());
}
}
}
80 changes: 80 additions & 0 deletions src/Hazelcast.Net.Tests/Models/HotRestartOptionsTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// Copyright (c) 2008-2024, Hazelcast, Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using Hazelcast.Core;
using NUnit.Framework;
using Hazelcast.Models;
using Hazelcast.Serialization;
using NSubstitute;
namespace Hazelcast.Tests.Models
{
[TestFixture]
public class HotRestartOptionsTests
{
[Test]
public void Constructor_WithValidParameters_InitializesPropertiesCorrectly()
{
var enabled = true;
var fsync = true;

var hotRestartOptions = new HotRestartOptions
{
Enabled = enabled,
Fsync = fsync
};

Assert.AreEqual(enabled, hotRestartOptions.Enabled);
Assert.AreEqual(fsync, hotRestartOptions.Fsync);
}

[Test]
public void WriteData_ReadData_WritesAndReadsDataCorrectly()
{
var enabled = true;
var fsync = true;

var hotRestartOptions = new HotRestartOptions
{
Enabled = enabled,
Fsync = fsync
};

var output = new ObjectDataOutput(1024, null, Endianness.LittleEndian);
hotRestartOptions.WriteData(output);

var input = new ObjectDataInput(output.Buffer, null, Endianness.LittleEndian);
var readHotRestartOptions = new HotRestartOptions();
readHotRestartOptions.ReadData(input);

Assert.AreEqual(hotRestartOptions.Enabled, readHotRestartOptions.Enabled);
Assert.AreEqual(hotRestartOptions.Fsync, readHotRestartOptions.Fsync);
}

[Test]
public void ToString_ReturnsCorrectFormat()
{
var enabled = true;
var fsync = true;

var hotRestartOptions = new HotRestartOptions
{
Enabled = enabled,
Fsync = fsync
};

var expectedString = $"HotRestartConfig{{enabled={enabled}, fsync={fsync}}}";

Assert.AreEqual(expectedString, hotRestartOptions.ToString());
}
}
}
Loading

0 comments on commit 5d13453

Please sign in to comment.