Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 34 additions & 17 deletions src/Hocon.API.Tests/HoconAPISpec.ApproveConfiguration.approved.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,47 @@ namespace Hocon
protected CDataConfigurationElement() { }
protected override void DeserializeElement(System.Xml.XmlReader reader, bool serializeCollectionKey) { }
}
public class Config : Hocon.HoconRoot, System.IEquatable<Hocon.Config>, System.Runtime.Serialization.ISerializable
public class Config : System.Runtime.Serialization.ISerializable
{
[System.ObsoleteAttribute("For json serialization/deserialization only", true)]
protected Config() { }
protected Config(Hocon.HoconValue value) { }
protected Config(Hocon.HoconValue value, Hocon.Config fallback) { }
public static readonly Hocon.Config Empty;
public Config(Hocon.HoconRoot root) { }
public Config(Hocon.HoconRoot root, Hocon.Config fallback) { }
public Config(Hocon.Config source) { }
public Config(Hocon.Config source, Hocon.Config fallback) { }
[System.ObsoleteAttribute("Used for serialization only", true)]
public Config(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public static Hocon.Config Empty { get; }
public virtual System.Collections.Generic.IReadOnlyList<Hocon.HoconValue> Fallbacks { get; }
protected Config(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public Hocon.Config Fallback { get; }
public virtual bool IsEmpty { get; }
public Hocon.HoconValue Root { get; }
protected System.Collections.Generic.List<Hocon.HoconValue> _fallbacks { get; }
public override System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, Hocon.HoconField>> AsEnumerable() { }
public virtual bool Equals(Hocon.Config other) { }
public override bool Equals(object obj) { }
public System.Collections.Generic.IEnumerable<Hocon.HoconSubstitution> Substitutions { get; set; }
public Hocon.HoconValue Value { get; }
public virtual System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, Hocon.HoconValue>> AsEnumerable() { }
protected Hocon.Config Copy(Hocon.Config fallback = null) { }
public virtual bool GetBoolean(string path, bool default = False) { }
public virtual System.Collections.Generic.IList<bool> GetBooleanList(string path) { }
public virtual System.Collections.Generic.IList<byte> GetByteList(string path) { }
public virtual System.Nullable<long> GetByteSize(string path) { }
public virtual Hocon.Config GetConfig(string path) { }
public virtual Hocon.Config GetConfig(Hocon.HoconPath path) { }
protected override Hocon.HoconValue GetNode(Hocon.HoconPath path) { }
public virtual decimal GetDecimal(string path, [System.Runtime.CompilerServices.DecimalConstantAttribute(0, 0, 0u, 0u, 0u)] decimal @default) { }
public virtual System.Collections.Generic.IList<decimal> GetDecimalList(string path) { }
public virtual double GetDouble(string path, double default = 0) { }
public virtual System.Collections.Generic.IList<double> GetDoubleList(string path) { }
public virtual float GetFloat(string path, float default = 0) { }
public virtual System.Collections.Generic.IList<float> GetFloatList(string path) { }
public virtual int GetInt(string path, int default = 0) { }
public virtual System.Collections.Generic.IList<int> GetIntList(string path) { }
public virtual long GetLong(string path, long default = 0) { }
public virtual System.Collections.Generic.IList<long> GetLongList(string path) { }
public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public string ToString(bool useFallbackValues) { }
protected override bool TryGetNode(Hocon.HoconPath path, out Hocon.HoconValue result) { }
public virtual string GetString(string path, string default = null) { }
public virtual string GetString(Hocon.HoconPath path, string default = null) { }
public virtual System.Collections.Generic.IList<string> GetStringList(string path) { }
public virtual System.Collections.Generic.IList<string> GetStringList(Hocon.HoconPath path) { }
public virtual System.TimeSpan GetTimeSpan(string path, System.Nullable<System.TimeSpan> default = null, bool allowInfinite = True) { }
public Hocon.HoconValue GetValue(string path) { }
public virtual bool HasPath(string path) { }
public string PrettyPrint(int indentSize) { }
public override string ToString() { }
public string ToString(bool includeFallback) { }
public virtual Hocon.Config WithFallback(Hocon.Config fallback) { }
public static Hocon.Config +(Hocon.Config config, string fallback) { }
public static Hocon.Config +(string configHocon, Hocon.Config fallbackConfig) { }
Expand Down
10 changes: 9 additions & 1 deletion src/Hocon.API.Tests/HoconAPISpec.ApproveCore.approved.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace Hocon
public Hocon.HoconType Type { get; }
public void Add(Hocon.HoconValue value) { }
public Hocon.IHoconElement Clone(Hocon.IHoconElement newParent) { }
public Hocon.IHoconElement Copy(Hocon.IHoconElement newParent) { }
public bool Equals(Hocon.IHoconElement other) { }
public override bool Equals(object obj) { }
public System.Collections.Generic.IList<Hocon.HoconValue> GetArray() { }
Expand Down Expand Up @@ -79,6 +80,7 @@ namespace Hocon
public Hocon.HoconType Type { get; }
public Hocon.HoconValue Value { get; }
public Hocon.IHoconElement Clone(Hocon.IHoconElement newParent) { }
public Hocon.IHoconElement Copy(Hocon.IHoconElement newParent) { }
public bool Equals(Hocon.IHoconElement other) { }
public override bool Equals(object obj) { }
public System.Collections.Generic.IList<Hocon.HoconValue> GetArray() { }
Expand Down Expand Up @@ -107,6 +109,7 @@ namespace Hocon
public abstract Hocon.HoconType Type { get; }
public virtual string Value { get; }
public abstract Hocon.IHoconElement Clone(Hocon.IHoconElement newParent);
public Hocon.IHoconElement Copy(Hocon.IHoconElement newParent) { }
public bool Equals(Hocon.IHoconElement other) { }
public override bool Equals(object obj) { }
public System.Collections.Generic.IList<Hocon.HoconValue> GetArray() { }
Expand Down Expand Up @@ -153,7 +156,7 @@ namespace Hocon
public override string Value { get; }
public override Hocon.IHoconElement Clone(Hocon.IHoconElement newParent) { }
}
public class HoconObject : System.Collections.Generic.Dictionary<string, Hocon.HoconField>, Hocon.IHoconElement, System.IEquatable<Hocon.IHoconElement>
public class HoconObject : System.Collections.Generic.SortedDictionary<string, Hocon.HoconField>, Hocon.IHoconElement, System.IEquatable<Hocon.IHoconElement>
{
public HoconObject(Hocon.IHoconElement parent) { }
public static Hocon.HoconObject Empty { get; }
Expand All @@ -166,6 +169,7 @@ namespace Hocon
public Hocon.HoconType Type { get; }
public System.Collections.Generic.IDictionary<string, object> Unwrapped { get; }
public Hocon.IHoconElement Clone(Hocon.IHoconElement newParent) { }
public Hocon.IHoconElement Copy(Hocon.IHoconElement newParent) { }
public bool Equals(Hocon.IHoconElement other) { }
public override bool Equals(object obj) { }
public void FallbackMerge(Hocon.HoconObject other) { }
Expand Down Expand Up @@ -356,6 +360,7 @@ namespace Hocon
public Hocon.HoconValue ResolvedValue { get; }
public Hocon.HoconType Type { get; }
public Hocon.IHoconElement Clone(Hocon.IHoconElement newParent) { }
public Hocon.IHoconElement Copy(Hocon.IHoconElement newParent) { }
public bool Equals(Hocon.IHoconElement other) { }
public override bool Equals(object obj) { }
public System.Collections.Generic.IList<Hocon.HoconValue> GetArray() { }
Expand Down Expand Up @@ -401,6 +406,7 @@ namespace Hocon
{
public HoconValue(Hocon.IHoconElement parent) { }
public System.Collections.ObjectModel.ReadOnlyCollection<Hocon.IHoconElement> Children { get; }
public bool IsEmpty { get; }
public Hocon.IHoconElement Parent { get; }
public virtual string Raw { get; }
public Hocon.HoconType Type { get; }
Expand All @@ -409,6 +415,7 @@ namespace Hocon
public Hocon.HoconRoot AtKey(string key) { }
public new void Clear() { }
public virtual Hocon.IHoconElement Clone(Hocon.IHoconElement newParent) { }
public Hocon.IHoconElement Copy(Hocon.IHoconElement newParent) { }
public virtual bool Equals(Hocon.IHoconElement other) { }
public override bool Equals(object obj) { }
public virtual System.Collections.Generic.IList<Hocon.HoconValue> GetArray() { }
Expand Down Expand Up @@ -479,6 +486,7 @@ namespace Hocon
string Raw { get; }
Hocon.HoconType Type { get; }
Hocon.IHoconElement Clone(Hocon.IHoconElement newParent);
Hocon.IHoconElement Copy(Hocon.IHoconElement newParent);
System.Collections.Generic.IList<Hocon.HoconValue> GetArray();
Hocon.HoconObject GetObject();
string GetString();
Expand Down
18 changes: 9 additions & 9 deletions src/Hocon.Configuration.Test/ConfigurationSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public void Fallback_should_not_be_modified()
}
}");

var merged = config1.WithFallback(config2).Value.GetObject(); // Perform values loading
var merged = config1.WithFallback(config2).Root.GetObject(); // Perform values loading

config1.GetInt("a.b.c").Should().Be(5);
config1.GetInt("a.b.e").Should().Be(7);
Expand Down Expand Up @@ -515,9 +515,9 @@ public void Config_will_not_throw_on_duplicate_fallbacks()

// normal fallback
var f1 = c1.WithFallback(c2).WithFallback(Config.Empty);
c1.Fallbacks.Count.Should().Be(0); // original copy should not have been modified.
c1.Fallback.Should().BeNull(); // original copy should not have been modified.

// someone adds the same fallback again with realizing it
// someone adds the same fallback again without realizing it
f1.WithFallback(Config.Empty).GetString("bar.biz").Should().Be("fuber"); // shouldn't throw

var final = f1.WithFallback(c2);
Expand All @@ -539,7 +539,7 @@ public void Quoted_key_should_be_parsed()
}
");

var megred = config2.WithFallback(config1).Value;
var megred = config2.WithFallback(config1).Root;
// Is throwing at "/weird/*" key parsing
megred.Invoking(r => r.GetObject()).Should().NotThrow();
}
Expand All @@ -560,7 +560,7 @@ public void Quoted_key_with_dot_should_be_parsed()
}"
);

var megred = config2.WithFallback(config1).Value;
var megred = config2.WithFallback(config1).Root;
// Is throwing at "System.Byte[]" key parsing
megred.Invoking(r => r.GetObject()).Should().NotThrow();
}
Expand All @@ -585,7 +585,7 @@ public void HoconValue_GetObject_should_use_fallback_values_with_complex_objects
var configWithFallback = config1.WithFallback(config2);

var config = configWithFallback.GetConfig("akka.actor.deployment");
var rootObj = config.Value.GetObject();
var rootObj = config.Root.GetObject();
rootObj.Unwrapped.Should().ContainKeys("/worker1", "/worker2");
rootObj["/worker1.router"].Raw.Should().Be("round-robin-group1");
rootObj["/worker1.router"].Raw.Should().Be("round-robin-group1");
Expand Down Expand Up @@ -652,7 +652,7 @@ public void WithFallback_ShouldNotChangeOriginalConfig()
a.WithFallback(b);
a.WithFallback(b);

a.Fallbacks.Count.Should().Be(0);
a.Fallback.Should().BeNull();
a.GetString("akka.other-key", null).Should().BeNull();
ReferenceEquals(oldA, a).Should().BeTrue();
oldAContent.Should().Equals(a);
Expand Down Expand Up @@ -687,8 +687,8 @@ public void WithFallback_ShouldMergeSubstitutionProperly()
dedicated-thread-pool.substring = substring
");

var result = combined.Root.ToString(1, 2);
var expected = expectedConfig.Root.ToString(1, 2);
var result = combined.DumpConfig(false);
var expected = expectedConfig.DumpConfig(false);

expected.Should().BeEquivalentTo(result);
combined.GetInt("dedicated-thread-pool.thread-count").Should().Be(4);
Expand Down
2 changes: 1 addition & 1 deletion src/Hocon.Configuration.Test/SerializationSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void QuotedKeyWithInvalidCharactersShouldSerializeProperly()

Assert.True(config.GetBoolean("this.\"should[]\".work"));
Assert.True(deserialized.GetBoolean("this.\"should[]\".work"));
Assert.Equal(config, deserialized);
Assert.Equal(config.ToString(), deserialized.ToString());
}

}
Expand Down
Loading