Changeset 88 for java/main/src/test/java


Ignore:
Timestamp:
06/30/13 12:48:20 (11 years ago)
Author:
psniegowski
Message:

HIGHLIGHTS:

  • loading f0 schema with XmlLoader?
  • use XmlLoader? to load configuration
  • introduce unified fork-join model of various entities

(Instances, Connections, GUI Frames, etc.),
all those entities clean up gracefully on
shutdown, which may be initialized by user
or by some entity

  • basing on above, simplify several organizing classes

(Observer, main class)

(to host native frams server process from Java level)

CHANGELOG:
Remove redundant Observer class.

Clean up in AbstractJoinable?.

Update ExternalProcess? class to changes in joining model.

Another sweep through code with FindBugs?.

Find bug with not joining RemoteInstance?.

Joining almost works.

Much improved joining model.

More improvement to joining model.

Add logging messages around joinable operations.

Rename methods in AbstractJoinable?.

Improve Joinable.

Rewrite of entity structure.

More simplifications with entities.

Further improve joinables.

Let Frame compose from JFrame instead of inheriting.

Add join classes.

Improvements of closing.

Add Builder interface.

Add FramsServerTest?.xml

FramsServer? may be configured through xml.

Make Framsticks main class an Observer of Entities.

Make Observer a generic type.

Remove variables regarding to removed endpoint.

Simplify observer (remove endpoints).

More changes to Observer and Endpoint.

Minor improvements.

Add OutputListener? to ExternalProcess?.

Improve testing of ExternalProcess?.

Add ExternalProcess? runner.

Rename the Program class to Framsticks.

Migrate Program to use XmlLoader? configuration.

First steps with configuration using XmlLoader?.

Fix several bugs.

Move all f0 classes to apriopriate package.

XmlLoader? is able to load Schema.

XmlLoader? is loading classes and props.

Add GroupBuilder?.

Location:
java/main/src/test/java/com/framsticks
Files:
6 added
2 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • java/main/src/test/java/com/framsticks/gui/BrowserTest.java

    r87 r88  
    33import javax.swing.JFrame;
    44
    5 import org.apache.commons.configuration.PropertiesConfiguration;
    65import org.apache.log4j.Logger;
    76import org.fest.swing.edt.FailOnThreadViolationRepaintManager;
     
    1615import com.framsticks.remote.RemoteInstance;
    1716import com.framsticks.test.TestConfiguration;
     17import com.framsticks.util.dispatching.Dispatching;
     18import com.framsticks.util.dispatching.JoinableMonitor;
     19// import com.framsticks.util.dispatching.Dispatching;
    1820
    1921import static org.fest.assertions.Assertions.*;
     
    2527        private static final Logger log = Logger.getLogger(BrowserTest.class);
    2628
     29        JoinableMonitor monitor;
    2730        Browser browser;
    2831        Robot robot;
     
    3740
    3841                browser = new Browser();
    39                 browser.configure(new PropertiesConfiguration());
     42                monitor = new JoinableMonitor(browser);
    4043
    4144                RemoteInstance localhost = new RemoteInstance();
     
    4346                localhost.setAddress("localhost:9009");
    4447
    45                 browser.addEndpointForInstance(localhost);
     48                browser.addInstance(localhost);
    4649
    47                 browser.start();
     50                monitor.use();
    4851                // robot.waitForIdle();
    4952                frame = new FrameFixture(robot,
     
    5154                                        @Override
    5255                                        protected JFrame executeInEDT() throws Throwable {
    53                                                 return browser.getMainFrame();
     56                                                return browser.getMainFrame().getSwing();
    5457                                        }
    5558                                }));
     
    8689                clickAndExpandPath(tree, "localhost/simulator/genepools/groups");
    8790                clickAndExpandPath(tree, "localhost/simulator/genepools/groups/Genotypes");
     91
     92
     93
     94
     95
     96
    8897                // tree.clickPath("localhost/simulator/genepools/groups/Genotypes/genotypes");
    8998                // robot.waitForIdle();
     
    97106        }
    98107
    99         public void sleep(int seconds) {
    100                 try {
    101                         Thread.sleep(seconds * 1000, 0);
    102                 } catch (InterruptedException e) {
    103                         e.printStackTrace();
    104                 }
    105         }
    106108
    107109        @AfterClass
    108110        public void tearDown() {
    109                 // frame.close();
    110                 frame.cleanUp();
     111                log.info("before close");
     112
     113                monitor.drop();
     114
     115                Dispatching.joinAbsolutely(browser);
     116                // frame.cleanUp();
     117                // log.info("before close");
     118                // browser.interrupt();
     119
     120                // try {
     121                //      // frame.close();
     122                // } catch (Throwable t) {
     123                //      log.error("caught ", t);
     124                // }
     125                // log.info("after close");
     126                // // frame.close();
     127                // // frame.cleanUp();
     128
     129
     130
     131                // Dispatching.join(browser);
    111132        }
    112133
  • java/main/src/test/java/com/framsticks/params/ParamBuilderTest.java

    r87 r88  
    2020                builderFramsClass = FramsClass.build().forClass(ParamBuilder.class);
    2121
    22                 assertThat(builderFramsClass.getParamCount()).isEqualTo(6);
     22                assertThat(builderFramsClass.getParamCount()).isEqualTo(10);
    2323                assertThat(builderFramsClass.getName()).isEqualTo("prop");
    2424                assertThat(builderFramsClass.getId()).isEqualTo("prop");
  • java/main/src/test/java/com/framsticks/parsers/F0ParserTest.java

    r87 r88  
    55import com.framsticks.model.*;
    66import com.framsticks.model.Package;
     7import com.framsticks.model.f0.Schema;
    78import com.framsticks.params.*;
    89import com.framsticks.params.types.FloatParam;
     
    2930        @BeforeClass
    3031        public void setUp() throws Exception {
    31                 schema = new Schema(Schema.getDefaultDefinitionAsStream());
     32                schema = Schema.load(Schema.getDefaultDefinitionAsStream());
    3233                Package.register(schema.getRegistry());
    3334        }
     
    3536        @Test
    3637        public void primitiveParam() {
    37                 FramsClass joint = schema.getRegistry().getInfoFromCache("j");
     38                FramsClass joint = schema.getFramsClass("j");
    3839                PrimitiveParam<?> dx = joint.getParamEntry("dx", PrimitiveParam.class);
    3940                assertThat(dx).isInstanceOf(FloatParam.class);
     
    4748        @Test
    4849        public void readF0() throws IOException, ParseException {
     50                assertThat(schema.getFramsClass("p")).isInstanceOf(FramsClass.class);
     51                assertThat(schema.getRegistry().getInfoFromCache("p").getParamEntry("as", FloatParam.class).getDef(Double.class)).isEqualTo(0.25, delta(0.0));
     52
    4953                accesses = new F0Parser(schema, F0ParserTest.class.getResourceAsStream("/parsers/f0_example.txt")).parse();
    5054
     
    7579                assertThat(model.getJoints().get(0).part1).isEqualTo(0);
    7680                assertThat(model.getJoints().get(0).part2).isEqualTo(1);
     81                assertThat(model.getNeuroDefs().size()).isEqualTo(6);
    7782                assertThat(model.getNeuroDefs().get(0).part).isEqualTo(1);
    7883                assertThat(model.getNeuroDefs().get(0).joint).isEqualTo(-1);
     
    8994        public void print() throws Exception {
    9095                ListSink sink = new ListSink();
     96
     97
    9198                new F0Writer(schema, model, sink).write();
    9299
  • java/main/src/test/java/com/framsticks/test/TestConfiguration.java

    r84 r88  
    1111
    1212        @BeforeClass
    13         public static void setUpConfiguration() {
     13        public void setUpConfiguration() {
    1414                PropertyConfigurator.configure(TestConfiguration.class.getResource("/log4j.properties"));
    15                 log.info("logging configured");
     15                log.info("testing " + this.getClass());
    1616        }
    1717
Note: See TracChangeset for help on using the changeset viewer.