Skip to content

Commit 7c35692

Browse files
committed
Add an API test and allow client to deserialize JobType class
1 parent 9836398 commit 7c35692

File tree

9 files changed

+92
-49
lines changed

9 files changed

+92
-49
lines changed

IntegrationEngine.Client/IInEngineClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public interface IInEngineClient
2020
SimpleTrigger UpdateSimpleTrigger(SimpleTrigger simpleTrigger);
2121
SimpleTrigger DeleteSimpleTrigger(string id);
2222
IList<InEngineTimeZone> GetTimeZones();
23-
IList<string> GetJobTypes();
23+
IList<JobType> GetJobTypes();
2424
HealthStatus GetHealthStatus();
2525
}
2626
}

IntegrationEngine.Client/InEngineClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@ public IList<InEngineTimeZone> GetTimeZones()
123123
#endregion
124124

125125
#region JobType
126-
public IList<string> GetJobTypes()
126+
public IList<JobType> GetJobTypes()
127127
{
128128
var request = new RestRequest(EndpointName.JobType, Method.GET);
129129
var result = RestClient.Execute(request);
130-
return JsonConvert.DeserializeObject<IList<string>>(result.Content);
130+
return JsonConvert.DeserializeObject<IList<JobType>>(result.Content);
131131
}
132132
#endregion
133133

IntegrationEngine.ConsoleHost/IntegrationEngine.ConsoleHost.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
<Name>IntegrationEngine.Core</Name>
8787
</ProjectReference>
8888
<ProjectReference Include="..\IntegrationEngine.Model\IntegrationEngine.Model.csproj">
89-
<Project>{0b499fe4-0bdb-4080-bcb7-f8d4ce54a4ff}</Project>
89+
<Project>{0B499FE4-0BDB-4080-BCB7-F8D4CE54A4FF}</Project>
9090
<Name>IntegrationEngine.Model</Name>
9191
</ProjectReference>
9292
<ProjectReference Include="..\IntegrationEngine\IntegrationEngine.csproj">

IntegrationEngine.ConsoleHost/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace IntegrationEngine.ConsoleHost
55
{
6-
class MainClass
6+
public class MainClass
77
{
88
public static void Main(string[] args)
99
{

IntegrationEngine.Model/JobType.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,10 @@ public class JobType : IJobType
1010
{
1111
public string Name { get; set; }
1212
public string FullName { get; set; }
13+
14+
public override string ToString()
15+
{
16+
return string.Format("[JobType: Name={0}, FullName={1}]", Name, FullName);
17+
}
1318
}
1419
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using BeekmanLabs.UnitTesting;
2+
using IntegrationEngine.Api.Controllers;
3+
using IntegrationEngine.Model;
4+
using IntegrationEngine.Scheduler;
5+
using Moq;
6+
using NUnit.Framework;
7+
using System;
8+
using System.Collections;
9+
using System.Collections.Generic;
10+
11+
namespace IntegrationEngine.Tests
12+
{
13+
public class JobTypeControllerTest : TestBase<JobTypeController>
14+
{
15+
[Test]
16+
public void ShouldReturnListOfJobTypes()
17+
{
18+
var engineScheduler = new Mock<EngineScheduler>();
19+
var type = typeof(IntegrationJobFixture);
20+
var expected = new List<JobType>() {
21+
new JobType() {
22+
FullName = type.FullName,
23+
Name = type.Name,
24+
}
25+
};
26+
engineScheduler.SetupGet(x => x.IntegrationJobTypes).Returns(new List<Type>() { type });
27+
Subject.EngineScheduler = engineScheduler.Object;
28+
29+
var result = Subject.GetJobTypes();
30+
31+
Assert.That(result, Is.EqualTo(expected));
32+
}
33+
}
34+
}
35+

IntegrationEngine.Tests/IntegrationEngine.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
<Compile Include="Properties\AssemblyInfo.cs" />
9292
<Compile Include="Scheduler\EngineSchedulerTest.cs" />
9393
<Compile Include="StubContainer.cs" />
94+
<Compile Include="Api\Controllers\JobTypeControllerTest.cs" />
9495
</ItemGroup>
9596
<ItemGroup>
9697
<None Include="..\configuration\IntegrationEngine.json">

IntegrationEngine.sln

Lines changed: 45 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 2013
3+
# Visual Studio 2012
44
VisualStudioVersion = 12.0.31101.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IntegrationEngine", "IntegrationEngine\IntegrationEngine.csproj", "{7D49353D-A68C-4ACA-A6A5-40B1C314C30E}"
@@ -49,6 +49,36 @@ Global
4949
Release|x86 = Release|x86
5050
EndGlobalSection
5151
GlobalSection(ProjectConfigurationPlatforms) = postSolution
52+
{0B499FE4-0BDB-4080-BCB7-F8D4CE54A4FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
53+
{0B499FE4-0BDB-4080-BCB7-F8D4CE54A4FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
54+
{0B499FE4-0BDB-4080-BCB7-F8D4CE54A4FF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
55+
{0B499FE4-0BDB-4080-BCB7-F8D4CE54A4FF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
56+
{0B499FE4-0BDB-4080-BCB7-F8D4CE54A4FF}.Debug|x86.ActiveCfg = Debug|Any CPU
57+
{0B499FE4-0BDB-4080-BCB7-F8D4CE54A4FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
58+
{0B499FE4-0BDB-4080-BCB7-F8D4CE54A4FF}.Release|Any CPU.Build.0 = Release|Any CPU
59+
{0B499FE4-0BDB-4080-BCB7-F8D4CE54A4FF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
60+
{0B499FE4-0BDB-4080-BCB7-F8D4CE54A4FF}.Release|Mixed Platforms.Build.0 = Release|Any CPU
61+
{0B499FE4-0BDB-4080-BCB7-F8D4CE54A4FF}.Release|x86.ActiveCfg = Release|Any CPU
62+
{3F3794D7-4078-4D26-954C-7864173EDD86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
63+
{3F3794D7-4078-4D26-954C-7864173EDD86}.Debug|Any CPU.Build.0 = Debug|Any CPU
64+
{3F3794D7-4078-4D26-954C-7864173EDD86}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
65+
{3F3794D7-4078-4D26-954C-7864173EDD86}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
66+
{3F3794D7-4078-4D26-954C-7864173EDD86}.Debug|x86.ActiveCfg = Debug|Any CPU
67+
{3F3794D7-4078-4D26-954C-7864173EDD86}.Release|Any CPU.ActiveCfg = Release|Any CPU
68+
{3F3794D7-4078-4D26-954C-7864173EDD86}.Release|Any CPU.Build.0 = Release|Any CPU
69+
{3F3794D7-4078-4D26-954C-7864173EDD86}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
70+
{3F3794D7-4078-4D26-954C-7864173EDD86}.Release|Mixed Platforms.Build.0 = Release|Any CPU
71+
{3F3794D7-4078-4D26-954C-7864173EDD86}.Release|x86.ActiveCfg = Release|Any CPU
72+
{46DB723B-F767-4F5A-A1DA-53A6CF13704B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
73+
{46DB723B-F767-4F5A-A1DA-53A6CF13704B}.Debug|Any CPU.Build.0 = Debug|Any CPU
74+
{46DB723B-F767-4F5A-A1DA-53A6CF13704B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
75+
{46DB723B-F767-4F5A-A1DA-53A6CF13704B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
76+
{46DB723B-F767-4F5A-A1DA-53A6CF13704B}.Debug|x86.ActiveCfg = Debug|Any CPU
77+
{46DB723B-F767-4F5A-A1DA-53A6CF13704B}.Release|Any CPU.ActiveCfg = Release|Any CPU
78+
{46DB723B-F767-4F5A-A1DA-53A6CF13704B}.Release|Any CPU.Build.0 = Release|Any CPU
79+
{46DB723B-F767-4F5A-A1DA-53A6CF13704B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
80+
{46DB723B-F767-4F5A-A1DA-53A6CF13704B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
81+
{46DB723B-F767-4F5A-A1DA-53A6CF13704B}.Release|x86.ActiveCfg = Release|Any CPU
5282
{7D49353D-A68C-4ACA-A6A5-40B1C314C30E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
5383
{7D49353D-A68C-4ACA-A6A5-40B1C314C30E}.Debug|Any CPU.Build.0 = Debug|Any CPU
5484
{7D49353D-A68C-4ACA-A6A5-40B1C314C30E}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
@@ -60,6 +90,16 @@ Global
6090
{7D49353D-A68C-4ACA-A6A5-40B1C314C30E}.Release|Mixed Platforms.Build.0 = Release|x86
6191
{7D49353D-A68C-4ACA-A6A5-40B1C314C30E}.Release|x86.ActiveCfg = Release|x86
6292
{7D49353D-A68C-4ACA-A6A5-40B1C314C30E}.Release|x86.Build.0 = Release|x86
93+
{BBF7B784-DF72-4561-92B9-4021B5F7D8E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
94+
{BBF7B784-DF72-4561-92B9-4021B5F7D8E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
95+
{BBF7B784-DF72-4561-92B9-4021B5F7D8E3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
96+
{BBF7B784-DF72-4561-92B9-4021B5F7D8E3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
97+
{BBF7B784-DF72-4561-92B9-4021B5F7D8E3}.Debug|x86.ActiveCfg = Debug|Any CPU
98+
{BBF7B784-DF72-4561-92B9-4021B5F7D8E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
99+
{BBF7B784-DF72-4561-92B9-4021B5F7D8E3}.Release|Any CPU.Build.0 = Release|Any CPU
100+
{BBF7B784-DF72-4561-92B9-4021B5F7D8E3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
101+
{BBF7B784-DF72-4561-92B9-4021B5F7D8E3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
102+
{BBF7B784-DF72-4561-92B9-4021B5F7D8E3}.Release|x86.ActiveCfg = Release|Any CPU
63103
{C273AE91-E13F-4443-8D01-9C97016AB4AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
64104
{C273AE91-E13F-4443-8D01-9C97016AB4AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
65105
{C273AE91-E13F-4443-8D01-9C97016AB4AC}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
@@ -71,26 +111,6 @@ Global
71111
{C273AE91-E13F-4443-8D01-9C97016AB4AC}.Release|Mixed Platforms.Build.0 = Release|x86
72112
{C273AE91-E13F-4443-8D01-9C97016AB4AC}.Release|x86.ActiveCfg = Release|x86
73113
{C273AE91-E13F-4443-8D01-9C97016AB4AC}.Release|x86.Build.0 = Release|x86
74-
{3F3794D7-4078-4D26-954C-7864173EDD86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
75-
{3F3794D7-4078-4D26-954C-7864173EDD86}.Debug|Any CPU.Build.0 = Debug|Any CPU
76-
{3F3794D7-4078-4D26-954C-7864173EDD86}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
77-
{3F3794D7-4078-4D26-954C-7864173EDD86}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
78-
{3F3794D7-4078-4D26-954C-7864173EDD86}.Debug|x86.ActiveCfg = Debug|Any CPU
79-
{3F3794D7-4078-4D26-954C-7864173EDD86}.Release|Any CPU.ActiveCfg = Release|Any CPU
80-
{3F3794D7-4078-4D26-954C-7864173EDD86}.Release|Any CPU.Build.0 = Release|Any CPU
81-
{3F3794D7-4078-4D26-954C-7864173EDD86}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
82-
{3F3794D7-4078-4D26-954C-7864173EDD86}.Release|Mixed Platforms.Build.0 = Release|Any CPU
83-
{3F3794D7-4078-4D26-954C-7864173EDD86}.Release|x86.ActiveCfg = Release|Any CPU
84-
{0B499FE4-0BDB-4080-BCB7-F8D4CE54A4FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
85-
{0B499FE4-0BDB-4080-BCB7-F8D4CE54A4FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
86-
{0B499FE4-0BDB-4080-BCB7-F8D4CE54A4FF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
87-
{0B499FE4-0BDB-4080-BCB7-F8D4CE54A4FF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
88-
{0B499FE4-0BDB-4080-BCB7-F8D4CE54A4FF}.Debug|x86.ActiveCfg = Debug|Any CPU
89-
{0B499FE4-0BDB-4080-BCB7-F8D4CE54A4FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
90-
{0B499FE4-0BDB-4080-BCB7-F8D4CE54A4FF}.Release|Any CPU.Build.0 = Release|Any CPU
91-
{0B499FE4-0BDB-4080-BCB7-F8D4CE54A4FF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
92-
{0B499FE4-0BDB-4080-BCB7-F8D4CE54A4FF}.Release|Mixed Platforms.Build.0 = Release|Any CPU
93-
{0B499FE4-0BDB-4080-BCB7-F8D4CE54A4FF}.Release|x86.ActiveCfg = Release|Any CPU
94114
{DFCD19CE-A96A-4B19-8CF1-9CAC560E7F42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
95115
{DFCD19CE-A96A-4B19-8CF1-9CAC560E7F42}.Debug|Any CPU.Build.0 = Debug|Any CPU
96116
{DFCD19CE-A96A-4B19-8CF1-9CAC560E7F42}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
@@ -123,26 +143,6 @@ Global
123143
{F3FCB706-F0DD-46C1-B121-785757FAE9B9}.Release|Mixed Platforms.Build.0 = Release|Any CPU
124144
{F3FCB706-F0DD-46C1-B121-785757FAE9B9}.Release|x86.ActiveCfg = Release|Any CPU
125145
{F3FCB706-F0DD-46C1-B121-785757FAE9B9}.Release|x86.Build.0 = Release|Any CPU
126-
{BBF7B784-DF72-4561-92B9-4021B5F7D8E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
127-
{BBF7B784-DF72-4561-92B9-4021B5F7D8E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
128-
{BBF7B784-DF72-4561-92B9-4021B5F7D8E3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
129-
{BBF7B784-DF72-4561-92B9-4021B5F7D8E3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
130-
{BBF7B784-DF72-4561-92B9-4021B5F7D8E3}.Debug|x86.ActiveCfg = Debug|Any CPU
131-
{BBF7B784-DF72-4561-92B9-4021B5F7D8E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
132-
{BBF7B784-DF72-4561-92B9-4021B5F7D8E3}.Release|Any CPU.Build.0 = Release|Any CPU
133-
{BBF7B784-DF72-4561-92B9-4021B5F7D8E3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
134-
{BBF7B784-DF72-4561-92B9-4021B5F7D8E3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
135-
{BBF7B784-DF72-4561-92B9-4021B5F7D8E3}.Release|x86.ActiveCfg = Release|Any CPU
136-
{46DB723B-F767-4F5A-A1DA-53A6CF13704B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
137-
{46DB723B-F767-4F5A-A1DA-53A6CF13704B}.Debug|Any CPU.Build.0 = Debug|Any CPU
138-
{46DB723B-F767-4F5A-A1DA-53A6CF13704B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
139-
{46DB723B-F767-4F5A-A1DA-53A6CF13704B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
140-
{46DB723B-F767-4F5A-A1DA-53A6CF13704B}.Debug|x86.ActiveCfg = Debug|Any CPU
141-
{46DB723B-F767-4F5A-A1DA-53A6CF13704B}.Release|Any CPU.ActiveCfg = Release|Any CPU
142-
{46DB723B-F767-4F5A-A1DA-53A6CF13704B}.Release|Any CPU.Build.0 = Release|Any CPU
143-
{46DB723B-F767-4F5A-A1DA-53A6CF13704B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
144-
{46DB723B-F767-4F5A-A1DA-53A6CF13704B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
145-
{46DB723B-F767-4F5A-A1DA-53A6CF13704B}.Release|x86.ActiveCfg = Release|Any CPU
146146
{F999051E-B715-4AB9-A3B2-0D91A896A2C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
147147
{F999051E-B715-4AB9-A3B2-0D91A896A2C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
148148
{F999051E-B715-4AB9-A3B2-0D91A896A2C2}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
@@ -154,10 +154,12 @@ Global
154154
{F999051E-B715-4AB9-A3B2-0D91A896A2C2}.Release|Mixed Platforms.Build.0 = Release|Any CPU
155155
{F999051E-B715-4AB9-A3B2-0D91A896A2C2}.Release|x86.ActiveCfg = Release|Any CPU
156156
EndGlobalSection
157-
GlobalSection(SolutionProperties) = preSolution
158-
HideSolutionNode = FALSE
157+
GlobalSection(NestedProjects) = preSolution
159158
EndGlobalSection
160159
GlobalSection(MonoDevelopProperties) = preSolution
161160
StartupItem = IntegrationEngine.ConsoleHost\IntegrationEngine.ConsoleHost.csproj
162161
EndGlobalSection
162+
GlobalSection(SolutionProperties) = preSolution
163+
HideSolutionNode = FALSE
164+
EndGlobalSection
163165
EndGlobal

IntegrationEngine/Scheduler/EngineScheduler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace IntegrationEngine.Scheduler
1313
public class EngineScheduler : IEngineScheduler
1414
{
1515
public IScheduler Scheduler { get; set; }
16-
public IList<Type> IntegrationJobTypes { get; set; }
16+
public virtual IList<Type> IntegrationJobTypes { get; set; }
1717
public IMessageQueueClient MessageQueueClient { get; set; }
1818
public ILog Log { get; set; }
1919

0 commit comments

Comments
 (0)