Mercurial > hg > Members > shoshi > jungle > jungle-core
changeset 359:f85a437e495b
Logupdate termination
author | suruga |
---|---|
date | Wed, 31 Jan 2018 18:33:46 +0900 |
parents | e13af3fd64cf |
children | d10d35c0960a |
files | .idea/modules.xml jungle-core.iml src/test/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/logupdate/LogupdateFinish.java src/test/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/logupdate/LogupdateTestConfig.java src/test/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/logupdate/LogupdateTestStartCodeSegment.java |
diffstat | 5 files changed, 52 insertions(+), 117 deletions(-) [+] |
line wrap: on
line diff
--- a/.idea/modules.xml Mon Dec 25 19:53:26 2017 +0900 +++ b/.idea/modules.xml Wed Jan 31 18:33:46 2018 +0900 @@ -3,6 +3,8 @@ <component name="ProjectModuleManager"> <modules> <module fileurl="file://$PROJECT_DIR$/jungle-core.iml" filepath="$PROJECT_DIR$/jungle-core.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/jungle-core_main.iml" filepath="$PROJECT_DIR$/.idea/modules/jungle-core_main.iml" group="jungle-core" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/jungle-core_test.iml" filepath="$PROJECT_DIR$/.idea/modules/jungle-core_test.iml" group="jungle-core" /> </modules> </component> </project> \ No newline at end of file
--- a/jungle-core.iml Mon Dec 25 19:53:26 2017 +0900 +++ b/jungle-core.iml Wed Jan 31 18:33:46 2018 +0900 @@ -1,126 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <module external.linked.project.id="jungle-core" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="cr.ie.u_ryukyu.ac.jp" external.system.module.version="1.1" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="false"> - <output url="file://$MODULE_DIR$/build/classes/main" /> - <output-test url="file://$MODULE_DIR$/build/classes/test" /> + <component name="NewModuleRootManager" inherit-compiler-output="true"> <exclude-output /> <content url="file://$MODULE_DIR$"> - <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> - <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> - <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> - <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" /> <excludeFolder url="file://$MODULE_DIR$/.gradle" /> <excludeFolder url="file://$MODULE_DIR$/build" /> + <excludeFolder url="file://$MODULE_DIR$/out" /> </content> <orderEntry type="inheritedJdk" /> <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="module-library"> - <library name="Gradle: commons-collections:commons-collections:3.2.1"> - <CLASSES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/commons-collections/commons-collections/3.2.1/761ea405b9b37ced573d2df0d1e3a4e0f9edc668/commons-collections-3.2.1.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/commons-collections/commons-collections/3.2.1/fa095ef874374e5b2a11f8b06c26a5d68c7cb3a4/commons-collections-3.2.1-sources.jar!/" /> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library name="Gradle: org.apache.maven.surefire:surefire-junit4:2.13"> - <CLASSES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.maven.surefire/surefire-junit4/2.13/d2a35c1d9af8b40905d6d0cb2c5dc8ff748f8589/surefire-junit4-2.13.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.maven.surefire/surefire-junit4/2.13/fcbb7062f412c1450d86709cb67c4b9261652170/surefire-junit4-2.13-sources.jar!/" /> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library name="Gradle: com.google.guava:guava:20.0"> - <CLASSES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/20.0/89507701249388e1ed5ddcf8c41f4ce1be7831ef/guava-20.0.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/20.0/9c8493c7991464839b612d7547d6c263adf08f75/guava-20.0-sources.jar!/" /> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library name="Gradle: junit:junit:4.11"> - <CLASSES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/junit/junit/4.11/4e031bb61df09069aeb2bffb4019e7a5034a4ee0/junit-4.11.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/junit/junit/4.11/28e0ad201304e4a4abf999ca0570b7cffc352c3c/junit-4.11-sources.jar!/" /> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library name="Gradle: cr.ie.u_ryukyu.ac.jp:Alice:1.1"> - <CLASSES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/cr.ie.u_ryukyu.ac.jp/Alice/1.1/7c97e4cbaf96d287ca1c4a8db639b8453a6debcd/Alice-1.1.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library name="Gradle: org.msgpack:msgpack:0.6.12"> - <CLASSES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.msgpack/msgpack/0.6.12/6a0c88fe022993c490011c3dce7127b29f9a9b3b/msgpack-0.6.12.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.msgpack/msgpack/0.6.12/d884987a52e47f566c6356ce948edbf546616072/msgpack-0.6.12-sources.jar!/" /> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library name="Gradle: org.apache.maven.surefire:surefire-api:2.13"> - <CLASSES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.maven.surefire/surefire-api/2.13/4b0223fb338f7f875662497203e9812654e3255c/surefire-api-2.13.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.maven.surefire/surefire-api/2.13/4a1791d8f4e73c797c165e0a11a284a56638675a/surefire-api-2.13-sources.jar!/" /> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library name="Gradle: org.hamcrest:hamcrest-core:1.3"> - <CLASSES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/42a25dc3219429f0e5d060061f71acb49bf010a0/hamcrest-core-1.3.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/1dc37250fbc78e23a65a67fbbaf71d2e9cbc3c0b/hamcrest-core-1.3-sources.jar!/" /> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library name="Gradle: com.googlecode.json-simple:json-simple:1.1.1"> - <CLASSES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.googlecode.json-simple/json-simple/1.1.1/c9ad4a0850ab676c5c64461a05ca524cdfff59f1/json-simple-1.1.1.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.googlecode.json-simple/json-simple/1.1.1/15bba08e3a239d54b68209c001f9c911559d2fed/json-simple-1.1.1-sources.jar!/" /> - </SOURCES> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library name="Gradle: org.javassist:javassist:3.18.1-GA"> - <CLASSES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.javassist/javassist/3.18.1-GA/d9a09f7732226af26bf99f19e2cffe0ae219db5b/javassist-3.18.1-GA.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES> - <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.javassist/javassist/3.18.1-GA/d8d089f3a8845cce22d3006e02ab1403dd73b5b6/javassist-3.18.1-GA-sources.jar!/" /> - </SOURCES> - </library> - </orderEntry> </component> </module> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/logupdate/LogupdateFinish.java Wed Jan 31 18:33:46 2018 +0900 @@ -0,0 +1,32 @@ +package jp.ac.u_ryukyu.ie.cr.jungleNetwork.logupdate; + +import alice.codesegment.CodeSegment; +import alice.datasegment.CommandType; +import alice.datasegment.ReceiveData; +import alice.datasegment.Receiver; + +import java.util.List; + +public class LogupdateFinish extends CodeSegment { + Receiver finish = ids.create(CommandType.TAKE); + private Receiver clist = ids.create(CommandType.PEEK); + + LogupdateFinish() { + finish.setKey("jungleControl"); + } + + @Override + public void run() { + int command = finish.asInteger(); + + @SuppressWarnings("unchecked") + List<String> list = clist.asClass(List.class); + for (String node : list) {//他ノードへlogの書き込み + if (!node.equals(finish.from)) + ods.put(node, "jungleControl", 1); + } + if (command == 1) { + ods.finish("local"); + } + } +}
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/logupdate/LogupdateTestConfig.java Mon Dec 25 19:53:26 2017 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/logupdate/LogupdateTestConfig.java Wed Jan 31 18:33:46 2018 +0900 @@ -14,6 +14,7 @@ public String key = "remote"; private boolean writeMode = false; private String[] args1; + int writeCount = 1; public LogupdateTestConfig(String[] args) { super(args); @@ -23,6 +24,8 @@ hostname = args[++i]; } else if ("-cp".equals(args[i])) { connectPort = Integer.parseInt(args[++i]); + } else if ("-count".equals(args[i])) { + writeCount = Integer.parseInt(args[++i]); } else if ("-key".equals(args[i])) { key = args[++i]; } else if ("-write".equals(args[i])) {
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/logupdate/LogupdateTestStartCodeSegment.java Mon Dec 25 19:53:26 2017 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/jungleNetwork/logupdate/LogupdateTestStartCodeSegment.java Wed Jan 31 18:33:46 2018 +0900 @@ -11,6 +11,7 @@ import jp.ac.u_ryukyu.ie.cr.jungleNetwork.persistent.AliceJournal; import java.io.IOException; +import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -21,6 +22,7 @@ int bbsPort = 8080; Receiver host = ids.create(CommandType.PEEK); + Receiver clist = ids.create(CommandType.PEEK); Receiver conf = ids.create(CommandType.PEEK); private Pattern pattern = Pattern.compile("^(node|cli)([0-9]+)$"); private String[] args; @@ -29,6 +31,7 @@ public LogupdateTestStartCodeSegment(){ conf.setKey("config"); host.setKey("host"); + clist.setKey("_CLIST"); } @Override @@ -50,10 +53,18 @@ ods.put("updator", cassaBBS); new LogUpdateCodeSegment(); - if (config.isWriteMode()){ - bbsTest.createMessage(); + if (config.isWriteMode()) { + for (int i = config.writeCount;i>0;i--) { + bbsTest.createMessage(); + } try { bbsTest.checkTime(); + @SuppressWarnings("unchecked") + List<String> list = clist.asClass(List.class); + for (String node : list) {//他ノードへlogの書き込み + ods.put(node, "jungleControl", 1); + } + ods.finish("local"); } catch (IOException e) { e.printStackTrace(); }