Ignore:
Timestamp:
07/06/13 03:51:11 (11 years ago)
Author:
psniegowski
Message:

HIGHLIGHTS:

  • add proper exception passing between communication sides:

if exception occur during handling client request, it is
automatically passed as comment to error response.

it may be used to snoop communication between peers

  • fix algorithm choosing text controls in GUI
  • allow GUI testing in virtual frame buffer (xvfb)

FEST had some problem with xvfb but workaround was found

supports tab-completion based on requests history

CHANGELOG:
Further improve handling of exceptions in GUI.

Add StatusBar? implementing ExceptionResultHandler?.

Make completion processing asynchronous.

Minor changes.

Improve completion in console.

Improve history in InteractiveConsole?.

First working version of DirectConsole?.

Minor changes.

Make Connection.address non final.

It is more suitable to use in configuration.

Improvement of consoles.

Improve PopupMenu? and closing of FrameJoinable?.

Fix BrowserTest?.

Found bug with FEST running under xvfb.

JButtonFixture.click() is not working under xvfb.
GuiTest? has wrapper which uses JButton.doClick() directly.

Store CompositeParam? param in TreeNode?.

Simplify ClientSideManagedConnection? connecting.

There is now connectedFunctor needed, ApplicationRequests? can be
send right after creation. They are buffered until the version
and features are negotiated.

Narow down interface of ClientSideManagedConnection?.

Allow that connection specialization send only
ApplicationRequests?.

Improve policy of text control choosing.

Change name of Genotype in BrowserTest?.

Make BrowserTest? change name of Genotype.

Minor change.

First working draft of TrackConsole?.

Simplify Consoles.

More improvements with gui joinables.

Unify initialization on gui joinables.

More rework of Frame based entities.

Refactorize structure of JFrames based entities.

Extract GuiTest? from BrowserBaseTest?.

Reorganize Console classes structure.

Add Collection view to JoinableCollection?.

Configure timeout in testing.

Minor changes.

Rework connections hierarchy.

Add Mode to the get operation.

Make get and set in Tree take PrimitiveParam?.

Unify naming of operations.

Make RunAt? use the given ExceptionHandler?.

It wraps the virtual runAt() method call with
try-catch passing exception to handler.

Force RunAt? to include ExceptionHandler?.

Improve ClientAtServer?.

Minor change.

Another sweep with FindBugs?.

Rename Instance to Tree.

Minor changes.

Minor changes.

Further clarify semantics of Futures.

Add FutureHandler?.

FutureHandler? is refinement of Future, that proxifies
exception handling to ExceptionResultHandler? given
at construction time.

Remove StateFunctor? (use Future<Void> instead).

Make Connection use Future<Void>.

Unparametrize *ResponseFuture?.

Remove StateCallback? not needed anymore.

Distinguish between sides of ResponseFuture?.

Base ResponseCallback? on Future (now ResponseFuture?).

Make asynchronous store taking Future for flags.

Implement storeValue in ObjectInstance?.

File:
1 edited

Legend:

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

    r96 r97  
    44import org.testng.annotations.Test;
    55
    6 import com.framsticks.core.ObjectInstance;
     6import com.framsticks.core.Mode;
     7import com.framsticks.core.ObjectTree;
    78import com.framsticks.core.Path;
    89import com.framsticks.core.XmlBasedTest;
    9 import com.framsticks.remote.RemoteInstance;
     10import com.framsticks.remote.RemoteTree;
    1011
    1112import com.framsticks.test.TestClass;
    12 import com.framsticks.core.Instance;
     13import com.framsticks.core.Tree;
    1314import com.framsticks.params.FramsClass;
    14 import com.framsticks.util.AbstractStateFunctor;
    1515import com.framsticks.util.dispatching.Dispatching;
    1616import com.framsticks.params.AccessInterface;
     17import com.framsticks.params.PrimitiveParam;
    1718import com.framsticks.params.PropertiesAccess;
    18 import com.framsticks.params.ValueParam;
    1919import com.framsticks.params.types.ProcedureParam;
    2020import com.framsticks.util.dispatching.Dispatching.Waiter;
    21 import com.framsticks.util.dispatching.Future;
     21import com.framsticks.util.dispatching.FutureHandler;
    2222import com.framsticks.util.dispatching.RunAt;
    2323
    24 import static com.framsticks.core.InstanceUtils.*;
     24import static com.framsticks.core.TreeOperations.*;
    2525
    2626import static org.fest.assertions.Assertions.*;
     
    2929public class ServerTest extends XmlBasedTest {
    3030
    31         protected RemoteInstance remote;
     31        protected RemoteTree remote;
    3232        protected FramsClass remoteTestFramsClass;
    3333        protected Path remotePath;
    3434
    3535        protected Server server;
    36         protected ObjectInstance hosted;
     36        protected ObjectTree hosted;
    3737        protected TestClass hostedObject;
    3838
     
    4646                assertThat(framsticks.size()).isEqualTo(2);
    4747                assertThat(framsticks.get("test")).isInstanceOf(Server.class);
    48                 assertThat(framsticks.get("remote")).isInstanceOf(RemoteInstance.class);
     48                assertThat(framsticks.get("remote")).isInstanceOf(RemoteTree.class);
    4949
    5050                server = (Server) framsticks.get("test");
    51                 remote = (RemoteInstance) framsticks.get("remote");
    52                 assertThat(server.getHosted()).isInstanceOf(ObjectInstance.class);
    53                 hosted = (ObjectInstance) server.getHosted();
     51                remote = (RemoteTree) framsticks.get("remote");
     52                assertThat(server.getHosted()).isInstanceOf(ObjectTree.class);
     53                hosted = (ObjectTree) server.getHosted();
    5454                assertThat(hosted.getRootObject()).isInstanceOf(TestClass.class);
    5555                hostedObject = hosted.getRootObject(TestClass.class);
     
    5858        @Test(dependsOnMethods = "runServer")
    5959        public void fetchInfo() {
    60                 remote.dispatch(new RunAt<Instance>() {
     60                remote.dispatch(new RunAt<Tree>(failOnException) {
    6161                        @Override
    62                         public void run() {
    63                                 remote.fetchInfo(Path.to(remote, "/"), new Future<FramsClass>(failOnException()) {
     62                        protected void runAt() {
     63                                remote.info(Path.to(remote, "/"), new FutureHandler<FramsClass>(failOnException) {
    6464                                        @Override
    6565                                        protected void result(FramsClass result) {
     
    7878                final Waiter waiter = produceWaiter(1.0);
    7979
    80                 remote.dispatch(new RunAt<Instance>() {
     80                remote.dispatch(new RunAt<Tree>(failOnException) {
    8181                        @Override
    82                         public void run() {
     82                        protected void runAt() {
    8383                                final Path path = Path.to(remote, "/");
    8484                                assertThat(path.isResolved()).isFalse();
    8585
    86                                 remote.resolve(path, new Future<Path>(failOnException()) {
     86                                remote.resolve(path, new FutureHandler<Path>(failOnException) {
    8787                                        @Override
    8888                                        protected void result(final Path result) {
    8989                                                assertThat(result.isResolved()).isTrue();
    9090                                                remotePath = result;
    91                                                 remote.fetchValues(result, new AbstractStateFunctor(failOnException()) {
     91                                                remote.get(result, Mode.FETCH, new FutureHandler<Object>(failOnException) {
    9292                                                        @Override
    93                                                         public void call() {
     93                                                        protected void result(Object object) {
    9494                                                                AccessInterface access = bindAccess(result);
    9595                                                                assertThat(access).isInstanceOf(PropertiesAccess.class);
     
    108108                final Waiter waiter = produceWaiter(2.0);
    109109
    110                 storeValue(remotePath, remoteTestFramsClass.getParamEntry("name", ValueParam.class), "new name", new AbstractStateFunctor(failOnException()) {
     110                set(remotePath, remoteTestFramsClass.getParamEntry("name", PrimitiveParam.class), "new name", new FutureHandler<Integer>(failOnException) {
    111111                        @Override
    112                         public void call() {
     112                        protected void result(Integer flags) {
     113                                // assertThat(flags).isEqualTo(0);
    113114                                /** And now check directly whether it was really set. */
    114                                 hosted.dispatch(new RunAt<Instance>() {
     115                                hosted.dispatch(new RunAt<Tree>(failOnException) {
    115116                                        @Override
    116                                         public void run() {
     117                                        protected void runAt() {
    117118                                                assertThat(hostedObject.getName()).isEqualTo("new name");
    118119                                                waiter.pass();
     
    128129                final Waiter waiter = produceWaiter(2.0);
    129130
    130                 call(remotePath, remoteTestFramsClass.getParamEntry("resetHistory", ProcedureParam.class), new Object[] {}, new Future<Object>(failOnException()) {
     131                call(remotePath, remoteTestFramsClass.getParamEntry("resetHistory", ProcedureParam.class), new Object[] {}, new FutureHandler<Object>(failOnException) {
    131132                        @Override
    132133                        protected void result(Object result) {
     
    135136                });
    136137
    137                 call(remotePath, remoteTestFramsClass.getParamEntry("appendHistory", ProcedureParam.class), new Object[] {"next word"}, new Future<Object>(failOnException()) {
     138                call(remotePath, remoteTestFramsClass.getParamEntry("appendHistory", ProcedureParam.class), new Object[] {"next word"}, new FutureHandler<Object>(failOnException) {
    138139                        @Override
    139140                        protected void result(Object result) {
    140                                 hosted.dispatch(new RunAt<Instance>() {
     141                                hosted.dispatch(new RunAt<Tree>(failOnException) {
    141142                                        @Override
    142                                         public void run() {
     143                                        protected void runAt() {
    143144                                                assertThat(hostedObject.getHistory()).isEqualTo("next word|");
    144145                                                waiter.pass();
Note: See TracChangeset for help on using the changeset viewer.