diff --git a/src/Coherence/Coherence.csproj b/src/Coherence/Coherence.csproj
index e85fcff..f64d297 100644
--- a/src/Coherence/Coherence.csproj
+++ b/src/Coherence/Coherence.csproj
@@ -71,7 +71,8 @@
-
+
+
diff --git a/src/Coherence/Config/CoherenceConfigHandler.cs b/src/Coherence/Config/CoherenceConfigHandler.cs
deleted file mode 100644
index 99046d7..0000000
--- a/src/Coherence/Config/CoherenceConfigHandler.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2000, 2020, Oracle and/or its affiliates.
- *
- * Licensed under the Universal Permissive License v 1.0 as shown at
- * http://oss.oracle.com/licenses/upl.
- */
-using System.Collections;
-using System.Configuration;
-using System.Xml;
-
-using Tangosol.IO.Resources;
-
-namespace Tangosol.Config
-{
- ///
- /// Configuration section handler for the Coherence for .NET
- /// configuration section (<coherence>).
- ///
- ///
- /// Aleksandar Seovic 2006.10.06
- /// Goran Milosavljevic 2008.10.06
- public class CoherenceConfigHandler : IConfigurationSectionHandler
- {
- ///
- /// Creates a with information parsed
- /// from the Coherence for .NET configuration section.
- ///
- ///
- /// The CoherenceConfig object with information from the
- /// configuration section.
- ///
- /// Parent object.
- /// Configuration context object.
- /// Section XML node.
- public object Create(object parent, object configContext, XmlNode section)
- {
- var config = new CoherenceConfig();
- var cacheFactoryConfig = section.SelectSingleNode("cache-factory-config");
- var coherenceConfig = section.SelectSingleNode("coherence-config");
- var cacheConfig = section.SelectSingleNode("cache-config");
- var pofConfig = section.SelectSingleNode("pof-config");
- var messagingDebug = section.SelectSingleNode("COHERENCE_MESSAGING_DEBUG");
-
- config.ConfigProperties = new Hashtable();
-
- // TODO: The cache-factory-config element is deprecated as of
- // Coherence 3.7. We should remove support altogether in 4.0.
- if (cacheFactoryConfig != null)
- {
- config.OperationalConfig = ResourceLoader.GetResource(cacheFactoryConfig.InnerText);
- }
- if (coherenceConfig != null)
- {
- config.OperationalConfig = ResourceLoader.GetResource(coherenceConfig.InnerText);
- }
- if (cacheConfig != null)
- {
- config.CacheConfig = ResourceLoader.GetResource(cacheConfig.InnerText);
- }
- if (pofConfig != null)
- {
- config.PofConfig = ResourceLoader.GetResource(pofConfig.InnerText);
- }
- if (messagingDebug != null)
- {
- config.ConfigProperties.Add("COHERENCE_MESSAGING_DEBUG", messagingDebug.InnerText);
- }
-
- foreach (XmlNode node in section.ChildNodes)
- {
- if (node.Name.Equals("property"))
- {
- XmlAttributeCollection attributes = node.Attributes;
- if (attributes != null)
- {
- string key = attributes["name"].Value;
- string value = attributes["value"].Value;
- if (key != null && value != null)
- {
- config.ConfigProperties.Add(key, value);
- }
- }
- }
- }
-
- return config;
- }
- }
-}
\ No newline at end of file
diff --git a/src/Coherence/Util/ConfigurationUtils.cs b/src/Coherence/Util/ConfigurationUtils.cs
index 4a2d5d3..5ef3abd 100644
--- a/src/Coherence/Util/ConfigurationUtils.cs
+++ b/src/Coherence/Util/ConfigurationUtils.cs
@@ -1,13 +1,15 @@
/*
- * Copyright (c) 2000, 2020, Oracle and/or its affiliates.
+ * Copyright (c) 2000, 2024, Oracle and/or its affiliates.
*
* Licensed under the Universal Permissive License v 1.0 as shown at
- * http://oss.oracle.com/licenses/upl.
+ * https://oss.oracle.com/licenses/upl.
*/
using System;
-using System.Configuration;
-
+using System.Collections;
+using System.IO;
+using Microsoft.Extensions.Configuration;
using Tangosol.Config;
+using Tangosol.IO.Resources;
namespace Tangosol.Util
{
@@ -21,26 +23,54 @@ public class ConfigurationUtils
/// The name of the configuration element that contains Coherence
/// configuration settings.
///
- private const string CONFIG_SECTION_NAME = "coherence";
-
- // TODO: remove this constant in a future release
- private const string _CONFIG_SECTION_NAME = "tangosol-coherence";
+ private const string CONFIG_SECTION_NAME = "Coherence";
///
/// Parses the Coherence configuration section within the standard
- /// .NET configuration file (App.config or Web.config).
+ /// .NET configuration file (appsettings.json).
///
///
- /// An instance of created by
- /// .
+ /// An instance of
///
public static object GetCoherenceConfiguration()
{
- // TODO: we still check for the legacy "tangosol-coherence" config
- // section for backwards compatibility; this check should be
- // removed in a future release
- return ConfigurationManager.GetSection(CONFIG_SECTION_NAME)
- ?? ConfigurationManager.GetSection(_CONFIG_SECTION_NAME);
+ IConfiguration cohCfg = new ConfigurationBuilder()
+ .SetBasePath(Directory.GetCurrentDirectory())
+ .AddJsonFile("appsettings.json", true)
+ .Build()
+ .GetSection(CONFIG_SECTION_NAME);
+
+ CoherenceConfig config = new CoherenceConfig();
+ string coherenceConfig = cohCfg["CoherenceConfig"];
+ string cacheConfig = cohCfg["CacheConfig"];
+ string pofConfig = cohCfg["PofConfig"];
+ string messagingDebug = cohCfg["COHERENCE_MESSAGING_DEBUG"];
+
+ config.ConfigProperties = new Hashtable();
+ if (coherenceConfig != null)
+ {
+ config.OperationalConfig = ResourceLoader.GetResource(coherenceConfig);
+ }
+ if (cacheConfig != null)
+ {
+ config.CacheConfig = ResourceLoader.GetResource(cacheConfig);
+ }
+ if (pofConfig != null)
+ {
+ config.PofConfig = ResourceLoader.GetResource(pofConfig);
+ }
+ if (messagingDebug != null)
+ {
+ config.ConfigProperties.Add("COHERENCE_MESSAGING_DEBUG", messagingDebug);
+ }
+
+ IConfigurationSection properties = cohCfg.GetSection("Properties");
+ foreach (var property in properties.GetChildren())
+ {
+ config.ConfigProperties.Add(property.Key, property.Value);
+ }
+
+ return config;
}
///
diff --git a/tests/Coherence.Tests/App.config b/tests/Coherence.Tests/App.config
deleted file mode 100644
index 103f0c4..0000000
--- a/tests/Coherence.Tests/App.config
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- assembly://Coherence.Tests/Tangosol.Resources/s4hc-cache-config.xml
- assembly://Coherence.Tests/Tangosol.Resources/s4hc-test-config.xml
- assembly://Coherence.Tests/Tangosol.Resources/s4hc-test-coherence.xml
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/tests/Coherence.Tests/Coherence.Tests.csproj b/tests/Coherence.Tests/Coherence.Tests.csproj
index 5d1b878..9414e79 100644
--- a/tests/Coherence.Tests/Coherence.Tests.csproj
+++ b/tests/Coherence.Tests/Coherence.Tests.csproj
@@ -36,9 +36,9 @@
See https://github.com/dotnet/runtime/issues/22720 for details.
-->
-
-
-
+
+
+
@@ -58,6 +58,9 @@
+
+ PreserveNewest
+
diff --git a/tests/Coherence.Tests/appsettings.json b/tests/Coherence.Tests/appsettings.json
new file mode 100644
index 0000000..0093619
--- /dev/null
+++ b/tests/Coherence.Tests/appsettings.json
@@ -0,0 +1,17 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ },
+ "Coherence": {
+ "CacheConfig": "assembly://Coherence.Tests/Tangosol.Resources/s4hc-cache-config.xml",
+ "PofConfig": "assembly://Coherence.Tests/Tangosol.Resources/s4hc-test-config.xml",
+ "CoherenceConfig": "assembly://Coherence.Tests/Tangosol.Resources/s4hc-test-coherence.xml",
+ "Properties": {
+ "coherence.proxy.port1": "9099",
+ "coherence.serializer": "pof"
+ }
+ }
+}
\ No newline at end of file