Skip to content

Commit aeb223f

Browse files
committed
Merge branch 'develop'
2 parents 74378d9 + 3d0a666 commit aeb223f

39 files changed

+777
-101
lines changed

IntegrationEngine.Client.net40/IntegrationEngine.Client.net40.csproj

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
44
<PropertyGroup>
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -32,10 +32,6 @@
3232
<WarningLevel>4</WarningLevel>
3333
</PropertyGroup>
3434
<ItemGroup>
35-
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
36-
<SpecificVersion>False</SpecificVersion>
37-
<HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net40\Newtonsoft.Json.dll</HintPath>
38-
</Reference>
3935
<Reference Include="RestSharp">
4036
<HintPath>..\packages\RestSharp.105.0.1\lib\net4\RestSharp.dll</HintPath>
4137
</Reference>
@@ -46,6 +42,9 @@
4642
<Reference Include="Microsoft.CSharp" />
4743
<Reference Include="System.Data" />
4844
<Reference Include="System.Xml" />
45+
<Reference Include="Newtonsoft.Json">
46+
<HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net40\Newtonsoft.Json.dll</HintPath>
47+
</Reference>
4948
</ItemGroup>
5049
<ItemGroup>
5150
<Compile Include="..\configuration\SharedAssemblyInfo.cs">
@@ -54,6 +53,9 @@
5453
<Compile Include="..\IntegrationEngine.Client\EndpointName.cs">
5554
<Link>EndpointName.cs</Link>
5655
</Compile>
56+
<Compile Include="..\IntegrationEngine.Client\IInEngineClient.cs">
57+
<Link>IInEngineClient.cs</Link>
58+
</Compile>
5759
<Compile Include="..\IntegrationEngine.Client\InEngineClient.cs">
5860
<Link>InEngineClient.cs</Link>
5961
</Compile>
@@ -64,7 +66,7 @@
6466
</ItemGroup>
6567
<ItemGroup>
6668
<ProjectReference Include="..\IntegrationEngine.Model.net40\IntegrationEngine.Model.net40.csproj">
67-
<Project>{dfcd19ce-a96a-4b19-8cf1-9cac560e7f42}</Project>
69+
<Project>{DFCD19CE-A96A-4B19-8CF1-9CAC560E7F42}</Project>
6870
<Name>IntegrationEngine.Model.net40</Name>
6971
</ProjectReference>
7072
</ItemGroup>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using InEngineTimeZone = IntegrationEngine.Model.TimeZone;
2+
using IntegrationEngine.Model;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Net;
6+
7+
namespace IntegrationEngine.Client
8+
{
9+
public interface IInEngineClient
10+
{
11+
HttpStatusCode Ping();
12+
IList<CronTrigger> GetCronTriggers();
13+
CronTrigger GetCronTriggerById(string id);
14+
CronTrigger CreateCronTrigger(CronTrigger cronTrigger);
15+
CronTrigger UpdateCronTrigger(CronTrigger cronTrigger);
16+
CronTrigger DeleteCronTrigger(string id);
17+
IList<SimpleTrigger> GetSimpleTriggers();
18+
SimpleTrigger GetSimpleTriggerById(string id);
19+
SimpleTrigger CreateSimpleTrigger(SimpleTrigger simpleTrigger);
20+
SimpleTrigger UpdateSimpleTrigger(SimpleTrigger simpleTrigger);
21+
SimpleTrigger DeleteSimpleTrigger(string id);
22+
IList<InEngineTimeZone> GetTimeZones();
23+
IList<string> GetJobTypes();
24+
HealthStatus GetHealthStatus();
25+
}
26+
}
27+

IntegrationEngine.Client/InEngineClient.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
using IntegrationEngine.Model;
66
using RestSharp;
77
using Newtonsoft.Json;
8+
using System.Net;
89

910
namespace IntegrationEngine.Client
1011
{
11-
public class InEngineClient
12+
public class InEngineClient : IInEngineClient
1213
{
1314
public RestClient RestClient { get; set; }
1415

@@ -22,6 +23,11 @@ public InEngineClient(string apiUrl)
2223
RestClient = new RestClient(apiUrl);
2324
}
2425

26+
public HttpStatusCode Ping()
27+
{
28+
return RestClient.Execute(new RestRequest(EndpointName.HealthStatus, Method.GET)).StatusCode;
29+
}
30+
2531
#region CronTrigger
2632
public IList<CronTrigger> GetCronTriggers()
2733
{

IntegrationEngine.Client/IntegrationEngine.Client.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,13 @@
3030
<ConsolePause>false</ConsolePause>
3131
</PropertyGroup>
3232
<ItemGroup>
33-
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
34-
<SpecificVersion>False</SpecificVersion>
35-
<HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
36-
</Reference>
3733
<Reference Include="System" />
3834
<Reference Include="RestSharp">
3935
<HintPath>..\packages\RestSharp.105.0.1\lib\net4\RestSharp.dll</HintPath>
4036
</Reference>
37+
<Reference Include="Newtonsoft.Json">
38+
<HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
39+
</Reference>
4140
</ItemGroup>
4241
<ItemGroup>
4342
<Compile Include="..\configuration\SharedAssemblyInfo.cs">
@@ -46,6 +45,7 @@
4645
<Compile Include="InEngineClient.cs" />
4746
<Compile Include="Properties\AssemblyInfo.cs" />
4847
<Compile Include="EndpointName.cs" />
48+
<Compile Include="IInEngineClient.cs" />
4949
</ItemGroup>
5050
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
5151
<ItemGroup>

IntegrationEngine.ConsoleClient/IntegrationEngine.ConsoleClient.csproj

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
44
<PropertyGroup>
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -8,13 +8,14 @@
88
<OutputType>Exe</OutputType>
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<RootNamespace>IntegrationEngine.ConsoleClient</RootNamespace>
11-
<AssemblyName>IntegrationEngine.ConsoleClient</AssemblyName>
11+
<AssemblyName>inengine</AssemblyName>
1212
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
1414
<TargetFrameworkProfile />
15+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
16+
<RestorePackages>true</RestorePackages>
1517
</PropertyGroup>
1618
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17-
<PlatformTarget>AnyCPU</PlatformTarget>
1819
<DebugSymbols>true</DebugSymbols>
1920
<DebugType>full</DebugType>
2021
<Optimize>false</Optimize>
@@ -42,25 +43,31 @@
4243
<Reference Include="Microsoft.CSharp" />
4344
<Reference Include="System.Data" />
4445
<Reference Include="System.Xml" />
46+
<Reference Include="CommandLine">
47+
<HintPath>..\packages\CommandLineParser.1.9.71\lib\net45\CommandLine.dll</HintPath>
48+
</Reference>
4549
</ItemGroup>
4650
<ItemGroup>
4751
<Compile Include="Program.cs" />
4852
<Compile Include="Properties\AssemblyInfo.cs" />
53+
<Compile Include="Options.cs" />
4954
</ItemGroup>
5055
<ItemGroup>
5156
<ProjectReference Include="..\IntegrationEngine.Client\IntegrationEngine.Client.csproj">
52-
<Project>{f3fcb706-f0dd-46c1-b121-785757fae9b9}</Project>
57+
<Project>{F3FCB706-F0DD-46C1-B121-785757FAE9B9}</Project>
5358
<Name>IntegrationEngine.Client</Name>
5459
</ProjectReference>
5560
<ProjectReference Include="..\IntegrationEngine.Model\IntegrationEngine.Model.csproj">
56-
<Project>{0b499fe4-0bdb-4080-bcb7-f8d4ce54a4ff}</Project>
61+
<Project>{0B499FE4-0BDB-4080-BCB7-F8D4CE54A4FF}</Project>
5762
<Name>IntegrationEngine.Model</Name>
5863
</ProjectReference>
5964
</ItemGroup>
6065
<ItemGroup>
6166
<None Include="app.config" />
67+
<None Include="packages.config" />
6268
</ItemGroup>
6369
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
70+
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
6471
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
6572
Other similar extension points exist, see Microsoft.Common.targets.
6673
<Target Name="BeforeBuild">
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using CommandLine;
2+
using System;
3+
using System.Collections.Generic;
4+
using IntegrationEngine.Client;
5+
6+
namespace IntegrationEngine.ConsoleClient
7+
{
8+
9+
public class Options
10+
{
11+
[Option('m', "method", Required = true, HelpText = "Call a method from IntegrationEngine.Client.")]
12+
public string MethodName { get; set; }
13+
14+
[Option('u', "url", Required = false, HelpText = "Web API url.")]
15+
public string WebApiUrl { get; set; }
16+
}
17+
}
Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
using IntegrationEngine.Client;
1+
using CommandLine;
2+
using CommandLine.Text;
3+
using IntegrationEngine.Client;
4+
using IntegrationEngine.Model;
25
using System;
36
using System.Collections.Generic;
47
using System.Linq;
@@ -10,10 +13,32 @@ class Program
1013
{
1114
static void Main(string[] args)
1215
{
13-
var client = new InEngineClient();
14-
var triggers = client.GetCronTriggers();
15-
Console.WriteLine(triggers.Count);
16-
Console.ReadLine();
16+
var options = new Options();
17+
if (!CommandLine.Parser.Default.ParseArguments(args, options))
18+
return;
19+
var client = !string.IsNullOrWhiteSpace(options.WebApiUrl) ?
20+
new InEngineClient(options.WebApiUrl) :
21+
new InEngineClient();
22+
var type = client.GetType();
23+
if (!type.GetMethods().Where(x => x.Name == options.MethodName && !x.GetParameters().Any()).Any())
24+
{
25+
Console.WriteLine("Method '{0}' does not exist", options.MethodName);
26+
var availableMethods = typeof(IInEngineClient).GetMethods()
27+
.Where(x => !x.GetParameters().Any())
28+
.Select(x => x.Name)
29+
.ToList();
30+
Console.WriteLine("Available methods: '{0}'", string.Join(", ", availableMethods));
31+
return;
32+
}
33+
var method = type.GetMethod(options.MethodName);
34+
dynamic result = method.Invoke(client, null);
35+
if (result == null)
36+
Console.WriteLine("The web API did not return a result. Is the URL correct and the server online? Try -mPing.");
37+
else if (method.ReturnType.GetInterface("IEnumerable") != null)
38+
foreach (var item in result)
39+
Console.WriteLine(item);
40+
else
41+
Console.WriteLine(result);
1742
}
1843
}
1944
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="CommandLineParser" version="1.9.71" targetFramework="net45" />
4+
</packages>
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{F999051E-B715-4AB9-A3B2-0D91A896A2C2}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>IntegrationEngine.Model.Tests</RootNamespace>
11+
<AssemblyName>IntegrationEngine.Model.Tests</AssemblyName>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
15+
<RestorePackages>true</RestorePackages>
16+
</PropertyGroup>
17+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>bin\Debug\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<DebugType>pdbonly</DebugType>
28+
<Optimize>true</Optimize>
29+
<OutputPath>bin\Release\</OutputPath>
30+
<DefineConstants>TRACE</DefineConstants>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
</PropertyGroup>
34+
<ItemGroup>
35+
<Reference Include="CronExpressionDescriptor">
36+
<HintPath>..\packages\CronExpressionDescriptor.1.12.0\lib\net35\CronExpressionDescriptor.dll</HintPath>
37+
</Reference>
38+
<Reference Include="Elasticsearch.Net">
39+
<HintPath>..\packages\Elasticsearch.Net.1.3.1\lib\Elasticsearch.Net.dll</HintPath>
40+
</Reference>
41+
<Reference Include="Nest">
42+
<HintPath>..\packages\NEST.1.3.1\lib\Nest.dll</HintPath>
43+
</Reference>
44+
<Reference Include="Newtonsoft.Json">
45+
<HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
46+
</Reference>
47+
<Reference Include="nunit.framework">
48+
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
49+
</Reference>
50+
<Reference Include="System" />
51+
<Reference Include="System.Core" />
52+
<Reference Include="System.Xml.Linq" />
53+
<Reference Include="System.Data.DataSetExtensions" />
54+
<Reference Include="Microsoft.CSharp" />
55+
<Reference Include="System.Data" />
56+
<Reference Include="System.Xml" />
57+
</ItemGroup>
58+
<ItemGroup>
59+
<Compile Include="Properties\AssemblyInfo.cs" />
60+
<Compile Include="TriggerPropertyExtensionTest.cs" />
61+
</ItemGroup>
62+
<ItemGroup>
63+
<None Include="packages.config" />
64+
</ItemGroup>
65+
<ItemGroup>
66+
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
67+
</ItemGroup>
68+
<ItemGroup>
69+
<ProjectReference Include="..\IntegrationEngine.Model\IntegrationEngine.Model.csproj">
70+
<Project>{0B499FE4-0BDB-4080-BCB7-F8D4CE54A4FF}</Project>
71+
<Name>IntegrationEngine.Model</Name>
72+
</ProjectReference>
73+
</ItemGroup>
74+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
75+
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
76+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
77+
Other similar extension points exist, see Microsoft.Common.targets.
78+
<Target Name="BeforeBuild">
79+
</Target>
80+
<Target Name="AfterBuild">
81+
</Target>
82+
-->
83+
</Project>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("IntegrationEngine.Model.Tests")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("Hewlett-Packard Company")]
12+
[assembly: AssemblyProduct("IntegrationEngine.Model.Tests")]
13+
[assembly: AssemblyCopyright("Copyright © Hewlett-Packard Company 2015")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("e6becfb2-19e7-4325-9be2-94c633333e30")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

0 commit comments

Comments
 (0)