source: java/main/src/test/java/com/framsticks/model/f0/SchemaTest.java @ 105

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

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 size: 1.5 KB
Line 
1package com.framsticks.model.f0;
2
3import org.testng.annotations.*;
4
5import com.framsticks.params.FramsClass;
6import com.framsticks.params.types.FloatParam;
7import com.framsticks.test.TestConfiguration;
8import com.framsticks.model.f0.Schema;
9
10import static org.fest.assertions.Delta.*;
11
12import static org.fest.assertions.Assertions.*;
13import static com.framsticks.params.ParamsUtil.getParam;
14
15public class SchemaTest extends TestConfiguration {
16
17        @Test
18        public void loadSchemaWithXmlLoader() {
19                Schema schema = new SchemaBuilder().stream(Schema.getDefaultDefinitionAsStream()).finish();
20                assertThat(schema.getFramsClasses().size()).isEqualTo(5);
21                assertThat(schema.getNeuroClasses().size()).isEqualTo(21);
22
23                assertThat(schema.getFramsClass("m").getName()).isEqualTo("Model");
24
25                assertThat(schema.getNeuroClass("|").getName()).isEqualTo("Bend muscle");
26                assertThat(getParam(schema.getNeuroClass("VEye"), "p")).isInstanceOf(FloatParam.class);
27                assertThat(getParam(schema.getNeuroClass("VEye"), "p", FloatParam.class).getMax(Double.class)).isEqualTo(10.0, delta(0.0));
28
29                FramsClass partClass = schema.getFramsClass("p");
30                assertThat(partClass).isNotNull();
31                assertThat(getParam(partClass, "as", FloatParam.class).getDef(Double.class)).isEqualTo(0.25, delta(0.0));
32                assertThat(partClass.getGroupCount()).isEqualTo(3);
33                assertThat(partClass.getGroup(1).getName()).isEqualTo("Other properties");
34                assertThat(partClass.getGroup(1).getCount()).isEqualTo(7);
35                assertThat(partClass.getGroup(1).getParam(2)).isEqualTo(partClass.getParam("dn"));
36        }
37
38}
Note: See TracBrowser for help on using the repository browser.