Skip to content

Commit 7af3e01

Browse files
committed
Implement multiple object operations
Redesigned Consumer implementation to handle multiple object operations. Redesigned Provider implementation to handle multiple object operations. Updated AU and US demo projects to reflect mutliple object operations. Updated documentation to reflect changes. Fixed issue with mustUseAdvisory implementation.
1 parent a8cbeb3 commit 7af3e01

108 files changed

Lines changed: 6344 additions & 2097 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/.vs/config/applicationhost.config

Lines changed: 1027 additions & 0 deletions
Large diffs are not rendered by default.

Code/Sif3Framework/Sif.Framework.EnvironmentProvider/Controllers/EnvironmentsController.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 2016 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.
@@ -25,7 +25,7 @@ namespace Sif.Framework.EnvironmentProvider.Controllers
2525
/// Valid single operations: POST, GET, DELETE.
2626
/// Valid multiple operations: none.
2727
/// </summary>
28-
public class EnvironmentsController : Sif.Framework.Controller.EnvironmentsController
28+
public class EnvironmentsController : Sif.Framework.Controllers.EnvironmentsController
2929
{
3030

3131
// POST api/{controller}

Code/Sif3Framework/Sif.Framework.EnvironmentProvider/Global.asax.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Sif.Framework.Utils;
2+
using Sif.Framework.WebApi;
23
using System.Net.Http.Formatting;
34
using System.Web.Http;
45
using System.Web.Http.ExceptionHandling;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
[assembly: AssemblyConfiguration("")]
1111
[assembly: AssemblyCompany("Systemic Pty Ltd")]
1212
[assembly: AssemblyProduct("Sif.Framework.EnvironmentProvider")]
13-
[assembly: AssemblyCopyright("Copyright © Systemic Pty Ltd 2015")]
13+
[assembly: AssemblyCopyright("Copyright © Systemic Pty Ltd 2016")]
1414
[assembly: AssemblyTrademark("")]
1515
[assembly: AssemblyCulture("")]
1616

@@ -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.22.0.0")]
35-
[assembly: AssemblyFileVersion("0.22.0.0")]
34+
[assembly: AssemblyVersion("1.0.0.0")]
35+
[assembly: AssemblyFileVersion("1.0.0.0")]

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
[assembly: AssemblyConfiguration("")]
1111
[assembly: AssemblyCompany("Systemic Pty Ltd")]
1212
[assembly: AssemblyProduct("Sif.Framework.Test")]
13-
[assembly: AssemblyCopyright("Copyright © Systemic Pty Ltd 2015")]
13+
[assembly: AssemblyCopyright("Copyright © Systemic Pty Ltd 2016")]
1414
[assembly: AssemblyTrademark("")]
1515
[assembly: AssemblyCulture("")]
1616

@@ -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.22.0.0")]
36-
[assembly: AssemblyFileVersion("0.22.0.0")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

Code/Sif3Framework/Sif.Framework.Tests/Service/Mapper/MapperFactoryTest.cs

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014 Systemic Pty Ltd
2+
* Copyright 2016 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.
@@ -16,7 +16,9 @@
1616

1717
using Microsoft.VisualStudio.TestTools.UnitTesting;
1818
using Sif.Framework.Model.Infrastructure;
19+
using Sif.Framework.Model.Responses;
1920
using Sif.Specification.Infrastructure;
21+
using System.Collections.Generic;
2022

2123
namespace Sif.Framework.Service.Mapper
2224
{
@@ -89,7 +91,7 @@ public void EnvironmentResponseMapperTest()
8991

9092
foreach (ProvisionedZone sourceProvisionedZone in source.ProvisionedZones.Values)
9193
{
92-
Assert.AreEqual(sourceProvisionedZone.SifId , destination.provisionedZones[index].id);
94+
Assert.AreEqual(sourceProvisionedZone.SifId, destination.provisionedZones[index].id);
9395
int sourceIndex = 0;
9496

9597
foreach (Model.Infrastructure.Service sourceService in sourceProvisionedZone.Services)
@@ -114,6 +116,72 @@ public void EnvironmentResponseMapperTest()
114116

115117
}
116118

119+
[TestMethod]
120+
public void ExplicitResponseMapperTest()
121+
{
122+
ResponseError srcError = new ResponseError { Code = 123, Description = "Err desc", Id = "42", Message = "Error occurred", Scope = "request" };
123+
errorType destError = MapperFactory.CreateInstance<ResponseError, errorType>(srcError);
124+
125+
//// Create.
126+
CreateStatus srcCreateStatus = new CreateStatus { AdvisoryId = "src456", Error = srcError, Id = "cr8", StatusCode = "200" };
127+
createType destCreateStatus = MapperFactory.CreateInstance<CreateStatus, createType>(srcCreateStatus);
128+
MultipleCreateResponse srcCreateResponse = new MultipleCreateResponse { StatusRecords = new List<CreateStatus> { srcCreateStatus } };
129+
createResponseType destCreateResponse = MapperFactory.CreateInstance<MultipleCreateResponse, createResponseType>(srcCreateResponse);
130+
int index = 0;
131+
132+
foreach (CreateStatus record in srcCreateResponse.StatusRecords)
133+
{
134+
Assert.AreEqual(record.AdvisoryId, destCreateResponse.creates[index].advisoryId);
135+
Assert.AreEqual(record.Error.Code, destCreateResponse.creates[index].error.code);
136+
Assert.AreEqual(record.Error.Description, destCreateResponse.creates[index].error.description);
137+
Assert.AreEqual(record.Error.Id, destCreateResponse.creates[index].error.id);
138+
Assert.AreEqual(record.Error.Message, destCreateResponse.creates[index].error.message);
139+
Assert.AreEqual(record.Error.Scope, destCreateResponse.creates[index].error.scope);
140+
Assert.AreEqual(record.Id, destCreateResponse.creates[index].id);
141+
Assert.AreEqual(record.StatusCode, destCreateResponse.creates[index].statusCode);
142+
index++;
143+
}
144+
145+
// Delete.
146+
DeleteStatus srcDeleteStatus = new DeleteStatus { Error = srcError, Id = "del8", StatusCode = "300" };
147+
deleteStatus destDeleteStatus = MapperFactory.CreateInstance<DeleteStatus, deleteStatus>(srcDeleteStatus);
148+
MultipleDeleteResponse srcDeleteResponse = new MultipleDeleteResponse { StatusRecords = new List<DeleteStatus> { srcDeleteStatus } };
149+
deleteResponseType destDeleteResponse = MapperFactory.CreateInstance<MultipleDeleteResponse, deleteResponseType>(srcDeleteResponse);
150+
index = 0;
151+
152+
foreach (DeleteStatus record in srcDeleteResponse.StatusRecords)
153+
{
154+
Assert.AreEqual(record.Error.Code, destDeleteResponse.deletes[index].error.code);
155+
Assert.AreEqual(record.Error.Description, destDeleteResponse.deletes[index].error.description);
156+
Assert.AreEqual(record.Error.Id, destDeleteResponse.deletes[index].error.id);
157+
Assert.AreEqual(record.Error.Message, destDeleteResponse.deletes[index].error.message);
158+
Assert.AreEqual(record.Error.Scope, destDeleteResponse.deletes[index].error.scope);
159+
Assert.AreEqual(record.Id, destDeleteResponse.deletes[index].id);
160+
Assert.AreEqual(record.StatusCode, destDeleteResponse.deletes[index].statusCode);
161+
index++;
162+
}
163+
164+
// Update.
165+
UpdateStatus srcUpdateStatus = new UpdateStatus { Error = srcError, Id = "up8", StatusCode = "400" };
166+
updateType destUpdateStatus = MapperFactory.CreateInstance<UpdateStatus, updateType>(srcUpdateStatus);
167+
MultipleUpdateResponse srcUpdateResponse = new MultipleUpdateResponse { StatusRecords = new List<UpdateStatus> { srcUpdateStatus } };
168+
updateResponseType destUpdateResponse = MapperFactory.CreateInstance<MultipleUpdateResponse, updateResponseType>(srcUpdateResponse);
169+
index = 0;
170+
171+
foreach (UpdateStatus record in srcUpdateResponse.StatusRecords)
172+
{
173+
Assert.AreEqual(record.Error.Code, destUpdateResponse.updates[index].error.code);
174+
Assert.AreEqual(record.Error.Description, destUpdateResponse.updates[index].error.description);
175+
Assert.AreEqual(record.Error.Id, destUpdateResponse.updates[index].error.id);
176+
Assert.AreEqual(record.Error.Message, destUpdateResponse.updates[index].error.message);
177+
Assert.AreEqual(record.Error.Scope, destUpdateResponse.updates[index].error.scope);
178+
Assert.AreEqual(record.Id, destUpdateResponse.updates[index].id);
179+
Assert.AreEqual(record.StatusCode, destUpdateResponse.updates[index].statusCode);
180+
index++;
181+
}
182+
183+
}
184+
117185
}
118186

119187
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ClassDiagram MajorVersion="1" MinorVersion="1" MembersFormat="FullSignature">
3+
<Class Name="Sif.Framework.Consumers.Consumer&lt;TSingle, TMultiple, TPrimaryKey&gt;">
4+
<Position X="11.25" Y="2.75" Width="8.5" />
5+
<Members>
6+
<Method Name="Consumer" Hidden="true" />
7+
</Members>
8+
<Compartments>
9+
<Compartment Name="Fields" Collapsed="true" />
10+
<Compartment Name="Properties" Collapsed="true" />
11+
</Compartments>
12+
<TypeIdentifier>
13+
<HashCode>AgQAAAAAAABBAAAAAAgACABAAAEBAFgAQAAAAEoAEAA=</HashCode>
14+
<FileName>Consumers\Consumer.cs</FileName>
15+
</TypeIdentifier>
16+
<Lollipop Position="0.2" />
17+
</Class>
18+
<Class Name="Sif.Framework.Consumers.BasicConsumer&lt;T&gt;">
19+
<Position X="12" Y="7.75" Width="7" />
20+
<Members>
21+
<Method Name="BasicConsumer" Hidden="true" />
22+
</Members>
23+
<TypeIdentifier>
24+
<HashCode>AAAAAAAAAABAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAA=</HashCode>
25+
<FileName>Consumers\BasicConsumer.cs</FileName>
26+
</TypeIdentifier>
27+
<Lollipop Position="0.2" />
28+
</Class>
29+
<Class Name="Sif.Framework.Providers.Provider&lt;TSingle, TMultiple&gt;">
30+
<Position X="11.25" Y="10.75" Width="8" />
31+
<Members>
32+
<Method Name="CreateError" Hidden="true" />
33+
<Method Name="Provider" Hidden="true" />
34+
</Members>
35+
<Compartments>
36+
<Compartment Name="Fields" Collapsed="true" />
37+
</Compartments>
38+
<TypeIdentifier>
39+
<HashCode>AAAAAAAAAAAAAABAAAAIABAACAEAAAAAAEAAAAAAAAg=</HashCode>
40+
<FileName>Providers\Provider.cs</FileName>
41+
</TypeIdentifier>
42+
<Lollipop Position="0.2" />
43+
</Class>
44+
<Class Name="Sif.Framework.Providers.BasicProvider&lt;T&gt;">
45+
<Position X="13.5" Y="14.5" Width="3.25" />
46+
<TypeIdentifier>
47+
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAg=</HashCode>
48+
<FileName>Providers\BasicProvider.cs</FileName>
49+
</TypeIdentifier>
50+
<Lollipop Position="0.2" />
51+
</Class>
52+
<Interface Name="Sif.Framework.Consumers.IConsumer&lt;TSingle, TMultiple, TPrimaryKey&gt;">
53+
<Position X="0.75" Y="2.75" Width="8.5" />
54+
<TypeIdentifier>
55+
<HashCode>AAQAAAAAAAABAAAAAAAAAAAAAAEBAEgAQAAAAAAAEAA=</HashCode>
56+
<FileName>Consumers\IConsumer.cs</FileName>
57+
</TypeIdentifier>
58+
</Interface>
59+
<Interface Name="Sif.Framework.Consumers.IBasicConsumer&lt;T&gt;">
60+
<Position X="3.75" Y="7.75" Width="2.5" />
61+
<TypeIdentifier>
62+
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
63+
<FileName>Consumers\IBasicConsumer.cs</FileName>
64+
</TypeIdentifier>
65+
</Interface>
66+
<Interface Name="Sif.Framework.Providers.IProvider&lt;TSingle, TMultiple, TPrimaryKey&gt;">
67+
<Position X="0.5" Y="10.75" Width="8" />
68+
<TypeIdentifier>
69+
<HashCode>AAAAAAAAAAAAAABAAAAAAAAACAEAAAAAAAAAAAAAAAg=</HashCode>
70+
<FileName>Providers\IProvider.cs</FileName>
71+
</TypeIdentifier>
72+
</Interface>
73+
<Interface Name="Sif.Framework.Providers.IBasicProvider&lt;T&gt;" Collapsed="true">
74+
<Position X="3.25" Y="14.5" Width="2.25" />
75+
<TypeIdentifier>
76+
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
77+
<FileName>Providers\IBasicProvider.cs</FileName>
78+
</TypeIdentifier>
79+
</Interface>
80+
<Interface Name="Sif.Framework.Model.DataModels.IPayloadSerialisable&lt;TSingle, TMultiple&gt;">
81+
<Position X="3.25" Y="0.5" Width="3.25" />
82+
<TypeIdentifier>
83+
<HashCode>AAAAAAAAAABAAAAAAAgAAABAAAAAAAAAAAAAAAgAAAA=</HashCode>
84+
<FileName>Model\DataModels\IPayloadSerialisable.cs</FileName>
85+
</TypeIdentifier>
86+
</Interface>
87+
<Font Name="Segoe UI" Size="9" />
88+
</ClassDiagram>

0 commit comments

Comments
 (0)