- Timestamp:
- 09/10/13 21:11:41 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
java/main/src/test/java/com/framsticks/hosting/ServerTest.java
r103 r105 8 8 import org.testng.annotations.Test; 9 9 10 import com.framsticks.core.ListChange;11 import com.framsticks.core.LocalTree;12 import com.framsticks.core.Path;13 import com.framsticks.core.Result;14 import com.framsticks.core.TreeOperations;15 import com.framsticks.core.ValueChange;16 10 import com.framsticks.core.XmlBasedTest; 17 11 import com.framsticks.remote.RemoteTree; 12 import com.framsticks.structure.LocalTree; 13 import com.framsticks.structure.Path; 14 import com.framsticks.structure.Tree; 15 import com.framsticks.structure.TreeOperations; 16 import com.framsticks.structure.messages.ListChange; 17 import com.framsticks.structure.messages.Result; 18 import com.framsticks.structure.messages.ValueChange; 18 19 19 20 import com.framsticks.test.TestClass; 20 import com.framsticks.core.Tree;21 21 import com.framsticks.params.FramsClass; 22 22 import com.framsticks.params.Access; … … 29 29 import com.framsticks.params.types.ProcedureParam; 30 30 import com.framsticks.util.dispatching.Dispatching.Waiter; 31 import com.framsticks.util.dispatching.Future Handler;31 import com.framsticks.util.dispatching.Future; 32 32 import com.framsticks.util.dispatching.RunAt; 33 33 34 import static com.framsticks. core.TreeOperations.*;34 import static com.framsticks.params.ParamsUtil.arguments; 35 35 36 36 import static org.fest.assertions.Assertions.*; 37 import static com.framsticks.params.ParamsUtil.getParam; 38 import static com.framsticks.structure.TreeOperations.*; 37 39 38 40 @Test … … 72 74 final Waiter waiter = produceWaiter(1.0); 73 75 74 TreeOperations.tryGet(remote, "/testClass", new Future Handler<Path>(failOnException) {76 TreeOperations.tryGet(remote, "/testClass", new Future<Path>(failOnException) { 75 77 @Override 76 78 protected void result(Path path) { … … 88 90 final Waiter waiter = produceWaiter(1.0); 89 91 90 TreeOperations.tryGet(remote, "/testClass", new Future Handler<Path>(failOnException) {92 TreeOperations.tryGet(remote, "/testClass", new Future<Path>(failOnException) { 91 93 @Override 92 94 protected void result(Path path) { … … 105 107 final Waiter waiter = produceWaiter(2.0); 106 108 107 set(remotePath, remoteTestFramsClass.getParamEntry("name", PrimitiveParam.class), "new name", new FutureHandler<Integer>(failOnException) {109 set(remotePath, getParam(remoteTestFramsClass, "name", PrimitiveParam.class), "new name", new Future<Integer>(failOnException) { 108 110 @Override 109 111 protected void result(Integer flags) { … … 132 134 }; 133 135 134 TreeOperations.tryGet(remote, "/cli/events", new Future Handler<Path>(failOnException) {136 TreeOperations.tryGet(remote, "/cli/events", new Future<Path>(failOnException) { 135 137 @Override 136 138 protected void result(Path path) { … … 139 141 }); 140 142 141 addListener(remotePath, remoteTestFramsClass.getParamEntry("history_changed", EventParam.class), listener, ValueChange.class, produceWaiter(1.0).passInFuture(Void.class));143 addListener(remotePath, getParam(remoteTestFramsClass, "history_changed", EventParam.class), listener, ValueChange.class, produceWaiter(1.0).passInFuture(Void.class)); 142 144 } 143 145 … … 146 148 final Waiter waiter = produceWaiter(2.0); 147 149 148 call(remotePath, remoteTestFramsClass.getParamEntry("resetHistory", ProcedureParam.class), new Object[] {}, Object.class, produceWaiter(2.0).passInFuture(Object.class));149 150 call(remotePath, remoteTestFramsClass.getParamEntry("appendHistory", ProcedureParam.class), new Object[] {"next word"}, Result.class, new FutureHandler<Result>(failOnException) {150 call(remotePath, getParam(remoteTestFramsClass, "resetHistory", ProcedureParam.class), arguments(), Object.class, produceWaiter(2.0).passInFuture(Object.class)); 151 152 call(remotePath, getParam(remoteTestFramsClass, "appendHistory", ProcedureParam.class), arguments("next word"), Result.class, new Future<Result>(failOnException) { 151 153 @Override 152 154 protected void result(final Result result) { … … 167 169 @Test(dependsOnMethods = "callMethod") 168 170 public void deregisterListener() { 169 removeListener(remotePath, remoteTestFramsClass.getParamEntry("history_changed", EventParam.class), listener, produceWaiter(1.0).passInFuture(Void.class));171 removeListener(remotePath, getParam(remoteTestFramsClass, "history_changed", EventParam.class), listener, produceWaiter(1.0).passInFuture(Void.class)); 170 172 171 173 assertThat(listenerArguments).isEqualTo(Arrays.asList("", "next word|")); … … 183 185 }; 184 186 185 addListener(remotePath, remoteTestFramsClass.getParamEntry("children_changed", EventParam.class), childListener, ListChange.class, produceWaiter(1.0).passInFuture(Void.class));187 addListener(remotePath, getParam(remoteTestFramsClass, "children_changed", EventParam.class), childListener, ListChange.class, produceWaiter(1.0).passInFuture(Void.class)); 186 188 } 187 189 … … 189 191 public void createChild() { 190 192 final Waiter waiter = produceWaiter(2.0); 191 call(remotePath, "createChild", new Object[] { "a child" }, Object.class, produceWaiter(2.0).passInFuture(Object.class));192 call(remotePath, "createChild", new Object[] { "another child" }, Object.class, produceWaiter(2.0).passInFuture(Object.class));193 194 tryGet(remote, "/testClass/children/c0", new Future Handler<Path>(failOnException) {193 call(remotePath, "createChild", arguments("a child"), Object.class, produceWaiter(2.0).passInFuture(Object.class)); 194 call(remotePath, "createChild", arguments("another child"), Object.class, produceWaiter(2.0).passInFuture(Object.class)); 195 196 tryGet(remote, "/testClass/children/c0", new Future<Path>(failOnException) { 195 197 196 198 @Override 197 199 protected void result(Path result) { 198 set(result, get FramsClass(result).getParamEntry("name", StringParam.class), "new_name", new FutureHandler<Integer>(failOnException) {200 set(result, getParam(result, "name", StringParam.class), "new_name", new Future<Integer>(failOnException) { 199 201 200 202 @Override … … 209 211 @Test(dependsOnMethods = "createChild") 210 212 public void deregisterChildListener() { 211 removeListener(remotePath, remoteTestFramsClass.getParamEntry("children_changed", EventParam.class), childListener, produceWaiter(1.0).passInFuture(Void.class));213 removeListener(remotePath, getParam(remoteTestFramsClass, "children_changed", EventParam.class), childListener, produceWaiter(1.0).passInFuture(Void.class)); 212 214 } 213 215
Note: See TracChangeset
for help on using the changeset viewer.