Changeset 100 for java/main/src/test


Ignore:
Timestamp:
07/12/13 23:41:06 (11 years ago)
Author:
psniegowski
Message:

HIGHLIGHTS:

  • add <include/> to configuration
  • add side notes to tree
    • used to store arbitrary information alongside the tree structure
  • migrate to log4j2
    • supports lazy string evaluation of passed arguments
  • improve GUI tree
    • it stays in synchronization with actual state (even in high load test scenario)
  • improve panel management in GUI
  • make loading objects in GUI more lazy
  • offload parsing to connection receiver thread
    • info parsing
    • first step of objects parsing
  • fix connection parsing bug (eof in long values)
  • support zero-arguments procedure in table view

CHANGELOG:
Implement procedure calls from table view.

Refactorization around procedures in tables.

Add table editor for buttons.

Render buttons in the the list view.

Further improve Columns.

Add Column class for TableModel?.

Accept also non-arguments ProcedureParams? in tableView.

Increase maximal TextAreaControl? size.

Add tooltip to ProcedureControl?.

Fix bug of interpreting eofs in long values by connection reader.

Further rework connection parsing.

Simplify client connection processing.

Test ListChange? modification.

Test ListChange? events with java server.

Add TestChild?.

Fix bug with fast deregistering when connecting to running server.

Another minor refactorization in TreeOperations?.

Fix bug in SimpleAbstractAccess? loading routine.

Another minor improvement.

Minor change.

Make reading of List objects two-phase.

Another minor change.

Dispatch parsing into receiver thread.

Another step.

Enclose passing value in ObjectParam? case in closure.

Minor step.

Minor change on way to offload parsing.

Temporarily comment out single ValueParam? get.

It will be generalized to multi ValueParam?.

Process info in receiver thread.

Add DispatchingExceptionHandler?.

Make waits in browser test longer.

Use FETCHED_MARK.

It is honored in GUI, where it used to decide whether to get values

after user action.

It is set in standard algorithm for processing fetched values.

Add remove operation to side notes.

Make loading more lazy.

Improve loading policy.

On node choose load itself, on node expansion, load children.

Minor improvement.

Fix bug with panel interleaving.

Minor improvements.

Improve panel management.

More cleaning around panels.

Reorganize panels.

Further improve tree.

Fix bug in TreeModel?.

Remove children from TreeNode?.

Implement TreeNode? hashCode and equals.

Make TreeNode? delegate equals and hashcode to internal reference.

Move listeners from TreeNode? to side notes.

Store path.textual as a side note.

Side note params instead of accesses for objects.

More refactorizations.

In TreeNode? bindAccess based on side notes.

Minor step.

Hide createAccess.

Rename AccessInterface? to Access.

Minor changes.

Several improvements in high load scenarios.

Change semantics of ArrayListAccess?.set(index, null);

It now removes the element, making list shorter
(it was set to null before).

Add path remove handler.

Handle exceptions in Connection.

Update .gitignore

Configure logging to file.

Move registration to TreeModel?.

Further refactorization.

Minor refactorization.

Minor improvements.

Use specialized event also for Modify action of ListChange?.

Use remove events.

Use the insertion events for tree.

Further improve tree refreshing.

Further improve reacting on events in GUI.

Fix problem with not adding objects on addition list change.

Migrate to log4j lazy String construction interface.

Migrate imports to log4j2.

Drop dependency on adapter to version 1.2.

Switch log4j implementation to log4j2.

Add dirty mark to the NodeAtFrame?.

Make selecting in AccessInterfaces? type safe.

Ignore containers size settings in Model and Genotype.

Use tree side notes to remember local changes and panels.

Add sideNotes to tree.

They will be used to store various accompanying information
right in the tree.

Use ReferenceIdentityMap? from apache in TreeNode?.

It suits the need perfectly (weak semantics on both key and value).

Make ArrayListParam? do not react size changes.

Guard in TableModel? before not yet loaded objects.

Add <include/> clause and AutoInjector?.

Extract common columns configuration to separate xml,
that can be included by other configurations.

Location:
java/main/src/test
Files:
1 added
1 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • java/main/src/test/java/com/framsticks/core/ListChangeTest.java

    r87 r100  
    11package com.framsticks.core;
     2
     3import java.util.Arrays;
    24
    35import org.testng.annotations.BeforeMethod;
     
    68import com.framsticks.core.ListChange.Action;
    79import com.framsticks.params.FramsClass;
     10import com.framsticks.params.ListSink;
    811import com.framsticks.params.ListSource;
    912import com.framsticks.params.ReflectionAccess;
     
    5760        @Test(dependsOnMethods = "createReflectionAccess")
    5861        public void load() throws Exception {
    59                 access.select(listChange).load(ListSource.createFrom("type:2", "pos:5", "id:test"));
     62                access.select(listChange).load(ListSource.createFrom("type:2", "pos:0", "id:test"));
    6063
    6164                assertThat(listChange.action).isEqualTo(Action.Modify);
    62                 assertThat(listChange.position).isEqualTo(5);
     65                assertThat(listChange.position).isEqualTo(0);
    6366                assertThat(listChange.identifier).isEqualTo("test");
     67
     68                ListSink sink = new ListSink();
     69                access.select(listChange).save(sink);
     70                assertThat(sink.getOut()).isEqualTo(Arrays.asList("ListChange:", "type:2", "pos:0", "id:test", ""));
    6471        }
    6572
  • java/main/src/test/java/com/framsticks/core/LocalTreeTest.java

    r99 r100  
    1616import com.framsticks.util.dispatching.Monitor;
    1717import com.framsticks.util.dispatching.RunAt;
    18 import com.framsticks.params.AccessInterface;
     18import com.framsticks.params.Access;
    1919import com.framsticks.params.ReflectionAccess;
    2020import com.framsticks.params.types.FloatParam;
     
    7272                                Path path = Path.to(tree, "/");
    7373                                assertThat(path.isResolved());
    74                                 AccessInterface access = TreeOperations.bindAccess(path);
     74                                Access access = TreeOperations.bindAccess(path);
    7575                                assertThat(access.get("se", Double.class)).isEqualTo(1.0);
    7676
  • java/main/src/test/java/com/framsticks/dumping/StreamTest.java

    r97 r100  
    1616                //                              public void result(Path result, Exception e) {
    1717                //                                      if (e != null) {
    18                 //                                              log.error("failed to load file: " + e);
     18                //                                              log.error("failed to load file: {}", e);
    1919                //                                              fireRun(e);
    2020                //                                              return;
     
    2626                //                      stream.load();
    2727                //              } catch (IOException e) {
    28                 //                      log.error("io failure: " + e);
     28                //                      log.error("io failure: {}", e);
    2929                //                      fireRun(e);
    3030                //              }
  • java/main/src/test/java/com/framsticks/gui/BrowserBaseTest.java

    r99 r100  
    33import javax.swing.JFrame;
    44
    5 import org.apache.log4j.Logger;
     5import org.apache.logging.log4j.Logger;
     6import org.apache.logging.log4j.LogManager;
    67import org.fest.swing.edt.GuiQuery;
    78import org.fest.swing.fixture.FrameFixture;
     
    1819public abstract class BrowserBaseTest extends GuiTest {
    1920
    20         private static final Logger log = Logger.getLogger(BrowserTest.class);
     21        private static final Logger log = LogManager.getLogger(BrowserTest.class);
    2122
    2223        protected Browser browser;
     
    5253                Dispatching.sleep(2.0);
    5354                tree.expandPath(path);
     55                Dispatching.sleep(2.0);
    5456                robot.waitForIdle();
    5557        }
  • java/main/src/test/java/com/framsticks/gui/BrowserTest.java

    r99 r100  
    77
    88
    9 import org.apache.log4j.Logger;
     9import org.apache.logging.log4j.Logger;
     10import org.apache.logging.log4j.LogManager;
    1011import org.fest.swing.edt.GuiTask;
    1112import org.testng.annotations.Test;
     
    1718public class BrowserTest extends BrowserBaseTest {
    1819
    19         private static final Logger log = Logger.getLogger(BrowserTest.class);
     20        private static final Logger log = LogManager.getLogger(BrowserTest.class);
    2021
    2122        RemoteTree localhost;
     
    3435        }
    3536
    36         @Test(timeOut = 30000)
     37        @Test(timeOut = 60000)
    3738        public void testShow() {
    3839                Dispatching.synchronize(localhost, 1.0);
  • java/main/src/test/java/com/framsticks/gui/LocalTreeBrowserTest.java

    r99 r100  
    2929        }
    3030
    31         @Test(timeOut = 10000)
     31        @Test(timeOut = 30000)
    3232        public void testShow() {
    3333                tree.dispatch(new RunAt<Tree>(failOnException) {
  • java/main/src/test/java/com/framsticks/gui/ProcedureBrowserTest.java

    r99 r100  
    1010import com.framsticks.core.Tree;
    1111import com.framsticks.core.LocalTree;
    12 import com.framsticks.params.AccessInterface;
     12import com.framsticks.params.Access;
    1313import com.framsticks.params.EventListener;
    1414import com.framsticks.params.FramsClass;
     
    6262                        @Override
    6363                        protected void runAt() {
    64                                 AccessInterface access = bindAccess(tree, "/");
     64                                Access access = bindAccess(tree, "/");
    6565                                assertThat(access).isInstanceOf(ReflectionAccess.class);
    6666                                FramsClass framsClass = access.getFramsClass();
    67                                 assertThat(framsClass.getParamCount()).isEqualTo(5);
    6867                                assertThat(framsClass.getParam(0).getId()).isEqualTo("name");
    6968                                assertThat(framsClass.getParam(1).getId()).isEqualTo("history");
     
    9493                        @Override
    9594                        protected void runAt() {
    96                                 AccessInterface access = bindAccess(tree, "/");
     95                                Access access = bindAccess(tree, "/");
    9796                                assertThat(access.get("history", String.class)).isEqualTo("initial|Żółw|");
    9897
     
    107106                        @Override
    108107                        protected void runAt() {
    109                                 AccessInterface access = bindAccess(tree, "/");
     108                                Access access = bindAccess(tree, "/");
    110109                                assertThat(access.get("history", String.class)).isEqualTo("");
    111110
  • java/main/src/test/java/com/framsticks/hosting/ServerTest.java

    r99 r100  
    88import org.testng.annotations.Test;
    99
     10import com.framsticks.core.ListChange;
    1011import com.framsticks.core.LocalTree;
    1112import com.framsticks.core.Path;
     
    1819import com.framsticks.core.Tree;
    1920import com.framsticks.params.FramsClass;
    20 import com.framsticks.params.AccessInterface;
     21import com.framsticks.params.Access;
    2122import com.framsticks.params.EventListener;
    2223import com.framsticks.params.PrimitiveParam;
    2324import com.framsticks.params.PropertiesAccess;
    2425import com.framsticks.params.types.EventParam;
     26import com.framsticks.params.types.StringParam;
    2527// import com.framsticks.params.types.EventParam;
    2628import com.framsticks.params.types.ProcedureParam;
     
    4446        protected TestClass hostedObject;
    4547        protected EventListener<ChangeEvent> listener;
     48        protected EventListener<ListChange> childListener;
     49
    4650        protected List<String> listenerArguments = new LinkedList<>();
     51        protected List<ListChange> childrenChanges = new LinkedList<>();
     52
    4753
    4854        @Override
     
    9096                                assertThat(path.isResolved()).isTrue();
    9197                                remotePath = path;
    92                                 AccessInterface access = bindAccess(path);
     98                                Access access = bindAccess(path);
    9399                                assertThat(access).isInstanceOf(PropertiesAccess.class);
    94100                                assertThat(access.get("name", String.class)).isEqualTo("a test name");
     
    167173        }
    168174
    169         @Test(dependsOnMethods = "callMethod")
     175
     176        @Test(dependsOnMethods = "deregisterListener")
     177        public void registerChildListener() {
     178
     179                childListener = new EventListener<ListChange>() {
     180                        @Override
     181                        public void action(ListChange listChange) {
     182                                childrenChanges.add(listChange);
     183                        }
     184                };
     185
     186                addListener(remotePath, remoteTestFramsClass.getParamEntry("children_changed", EventParam.class), childListener, ListChange.class, produceWaiter(1.0).passInFuture(Void.class));
     187        }
     188
     189        @Test(dependsOnMethods = "registerChildListener")
     190        public void createChild() {
     191                final Waiter waiter = produceWaiter(2.0);
     192                call(remotePath, "createChild", new Object[] { "a child" }, produceWaiter(2.0).passInFuture(Object.class));
     193                call(remotePath, "createChild", new Object[] { "another child" }, produceWaiter(2.0).passInFuture(Object.class));
     194
     195                tryGet(remote, "/testClass/children/c0", new FutureHandler<Path>(failOnException) {
     196
     197                        @Override
     198                        protected void result(Path result) {
     199                                set(result, getFramsClass(result).getParamEntry("name", StringParam.class), "new_name", new FutureHandler<Integer>(failOnException) {
     200
     201                                        @Override
     202                                        protected void result(Integer result) {
     203                                                waiter.pass();
     204                                        }
     205                                });
     206                        }
     207                });
     208        }
     209
     210        @Test(dependsOnMethods = "createChild")
     211        public void deregisterChildListener() {
     212                removeListener(remotePath, remoteTestFramsClass.getParamEntry("children_changed", EventParam.class), childListener, produceWaiter(1.0).passInFuture(Void.class));
     213        }
     214
     215        @Test(dependsOnMethods = "deregisterChildListener")
     216        public void checkListChanges() {
     217                assertThat(childrenChanges).isEqualTo(Arrays.asList(
     218                        new ListChange(ListChange.Action.Add, 0, "c0"),
     219                        new ListChange(ListChange.Action.Add, 1, "c1"),
     220                        new ListChange(ListChange.Action.Modify, 0, "c0")
     221                ));
     222        }
     223
     224        @Test(dependsOnMethods = "checkListChanges")
    170225        public void endWait() {
    171226                monitor.useFor(1.0);
  • java/main/src/test/java/com/framsticks/model/ModelPackageTest.java

    r90 r100  
    2121        @Test(dataProvider = "classesList")
    2222        public void testFramsClass(Class<?> javaClass, String name, int paramCount, Object[][] paramsTests) throws InstantiationException, IllegalAccessException {
    23                 // log.info("testing " + name + " " + javaClass + " " + Package.class.getResource(filename));
    2423                String filename = "/info/" + name + ".info";
    2524                InputStream stream = ModelPackage.class.getResourceAsStream(filename);
  • java/main/src/test/java/com/framsticks/params/FramsClassBuilderTest.java

    r99 r100  
    3434        @Test
    3535        public void checkProcedureParams() {
    36                 assertThat(framsClass.getParamCount()).isEqualTo(5);
     36                assertThat(framsClass.getParamCount()).isEqualTo(8);
    3737
    3838                assertThat(framsClass.getParam("name")).isInstanceOf(StringParam.class);
     
    8080                                        "name:ResetHistory",
    8181                                        "type:p()",
     82                                        "",
     83                                        "prop:",
     84                                        "id:children",
     85                                        "name:Children",
     86                                        "type:l TestChild uid",
     87                                        "flags:1",
     88                                        "",
     89                                        "prop:",
     90                                        "id:createChild",
     91                                        "name:CreateChild",
     92                                        "type:p(s arg0)",
     93                                        "",
     94                                        "prop:",
     95                                        "id:children_changed",
     96                                        "name:ChildrenListener",
     97                                        "type:e ListChange",
    8298                                        ""
    8399                                )
  • java/main/src/test/java/com/framsticks/params/ParamBuilderTest.java

    r96 r100  
    1414        ParamBuilder builder;
    1515        FramsClass builderFramsClass;
    16         AccessInterface access;
     16        Access access;
    1717
    1818        @Test
     
    3434                MultiParamLoader loader = new MultiParamLoader();
    3535                loader.setNewSource(source);
    36                 loader.addAccessInterface(access);
     36                loader.addAccess(access);
    3737                loader.addBreakCondition(MultiParamLoader.Status.AfterObject);
    3838
  • java/main/src/test/java/com/framsticks/parsers/F0ParserTest.java

    r90 r100  
    2424
    2525        private Schema schema;
    26         private List<AccessInterface> accesses;
     26        private List<Access> accesses;
    2727        private List<ModelComponent> components;
    2828        private Model model;
     
    7272
    7373        @Test(dependsOnMethods = {"readF0"})
    74         public void stripAccessInterface() {
    75                 components = Util.stripAccessInterface(accesses, ModelComponent.class);
     74        public void stripAccess() {
     75                components = Util.stripAccess(accesses, ModelComponent.class);
    7676
    7777                assertThat(components.get(1)).isInstanceOf(Part.class);
     
    8181        }
    8282
    83         @Test(dependsOnMethods = {"stripAccessInterface"})
     83        @Test(dependsOnMethods = {"stripAccess"})
    8484        public void buildModel() {
    8585                model = new ModelBuilder().addComponents(components).finish();
  • java/main/src/test/java/com/framsticks/test/TestConfiguration.java

    r99 r100  
    66import java.util.Set;
    77
    8 import org.apache.log4j.Logger;
    9 import org.apache.log4j.PropertyConfigurator;
     8import org.apache.logging.log4j.Logger;
     9import org.apache.logging.log4j.LogManager;
    1010import org.testng.annotations.*;
    1111
     
    2121public class TestConfiguration {
    2222
    23         private static final Logger log = Logger.getLogger(TestConfiguration.class);
     23        private static final Logger log = LogManager.getLogger(TestConfiguration.class);
    2424
    2525        @BeforeClass
    2626        public void setUpConfiguration() {
    27                 PropertyConfigurator.configure(TestConfiguration.class.getResource("/log4j.properties"));
    28                 log.info("testing " + this.getClass());
     27                log.info("testing {}", this.getClass());
    2928        }
    3029
     
    8685        @BeforeMethod
    8786        public void clearWaiters() {
    88                 waiters.clear();
     87                synchronized (waiters) {
     88                        waiters.clear();
     89                }
    8990        }
    9091
    9192        protected Dispatching.Waiter produceWaiter(double timeOut) {
    9293                Waiter waiter = new Waiter(timeOut, failOnException);
    93                 waiters.add(waiter);
     94                synchronized (waiters) {
     95                        waiters.add(waiter);
     96                }
    9497                return waiter;
    9598        }
     
    98101                @Override
    99102                public void handle(FramsticksException e) {
    100                         log.error("passing exception as assertion in " + TestConfiguration.this.getClass(), e);
     103                        log.error("passing exception as assertion in {}", TestConfiguration.this.getClass(), e);
    101104                        addAsyncAssertion(e);
    102105                }
Note: See TracChangeset for help on using the changeset viewer.