source: java/main/src/test/java/com/framsticks/gui/ProcedureBrowserTest.java @ 97

Last change on this file since 97 was 97, checked in by psniegowski, 11 years ago

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 size: 3.0 KB
Line 
1
2package com.framsticks.gui;
3
4import static org.fest.assertions.Assertions.assertThat;
5
6import org.fest.swing.fixture.JPanelFixture;
7import org.testng.annotations.Test;
8
9import com.framsticks.core.Tree;
10import com.framsticks.core.ObjectTree;
11import com.framsticks.params.AccessInterface;
12import com.framsticks.params.FramsClass;
13import com.framsticks.params.ReflectionAccess;
14import com.framsticks.params.types.StringParam;
15import com.framsticks.parsers.XmlLoader;
16import com.framsticks.test.TestClass;
17// import com.framsticks.util.dispatching.Dispatching;
18import com.framsticks.util.dispatching.RunAt;
19import static com.framsticks.core.TreeOperations.*;
20
21@Test
22public class ProcedureBrowserTest extends BrowserBaseTest {
23
24        ObjectTree tree;
25
26        @Override
27        protected void configureBrowser() {
28                browser = new XmlLoader().load(Browser.class, getClass().getResourceAsStream("/configs/ProcedureBrowserTest.xml"));
29
30                assertThat(browser.getTrees().size()).isEqualTo(1);
31                assertThat(browser.getTrees().get("test")).isInstanceOf(ObjectTree.class);
32
33                tree = (ObjectTree) browser.getTrees().get("test");
34        }
35
36        @Test(timeOut = 10000)
37        public void testShow() {
38                tree.dispatch(new RunAt<Tree>(failOnException) {
39                        @Override
40                        protected void runAt() {
41                                assertThat(tree.getRootObject()).isInstanceOf(TestClass.class);
42                        }
43                });
44
45                clickAndExpandPath("test");
46
47                tree.dispatch(new RunAt<Tree>(failOnException) {
48                        @Override
49                        protected void runAt() {
50                                assertThat(bindAccess(tree, "/").getFramsClass().getParam("history")).isInstanceOf(StringParam.class);
51                        }
52                });
53
54                // monitor.useFor(4.0);
55
56                tree.dispatch(new RunAt<Tree>(failOnException) {
57                        @Override
58                        protected void runAt() {
59                                AccessInterface access = bindAccess(tree, "/");
60                                assertThat(access).isInstanceOf(ReflectionAccess.class);
61                                FramsClass framsClass = access.getFramsClass();
62                                assertThat(framsClass.getParamCount()).isEqualTo(4);
63                                assertThat(framsClass.getParam(0).getId()).isEqualTo("name");
64                                assertThat(framsClass.getParam(1).getId()).isEqualTo("history");
65                                assertThat(framsClass.getParam(2).getId()).isEqualTo("appendHistory");
66                                assertThat(framsClass.getParam(3).getId()).isEqualTo("resetHistory");
67
68                                assertThat(access.get("history", String.class)).isEqualTo("initial|");
69                        }
70                });
71
72                // frame.panel("TestClass");
73                final JPanelFixture appendHistory = frame.panel("TestClass").panel("appendHistory");
74                appendHistory.panel("arg0").textBox("value").enterText("Żółw");
75                assertThat(appendHistory.panel("arg0").textBox("value").text()).isEqualTo("Żółw");
76                clickButton(appendHistory.button("call"));
77                waitForIdle();
78
79
80                tree.dispatch(new RunAt<Tree>(failOnException) {
81                        @Override
82                        protected void runAt() {
83                                assertThat(bindAccess(tree, "/").get("history", String.class)).isEqualTo("initial|Żółw|");
84                        }
85                });
86
87                clickButton(frame.panel("TestClass").panel("resetHistory").button("call"));
88                waitForIdle();
89
90                tree.dispatch(new RunAt<Tree>(failOnException) {
91                        @Override
92                        protected void runAt() {
93                                assertThat(bindAccess(tree, "/").get("history", String.class)).isEqualTo("");
94                        }
95                });
96        }
97}
Note: See TracBrowser for help on using the repository browser.