Ignore:
Timestamp:
09/10/13 21:11:41 (11 years ago)
Author:
psniegowski
Message:

HIGHLIGHTS:

  • import refactorization: move Tree, Path, etc.

from core to structure package

  • initial serialization implementation
  • improve PrimeExperiment? test
  • many organizational changes and convenience improvements

CHANGELOG:
Make registry in AbstractTree? final.

Move most classes from core to structure package.

Minor changes.

Switch names of Future and FutureHandler?.

Rename ExceptionResultHandler? to ExceptionHandler?.

Rename ExceptionHandler? to ExceptionDispatcherHandler?.

Fix bug in ParamCandidate? cache.

Add missing synchronization to the BufferedDispatcher?.

Develop @Serialized support.

Rework serialization further.

Add serialization/deserialization interface to ValueParam?.

Move getStorageType and isNumeric from Param down to params hierarchy.

Minor changes.

Improve param type induction.

Add TestSerializedClass? for testing new serialization.

Add info files gor GenePool? and Population.

Add standard.expt exemplary netfile.

Add type name field to PropertiesObject?.

Use PropertiesObject? for PropertiesAccess? instead of ordinary map.

Hide getFramsClass is several more places.

More unification accross FramsClass?, Access and Path.

Add ParamCollection?.

Simplify interface for getting params from FramsClass?, Access
or Path.

Make Access.call() interface variadic.

Add arguments(args) convenience wrapper around new Object[] {args}.

Upgrade to apache.commons.lang version 3.1

Minor improvement with Response constructors.

Develop proper result printing in ClientAtServer?.

Add experimentNetsave to PrimeExperiment?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • java/main/src/test/java/com/framsticks/hosting/ServerTest.java

    r103 r105  
    88import org.testng.annotations.Test;
    99
    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;
    1610import com.framsticks.core.XmlBasedTest;
    1711import com.framsticks.remote.RemoteTree;
     12import com.framsticks.structure.LocalTree;
     13import com.framsticks.structure.Path;
     14import com.framsticks.structure.Tree;
     15import com.framsticks.structure.TreeOperations;
     16import com.framsticks.structure.messages.ListChange;
     17import com.framsticks.structure.messages.Result;
     18import com.framsticks.structure.messages.ValueChange;
    1819
    1920import com.framsticks.test.TestClass;
    20 import com.framsticks.core.Tree;
    2121import com.framsticks.params.FramsClass;
    2222import com.framsticks.params.Access;
     
    2929import com.framsticks.params.types.ProcedureParam;
    3030import com.framsticks.util.dispatching.Dispatching.Waiter;
    31 import com.framsticks.util.dispatching.FutureHandler;
     31import com.framsticks.util.dispatching.Future;
    3232import com.framsticks.util.dispatching.RunAt;
    3333
    34 import static com.framsticks.core.TreeOperations.*;
     34import static com.framsticks.params.ParamsUtil.arguments;
    3535
    3636import static org.fest.assertions.Assertions.*;
     37import static com.framsticks.params.ParamsUtil.getParam;
     38import static com.framsticks.structure.TreeOperations.*;
    3739
    3840@Test
     
    7274                final Waiter waiter = produceWaiter(1.0);
    7375
    74                 TreeOperations.tryGet(remote, "/testClass", new FutureHandler<Path>(failOnException) {
     76                TreeOperations.tryGet(remote, "/testClass", new Future<Path>(failOnException) {
    7577                        @Override
    7678                        protected void result(Path path) {
     
    8890                final Waiter waiter = produceWaiter(1.0);
    8991
    90                 TreeOperations.tryGet(remote, "/testClass", new FutureHandler<Path>(failOnException) {
     92                TreeOperations.tryGet(remote, "/testClass", new Future<Path>(failOnException) {
    9193                        @Override
    9294                        protected void result(Path path) {
     
    105107                final Waiter waiter = produceWaiter(2.0);
    106108
    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) {
    108110                        @Override
    109111                        protected void result(Integer flags) {
     
    132134                };
    133135
    134                 TreeOperations.tryGet(remote, "/cli/events", new FutureHandler<Path>(failOnException) {
     136                TreeOperations.tryGet(remote, "/cli/events", new Future<Path>(failOnException) {
    135137                        @Override
    136138                        protected void result(Path path) {
     
    139141                });
    140142
    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));
    142144        }
    143145
     
    146148                final Waiter waiter = produceWaiter(2.0);
    147149
    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) {
    151153                        @Override
    152154                        protected void result(final Result result) {
     
    167169        @Test(dependsOnMethods = "callMethod")
    168170        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));
    170172
    171173                assertThat(listenerArguments).isEqualTo(Arrays.asList("", "next word|"));
     
    183185                };
    184186
    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));
    186188        }
    187189
     
    189191        public void createChild() {
    190192                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 FutureHandler<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) {
    195197
    196198                        @Override
    197199                        protected void result(Path result) {
    198                                 set(result, getFramsClass(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) {
    199201
    200202                                        @Override
     
    209211        @Test(dependsOnMethods = "createChild")
    210212        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));
    212214        }
    213215
Note: See TracChangeset for help on using the changeset viewer.