Skip to content

Commit f84a588

Browse files
committed
Implemented test tool for harmonize
1 parent 1172203 commit f84a588

22 files changed

+887
-8
lines changed

Bebbs.Harmonize.Host/Container.cs

+9-7
Original file line numberDiff line numberDiff line change
@@ -76,27 +76,29 @@ public async Task Start()
7676

7777
CreateKernel();
7878

79-
_service = _kernel.Get<TService>();
79+
Service = _kernel.Get<TService>();
8080

81-
await _service.Initialize();
81+
await Service.Initialize();
8282

83-
await _service.Start();
83+
await Service.Start();
8484
}
8585

8686
public async Task Stop()
8787
{
8888
Instrumentation.Container.Stopping();
8989

90-
if (_service != null)
90+
if (Service != null)
9191
{
92-
await _service.Stop();
92+
await Service.Stop();
9393

94-
await _service.Cleanup();
94+
await Service.Cleanup();
9595

96-
_service = default(TService);
96+
Service = default(TService);
9797
}
9898

9999
DisposeKernel();
100100
}
101+
102+
public TService Service { get; private set; }
101103
}
102104
}

Bebbs.Harmonize.Tool/App.config

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<configSections>
4+
<section name="hostContainer" type="SimpleConfig.Section, SimpleConfig" />
5+
<section name="rabbitMq" type="SimpleConfig.Section, SimpleConfig" />
6+
</configSections>
7+
<hostContainer>
8+
<modulePatterns>
9+
<modulePattern Path="" Pattern="Bebbs.Harmonize.With.Messaging.Over.RabbitMq.dll" />
10+
<modulePattern Path="" Pattern="Bebbs.Harmonize.With.Message.As.Hml.dll" />
11+
</modulePatterns>
12+
</hostContainer>
13+
<rabbitMq HostName="devbox" UserName="HarmonizeClient" Password="P2ssw0rd" ExchangeName="Harmonize" QueueName="Host" />
14+
<startup>
15+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
16+
</startup>
17+
<runtime>
18+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
19+
<dependentAssembly>
20+
<assemblyIdentity name="Caliburn.Micro" publicKeyToken="8e5891231f2ed21f" culture="neutral" />
21+
<bindingRedirect oldVersion="0.0.0.0-2.0.1.0" newVersion="2.0.1.0" />
22+
</dependentAssembly>
23+
<dependentAssembly>
24+
<assemblyIdentity name="System.Reactive.Linq" publicKeyToken="31bf3856ad364e35" culture="neutral" />
25+
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
26+
</dependentAssembly>
27+
<dependentAssembly>
28+
<assemblyIdentity name="System.Reactive.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
29+
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
30+
</dependentAssembly>
31+
</assemblyBinding>
32+
</runtime>
33+
</configuration>

Bebbs.Harmonize.Tool/App.xaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Application x:Class="Bebbs.Harmonize.Tool.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:Bebbs.Harmonize.Tool">
5+
<Application.Resources>
6+
<ResourceDictionary>
7+
<ResourceDictionary.MergedDictionaries>
8+
<ResourceDictionary>
9+
<local:AppBootstrapper x:Key="bootstrapper" />
10+
</ResourceDictionary>
11+
</ResourceDictionary.MergedDictionaries>
12+
</ResourceDictionary>
13+
</Application.Resources>
14+
</Application>

Bebbs.Harmonize.Tool/App.xaml.cs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Configuration;
4+
using System.Data;
5+
using System.Linq;
6+
using System.Threading.Tasks;
7+
using System.Windows;
8+
9+
namespace Bebbs.Harmonize.Tool
10+
{
11+
/// <summary>
12+
/// Interaction logic for App.xaml
13+
/// </summary>
14+
public partial class App : Application
15+
{
16+
}
17+
}
+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Caliburn.Micro;
4+
using Ninject;
5+
6+
namespace Bebbs.Harmonize.Tool
7+
{
8+
public class AppBootstrapper : BootstrapperBase
9+
{
10+
private IKernel _kernel;
11+
12+
public AppBootstrapper()
13+
{
14+
Initialize();
15+
}
16+
17+
protected override void Configure()
18+
{
19+
_kernel = new StandardKernel(new Module());
20+
}
21+
22+
protected override object GetInstance(Type service, string key)
23+
{
24+
var instance = _kernel.Get(service, key);
25+
if (instance != null)
26+
return instance;
27+
28+
throw new InvalidOperationException("Could not locate any instances.");
29+
}
30+
31+
protected override IEnumerable<object> GetAllInstances(Type service)
32+
{
33+
return _kernel.GetAll(service);
34+
}
35+
36+
protected override void BuildUp(object instance)
37+
{
38+
_kernel.Inject(instance);
39+
}
40+
41+
protected override void OnStartup(object sender, System.Windows.StartupEventArgs e)
42+
{
43+
DisplayRootViewFor<IMainWindowViewModel>();
44+
}
45+
}
46+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.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>{84F04954-3830-4050-98D1-6CE92C0812F1}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>Bebbs.Harmonize.Tool</RootNamespace>
11+
<AssemblyName>Bebbs.Harmonize.Tool</AssemblyName>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
15+
<WarningLevel>4</WarningLevel>
16+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
17+
<RestorePackages>true</RestorePackages>
18+
</PropertyGroup>
19+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
20+
<PlatformTarget>AnyCPU</PlatformTarget>
21+
<DebugSymbols>true</DebugSymbols>
22+
<DebugType>full</DebugType>
23+
<Optimize>false</Optimize>
24+
<OutputPath>bin\Debug\</OutputPath>
25+
<DefineConstants>DEBUG;TRACE</DefineConstants>
26+
<ErrorReport>prompt</ErrorReport>
27+
<WarningLevel>4</WarningLevel>
28+
</PropertyGroup>
29+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
30+
<PlatformTarget>AnyCPU</PlatformTarget>
31+
<DebugType>pdbonly</DebugType>
32+
<Optimize>true</Optimize>
33+
<OutputPath>bin\Release\</OutputPath>
34+
<DefineConstants>TRACE</DefineConstants>
35+
<ErrorReport>prompt</ErrorReport>
36+
<WarningLevel>4</WarningLevel>
37+
</PropertyGroup>
38+
<ItemGroup>
39+
<Reference Include="Bender">
40+
<HintPath>..\packages\Bender.3.0.1.0\lib\Bender.dll</HintPath>
41+
</Reference>
42+
<Reference Include="Caliburn.Micro">
43+
<HintPath>..\packages\Caliburn.Micro.Core.2.0.1\lib\net45\Caliburn.Micro.dll</HintPath>
44+
</Reference>
45+
<Reference Include="Caliburn.Micro.Platform">
46+
<HintPath>..\packages\Caliburn.Micro.2.0.1\lib\net45\Caliburn.Micro.Platform.dll</HintPath>
47+
</Reference>
48+
<Reference Include="Caliburn.Micro.Reactive.Extensions, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
49+
<SpecificVersion>False</SpecificVersion>
50+
<HintPath>..\packages\Caliburn.Micro.Reactive.Extensions.1.0.0.0\lib\portable-net45+win+wp80\Caliburn.Micro.Reactive.Extensions.dll</HintPath>
51+
</Reference>
52+
<Reference Include="Flexo">
53+
<HintPath>..\packages\flexo.1.0.19.0\lib\Flexo.dll</HintPath>
54+
</Reference>
55+
<Reference Include="Ninject">
56+
<HintPath>..\packages\Ninject.3.2.2.0\lib\net45-full\Ninject.dll</HintPath>
57+
</Reference>
58+
<Reference Include="SimpleConfig">
59+
<HintPath>..\packages\SimpleConfig.1.0.33.0\lib\SimpleConfig.dll</HintPath>
60+
</Reference>
61+
<Reference Include="System" />
62+
<Reference Include="System.Data" />
63+
<Reference Include="System.Reactive.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
64+
<SpecificVersion>False</SpecificVersion>
65+
<HintPath>..\packages\Rx-Core.2.2.5\lib\net45\System.Reactive.Core.dll</HintPath>
66+
</Reference>
67+
<Reference Include="System.Reactive.Interfaces, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
68+
<SpecificVersion>False</SpecificVersion>
69+
<HintPath>..\packages\Rx-Interfaces.2.2.5\lib\net45\System.Reactive.Interfaces.dll</HintPath>
70+
</Reference>
71+
<Reference Include="System.Reactive.Linq, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
72+
<SpecificVersion>False</SpecificVersion>
73+
<HintPath>..\packages\Rx-Linq.2.2.5\lib\net45\System.Reactive.Linq.dll</HintPath>
74+
</Reference>
75+
<Reference Include="System.Reactive.PlatformServices, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
76+
<SpecificVersion>False</SpecificVersion>
77+
<HintPath>..\packages\Rx-PlatformServices.2.2.5\lib\net45\System.Reactive.PlatformServices.dll</HintPath>
78+
</Reference>
79+
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
80+
<HintPath>..\packages\Caliburn.Micro.2.0.1\lib\net45\System.Windows.Interactivity.dll</HintPath>
81+
</Reference>
82+
<Reference Include="System.Xml" />
83+
<Reference Include="Microsoft.CSharp" />
84+
<Reference Include="System.Core" />
85+
<Reference Include="System.Xml.Linq" />
86+
<Reference Include="System.Data.DataSetExtensions" />
87+
<Reference Include="System.Xaml">
88+
<RequiredTargetFramework>4.0</RequiredTargetFramework>
89+
</Reference>
90+
<Reference Include="WindowsBase" />
91+
<Reference Include="PresentationCore" />
92+
<Reference Include="PresentationFramework" />
93+
</ItemGroup>
94+
<ItemGroup>
95+
<ApplicationDefinition Include="App.xaml">
96+
<Generator>MSBuild:Compile</Generator>
97+
<SubType>Designer</SubType>
98+
</ApplicationDefinition>
99+
<Compile Include="AppBootstrapper.cs" />
100+
<Compile Include="MainWindowViewModel.cs" />
101+
<Compile Include="Module.cs" />
102+
<Compile Include="Service\Bridge.cs" />
103+
<Compile Include="Service\Entity.cs" />
104+
<Compile Include="Service\Instance.cs" />
105+
<Compile Include="Service\Module.cs" />
106+
<Page Include="MainWindowView.xaml">
107+
<Generator>MSBuild:Compile</Generator>
108+
<SubType>Designer</SubType>
109+
</Page>
110+
<Compile Include="App.xaml.cs">
111+
<DependentUpon>App.xaml</DependentUpon>
112+
<SubType>Code</SubType>
113+
</Compile>
114+
<Compile Include="MainWindowView.xaml.cs">
115+
<DependentUpon>MainWindowView.xaml</DependentUpon>
116+
<SubType>Code</SubType>
117+
</Compile>
118+
</ItemGroup>
119+
<ItemGroup>
120+
<Compile Include="Properties\AssemblyInfo.cs">
121+
<SubType>Code</SubType>
122+
</Compile>
123+
<Compile Include="Properties\Resources.Designer.cs">
124+
<AutoGen>True</AutoGen>
125+
<DesignTime>True</DesignTime>
126+
<DependentUpon>Resources.resx</DependentUpon>
127+
</Compile>
128+
<Compile Include="Properties\Settings.Designer.cs">
129+
<AutoGen>True</AutoGen>
130+
<DependentUpon>Settings.settings</DependentUpon>
131+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
132+
</Compile>
133+
<EmbeddedResource Include="Properties\Resources.resx">
134+
<Generator>ResXFileCodeGenerator</Generator>
135+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
136+
</EmbeddedResource>
137+
<None Include="packages.config" />
138+
<None Include="Properties\Settings.settings">
139+
<Generator>SettingsSingleFileGenerator</Generator>
140+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
141+
</None>
142+
<AppDesigner Include="Properties\" />
143+
</ItemGroup>
144+
<ItemGroup>
145+
<None Include="App.config" />
146+
</ItemGroup>
147+
<ItemGroup>
148+
<ProjectReference Include="..\Bebbs.Harmonize.Host\Bebbs.Harmonize.Host.csproj">
149+
<Project>{21984f93-19aa-4d2b-bbdb-95e0092019a1}</Project>
150+
<Name>Bebbs.Harmonize.Host</Name>
151+
</ProjectReference>
152+
<ProjectReference Include="..\Bebbs.Harmonize.With\Bebbs.Harmonize.With.csproj">
153+
<Project>{91848444-1506-4f50-bf6c-d0528cd6c74e}</Project>
154+
<Name>Bebbs.Harmonize.With</Name>
155+
</ProjectReference>
156+
</ItemGroup>
157+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
158+
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
159+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
160+
<PropertyGroup>
161+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
162+
</PropertyGroup>
163+
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
164+
</Target>
165+
<PropertyGroup>
166+
<PostBuildEvent>xcopy $(TargetDir)*.* $(SolutionDir)bin\Tools\$(ProjectName)\ /E /I /R /Y
167+
xcopy $(SolutionDir)Bebbs.Harmonize.With.Message.As.Hml\$(OutDir)*.* $(SolutionDir)\bin\Tools\$(ProjectName)\ /E /I /R /Y
168+
xcopy $(SolutionDir)Bebbs.Harmonize.With.Messaging.Over.RabbitMq\$(OutDir)*.* $(SolutionDir)\bin\Tools\$(ProjectName)\ /E /I /R /Y</PostBuildEvent>
169+
</PropertyGroup>
170+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
171+
Other similar extension points exist, see Microsoft.Common.targets.
172+
<Target Name="BeforeBuild">
173+
</Target>
174+
<Target Name="AfterBuild">
175+
</Target>
176+
-->
177+
</Project>
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<Window x:Class="Bebbs.Harmonize.Tool.MainWindowView"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
Title="MainWindow" Height="350" Width="525">
5+
<Grid>
6+
<Grid.ColumnDefinitions>
7+
<ColumnDefinition Width="0.4*"/>
8+
<ColumnDefinition />
9+
</Grid.ColumnDefinitions>
10+
<Grid Grid.Column="0">
11+
<Grid.RowDefinitions>
12+
<RowDefinition Height="Auto"/>
13+
<RowDefinition />
14+
</Grid.RowDefinitions>
15+
<StackPanel>
16+
<StackPanel Orientation="Vertical">
17+
<Button Content="Register" Command="{Binding Register}" Margin="5,2"/>
18+
<Button Content="Action" Command="{Binding Action}" Margin="5,2"/>
19+
</StackPanel>
20+
</StackPanel>
21+
</Grid>
22+
</Grid>
23+
</Window>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Windows;
7+
using System.Windows.Controls;
8+
using System.Windows.Data;
9+
using System.Windows.Documents;
10+
using System.Windows.Input;
11+
using System.Windows.Media;
12+
using System.Windows.Media.Imaging;
13+
using System.Windows.Navigation;
14+
using System.Windows.Shapes;
15+
16+
namespace Bebbs.Harmonize.Tool
17+
{
18+
/// <summary>
19+
/// Interaction logic for MainWindow.xaml
20+
/// </summary>
21+
public partial class MainWindowView : Window
22+
{
23+
public MainWindowView()
24+
{
25+
InitializeComponent();
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)