Skip to content

Commit d2dce48

Browse files
committed
Updated SIF AU data model and added HITS Consumer
Updated the SIF AU 1.3 and 1.4 data models of the Sif3Specification Solution. Updated all unit tests and (AU) demo projects to reference the updated 1.4 data models. Fixed an issue with a missing namespace on serialisation of data model collections. Enhanced the demo AU Consumer to demonstrate connection with HITS.
1 parent 1fffc88 commit d2dce48

42 files changed

Lines changed: 156 additions & 83 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Code/Sif3Framework/Sif.Framework.EnvironmentProvider/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
//
3232
// You can specify all the values or you can default the Revision and Build Numbers
3333
// by using the '*' as shown below:
34-
[assembly: AssemblyVersion("0.20.0.0")]
35-
[assembly: AssemblyFileVersion("0.20.0.0")]
34+
[assembly: AssemblyVersion("0.21.0.0")]
35+
[assembly: AssemblyFileVersion("0.21.0.0")]
Binary file not shown.

Code/Sif3Framework/Sif.Framework.Tests/DataFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014 Systemic Pty Ltd
2+
* Copyright 2015 Systemic Pty Ltd
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@ public static Environment CreateEnvironmentRequest()
5757
AdapterProduct = adapterProduct,
5858
ApplicationKey = "UnitTesting",
5959
ApplicationProduct = applicationProduct,
60-
DataModelNamespace = "http://www.sifassociation.org/au/datamodel/1.3",
60+
DataModelNamespace = "http://www.sifassociation.org/au/datamodel/1.4",
6161
SupportedInfrastructureVersion = "3.0",
6262
Transport = "REST"
6363
};

Code/Sif3Framework/Sif.Framework.Tests/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("0.20.0.0")]
36-
[assembly: AssemblyFileVersion("0.20.0.0")]
35+
[assembly: AssemblyVersion("0.21.0.0")]
36+
[assembly: AssemblyFileVersion("0.21.0.0")]

Code/Sif3Framework/Sif.Framework.Tests/SifFramework.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<add key="consumer.environment.template.applicationKey" value="Sif3DemoApp"/>
1313
<add key="consumer.environment.template.authenticationMethod" value="Basic"/>
1414
<add key="consumer.environment.template.consumerName" value="DemoConsumer"/>
15-
<add key="consumer.environment.template.dataModelNamespace" value="http://www.sifassociation.org/au/datamodel/1.3"/>
15+
<add key="consumer.environment.template.dataModelNamespace" value="http://www.sifassociation.org/au/datamodel/1.4"/>
1616
<add key="consumer.environment.template.supportedInfrastructureVersion" value="3.0.1"/>
1717
</appSettings>
1818
<sifFramework>

Code/Sif3Framework/Sif.Framework.Tests/Utils/SerialisationUtilsTest.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014 Systemic Pty Ltd
2+
* Copyright 2015 Systemic Pty Ltd
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -81,10 +81,12 @@ public void environmentTypes_Serialisation()
8181
environmentType2
8282
};
8383

84-
string xmlString = SerialiserFactory.GetXmlSerialiser<Collection<environmentType>>(new XmlRootAttribute("environments")).Serialise((Collection<environmentType>)environmentTypes);
84+
XmlRootAttribute xmlRootAttribute = new XmlRootAttribute("environments") { Namespace = SettingsManager.ConsumerSettings.DataModelNamespace, IsNullable = false };
85+
86+
string xmlString = SerialiserFactory.GetXmlSerialiser<Collection<environmentType>>(xmlRootAttribute).Serialise((Collection<environmentType>)environmentTypes);
8587
System.Console.WriteLine(xmlString);
8688

87-
environmentTypes = SerialiserFactory.GetXmlSerialiser<Collection<environmentType>>(new XmlRootAttribute("environments")).Deserialise(xmlString);
89+
environmentTypes = SerialiserFactory.GetXmlSerialiser<Collection<environmentType>>(xmlRootAttribute).Deserialise(xmlString);
8890
System.Console.WriteLine("Number deserialised is " + environmentTypes.Count);
8991
}
9092

Code/Sif3Framework/Sif.Framework.Tests/Utils/SettingsManagerTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public void TestRetrieveAppSettings()
3636
Assert.AreEqual(settings.ApplicationKey, "Sif3DemoApp");
3737
Assert.AreEqual(settings.AuthenticationMethod, "Basic");
3838
Assert.AreEqual(settings.ConsumerName, "DemoConsumer");
39-
Assert.AreEqual(settings.DataModelNamespace, "http://www.sifassociation.org/au/datamodel/1.3");
39+
Assert.AreEqual(settings.DataModelNamespace, "http://www.sifassociation.org/au/datamodel/1.4");
4040
Assert.IsTrue(settings.DeleteOnUnregister);
4141
Assert.AreEqual(settings.EnvironmentUrl, "http://localhost:62921/api/environments/environment");
4242
Assert.IsNull(settings.InstanceId);

Code/Sif3Framework/Sif.Framework/Consumer/GenericConsumer.cs

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,33 @@ public class GenericConsumer<T, PK> : IGenericConsumer<T, PK> where T : IPersist
3838
private Environment environmentTemplate;
3939
private RegistrationService registrationService;
4040

41+
/// <summary>
42+
/// An XML serialiser for a single object.
43+
/// </summary>
44+
private ISerialiser<T> ObjectSerialiser
45+
{
46+
47+
get
48+
{
49+
return SerialiserFactory.GetXmlSerialiser<T>();
50+
}
51+
52+
}
53+
54+
/// <summary>
55+
/// An XML serialiser for a collection of objects.
56+
/// </summary>
57+
private ISerialiser<List<T>> ListSerialiser
58+
{
59+
60+
get
61+
{
62+
XmlRootAttribute xmlRootAttribute = new XmlRootAttribute(TypeName + "s") { Namespace = SettingsManager.ConsumerSettings.DataModelNamespace, IsNullable = false };
63+
return SerialiserFactory.GetXmlSerialiser<List<T>>(xmlRootAttribute);
64+
}
65+
66+
}
67+
4168
/// <summary>
4269
/// Name of the SIF data type that the Consumer is based on, e.g. SchoolInfo, StudentPersonal, etc.
4370
/// </summary>
@@ -103,11 +130,11 @@ public virtual PK Create(T obj)
103130
}
104131

105132
string url = EnvironmentUtils.ParseServiceUrl(environmentTemplate) + "/" + TypeName + "s" + "/" + TypeName;
106-
string body = SerialiserFactory.GetXmlSerialiser<T>().Serialise(obj);
133+
string body = ObjectSerialiser.Serialise(obj);
107134
string xml = HttpUtils.PostRequest(url, registrationService.AuthorisationToken, body);
108135
if (log.IsDebugEnabled) log.Debug("XML from POST request ...");
109136
if (log.IsDebugEnabled) log.Debug(xml);
110-
return (SerialiserFactory.GetXmlSerialiser<T>().Deserialise(xml)).Id;
137+
return (ObjectSerialiser.Deserialise(xml)).Id;
111138
}
112139

113140
/// <summary>
@@ -122,7 +149,7 @@ public virtual void Create(IEnumerable<T> objs)
122149
}
123150

124151
string url = EnvironmentUtils.ParseServiceUrl(environmentTemplate) + "/" + TypeName + "s";
125-
string body = SerialiserFactory.GetXmlSerialiser<List<T>>(new XmlRootAttribute(TypeName + "s")).Serialise((List<T>)objs);
152+
string body = ListSerialiser.Serialise((List<T>)objs);
126153
string xml = HttpUtils.PostRequest(url, registrationService.AuthorisationToken, body);
127154
if (log.IsDebugEnabled) log.Debug("XML from POST request ...");
128155
if (log.IsDebugEnabled) log.Debug(xml);
@@ -143,7 +170,7 @@ public virtual T Retrieve(PK id)
143170
string xml = HttpUtils.GetRequest(url, registrationService.AuthorisationToken);
144171
if (log.IsDebugEnabled) log.Debug("XML from GET request ...");
145172
if (log.IsDebugEnabled) log.Debug(xml);
146-
return SerialiserFactory.GetXmlSerialiser<T>().Deserialise(xml);
173+
return ObjectSerialiser.Deserialise(xml);
147174
}
148175

149176
/// <summary>
@@ -170,7 +197,7 @@ public virtual ICollection<T> Retrieve()
170197

171198
if (xml.Length > 0)
172199
{
173-
ICollection<T> pageResult = SerialiserFactory.GetXmlSerialiser<List<T>>(new XmlRootAttribute(TypeName + "s")).Deserialise(xml);
200+
ICollection<T> pageResult = ListSerialiser.Deserialise(xml);
174201

175202
if (pageResult == null || pageResult.Count == 0)
176203
{
@@ -202,11 +229,12 @@ public virtual ICollection<T> Retrieve(T obj)
202229
}
203230

204231
string url = EnvironmentUtils.ParseServiceUrl(environmentTemplate) + "/" + TypeName + "s";
205-
string body = SerialiserFactory.GetXmlSerialiser<T>().Serialise(obj);
232+
string body = ObjectSerialiser.Serialise(obj);
206233
string xml = HttpUtils.PostRequest(url, registrationService.AuthorisationToken, body, "GET");
207234
if (log.IsDebugEnabled) log.Debug("XML from POST request ...");
208235
if (log.IsDebugEnabled) log.Debug(xml);
209-
return SerialiserFactory.GetXmlSerialiser<List<T>>(new XmlRootAttribute(TypeName + "s")).Deserialise(xml);
236+
237+
return ListSerialiser.Deserialise(xml);
210238
}
211239

212240
/// <summary>
@@ -224,7 +252,8 @@ public virtual ICollection<T> Retrieve(int navigationPage, int navigationPageSiz
224252
string xml = HttpUtils.GetRequest(url, registrationService.AuthorisationToken, navigationPage, navigationPageSize);
225253
if (log.IsDebugEnabled) log.Debug("XML from GET request ...");
226254
if (log.IsDebugEnabled) log.Debug(xml);
227-
return SerialiserFactory.GetXmlSerialiser<List<T>>(new XmlRootAttribute(TypeName + "s")).Deserialise(xml);
255+
256+
return ListSerialiser.Deserialise(xml);
228257
}
229258

230259
/// <summary>
@@ -239,7 +268,7 @@ public virtual void Update(T obj)
239268
}
240269

241270
string url = EnvironmentUtils.ParseServiceUrl(environmentTemplate) + "/" + TypeName + "s" + "/" + obj.Id;
242-
string body = SerialiserFactory.GetXmlSerialiser<T>().Serialise(obj);
271+
string body = ObjectSerialiser.Serialise(obj);
243272
string xml = HttpUtils.PutRequest(url, registrationService.AuthorisationToken, body);
244273
if (log.IsDebugEnabled) log.Debug("XML from PUT request ...");
245274
if (log.IsDebugEnabled) log.Debug(xml);
@@ -257,7 +286,7 @@ public virtual void Update(IEnumerable<T> objs)
257286
}
258287

259288
string url = EnvironmentUtils.ParseServiceUrl(environmentTemplate) + "/" + TypeName + "s";
260-
string body = SerialiserFactory.GetXmlSerialiser<List<T>>(new XmlRootAttribute(TypeName + "s")).Serialise((List<T>)objs);
289+
string body = ListSerialiser.Serialise((List<T>)objs);
261290
string xml = HttpUtils.PutRequest(url, registrationService.AuthorisationToken, body);
262291
if (log.IsDebugEnabled) log.Debug("XML from PUT request ...");
263292
if (log.IsDebugEnabled) log.Debug(xml);

Code/Sif3Framework/Sif.Framework/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("0.20.0.0")]
36-
[assembly: AssemblyFileVersion("0.20.0.0")]
35+
[assembly: AssemblyVersion("0.21.0.0")]
36+
[assembly: AssemblyFileVersion("0.21.0.0")]
3737

3838
// Configure log4net using the .config file
3939
[assembly: log4net.Config.XmlConfigurator(Watch = true)]

Code/Sif3Framework/Sif.Framework/SifFramework.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<add key="consumer.environment.template.applicationKey" value="Sif3DemoApp"/>
1313
<add key="consumer.environment.template.authenticationMethod" value="Basic"/>
1414
<add key="consumer.environment.template.consumerName" value="DemoConsumer"/>
15-
<add key="consumer.environment.template.dataModelNamespace" value="http://www.sifassociation.org/au/datamodel/1.3"/>
15+
<add key="consumer.environment.template.dataModelNamespace" value="http://www.sifassociation.org/au/datamodel/1.4"/>
1616
<add key="consumer.environment.template.supportedInfrastructureVersion" value="3.0.1"/>
1717
<add key="consumer.paging.navigationPageSize" value="20"/>
1818
</appSettings>

0 commit comments

Comments
 (0)