Skip to content

Commit 97341cd

Browse files
committed
CAS.CommServer.ProtocolHub - rearrange - initial refactoring
- moving ProtocolHub to the destination folder. Issue #: 4860
1 parent cbea835 commit 97341cd

21 files changed

+1600
-0
lines changed
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
<?xml version="1.0"?>
2+
<configuration>
3+
<configSections>
4+
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
5+
<section name="CommServer.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
6+
</sectionGroup>
7+
</configSections>
8+
<applicationSettings>
9+
<CommServer.Properties.Settings>
10+
<setting name="EventLogSource" serializeAs="String">
11+
<value>CommServer</value>
12+
</setting>
13+
</CommServer.Properties.Settings>
14+
</applicationSettings>
15+
<appSettings>
16+
<add key="Opc.Da.SampleServer.Device" value="CASOpcDaWrapper.device.xml"/>
17+
<add key="key1" value="dd7427f4cb5d27ed8c56"/>
18+
<add key="key2" value="99e1c0d64cef6ad070d5f2c55ce2197e19fa4fb0"/>
19+
<!-- <add key="ItemDsc_configfile" value="X:\cas\vs\VS_30_NoRemoting\PR21XX-CommServer\CommServer\bin\Debug\item_dsc.xml" /> -->
20+
<add key="ItemDsc_configfile" value="item_dsc.xml"/>
21+
<!--error frequency for null protocol -->
22+
<add key="NULLErrorFrequency" value="100000"/>
23+
<add key="configfile" value="DefaultConfig.xml"/>
24+
<add key="PLCNaN" value="65535"/>
25+
<add key="MinAvgMax_Tag_management" value="50"/>
26+
<add key="MinAvgMax_Group_management" value="50"/>
27+
<add key="MinAvgMax_Group_Read_management" value="50"/>
28+
<add key="MinAvgMax_Transition_management" value="50"/>
29+
<add key="MinAvgMax_FrameResponse_management" value="20"/>
30+
<add key="MinAvgMax_CharacterGap_management" value="500"/>
31+
<add key="WaitForReconnectServerInSec" value="30"/>
32+
<add key="WaitForFirstGroupUpdateSendInMiliSec" value="0"/>
33+
<add key="HTTPport" value="8888"></add>
34+
<add key="HTTPSOAPport" value="9000"></add>
35+
<add key="RemotingHTTPport" value="5000"></add>
36+
<add key="ConsoleRemotingHTTPport" value="5757"></add>
37+
<add key="UseLocalTime" value="False"></add>
38+
<add key="MinAvgMax_Transaction_management" value="20"/>
39+
</appSettings>
40+
<!--ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_fxdebug/html/f88dda6f-5fda-45be-9b3c-745a9b708c4d.htm-->
41+
<!-- ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/dv_fxgenref/html/3f348f42-fa72-4ff2-aa1c-bb9eecad4bb2.htm -->
42+
<system.diagnostics>
43+
<sources>
44+
<source name="TracesFromEventLogMonitor" switchName="EventLogMonitor" switchType="System.Diagnostics.SourceSwitch">
45+
<listeners>
46+
<!--
47+
<add name="console"
48+
type="System.Diagnostics.ConsoleTraceListener">
49+
<filter type="System.Diagnostics.EventTypeFilter" initializeData="Warning"/>
50+
</add>
51+
-->
52+
<add name="DebugOutput"/>
53+
<add name="LogFile"/>
54+
<remove name="Default"/>
55+
</listeners>
56+
</source>
57+
<source name="TraceNet_to_Serial" switchName="Net_to_Serial" switchType="System.Diagnostics.SourceSwitch">
58+
<listeners>
59+
<!--
60+
<add name="console"
61+
type="System.Diagnostics.ConsoleTraceListener">
62+
<filter type="System.Diagnostics.EventTypeFilter" initializeData="Warning"/>
63+
</add>
64+
-->
65+
<add name="DebugOutput"/>
66+
<add name="LogFile"/>
67+
<remove name="Default"/>
68+
</listeners>
69+
</source>
70+
<source name="CAS.BaseStation.TraceEvent" switchName="BaseStationTrace" switchType="System.Diagnostics.SourceSwitch">
71+
<listeners>
72+
<add name="DebugOutput"/>
73+
<add name="LogFile"/>
74+
<remove name="Default"/>
75+
</listeners>
76+
</source>
77+
<source name="NetworkConfig.ApplicationProtocol" switchName="NetworkConfig" switchType="System.Diagnostics.SourceSwitch">
78+
<listeners>
79+
<add name="ConfigLogFile"/>
80+
<remove name="Default"/>
81+
</listeners>
82+
</source>
83+
<!-- ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_fxnetwork/html/5ef9fe4b-8d3d-490e-9259-1d014b2181af.htm -->
84+
<source name="System.Net.Sockets">
85+
<listeners>
86+
<add name="LogFile"/>
87+
<add name="DebugOutput"/>
88+
<remove name="Default"/>
89+
</listeners>
90+
</source>
91+
<source name="CAS.Lib.CommServer" switchName="CAS.Lib.CommServer" switchType="System.Diagnostics.SourceSwitch">
92+
<listeners>
93+
<add name="DebugOutput"/>
94+
<add name="LogFile"/>
95+
<remove name="Default"/>
96+
</listeners>
97+
</source>
98+
<source name="CAS.Lib.RTLib" switchName="CAS.Lib.CommServer" switchType="System.Diagnostics.SourceSwitch">
99+
<listeners>
100+
<add name="DebugOutput"/>
101+
<add name="LogFile"/>
102+
<remove name="Default"/>
103+
</listeners>
104+
</source>
105+
</sources>
106+
<switches>
107+
<!--ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/cpref6/html/T_System_Diagnostics_SourceLevels.htm-->
108+
<!-- SourceLevels Enumeration -->
109+
<add name="EventLogMonitor" value="All"/>
110+
<add name="NetworkConfig" value="Warning"/>
111+
<add name="Net_to_Serial" value="Warning"/>
112+
<add name="RS_to_Serial" value="Warning"/>
113+
<add name="CAPI_to_Serial" value="Warning"/>
114+
<add name="BaseStationTrace" value="Warning"/>
115+
<add name="CAS.Lib.CommServer" value="All"/>
116+
<add name="System.Net.Sockets" value="Warning"/>
117+
</switches>
118+
<sharedListeners>
119+
<add name="DebugOutput" type="System.Diagnostics.ConsoleTraceListener" initializeData="false">
120+
<!-- Allows all events through. -->
121+
<filter type="System.Diagnostics.EventTypeFilter" initializeData="All"/>
122+
<!-- Allows the Stop, Start, Suspend, Transfer, and Resume events through. -->
123+
<!-- <filter type="System.Diagnostics.EventTypeFilter" initializeData="ActivityTracing" /> -->
124+
<!-- Allows only Critical events through. -->
125+
<!-- <filter type="System.Diagnostics.EventTypeFilter" initializeData="Critical" /> -->
126+
<!-- Allows Critical and Error events through. -->
127+
<!-- <filter type="System.Diagnostics.EventTypeFilter" initializeData="Error" /> -->
128+
<!-- Allows Critical, Error, Warning, and Information events through. -->
129+
<!-- <filter type="System.Diagnostics.EventTypeFilter" initializeData="Information" /> -->
130+
<!-- Does not allow any events through. -->
131+
<!-- <filter type="System.Diagnostics.EventTypeFilter" initializeData="Off" /> -->
132+
<!-- Allows Critical, Error, Warning, Information, and Verbose events through. -->
133+
<!-- <filter type="System.Diagnostics.EventTypeFilter" initializeData="Verbose" /> -->
134+
<!-- Allows Critical, Error, and Warning events through. -->
135+
<!-- <filter type="System.Diagnostics.EventTypeFilter" initializeData="Warning" /> -->
136+
</add>
137+
<add name="LogFile" type="CAS.Lib.RTLib.Diagnostics.AdvancedDelimitedListTraceListener, CAS.RTLibComm" initializeData="|ApplicationDataPath|log\CommServer_Main.log" traceOutputOptions="DateTime">
138+
<filter type="System.Diagnostics.EventTypeFilter" initializeData="All"/>
139+
</add>
140+
<add name="ConfigLogFile" type="CAS.Lib.RTLib.Diagnostics.AdvancedDelimitedListTraceListener, CAS.RTLibComm" initializeData="|ApplicationDataPath|log\CommServer_NetworkConfig.log" traceOutputOptions="DateTime">
141+
<filter type="System.Diagnostics.EventTypeFilter" initializeData="All"/>
142+
</add>
143+
</sharedListeners>
144+
</system.diagnostics>
145+
<system.web>
146+
<membership defaultProvider="ClientAuthenticationMembershipProvider">
147+
<providers>
148+
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri=""/>
149+
</providers>
150+
</membership>
151+
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
152+
<providers>
153+
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400"/>
154+
</providers>
155+
</roleManager>
156+
</system.web>
157+
<!--
158+
<runtime>
159+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
160+
<dependentAssembly>
161+
<assemblyIdentity name="CAS.DeviceSymulator" publicKeyToken="8832FF1A67EA61A3" culture="neutral"/>
162+
<bindingRedirect oldVersion="0.0.0.0-3.4.9.36513" newVersion="3.4.9.36513"/>
163+
</dependentAssembly>
164+
<dependentAssembly>
165+
<assemblyIdentity name="CAS.CommServerConsoleInterface" publicKeyToken="8832FF1A67EA61A3" culture="neutral"/>
166+
<bindingRedirect oldVersion="0.0.0.0-3.4.9.36512" newVersion="3.4.9.36512"/>
167+
</dependentAssembly>
168+
<dependentAssembly>
169+
<assemblyIdentity name="CAS.RTLib" publicKeyToken="8832FF1A67EA61A3" culture="neutral"/>
170+
<bindingRedirect oldVersion="0.0.0.0-3.4.12.35936" newVersion="3.4.12.35936"/>
171+
</dependentAssembly>
172+
</assemblyBinding>
173+
</runtime>
174+
-->
175+
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup></configuration>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+

2+
using CAS.CommServer.ProtocolHub.Communication;
3+
using CAS.Lib.CodeProtect;
4+
using Microsoft.VisualStudio.TestTools.UnitTesting;
5+
using System.Diagnostics;
6+
using System.IO;
7+
8+
namespace CAS.CommServer.ProtocolHub.CommunicationUnitTests
9+
{
10+
[TestClass()]
11+
[DeploymentItem("CAS.License.lic")]
12+
[DeploymentItem("DefaultConfig.xml")]
13+
public class AssemblyInitializeClass
14+
{
15+
internal static CommServerComponent CommServerComponent { get; private set; }
16+
private static string m_InstallLicenseError = string.Empty;
17+
18+
[AssemblyInitialize()]
19+
public static void InstallLicense(TestContext testContext)
20+
{
21+
try
22+
{
23+
LibInstaller.InstalLicense(false);
24+
CommServerComponent = new CommServerComponent();
25+
CommServerComponent.Initialize("DefaultConfig.xml");
26+
}
27+
catch (System.Exception _ex)
28+
{
29+
m_InstallLicenseError = _ex.ToString();
30+
Debug.WriteLine(m_InstallLicenseError);
31+
throw;
32+
}
33+
}
34+
[AssemblyCleanup()]
35+
public static void MyClassTestCleanup()
36+
{
37+
CommServerComponent.Dispose();
38+
}
39+
[TestMethod]
40+
public void LicenseExist()
41+
{
42+
FileInfo _licenseFile = new FileInfo("DefaultConfig.xml");
43+
Assert.IsTrue(_licenseFile.Exists, "DefaultConfig.xml doesn't exist in the working directory");
44+
}
45+
[TestMethod]
46+
public void AssemblyInitializeTestMethod()
47+
{
48+
Assert.IsTrue(string.IsNullOrEmpty(m_InstallLicenseError), m_InstallLicenseError);
49+
}
50+
51+
}
52+
}
24.3 KB
Binary file not shown.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//<summary>
2+
// Title : Unit tests for CommServerComponent constructor
3+
// System : Microsoft Visual C# .NET 2008
4+
// $LastChangedDate$
5+
// $Rev$
6+
// $LastChangedBy$
7+
// $URL$
8+
// $Id$
9+
//
10+
// Copyright (C)2008, CAS LODZ POLAND.
11+
// TEL: +48 (42) 686 25 47
12+
// mailto://techsupp@cas.eu
13+
// http://www.cas.eu
14+
//</summary>
15+
16+
using CAS.CommServer.ProtocolHub.Communication;
17+
using Microsoft.VisualStudio.TestTools.UnitTesting;
18+
using System;
19+
20+
namespace CAS.CommServer.ProtocolHub.CommunicationUnitTests
21+
{
22+
[TestClass()]
23+
public class CommServerComponentTest
24+
{
25+
/// <summary>
26+
///A test for <see cref="CommServerComponent"/> Constructor - because it was created in assembly initialize class must throw an exception.
27+
///</summary>
28+
[TestMethod()]
29+
[ExpectedException(typeof(Exception))]
30+
public void CommServerComponentConstructorTest()
31+
{
32+
using (CommServerComponent target = new CommServerComponent())
33+
{ target.Initialize("DefaultConfig.xml"); }
34+
}
35+
}
36+
}
33.8 KB
Binary file not shown.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//_______________________________________________________________
2+
// Title : FacadeASALicense
3+
// System : Microsoft VisualStudio 2015 / C#
4+
// $LastChangedDate: $
5+
// $Rev: $
6+
// $LastChangedBy: $
7+
// $URL: $
8+
// $Id: $
9+
//
10+
// Copyright (C) 2016, CAS LODZ POLAND.
11+
// TEL: +48 (42) 686 25 47
12+
// mailto://techsupp@cas.eu
13+
// http://www.cas.eu
14+
//_______________________________________________________________
15+
16+
using CAS.CommServer.ProtocolHub.Communication.LicenseControl;
17+
using CAS.Lib.CodeProtect.LicenseDsc;
18+
using System;
19+
20+
namespace CAS.CommServer.ProtocolHub.CommunicationUnitTests.Instrumentation
21+
{
22+
internal class FacadeASALicense : ASALicense
23+
{
24+
internal static Action<string> m_Logger;
25+
26+
protected override void TraceNoLicenseFile(string reason)
27+
{
28+
m_Logger(reason);
29+
}
30+
protected override void TraceCurrentLicence(LicenseFile license)
31+
{
32+
m_Logger(license.ToString());
33+
}
34+
protected override void TraceFailureReason(string reason)
35+
{
36+
m_Logger(reason);
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)