-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update demo and tests projects to work in VS code and use .net 8
- Loading branch information
1 parent
bf663ea
commit cecc564
Showing
10 changed files
with
71 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,39 @@ | ||
/* | ||
* Copyright (c) 2023 Snowplow Analytics Ltd. All rights reserved. | ||
* This program is licensed to you under the Apache License Version 2.0, | ||
* and you may not use this file except in compliance with the Apache License | ||
* Version 2.0. You may obtain a copy of the Apache License Version 2.0 at | ||
* http://www.apache.org/licenses/LICENSE-2.0. | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the Apache License Version 2.0 is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the Apache License Version 2.0 for the specific | ||
* language governing permissions and limitations there under. | ||
*/ | ||
|
||
using Snowplow.Tracker; | ||
using Snowplow.Tracker.Logging; | ||
using Snowplow.Tracker.Models.Events; | ||
using System; | ||
using System.Linq; | ||
|
||
namespace Snowplow.Demo.Console | ||
string collectorHostname = "http://localhost:9090"; | ||
int port = 80; | ||
|
||
int count = 100; | ||
|
||
// help the user out a bit with ports | ||
if (Uri.IsWellFormedUriString(collectorHostname, UriKind.Absolute)) | ||
{ | ||
public class Program | ||
Uri tmp; | ||
if (Uri.TryCreate(collectorHostname, UriKind.Absolute, out tmp)) | ||
{ | ||
|
||
/// <summary> | ||
/// Runs the Console Demo application | ||
/// </summary> | ||
/// <param name="args"></param> | ||
public static void Main(string[] args) | ||
if (tmp.Scheme == "http" || tmp.Scheme == "https") | ||
{ | ||
string collectorHostname = "<invalid>"; | ||
int port = 80; | ||
|
||
int count = 100; | ||
|
||
switch (args.Count()) | ||
{ | ||
case 2: | ||
count = Int32.Parse(args[1]); | ||
goto case 1; | ||
case 1: | ||
collectorHostname = args[0]; | ||
break; | ||
default: | ||
System.Console.WriteLine("Invalid arguments. Usage: <app> <collector-hostname> [number of events to send]"); | ||
return; | ||
} | ||
|
||
// help the user out a bit with ports | ||
if (Uri.IsWellFormedUriString(collectorHostname, UriKind.Absolute)) | ||
{ | ||
Uri tmp; | ||
if (Uri.TryCreate(collectorHostname, UriKind.Absolute, out tmp)) | ||
{ | ||
if (tmp.Scheme == "http" || tmp.Scheme == "https") | ||
{ | ||
collectorHostname = tmp.Host; | ||
port = tmp.Port; | ||
} | ||
} | ||
} | ||
collectorHostname = tmp.Host; | ||
port = tmp.Port; | ||
} | ||
} | ||
} | ||
|
||
System.Console.WriteLine("Demo app started - sending " + count + " events to " + collectorHostname + " port " + port); | ||
System.Console.WriteLine("Demo app started - sending " + count + " events to " + collectorHostname + " port " + port); | ||
|
||
var logger = new ConsoleLogger(); | ||
var logger = new ConsoleLogger(); | ||
|
||
Tracker.Tracker.Instance.Start(collectorHostname, "snowplow-demo-app.db", l: logger, endpointPort: port); | ||
Tracker.Instance.Start(collectorHostname, "snowplow-demo-app.db", l: logger, endpointPort: port); | ||
|
||
for (int i = 0; i < count; i++) | ||
{ | ||
Tracker.Tracker.Instance.Track(new PageView().SetPageUrl("http://helloworld.com/sample/sample.php").Build()); | ||
} | ||
for (int i = 0; i < count; i++) | ||
{ | ||
Tracker.Instance.Track(new PageView().SetPageUrl("http://helloworld.com/sample/sample.php").Build()); | ||
} | ||
|
||
Tracker.Tracker.Instance.Flush(); | ||
Tracker.Tracker.Instance.Stop(); | ||
Tracker.Instance.Flush(); | ||
Tracker.Instance.Stop(); | ||
|
||
System.Console.WriteLine("Demo app finished"); | ||
System.Console.Out.Flush(); | ||
} | ||
} | ||
} | ||
System.Console.WriteLine("Demo app finished"); | ||
System.Console.Out.Flush(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,28 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net5.0</TargetFramework> | ||
<AssemblyName>Snowplow.Tracker.Tests</AssemblyName> | ||
<PackageId>Snowplow.Tracker.Tests</PackageId> | ||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles> | ||
<RuntimeFrameworkVersion>5.0.6</RuntimeFrameworkVersion> | ||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> | ||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> | ||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> | ||
</PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<WarningLevel>4</WarningLevel> | ||
<IsPackable>false</IsPackable> | ||
<IsTestProject>true</IsTestProject> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Snowplow.Tracker\Snowplow.Tracker.csproj" /> | ||
<PackageReference Include="coverlet.collector" Version="6.0.0" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" /> | ||
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" /> | ||
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" /> | ||
<PackageReference Include="NETStandard.Library" Version="2.0.3" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" /> | ||
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" /> | ||
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" /> | ||
<PackageReference Include="NETStandard.Library" Version="2.0.3" /> | ||
<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" /> | ||
<ProjectReference Include="..\Snowplow.Tracker\Snowplow.Tracker.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 8 additions & 8 deletions
16
Snowplow.Demo.Console.sln → Snowplow.Tracker/Snowplow.Tracker.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.31402.337 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.5.002.0 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Snowplow.Demo.Console", "Snowplow.Demo.Console\Snowplow.Demo.Console.csproj", "{0945D603-76B3-4524-A142-341908D40501}" | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Snowplow.Tracker", "Snowplow.Tracker.csproj", "{E88D3FEF-14DC-4D85-87E1-6DCEB79F32E9}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{0945D603-76B3-4524-A142-341908D40501}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{0945D603-76B3-4524-A142-341908D40501}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{0945D603-76B3-4524-A142-341908D40501}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{0945D603-76B3-4524-A142-341908D40501}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{E88D3FEF-14DC-4D85-87E1-6DCEB79F32E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{E88D3FEF-14DC-4D85-87E1-6DCEB79F32E9}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{E88D3FEF-14DC-4D85-87E1-6DCEB79F32E9}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{E88D3FEF-14DC-4D85-87E1-6DCEB79F32E9}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {4E8A30EC-4322-42A7-A26A-6F5D71425F90} | ||
SolutionGuid = {B5F43CF0-FE97-4274-8C47-6DC5557F9306} | ||
EndGlobalSection | ||
EndGlobal |