mirror of
https://gitee.com/dotnetchina/anno.core.git
synced 2025-12-06 08:48:50 +08:00
增加服务之间调用的测试
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -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
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
cd %cd%
|
||||
cd ./AnnoCenter/bin/Debug/net5
|
||||
cd ./AnnoCenter/bin/Debug/net5.0
|
||||
dotnet AnnoCenter.dll
|
||||
@@ -1,3 +1,3 @@
|
||||
cd %cd%
|
||||
cd ./AnnoCenter/bin/Release/net5
|
||||
cd ./AnnoCenter/bin/Release/net5.0
|
||||
dotnet AnnoCenter.dll
|
||||
@@ -1,3 +1,3 @@
|
||||
cd %cd%
|
||||
cd ./AnnoService/bin/Debug/net5
|
||||
cd ./AnnoService/bin/Debug/net5.0
|
||||
dotnet AnnoService.dll
|
||||
@@ -1,3 +1,3 @@
|
||||
cd %cd%
|
||||
cd ./AnnoService/bin/Release/net5
|
||||
cd ./AnnoService/bin/Release/net5.0
|
||||
dotnet AnnoService.dll
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
41
test/Anno.Test/ServiceCallService.cs
Normal file
41
test/Anno.Test/ServiceCallService.cs
Normal 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("我是清理者");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user