Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Moving to Green Pipes #28

Merged
merged 3 commits into from
Sep 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,19 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="GreenPipes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b800c4cfcdeea87b, processorArchitecture=MSIL">
<HintPath>..\packages\GreenPipes.1.0.0\lib\net452\GreenPipes.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Iesi.Collections">
<HintPath>..\packages\Iesi.Collections.4.0.1.4000\lib\net40\Iesi.Collections.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.5\lib\net45-full\log4net.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NHibernate, Version=4.0.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="GreenPipes" version="1.0.0" targetFramework="net452" />
<package id="Iesi.Collections" version="4.0.1.4000" targetFramework="net45" />
<package id="log4net" version="2.0.5" targetFramework="net452" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
<package id="NHibernate" version="4.0.4.4000" targetFramework="net45" />
<package id="NUnit" version="2.6.4" targetFramework="net45" />
<package id="System.Data.SQLite.Core" version="1.0.94.0" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,17 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="GreenPipes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b800c4cfcdeea87b, processorArchitecture=MSIL">
<HintPath>..\packages\GreenPipes.1.0.0\lib\net452\GreenPipes.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Iesi.Collections">
<HintPath>..\packages\Iesi.Collections.4.0.1.4000\lib\net40\Iesi.Collections.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NHibernate, Version=4.0.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<HintPath>..\packages\NHibernate.4.0.4.4000\lib\net40\NHibernate.dll</HintPath>
<Private>True</Private>
Expand Down
2 changes: 2 additions & 0 deletions src/Automatonymous.NHibernateIntegration/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="GreenPipes" version="1.0.0" targetFramework="net452" />
<package id="Iesi.Collections" version="4.0.1.4000" targetFramework="net45" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
<package id="NHibernate" version="4.0.4.4000" targetFramework="net45" />
</packages>
5 changes: 5 additions & 0 deletions src/Automatonymous.Tests/AsyncActivity_Specs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace Automatonymous.Tests
{
using System;
using System.Threading.Tasks;
using GreenPipes;
using NUnit.Framework;


Expand Down Expand Up @@ -45,6 +46,10 @@ void Visitable.Accept(StateMachineVisitor visitor)
{
visitor.Visit(this);
}

public void Probe(ProbeContext context)
{
}
}


Expand Down
8 changes: 6 additions & 2 deletions src/Automatonymous.Tests/Automatonymous.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="GreenPipes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b800c4cfcdeea87b, processorArchitecture=MSIL">
<HintPath>..\packages\GreenPipes.1.0.0\lib\net452\GreenPipes.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
Expand Down
5 changes: 5 additions & 0 deletions src/Automatonymous.Tests/Dependency_Specs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace Automatonymous.Tests
using System;
using System.Threading.Tasks;
using Activities;
using GreenPipes;
using NUnit.Framework;


Expand Down Expand Up @@ -76,6 +77,10 @@ public void Accept(StateMachineVisitor visitor)
{
visitor.Visit(this);
}

public void Probe(ProbeContext context)
{
}
}


Expand Down
5 changes: 5 additions & 0 deletions src/Automatonymous.Tests/Request_Specs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace Request_Specs
using System.Reflection;
using System.Threading.Tasks;
using Binders;
using GreenPipes;
using NUnit.Framework;


Expand Down Expand Up @@ -363,6 +364,10 @@ public Task Faulted<TException>(BehaviorExceptionContext<TInstance, TData, TExce
{
return next.Faulted(context);
}

public void Probe(ProbeContext context)
{
}
}


Expand Down
7 changes: 5 additions & 2 deletions src/Automatonymous.Tests/StateChangeObserver.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2011-2015 Chris Patterson, Dru Sellers
// Copyright 2011-2016 Chris Patterson, Dru Sellers
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
Expand All @@ -14,6 +14,7 @@ namespace Automatonymous.Tests
{
using System.Collections.Generic;
using System.Threading.Tasks;
using GreenPipes.Util;


class StateChangeObserver<T> :
Expand All @@ -27,9 +28,11 @@ public StateChangeObserver()

public IList<StateChange> Events { get; private set; }

public async Task StateChanged(InstanceContext<T> context, State currentState, State previousState)
public Task StateChanged(InstanceContext<T> context, State currentState, State previousState)
{
Events.Add(new StateChange(context, currentState, previousState));

return TaskUtil.Completed;
}


Expand Down
3 changes: 2 additions & 1 deletion src/Automatonymous.Tests/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
<package id="GreenPipes" version="1.0.0" targetFramework="net452" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
<package id="NUnit" version="2.6.4" targetFramework="net45" />
<package id="NUnit.Runners" version="2.6.4" targetFramework="net45" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="GreenPipes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b800c4cfcdeea87b, processorArchitecture=MSIL">
<HintPath>..\packages\GreenPipes.1.0.0\lib\net452\GreenPipes.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="QuickGraph">
<HintPath>..\packages\QuickGraph.3.6.61119.7\lib\net4\QuickGraph.dll</HintPath>
<Private>True</Private>
Expand Down
2 changes: 2 additions & 0 deletions src/Automatonymous.Visualizer/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="GreenPipes" version="1.0.0" targetFramework="net452" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
<package id="QuickGraph" version="3.6.61119.7" targetFramework="net40" />
</packages>
2 changes: 1 addition & 1 deletion src/Automatonymous.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Automatonymous", "Automatonymous\Automatonymous.csproj", "{FD8F92EB-5818-4C59-8859-19D3A74F979B}"
EndProject
Expand Down
1 change: 1 addition & 0 deletions src/Automatonymous.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AROUND_TYPE/@EntryValue">2</s:Int64>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/EXPLICIT_INTERNAL_MODIFIER/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/EXPLICIT_PRIVATE_MODIFIER/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/OLD_ENGINE/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SIMPLE_EMBEDDED_STATEMENT_STYLE/@EntryValue">LINE_BREAK</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AFTER_TYPECAST_PARENTHESES/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AROUND_MULTIPLICATIVE_OP/@EntryValue">True</s:Boolean>
Expand Down
6 changes: 6 additions & 0 deletions src/Automatonymous/Accessors/DefaultInstanceStateAccessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace Automatonymous.Accessors
using System.Linq.Expressions;
using System.Reflection;
using System.Threading.Tasks;
using GreenPipes;


/// <summary>
Expand Down Expand Up @@ -82,5 +83,10 @@ StateAccessor<TInstance> CreateDefaultAccessor()

return new InitialIfNullStateAccessor<TInstance>(_initialState, new RawStateAccessor<TInstance>(_machine, expression, _observer));
}

public void Probe(ProbeContext context)
{
_accessor.Value.Probe(context);
}
}
}
12 changes: 9 additions & 3 deletions src/Automatonymous/Accessors/InitialIfNullStateAccessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace Automatonymous.Accessors
using Activities;
using Behaviors;
using Contexts;
using GreenPipes;


public class InitialIfNullStateAccessor<TInstance> :
Expand All @@ -35,14 +36,14 @@ public InitialIfNullStateAccessor(State<TInstance> initialState, StateAccessor<T

async Task<State<TInstance>> StateAccessor<TInstance>.Get(InstanceContext<TInstance> context)
{
State<TInstance> state = await _stateAccessor.Get(context);
State<TInstance> state = await _stateAccessor.Get(context).ConfigureAwait(false);
if (state == null)
{
var behaviorContext = new EventBehaviorContext<TInstance>(context);

await _initialBehavior.Execute(behaviorContext);
await _initialBehavior.Execute(behaviorContext).ConfigureAwait(false);

state = await _stateAccessor.Get(context);
state = await _stateAccessor.Get(context).ConfigureAwait(false);
}
return state;
}
Expand All @@ -51,5 +52,10 @@ Task StateAccessor<TInstance>.Set(InstanceContext<TInstance> context, State<TIns
{
return _stateAccessor.Set(context, state);
}

public void Probe(ProbeContext context)
{
_stateAccessor.Probe(context);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2011-2015 Chris Patterson, Dru Sellers
// Copyright 2011-2016 Chris Patterson, Dru Sellers
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
Expand All @@ -13,7 +13,7 @@
namespace Automatonymous.Accessors
{
using System.Reflection;
using Internals;
using GreenPipes.Internals.Reflection;


public class IntCompositeEventStatusAccessor<TInstance> :
Expand Down
12 changes: 10 additions & 2 deletions src/Automatonymous/Accessors/IntStateAccessor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2011-2015 Chris Patterson, Dru Sellers
// Copyright 2011-2016 Chris Patterson, Dru Sellers
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
Expand All @@ -16,7 +16,10 @@ namespace Automatonymous.Accessors
using System.Linq.Expressions;
using System.Reflection;
using System.Threading.Tasks;
using Internals;
using GreenPipes;
using GreenPipes.Internals.Extensions;
using GreenPipes.Internals.Reflection;
using GreenPipes.Util;


/// <summary>
Expand Down Expand Up @@ -72,5 +75,10 @@ static ReadWriteProperty<TInstance, int> GetCurrentStateProperty(Expression<Func

return new ReadWriteProperty<TInstance, int>(propertyInfo);
}

public void Probe(ProbeContext context)
{
context.Add("currentStateProperty", _property.Property.Name);
}
}
}
12 changes: 10 additions & 2 deletions src/Automatonymous/Accessors/RawStateAccessor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2011-2015 Chris Patterson, Dru Sellers
// Copyright 2011-2016 Chris Patterson, Dru Sellers
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
Expand All @@ -16,7 +16,10 @@ namespace Automatonymous.Accessors
using System.Linq.Expressions;
using System.Reflection;
using System.Threading.Tasks;
using Internals;
using GreenPipes;
using GreenPipes.Internals.Extensions;
using GreenPipes.Internals.Reflection;
using GreenPipes.Util;


public class RawStateAccessor<TInstance> :
Expand Down Expand Up @@ -63,6 +66,11 @@ Task StateAccessor<TInstance>.Set(InstanceContext<TInstance> context, State<TIns
return _observer.StateChanged(context, state, previousState);
}

public void Probe(ProbeContext context)
{
context.Add("currentStateProperty", _property.Property.Name);
}

static ReadWriteProperty<TInstance, State> GetCurrentStateProperty(Expression<Func<TInstance, State>> currentStateExpression)
{
PropertyInfo propertyInfo = currentStateExpression.GetPropertyInfo();
Expand Down
13 changes: 11 additions & 2 deletions src/Automatonymous/Accessors/StringStateAccessor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2011-2015 Chris Patterson, Dru Sellers
// Copyright 2011-2016 Chris Patterson, Dru Sellers
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
Expand All @@ -16,7 +16,11 @@ namespace Automatonymous.Accessors
using System.Linq.Expressions;
using System.Reflection;
using System.Threading.Tasks;
using Internals;
using GreenPipes;
using GreenPipes.Internals.Extensions;
using GreenPipes.Internals.Reflection;
using GreenPipes.Util;


/// <summary>
/// Accesses the current state as a string property
Expand Down Expand Up @@ -72,5 +76,10 @@ static ReadWriteProperty<TInstance, string> GetCurrentStateProperty(Expression<F

return new ReadWriteProperty<TInstance, string>(propertyInfo);
}

public void Probe(ProbeContext context)
{
context.Add("currentStateProperty", _property.Property.Name);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2011-2015 Chris Patterson, Dru Sellers
// Copyright 2011-2016 Chris Patterson, Dru Sellers
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
Expand All @@ -13,7 +13,7 @@
namespace Automatonymous.Accessors
{
using System.Reflection;
using Internals;
using GreenPipes.Internals.Reflection;


public class StructCompositeEventStatusAccessor<TInstance> :
Expand Down
Loading