[nhin-d] push by joeshook@gmail.com - Work in progress for making Audit more plugable.... on 2014-10-15 16:16 GMT

0 views
Skip to first unread message

nhi...@googlecode.com

unread,
Oct 15, 2014, 12:17:09 PM10/15/14
to nhindirec...@googlegroups.com
Revision: 52f01e235783
Branch: default
Author: joes...@gmail.com <>
Date: Wed Oct 15 16:15:37 2014 UTC
Log: Work in progress for making Audit more plugable.
Fixed various compiler warnings.
https://code.google.com/p/nhin-d/source/detail?r=52f01e235783

Modified:
/csharp/agent/DirectAgent.cs
/csharp/auditors/DatabaseAuditor/AuditContext.cs
/csharp/auditors/DatabaseAuditor/Auditor.cs
/csharp/auditors/DatabaseAuditor/DatabaseAuditor.csproj
/csharp/common/Policies/IPolicyExpression.cs
/csharp/common/Policies/PolicyExpressionType.cs
/csharp/common/Policies/PolicyResolver.cs
/csharp/common/common.csproj
/csharp/gateway/install/copybins.bat
/csharp/unittests/smtpAgent/TestAuditor.cs
/csharp/unittests/smtpAgent/smtpagent.tests.csproj

=======================================
--- /csharp/agent/DirectAgent.cs Sun Mar 30 10:21:10 2014 UTC
+++ /csharp/agent/DirectAgent.cs Wed Oct 15 16:15:37 2014 UTC
@@ -159,6 +159,7 @@
/// An <see cref="ITrustAnchorResolver"/> instance providing trust
anchors.
/// </param>
/// <param name="certPolicyResolvers">Certificate <see
cref="ICertPolicyResolvers">policy container</see></param>
+ /// <param name="polciyFilter"></param>
public DirectAgent(IDomainResolver domainResolver,
ICertificateResolver privateCerts, ICertificateResolver publicCerts,
ITrustAnchorResolver anchors
, ICertPolicyResolvers certPolicyResolvers, IPolicyFilter
polciyFilter)
: this(domainResolver, privateCerts, publicCerts, anchors,
TrustModel.Default, SMIMECryptographer.Default, certPolicyResolvers,
polciyFilter)
=======================================
--- /csharp/auditors/DatabaseAuditor/AuditContext.cs Wed Apr 16 08:01:51
2014 UTC
+++ /csharp/auditors/DatabaseAuditor/AuditContext.cs Wed Oct 15 16:15:37
2014 UTC
@@ -34,4 +34,14 @@
}
}
}
+
+ public class AuditDbConfiguration : DbConfiguration
+ {
+ public AuditDbConfiguration()
+ {
+ SetExecutionStrategy("System.Data.SqlClient", () => new
DefaultExecutionStrategy());
+ SetDefaultConnectionFactory(new SqlConnectionFactory());
+ }
+ }
+
}
=======================================
--- /csharp/auditors/DatabaseAuditor/Auditor.cs Sat May 3 22:58:07 2014 UTC
+++ /csharp/auditors/DatabaseAuditor/Auditor.cs Wed Oct 15 16:15:37 2014 UTC
@@ -17,7 +17,7 @@

using System;
using System.IO;
-using Health.Direct.Common.Diagnostics;
+using System.Reflection;
using Health.Direct.SmtpAgent;
using Health.Direct.SmtpAgent.Diagnostics;

@@ -33,7 +33,7 @@
m_settings = AuditorSettings.Load(location);
BuildAuditLogMessage = new T();
}
-
+
public void Log(string category)
{
using (var db = new AuditContext().CreateContext(m_settings))
@@ -60,8 +60,7 @@
private static string HostLocation()
{
string programData =
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
- string myDataPath = Path.Combine(programData,
Path.Combine(@"DirectProject\auditors", AuditorSettings.ConfigFile));
- EventLogHelper.WriteInformation("Health.Direct.Audit",
myDataPath);
+ string myDataPath = Path.Combine(programData,
Path.Combine(@"DirectProject\auditors", "DatabaseAuditorSettings.xml"));
return myDataPath;
}
}
=======================================
--- /csharp/auditors/DatabaseAuditor/DatabaseAuditor.csproj Sat May 3
22:58:07 2014 UTC
+++ /csharp/auditors/DatabaseAuditor/DatabaseAuditor.csproj Wed Oct 15
16:15:37 2014 UTC
@@ -75,7 +75,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="DatabaseAuditorSettings.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
=======================================
--- /csharp/common/Policies/IPolicyExpression.cs Sun Mar 23 00:34:27 2014
UTC
+++ /csharp/common/Policies/IPolicyExpression.cs Wed Oct 15 16:15:37 2014
UTC
@@ -15,6 +15,7 @@
*/

using System.Security.Cryptography.X509Certificates;
+using Health.Direct.Policy;

namespace Health.Direct.Common.Policies
{
@@ -29,7 +30,7 @@
/// </para>
/// Expressions are categorized into three types.
/// <ul>
- /// <li>Literals: Literals are simply primitive types or objects
that have a static value. In the policy engine, literals are represented
by <see cref="IPolicyValue{T}"/> objects. </li>
+ /// <li>Literals: Literals are simply primitive types or objects
that have a static value. In the policy engine, literals are represented
by <see cref="Health.Direct.Policy.IPolicyValue{T}"/> objects. </li>
/// <li>References: References are objects whose values are
evaluated at runtime similar to variables. Reference may be simple
structures or specific structure types such as X509 certificates. At this
time all known implementations are of type <see cref="X509Certificate2"/>
</li>
/// <li>Operations: Operations are a combination of a <see
cref="PolicyOperator{T}"/> and one or more parameters. Operator parameters
are themselves expressions allowing parameters to be either literals,
references, or the result of another operation. </li>
/// </ul>
=======================================
--- /csharp/common/Policies/PolicyExpressionType.cs Sun Mar 23 00:34:27
2014 UTC
+++ /csharp/common/Policies/PolicyExpressionType.cs Wed Oct 15 16:15:37
2014 UTC
@@ -15,6 +15,8 @@
*/


+using Health.Direct.Policy;
+
namespace Health.Direct.Common.Policies
{
/// <summary>
=======================================
--- /csharp/common/Policies/PolicyResolver.cs Sat Mar 22 22:52:13 2014 UTC
+++ /csharp/common/Policies/PolicyResolver.cs Wed Oct 15 16:15:37 2014 UTC
@@ -54,9 +54,9 @@
}
}

- //TODO: Don't like this. Caching is not efficient and the comment
about CertPolicyUse is not enforced in the interface. And more...
+ //TODO: Don't like this. Caching is not efficient
/// <summary>
- /// Resolve policy by usage outgoing and <see
cref="Health.Direct.Config.Store.CertPolicyUse"/>
+ /// Resolve outgoing cert policy
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
@@ -66,7 +66,7 @@
}

/// <summary>
- /// Resolve policy by usage incoming and <see
cref="Health.Direct.Config.Store.CertPolicyUse"/>
+ /// Resolve incoming cert policy
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
=======================================
--- /csharp/common/common.csproj Sun Mar 30 10:41:51 2014 UTC
+++ /csharp/common/common.csproj Wed Oct 15 16:15:37 2014 UTC
@@ -59,6 +59,9 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="Health.Direct.Policy">
+
<HintPath>..\config\store\bin\Debug\Health.Direct.Policy.dll</HintPath>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
=======================================
--- /csharp/gateway/install/copybins.bat Thu Dec 23 01:11:26 2010 UTC
+++ /csharp/gateway/install/copybins.bat Wed Oct 15 16:15:37 2014 UTC
@@ -84,6 +84,7 @@
call :CopyFiles Health.Direct.Common.dll ^
Health.Direct.Agent.dll ^
Health.Direct.SmtpAgent.dll ^
+ Health.Direct.Policy.dll ^
Interop.ADODB.dll ^
Interop.CDO.dll ^
%platform_dir%\smtpEventHandler.dll ^
=======================================
--- /csharp/unittests/smtpAgent/TestAuditor.cs Wed Apr 16 08:01:51 2014 UTC
+++ /csharp/unittests/smtpAgent/TestAuditor.cs Wed Oct 15 16:15:37 2014 UTC
@@ -17,6 +17,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Health.Direct.Agent;
@@ -47,6 +48,11 @@
public TestAuditor()
{
CleanAuditEventTable();
+
+ string programData =
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),
@"DirectProject\auditors");
+ string myDataPath =
Path.Combine(programData, "DatabaseAuditorSettings.xml");
+ Directory.CreateDirectory(programData);
+ File.Copy("DatabaseAuditorSettings.xml", myDataPath, true);
}

[Fact]
@@ -211,10 +217,13 @@
localAuditComponent.Service
= "Health.Direct.SmtpAgent.Diagnostics.IAuditor`1[[Health.Direct.SmtpAgent.Diagnostics.IBuildAuditLogMessage,
Health.Direct.SmtpAgent]], Health.Direct.SmtpAgent";
localAuditComponent.Type
= "Health.Direct.DatabaseAuditor.Auditor`1[[Health.Direct.DatabaseAuditor.FullAuditMessageBuilder,
Health.Direct.DatabaseAuditor]], Health.Direct.DatabaseAuditor";
components[0] = localAuditComponent;
-
+
settings.Container.Components = components;
m_agent = SmtpAgentFactory.Create(settings);
- Assert.True(IoC.Resolve<IAuditor<IBuildAuditLogMessage>>() is
DatabaseAuditor.Auditor<FullAuditMessageBuilder>);
+
+
+ var auditor = IoC.Resolve<IAuditor<IBuildAuditLogMessage>>();
+ Assert.True(auditor is
DatabaseAuditor.Auditor<FullAuditMessageBuilder>);

Assert.Equal(0, AuditEventCount);
m_agent.Settings.InternalMessage.EnableRelay = true;
=======================================
--- /csharp/unittests/smtpAgent/smtpagent.tests.csproj Sun Apr 13 01:10:44
2014 UTC
+++ /csharp/unittests/smtpAgent/smtpagent.tests.csproj Wed Oct 15 16:15:37
2014 UTC
@@ -118,6 +118,7 @@
</Content>
<Content Include="SmtpAgentTestFiles\TestPlugin.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ <SubType>Designer</SubType>
</Content>
<Content
Include="SmtpAgentTestFiles\TestSmtpAgentAuditConfig_BadAuditor_Defaults.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Reply all
Reply to author
Forward
0 new messages