本文整理汇总了C#中Message.RequestNode方法的典型用法代码示例。如果您正苦于以下问题:C# Message.RequestNode方法的具体用法?C# Message.RequestNode怎么用?C# Message.RequestNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message.RequestNode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Command_Head
public void Command_Head()
{
var infoValue = new KeyValueBuilder(new Dictionary<string, string> {
{"XM","教师100"}
}).ToArray();
var request = new Message
{
MessageId = System.Guid.NewGuid().ToString(),
Version = "v1",
IsDumb = true,
Verb = "Head",
MessageType = "command",
Ontology = "JS",
Body = new BodyData(infoValue, null),
TimeStamp = DateTime.UtcNow.Ticks
}.JspxToken();
var response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.ReceiveOk == response.Body.Event.Status, response.Body.Event.Description);
request.IsDumb = false;
response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.ReceiveOk == response.Body.Event.Status, response.Body.Event.Description);
}
示例2: Action_Get2
public void Action_Get2()
{
var request = new Message
{
MessageId = System.Guid.NewGuid().ToString(),
Version = "v1",
Verb = "Get",
MessageType = "action",
IsDumb = true,
Ontology = "JS",
Body = new BodyData(new KeyValueBuilder().Append("Id", "0000A33A-F0A1-48CD-A9F2-FEB19F8E2BD0").ToArray(), null),
TimeStamp = DateTime.UtcNow.Ticks
}.JspxToken();
var response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.ExecuteOk == response.Body.Event.Status, response.Body.Event.Description);
var xm = response.Body.InfoValue.FirstOrDefault(a => a.Key.Equals("XM", StringComparison.OrdinalIgnoreCase));
Assert.IsTrue(xm != null);
Assert.IsTrue(response.Body.InfoValue.Any(a => a.Key.Equals("ZZJGM", StringComparison.OrdinalIgnoreCase)));
request.IsDumb = false;
response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.ExecuteOk == response.Body.Event.Status, response.Body.Event.Description);
xm = response.Body.InfoValue.FirstOrDefault(a => a.Key.Equals("XM", StringComparison.OrdinalIgnoreCase));
Assert.IsTrue(xm != null);
Assert.IsTrue(response.Body.InfoValue.Any(a => a.Key.Equals("ZZJGM", StringComparison.OrdinalIgnoreCase)));
}
示例3: Command_Get
public void Command_Get()
{
var request = new Message
{
MessageId = System.Guid.NewGuid().ToString(),
Version = "v1",
Verb = "Get",
MessageType = "command",
IsDumb = true,
Ontology = "JS",
Body = new BodyData(new KeyValueBuilder().Append("Id", "0000A33A-F0A1-48CD-A9F2-FEB19F8E2BD0").ToArray(), null),
TimeStamp = DateTime.UtcNow.Ticks
}.JspxToken();
var response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.ReceiveOk == response.Body.Event.Status, response.Body.Event.Description);
Assert.IsFalse(string.IsNullOrEmpty(response.Body.InfoValue[0].Key));
request.IsDumb = false;
response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.ReceiveOk == response.Body.Event.Status, response.Body.Event.Description);
Assert.IsFalse(string.IsNullOrEmpty(response.Body.InfoValue[0].Key));
}
示例4: Catalog_Must_IsLeaf
public void Catalog_Must_IsLeaf()
{
var infoValue = new KeyValueBuilder(new Dictionary<string, string> {
{"XM","测试"},
{"ZZJGM","110114"}
}).ToArray();
var request = new Message
{
MessageId = System.Guid.NewGuid().ToString(),
Version = "v1",
MessageType = "action",
IsDumb = true,
Verb = "Update",
Ontology = "JS",
Body = new BodyData(new KeyValueBuilder().Append("Id", "0008E9A4-CC11-48FB-9B1C-C72D4795AEDF").ToArray(), infoValue),
TimeStamp = DateTime.UtcNow.Ticks
}.JspxToken();
var response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.InvalidCatalog == response.Body.Event.Status, response.Body.Event.Description);
request.IsDumb = false;
response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.InvalidCatalog == response.Body.Event.Status, response.Body.Event.Description);
}
示例5: Action_Update_OutOfLength
public void Action_Update_OutOfLength()
{
var infoValue = new KeyValueBuilder(new Dictionary<string, string> {
{"XM","测试"},
{"ZZJGM","11011421005"}
}).ToArray();
var request = new Message
{
Version = "v1",
MessageType = "action",
IsDumb = true,
Verb = "Update",
Ontology = "JS",
MessageId = new string('A', 100),
Body = new BodyData(new KeyValueBuilder().Append("Id", "010C1D7A-9BA5-4AEA-9D4B-290476A79D12").ToArray(), infoValue),
}.JspxToken();
var response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.OutOfLength == response.Body.Event.Status, response.Body.Event.Description);
request.IsDumb = false;
response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.OutOfLength == response.Body.Event.Status, response.Body.Event.Description);
}
示例6: Action_Create_Dumb
public void Action_Create_Dumb()
{
var xm = System.Guid.NewGuid().ToString();
// 注意:基于serviceStack.Text的json反序列化貌似不认单引号只认双引号.
var json = "{\"XM\":\"" + xm + "\",\"ZZJGM\":\"11011421004\"}";
IInfoStringConverter converter;
AcDomain.NodeHost.InfoStringConverters.TryGetInfoStringConverter("json", out converter);
var infoValue = converter.ToDataItems(json);
var request = new Message
{
MessageId = System.Guid.NewGuid().ToString(),
Version = "v1",
Verb = Verb.Create.Code,
MessageType = "action",
IsDumb = true,
Ontology = "JS",
Body = new BodyData(infoValue.ToDto(), infoValue.ToDto())
{
QueryList = new string[] { "Id" }
},
TimeStamp = DateTime.UtcNow.Ticks
}.JspxSignature();
var response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.ExecuteOk == response.Body.Event.Status, response.Body.Event.Description);
request.Verb = "Get";
request.JspxSignature();// 重新签名
response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.NotExist == response.Body.Event.Status, response.Body.Event.Description);
}
示例7: Action_Update
public void Action_Update()
{
var xm = NewXM();
var infoValue = new KeyValueBuilder(new Dictionary<string, string> {
{"XM",xm},
{"ZZJGM","11011421004"}
}).ToArray();
var request = new Message
{
MessageId = System.Guid.NewGuid().ToString(),
Version = "v1",
MessageType = "action",
IsDumb = false,
Verb = "Create",
Ontology = "JS",
Body = new BodyData(infoValue, infoValue),
TimeStamp = DateTime.UtcNow.Ticks
}.JspxToken();
var response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.ExecuteOk == response.Body.Event.Status, response.Body.Event.Description);
request.MessageId = Guid.NewGuid().ToString();
request.Verb = "Update";
request.TimeStamp = DateTime.UtcNow.Ticks;
request.Body.InfoValue = new KeyValueBuilder().Append("XM", xm).Append("ZZJGM", "11011421004").ToArray();
xm = NewXM();
request.Body.InfoValue[0].Value = xm;
request.Body.InfoValue[1].Value = "11011421005";
response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.ExecuteOk == response.Body.Event.Status, response.Body.Event.Description);
request.Body.InfoId = new KeyValueBuilder().Append("XM", xm).Append("ZZJGM", "11011421005").ToArray();
request.Verb = "delete";
response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.ExecuteOk == response.Body.Event.Status, response.Body.Event.Description);
}
示例8: Entity_Event_InvalidStateCode
public void Entity_Event_InvalidStateCode()
{
var xm = System.Guid.NewGuid().ToString();
var infoValue = new KeyValueBuilder(new Dictionary<string, string> {
{"XM",xm},
{"ZZJGM","11011421005"}
}).ToArray();
var request = new Message
{
MessageId = System.Guid.NewGuid().ToString(),
MessageType = "event",
IsDumb = true,
Verb = "Create",
Ontology = "JS",
TimeStamp = DateTime.UtcNow.Ticks,
Version = "v1",
Body = new BodyData(infoValue, infoValue)
{
Event = new EventData
{
Subject = "StateCodeChanged",
SourceType = "entity"
}
},
}.JspxToken();
//var response = request.RequestNode(acDomain.NodeHost.Nodes.CenterNode);
var response = AnyMessage.Create(HecpRequest.Create(AcDomain, request), AcDomain.NodeHost.Nodes.CenterNode).Response();
Assert.IsTrue((int)Status.InvalidStatus == response.Body.Event.Status, response.Body.Event.Description);
request.IsDumb = false;
response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.InvalidStatus == response.Body.Event.Status, response.Body.Event.Description);
}
示例9: Command_Create_Must_Gave_XM_And_ZZJGM
public void Command_Create_Must_Gave_XM_And_ZZJGM()
{
var infoValue = new KeyValueBuilder(new Dictionary<string, string> {
{"XM","test"}
}).ToArray();
var request = new Message
{
MessageId = System.Guid.NewGuid().ToString(),
Version = "v1",
MessageType = "command",
IsDumb = true,
Verb = "Create",
Ontology = "JS",
Body = new BodyData(infoValue, infoValue),
TimeStamp = DateTime.UtcNow.Ticks,
}.JspxToken();
var response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.InvalidInfoId == response.Body.Event.Status, response.Body.Event.Description);
request.IsDumb = false;
response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.InvalidInfoId == response.Body.Event.Status, response.Body.Event.Description);
}
示例10: Command_MessageID_CanNotBeNullOrEmpty
public void Command_MessageID_CanNotBeNullOrEmpty()
{
var xm = System.Guid.NewGuid().ToString();
var infoValue = new KeyValueBuilder(new Dictionary<string, string> {
{"XM",xm},
{"ZZJGM","11011421005"}
}).ToArray();
var request = new Message
{
Version = "v1",
MessageType = "command",
IsDumb = true,
Verb = "Create",
Ontology = "JS",
MessageId = (DateTime.Now.Ticks % 2) == 0 ? null : string.Empty,
Body = new BodyData(infoValue, infoValue),
TimeStamp = DateTime.UtcNow.Ticks
}.JspxToken();
var response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.InvalidArgument == response.Body.Event.Status, response.Body.Event.Description);
request.IsDumb = false;
response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.InvalidArgument == response.Body.Event.Status, response.Body.Event.Description);
}
示例11: Command_Event_NotExist2
public void Command_Event_NotExist2()
{
var xm = System.Guid.NewGuid().ToString();
var infoValue = new KeyValueBuilder(new Dictionary<string, string> {
{"XM",xm},
{"ZZJGM","11011421005"}
}).ToArray();
var request = new Message
{
MessageId = System.Guid.NewGuid().ToString(),
Verb = "Create",
Ontology = "JS",
MessageType = "event",
IsDumb = true,
TimeStamp = DateTime.UtcNow.Ticks,
Version = "v1",
Body = new BodyData(infoValue, infoValue)
{
Event = new EventData
{
Subject = "StateCodeChanged",
SourceType = EventSourceType.Command.ToName(),
Status = (int)Status.AuditApproved
}
}
}.JspxToken();
var response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.NotExist == response.Body.Event.Status, response.Body.Event.Description);
request.IsDumb = false;
response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.NotExist == response.Body.Event.Status, response.Body.Event.Description);
}
示例12: Action_Delete
public void Action_Delete()
{
var xm = NewXM();
var infoValue = new List<KeyValue> {
new KeyValue("XM",xm),
new KeyValue("ZZJGM", "11011421004")
}.ToArray();
var request = new Message
{
MessageId = System.Guid.NewGuid().ToString(),
Version = "v1",
MessageType = "action",
IsDumb = true,
Verb = "Create",
Ontology = "JS",
Body = new BodyData(infoValue, infoValue)
{
QueryList = new string[] { "Id" }
},
TimeStamp = DateTime.UtcNow.Ticks
}.JspxToken();
var response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.ExecuteOk == response.Body.Event.Status, response.Body.Event.Description);
request.IsDumb = false;
response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.ExecuteOk == response.Body.Event.Status, response.Body.Event.Description);
request.Verb = "delete";
response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.ExecuteOk == response.Body.Event.Status, response.Body.Event.Description);
}
示例13: Action_Create
public void Action_Create()
{
var xm = NewXM();
var infoValue = new KeyValueBuilder(new Dictionary<string, string> {
{"XM",xm},
{"ZZJGM","11011421004"}
}).ToArray();
var request = new Message
{
MessageId = System.Guid.NewGuid().ToString(),
Version = "v1",
MessageType = "action",
IsDumb = true,
Verb = Verb.Create.Code,
Ontology = "JS",
Body = new BodyData(infoValue, infoValue)
{
QueryList = new string[] { "Id" }
},
TimeStamp = DateTime.UtcNow.Ticks
}.JspxToken();
//var response = request.RequestNode(acDomain.NodeHost.Nodes.CenterNode);
var response = AnyMessage.Create(HecpRequest.Create(AcDomain, request), AcDomain.NodeHost.Nodes.ThisNode).Response();
Assert.IsTrue((int)Status.ExecuteOk == response.Body.Event.Status, response.Body.Event.Description);
Assert.IsTrue((int)Status.ExecuteOk == response.Body.Event.Status, response.Body.Event.Description);
request.JspxSignature();// 签名
response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.ExecuteOk == response.Body.Event.Status, response.Body.Event.Description);
request.IsDumb = false;
request.JspxSignature();// 命令对象有更改则需重新签名
response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.ExecuteOk == response.Body.Event.Status, response.Body.Event.Description);
request.Verb = "Delete";
request.JspxSignature();// 命令对象有更改则需重新签名
response = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.ExecuteOk == response.Body.Event.Status, response.Body.Event.Description);
}
示例14: NotAuthorized
public void NotAuthorized()
{
var xm = NewXM();
var keys = new string[]{
"XM","ZZJGM"
};
var values = new string[]{
xm,"11011421004"
};
var infoValue = new KeyValueBuilder(keys, values).ToArray();
var client = new JsonServiceClient(AcDomain.NodeHost.Nodes.ThisNode.Node.AnycmdApiAddress);
var ticks = DateTime.UtcNow.Ticks;
var request = new Message
{
MessageId = System.Guid.NewGuid().ToString(),
Version = "v1",
MessageType = "action",
IsDumb = true,
Verb = Verb.Create.Code,
Ontology = "JS",
Body = new BodyData(infoValue, infoValue),
Credential = new CredentialData
{
ClientType = ClientType.Node.ToName(),
CredentialType = CredentialType.Token.ToName(),
ClientId = "41e711c6-f215-4606-a0bf-9af11cce1d54",
Ticks = ticks,
Password = TokenObject.Token("41e711c6-f215-4606-a0bf-9af11cce1d54", ticks, "invalidSecretKey")
},
TimeStamp = DateTime.UtcNow.Ticks
};
var response = client.Get(request);
Assert.IsTrue(Status.NotAuthorized.ToName() == response.Body.Event.ReasonPhrase, response.Body.Event.Description);
request.Verb = "Get";
request.JspxSignature();// 签名
var result = request.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
Assert.IsTrue((int)Status.NotExist == result.Body.Event.Status, result.Body.Event.Description);
}
示例15: Permission
public void Permission()
{
var infoId = new KeyValueBuilder(new Dictionary<string, string> {
{"SFZJH","320113198108242027"},
{"SFZJLXM","1"},
{"GHHM","85012345"}
}).ToArray();
var cmdDto = new Message
{
MessageId = System.Guid.NewGuid().ToString(),
Version = "v1",
Verb = "Head",
MessageType = "action",
IsDumb = true,
Ontology = "JS",
Body = new BodyData(infoId, null),
TimeStamp = DateTime.UtcNow.Ticks
}.JspxToken();
var response = cmdDto.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
//var response = AnyMessage.Create(HecpRequest.Create(request, Credential.Create(request))).Response();
Assert.IsTrue((int)Status.NoPermission == response.Body.Event.Status, response.Body.Event.Description);
cmdDto.IsDumb = false;
//response = request.RequestNode(acDomain.NodeHost.Nodes.CenterNode);
// 使用下面这行可以绕过网络传输从而易于调试,而上面那行需要网络传输
response = AnyMessage.Create(HecpRequest.Create(AcDomain, cmdDto), AcDomain.NodeHost.Nodes.ThisNode).Response();
Assert.IsTrue((int)Status.NoPermission == response.Body.Event.Status, response.Body.Event.Description);
cmdDto.MessageType = "Command";
response = cmdDto.RequestNode(AcDomain.NodeHost.Nodes.CenterNode);
//var response = AnyMessage.Create(HecpRequest.Create(request, Credential.Create(request))).Response();
Assert.IsTrue((int)Status.NoPermission == response.Body.Event.Status, response.Body.Event.Description);
cmdDto.IsDumb = false;
//response = request.RequestNode(acDomain.NodeHost.Nodes.CenterNode);
// 使用下面这行可以绕过网络传输从而易于调试,而上面那行需要网络传输
response = AnyMessage.Create(HecpRequest.Create(AcDomain, cmdDto), AcDomain.NodeHost.Nodes.ThisNode).Response();
Assert.IsTrue((int)Status.NoPermission == response.Body.Event.Status, response.Body.Event.Description);
}