diff options
Diffstat (limited to 'Software/Visual_Studio/Utilities')
4 files changed, 53 insertions, 25 deletions
diff --git a/Software/Visual_Studio/Utilities/Tango.Telemetry.Tester.IOT.CLI/App.config b/Software/Visual_Studio/Utilities/Tango.Telemetry.Tester.IOT.CLI/App.config index 959eb4686..60556a8ed 100644 --- a/Software/Visual_Studio/Utilities/Tango.Telemetry.Tester.IOT.CLI/App.config +++ b/Software/Visual_Studio/Utilities/Tango.Telemetry.Tester.IOT.CLI/App.config @@ -1,8 +1,12 @@ <?xml version="1.0" encoding="utf-8"?> <configuration> - <startup> - <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> - </startup> + <configSections> + <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> + <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> + </configSections> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> + </startup> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> @@ -31,4 +35,10 @@ </dependentAssembly> </assemblyBinding> </runtime> + <entityFramework> + <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> + <providers> + <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> + </providers> + </entityFramework> </configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/Utilities/Tango.Telemetry.Tester.IOT.CLI/Program.cs b/Software/Visual_Studio/Utilities/Tango.Telemetry.Tester.IOT.CLI/Program.cs index cb8a79288..0565ab00d 100644 --- a/Software/Visual_Studio/Utilities/Tango.Telemetry.Tester.IOT.CLI/Program.cs +++ b/Software/Visual_Studio/Utilities/Tango.Telemetry.Tester.IOT.CLI/Program.cs @@ -3,8 +3,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL; using Tango.BL.Enumerations; +using Tango.Logging; using Tango.Telemetry.Destinations; +using Tango.Telemetry.Mappers; using Tango.Telemetry.Sources; namespace Tango.Telemetry.Tester.IOT.CLI @@ -13,10 +16,13 @@ namespace Tango.Telemetry.Tester.IOT.CLI { static void Main(string[] args) { + LogManager.Default.RegisterLogger(new Tango.Logging.VSOutputLogger("IOT TESTER")); + TelemetryPublisher publisher = new TelemetryPublisher(new TelemetryPublisherConfiguration() { Environment = "DEV", SerialNumber = "dev-machine", + Organization = "Twine", MachineType = MachineTypes.TS1800, HistorySourcesRequestInterval = TimeSpan.FromSeconds(1), EnableBackoff = false, @@ -64,24 +70,17 @@ namespace Tango.Telemetry.Tester.IOT.CLI } } - [TelemetryName("JobRun")] - public class JobRunTestTelemetry : TelemetryBase - { - public String JobName { get; set; } - public String Thread { get; set; } - public double Length { get; set; } - } - public class JobRunsTestSource : ITelemetryHistorySource { - private int counter = 1; + private bool _busy; - public string Name { get; } = "Persons Source"; + public string Name { get; } = "JobRuns Source"; public bool RequiresTelemetryDuplicationTracking { get; } = false; + public TelemetryHistorySourceDirection Direction { get => TelemetryHistorySourceDirection.Descending; } public Task<bool> CanRequestHistory(DateTime from) { - return Task.FromResult(true); + return Task.FromResult(!_busy); } public void Dispose() @@ -91,17 +90,24 @@ namespace Tango.Telemetry.Tester.IOT.CLI public Task<IEnumerable<ITelemetry>> RequestHistory(DateTime from) { - return Task. - FromResult<IEnumerable<ITelemetry>>(new List<JobRunTestTelemetry>() - { - new JobRunTestTelemetry() - { - Time = DateTime.UtcNow, - JobName = $"Job For Materialized {counter++}", - Length = 1000 + counter, - Thread = $"Coats Thread {counter}" - } - }); + _busy = true; + + ObservablesContext.OverrideSettingsDataSource(new Core.DataSource() + { + Address = "localhost\\SQLPPC", + IntegratedSecurity = true, + Catalog = "Tango", + Type = Core.DataSourceType.SQLServer, + }); + + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + var runs = db.JobRuns.OrderByDescending(x => x.LastUpdated).Where(x => x.LastUpdated < from).Take(1).ToList(); + var runsT = runs.Select(x => JobRunMapper.MapJobRun(x)).ToList(); + + _busy = false; + return Task.FromResult<IEnumerable<ITelemetry>>(runsT); + } } } } diff --git a/Software/Visual_Studio/Utilities/Tango.Telemetry.Tester.IOT.CLI/Tango.Telemetry.Tester.IOT.CLI.csproj b/Software/Visual_Studio/Utilities/Tango.Telemetry.Tester.IOT.CLI/Tango.Telemetry.Tester.IOT.CLI.csproj index 0449a67fe..4b047b3dd 100644 --- a/Software/Visual_Studio/Utilities/Tango.Telemetry.Tester.IOT.CLI/Tango.Telemetry.Tester.IOT.CLI.csproj +++ b/Software/Visual_Studio/Utilities/Tango.Telemetry.Tester.IOT.CLI/Tango.Telemetry.Tester.IOT.CLI.csproj @@ -51,6 +51,12 @@ <Reference Include="DotNetty.Transport, Version=0.4.6.0, Culture=neutral, PublicKeyToken=bc13ca065fa06c29, processorArchitecture=MSIL"> <HintPath>..\..\packages\DotNetty.Transport.0.4.6\lib\net45\DotNetty.Transport.dll</HintPath> </Reference> + <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath> + </Reference> + <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> + </Reference> <Reference Include="Microsoft.Azure.Amqp, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\..\packages\Microsoft.Azure.Amqp.2.0.6\lib\net45\Microsoft.Azure.Amqp.dll</HintPath> </Reference> @@ -113,6 +119,7 @@ <HintPath>..\..\packages\System.AppContext.4.3.0\lib\net46\System.AppContext.dll</HintPath> </Reference> <Reference Include="System.ComponentModel.Composition" /> + <Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.Console, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>..\..\packages\System.Console.4.3.0\lib\net46\System.Console.dll</HintPath> </Reference> @@ -193,6 +200,10 @@ <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> <Name>Tango.Core</Name> </ProjectReference> + <ProjectReference Include="..\..\Tango.Logging\Tango.Logging.csproj"> + <Project>{BC932DBD-7CDB-488C-99E4-F02CF441F55E}</Project> + <Name>Tango.Logging</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.Telemetry\Tango.Telemetry.csproj"> <Project>{af593663-d4e9-4a14-a3f2-fea57f30e9e6}</Project> <Name>Tango.Telemetry</Name> diff --git a/Software/Visual_Studio/Utilities/Tango.Telemetry.Tester.IOT.CLI/packages.config b/Software/Visual_Studio/Utilities/Tango.Telemetry.Tester.IOT.CLI/packages.config index 8dabdb1c2..c64d28868 100644 --- a/Software/Visual_Studio/Utilities/Tango.Telemetry.Tester.IOT.CLI/packages.config +++ b/Software/Visual_Studio/Utilities/Tango.Telemetry.Tester.IOT.CLI/packages.config @@ -7,6 +7,7 @@ <package id="DotNetty.Handlers" version="0.4.6" targetFramework="net461" /> <package id="DotNetty.Transport" version="0.4.6" targetFramework="net461" /> <package id="EnterpriseLibrary.TransientFaultHandling" version="6.0.1304.0" targetFramework="net461" /> + <package id="EntityFramework" version="6.2.0" targetFramework="net461" /> <package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net461" /> <package id="Microsoft.Azure.Amqp" version="2.0.6" targetFramework="net461" /> <package id="Microsoft.Azure.Devices.Client" version="1.6.0" targetFramework="net461" /> |
