增加服务之间调用的测试

This commit is contained in:
duyanming
2020-11-25 11:43:27 +08:00
parent e0430c78f0
commit 27b7e4fc44
8 changed files with 58 additions and 15 deletions

1
.gitignore vendored
View File

@@ -18,6 +18,7 @@
/*/*/obj
/.vs/Anno/lut
/DCS/AppService/Packages/
/.vs
/.vs/Anno/DesignTimeBuild/.dtbcache
/.vs/Anno/v16/.suo
/.vs/Anno/v16/Server/sqlite3/storage.ide-shm

View File

@@ -1,3 +1,3 @@
cd %cd%
cd ./AnnoCenter/bin/Debug/net5
cd ./AnnoCenter/bin/Debug/net5.0
dotnet AnnoCenter.dll

View File

@@ -1,3 +1,3 @@
cd %cd%
cd ./AnnoCenter/bin/Release/net5
cd ./AnnoCenter/bin/Release/net5.0
dotnet AnnoCenter.dll

View File

@@ -1,3 +1,3 @@
cd %cd%
cd ./AnnoService/bin/Debug/net5
cd ./AnnoService/bin/Debug/net5.0
dotnet AnnoService.dll

View File

@@ -1,3 +1,3 @@
cd %cd%
cd ./AnnoService/bin/Release/net5
cd ./AnnoService/bin/Release/net5.0
dotnet AnnoService.dll

View File

@@ -41,27 +41,27 @@ namespace Anno.EngineData
*/
if (response.Equals(Input))
{
var responseReplica=new Dictionary<string,string>();
var responseReplica = new Dictionary<string, string>();
foreach (var dic in response)
{
responseReplica.Add(dic.Key,dic.Value);
responseReplica.Add(dic.Key, dic.Value);
}
return InvokeEngine.InvokeProcessor(channel, router, method, responseReplica);
}
if (!response.ContainsKey("TraceId"))
if (!response.ContainsKey("TraceId") && Input.ContainsKey("TraceId"))
{
response.Add("TraceId",RequestString("TraceId"));
response.Add("TraceId", RequestString("TraceId"));
}
if (!response.ContainsKey("PreTraceId"))
if (!response.ContainsKey("PreTraceId") && Input.ContainsKey("PreTraceId"))
{
response.Add("PreTraceId", RequestString("PreTraceId"));
}
if (!response.ContainsKey("TTL"))
if (!response.ContainsKey("TTL") && Input.ContainsKey("TTL"))
{
response.Add("TTL", RequestString("TTL"));
}
if (!response.ContainsKey("GlobalTraceId"))
if (!response.ContainsKey("GlobalTraceId") && Input.ContainsKey("GlobalTraceId"))
{
response.Add("GlobalTraceId", RequestString("GlobalTraceId"));
}
@@ -82,19 +82,19 @@ namespace Anno.EngineData
return InvokeEngine.InvokeProcessorAsync(channel, router, method, responseReplica);
}
if (!response.ContainsKey("TraceId"))
if (!response.ContainsKey("TraceId") && Input.ContainsKey("TraceId"))
{
response.Add("TraceId", RequestString("TraceId"));
}
if (!response.ContainsKey("PreTraceId"))
if (!response.ContainsKey("PreTraceId") && Input.ContainsKey("PreTraceId"))
{
response.Add("PreTraceId", RequestString("PreTraceId"));
}
if (!response.ContainsKey("TTL"))
if (!response.ContainsKey("TTL") && Input.ContainsKey("TTL"))
{
response.Add("TTL", RequestString("TTL"));
}
if (!response.ContainsKey("GlobalTraceId"))
if (!response.ContainsKey("GlobalTraceId") && Input.ContainsKey("GlobalTraceId"))
{
response.Add("GlobalTraceId", RequestString("GlobalTraceId"));
}

View File

@@ -14,6 +14,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Anno.CronNET\Anno.CronNET.csproj" />
<ProjectReference Include="..\..\src\Core\Anno.Rpc.Client\Anno.Rpc.Client.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Anno.Rpc.Client;
using NUnit.Framework;
namespace Anno.Test
{
[TestFixture]
public class ServiceCallService
{
[Test]
public void BuyProduct_test()
{
Dictionary<string, string> input = new Dictionary<string, string>();
input.Add("channel", "Anno.Plugs.HelloWorld");
input.Add("router", "HelloWorldViper");
input.Add("method", "BuyProduct");
input.Add("productName", "ThinkBook 14");
input.Add("number", "6");
var x = Connector.BrokerDns(input);
Assert.IsTrue(x.IndexOf("true") > 0);
}
[SetUp]
public void SetUp()
{
DefaultConfigManager.SetDefaultConnectionPool(1000, Environment.ProcessorCount * 2, 100);
DefaultConfigManager.SetDefaultConfiguration("ServiceCallService", "127.0.0.1", 6660, false);
}
[TearDown]
public void TearDown()
{
Console.WriteLine("我是清理者");
}
}
}