[성현모] 루프테스트 코드

This commit is contained in:
SHM
2025-11-03 09:04:29 +09:00
parent 3ba63ccb68
commit 05e08752b5

View File

@ -1,9 +1,11 @@
using CPMeta; using CPMeta;
using CPMeta.Models; using CPMeta.Models;
using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace PlayGround.NetFramework namespace PlayGround.NetFramework
@ -12,33 +14,57 @@ namespace PlayGround.NetFramework
{ {
static void Main(string[] args) static void Main(string[] args)
{ {
//global set
string host = "192.168.0.126";
//CpMetaSet //CpMetaSet
CPMeta.CPMeta.Port = 9000; CPMeta.CPMeta.Port = 9000;
string ProductId = Guid.NewGuid().ToString(); DateTime start = DateTime.Now;
string Mac1 = Guid.NewGuid().ToString(); Task.Run(async () =>
string Mac2 = Guid.NewGuid().ToString();
//Set
Task.Run(async() =>
{ {
Request_SetWbmsMeta req = new Request_SetWbmsMeta(); var rese2 = await CPMeta.CPMeta.GetWbmsMetaByMacAddress("192.168.0.126", "4594095f-01d0-4192-bc4a-0913ae496e25");
req.ProductID = ProductId; //var rese2 = await CPMeta.CPMeta.GetWbmsMetaByProductId(host, "cf35eeee-39ff-43e8-a7a9-0fd0baf6df2b");
req.MacAddress1 = Mac1; Console.WriteLine(JsonConvert.SerializeObject(rese2, Formatting.Indented));
req.MacAddress2 = Mac2; int c = 0;
var res = await CPMeta.CPMeta.SetWbmsMetaAsync("127.0.0.1", req);
}).Wait(); }).Wait();
//Get
Task.Run(async() =>
{
var rese2 = await CPMeta.CPMeta.GetWbmsMetaByProductId("127.0.0.1", ProductId);
var rese3 = await CPMeta.CPMeta.GetWbmsMetaByMacAddress("127.0.0.1", Mac1); Console.WriteLine((DateTime.Now - start).TotalSeconds + " sec");
var rese4 = await CPMeta.CPMeta.GetWbmsMetaByMacAddress("127.0.0.1", Mac2);
int b = 0; //for(int i=0;i<1000000;i++)
}).Wait();; //{
// string ProductId = Guid.NewGuid().ToString();
// string Mac1 = Guid.NewGuid().ToString();
// string Mac2 = Guid.NewGuid().ToString();
// //Set
// Task.Run(async () =>
// {
// Request_SetWbmsMeta req = new Request_SetWbmsMeta();
// req.ProductID = ProductId;
// req.MacAddress1 = Mac1;
// req.MacAddress2 = Mac2;
// if (i % 2 == 0)
// req.Type = "CMU";
// else
// req.Type = "BMU";
// req.ProductNo = "X";
// var res = await CPMeta.CPMeta.SetWbmsMetaAsync(host, req);
// }).Wait();
// //Get
// //Task.Run(async () =>
// //{
// // var rese2 = await CPMeta.CPMeta.GetWbmsMetaByProductId(host, ProductId);
// // var rese3 = await CPMeta.CPMeta.GetWbmsMetaByMacAddress(host, Mac1);
// // var rese4 = await CPMeta.CPMeta.GetWbmsMetaByMacAddress("192.168.0.126", Mac2);
// //}).Wait();
// Thread.Sleep(10);
//}
int a = 0; int a = 0;
} }