changeset 36:3929e66a6645

add RemoteTakeTest
author riono <e165729@ie.u-ryukyu.ac.jp>
date Tue, 11 May 2021 19:02:08 +0900
parents 9e31b8c7a5bd
children 090be804eaa9
files Christie_net.csproj Test/Example/HelloWorld/FinishHelloWorld.cs Test/Example/RemoteTake/CreateRemoteTakeTest.cs Test/Example/RemoteTake/FinishRemoteTake.cs Test/Example/RemoteTake/RTCommand.cs Test/Example/RemoteTake/StartRemoteTake.cs
diffstat 6 files changed, 68 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Christie_net.csproj	Tue May 04 22:17:11 2021 +0900
+++ b/Christie_net.csproj	Tue May 11 19:02:08 2021 +0900
@@ -3,7 +3,7 @@
     <PropertyGroup>
         <OutputType>Exe</OutputType>
         <TargetFramework>netcoreapp3.1</TargetFramework>
-        <StartupObject>Christie_net.Test.Example.HelloWorld.StartHelloWorld</StartupObject>
+        <StartupObject>Christie_net.Test.Example.RemoteTake.StartRemoteTake</StartupObject>
     </PropertyGroup>
 
     <ItemGroup>
--- a/Test/Example/HelloWorld/FinishHelloWorld.cs	Tue May 04 22:17:11 2021 +0900
+++ b/Test/Example/HelloWorld/FinishHelloWorld.cs	Tue May 11 19:02:08 2021 +0900
@@ -8,7 +8,6 @@
     [Take] private string world;
 
     public override void Run(CodeGearManager cgm) {
-        Console.WriteLine("fin:" + hello + " " + world);
         cgm.GetLocalDGM().Finish();
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Test/Example/RemoteTake/CreateRemoteTakeTest.cs	Tue May 11 19:02:08 2021 +0900
@@ -0,0 +1,15 @@
+using System;
+using Christie_net.annotation;
+using Christie_net.codegear;
+
+namespace Christie_net.Test.Example.RemoteTake {
+public class CreateRemoteTakeTest : CodeGear {
+    [Take] public RTCommand command;
+
+
+    public override void Run(CodeGearManager cgm) {
+        Console.WriteLine(command);
+        cgm.GetLocalDGM().Put("finish" , "end");
+    }
+}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Test/Example/RemoteTake/FinishRemoteTake.cs	Tue May 11 19:02:08 2021 +0900
@@ -0,0 +1,13 @@
+using Christie_net.annotation;
+using Christie_net.codegear;
+
+namespace Christie_net.Test.Example.RemoteTake {
+public class FinishRemoteTake : CodeGear {
+    [Take] public string finish;
+    
+    public override void Run(CodeGearManager cgm) {
+        cgm.GetDGM("remote").Finish();
+        cgm.GetLocalDGM().Finish();
+    }
+}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Test/Example/RemoteTake/RTCommand.cs	Tue May 11 19:02:08 2021 +0900
@@ -0,0 +1,22 @@
+using MessagePack;
+
+namespace Christie_net.Test.Example.RemoteTake {
+
+[MessagePackObject]
+public class RTCommand {
+    public string line;
+    public string cmd;
+    public int offset;
+
+    public RTCommand(string line, string cmd, int i) {
+        this.line = line;
+        this.cmd = cmd;
+        this.offset = i;
+    }
+
+    public override string ToString() {
+        return "RTCommand{ line=" + line + "\\" +
+               ", cmd=" + cmd + "\\" + ", offset=" + offset + "}";
+    }
+}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Test/Example/RemoteTake/StartRemoteTake.cs	Tue May 11 19:02:08 2021 +0900
@@ -0,0 +1,17 @@
+using Christie_net.codegear;
+
+namespace Christie_net.Test.Example.RemoteTake {
+public class StartRemoteTake : StartCodeGear {
+    public StartRemoteTake(CodeGearManager cgm) : base(cgm) { }
+
+    public static void Main() {
+        CodeGearManager cgm = CreateCgm(10001);
+        cgm.CreateRemoteDGM("remote", "localhost", 10001);
+        cgm.Setup(new CreateRemoteTakeTest());
+        cgm.Setup(new FinishRemoteTake());
+        RTCommand cmd = new RTCommand("insert", "line", 0);
+        cgm.GetDGM("remote").Put("command", cmd);
+    }
+    
+}
+}
\ No newline at end of file