Changeset 100 for java/main/src/test
- Timestamp:
- 07/12/13 23:41:06 (11 years ago)
- 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 1 1 package com.framsticks.core; 2 3 import java.util.Arrays; 2 4 3 5 import org.testng.annotations.BeforeMethod; … … 6 8 import com.framsticks.core.ListChange.Action; 7 9 import com.framsticks.params.FramsClass; 10 import com.framsticks.params.ListSink; 8 11 import com.framsticks.params.ListSource; 9 12 import com.framsticks.params.ReflectionAccess; … … 57 60 @Test(dependsOnMethods = "createReflectionAccess") 58 61 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")); 60 63 61 64 assertThat(listChange.action).isEqualTo(Action.Modify); 62 assertThat(listChange.position).isEqualTo( 5);65 assertThat(listChange.position).isEqualTo(0); 63 66 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", "")); 64 71 } 65 72 -
java/main/src/test/java/com/framsticks/core/LocalTreeTest.java
r99 r100 16 16 import com.framsticks.util.dispatching.Monitor; 17 17 import com.framsticks.util.dispatching.RunAt; 18 import com.framsticks.params.Access Interface;18 import com.framsticks.params.Access; 19 19 import com.framsticks.params.ReflectionAccess; 20 20 import com.framsticks.params.types.FloatParam; … … 72 72 Path path = Path.to(tree, "/"); 73 73 assertThat(path.isResolved()); 74 Access Interfaceaccess = TreeOperations.bindAccess(path);74 Access access = TreeOperations.bindAccess(path); 75 75 assertThat(access.get("se", Double.class)).isEqualTo(1.0); 76 76 -
java/main/src/test/java/com/framsticks/dumping/StreamTest.java
r97 r100 16 16 // public void result(Path result, Exception e) { 17 17 // if (e != null) { 18 // log.error("failed to load file: " +e);18 // log.error("failed to load file: {}", e); 19 19 // fireRun(e); 20 20 // return; … … 26 26 // stream.load(); 27 27 // } catch (IOException e) { 28 // log.error("io failure: " +e);28 // log.error("io failure: {}", e); 29 29 // fireRun(e); 30 30 // } -
java/main/src/test/java/com/framsticks/gui/BrowserBaseTest.java
r99 r100 3 3 import javax.swing.JFrame; 4 4 5 import org.apache.log4j.Logger; 5 import org.apache.logging.log4j.Logger; 6 import org.apache.logging.log4j.LogManager; 6 7 import org.fest.swing.edt.GuiQuery; 7 8 import org.fest.swing.fixture.FrameFixture; … … 18 19 public abstract class BrowserBaseTest extends GuiTest { 19 20 20 private static final Logger log = Log ger.getLogger(BrowserTest.class);21 private static final Logger log = LogManager.getLogger(BrowserTest.class); 21 22 22 23 protected Browser browser; … … 52 53 Dispatching.sleep(2.0); 53 54 tree.expandPath(path); 55 Dispatching.sleep(2.0); 54 56 robot.waitForIdle(); 55 57 } -
java/main/src/test/java/com/framsticks/gui/BrowserTest.java
r99 r100 7 7 8 8 9 import org.apache.log4j.Logger; 9 import org.apache.logging.log4j.Logger; 10 import org.apache.logging.log4j.LogManager; 10 11 import org.fest.swing.edt.GuiTask; 11 12 import org.testng.annotations.Test; … … 17 18 public class BrowserTest extends BrowserBaseTest { 18 19 19 private static final Logger log = Log ger.getLogger(BrowserTest.class);20 private static final Logger log = LogManager.getLogger(BrowserTest.class); 20 21 21 22 RemoteTree localhost; … … 34 35 } 35 36 36 @Test(timeOut = 30000)37 @Test(timeOut = 60000) 37 38 public void testShow() { 38 39 Dispatching.synchronize(localhost, 1.0); -
java/main/src/test/java/com/framsticks/gui/LocalTreeBrowserTest.java
r99 r100 29 29 } 30 30 31 @Test(timeOut = 10000)31 @Test(timeOut = 30000) 32 32 public void testShow() { 33 33 tree.dispatch(new RunAt<Tree>(failOnException) { -
java/main/src/test/java/com/framsticks/gui/ProcedureBrowserTest.java
r99 r100 10 10 import com.framsticks.core.Tree; 11 11 import com.framsticks.core.LocalTree; 12 import com.framsticks.params.Access Interface;12 import com.framsticks.params.Access; 13 13 import com.framsticks.params.EventListener; 14 14 import com.framsticks.params.FramsClass; … … 62 62 @Override 63 63 protected void runAt() { 64 Access Interfaceaccess = bindAccess(tree, "/");64 Access access = bindAccess(tree, "/"); 65 65 assertThat(access).isInstanceOf(ReflectionAccess.class); 66 66 FramsClass framsClass = access.getFramsClass(); 67 assertThat(framsClass.getParamCount()).isEqualTo(5);68 67 assertThat(framsClass.getParam(0).getId()).isEqualTo("name"); 69 68 assertThat(framsClass.getParam(1).getId()).isEqualTo("history"); … … 94 93 @Override 95 94 protected void runAt() { 96 Access Interfaceaccess = bindAccess(tree, "/");95 Access access = bindAccess(tree, "/"); 97 96 assertThat(access.get("history", String.class)).isEqualTo("initial|Żółw|"); 98 97 … … 107 106 @Override 108 107 protected void runAt() { 109 Access Interfaceaccess = bindAccess(tree, "/");108 Access access = bindAccess(tree, "/"); 110 109 assertThat(access.get("history", String.class)).isEqualTo(""); 111 110 -
java/main/src/test/java/com/framsticks/hosting/ServerTest.java
r99 r100 8 8 import org.testng.annotations.Test; 9 9 10 import com.framsticks.core.ListChange; 10 11 import com.framsticks.core.LocalTree; 11 12 import com.framsticks.core.Path; … … 18 19 import com.framsticks.core.Tree; 19 20 import com.framsticks.params.FramsClass; 20 import com.framsticks.params.Access Interface;21 import com.framsticks.params.Access; 21 22 import com.framsticks.params.EventListener; 22 23 import com.framsticks.params.PrimitiveParam; 23 24 import com.framsticks.params.PropertiesAccess; 24 25 import com.framsticks.params.types.EventParam; 26 import com.framsticks.params.types.StringParam; 25 27 // import com.framsticks.params.types.EventParam; 26 28 import com.framsticks.params.types.ProcedureParam; … … 44 46 protected TestClass hostedObject; 45 47 protected EventListener<ChangeEvent> listener; 48 protected EventListener<ListChange> childListener; 49 46 50 protected List<String> listenerArguments = new LinkedList<>(); 51 protected List<ListChange> childrenChanges = new LinkedList<>(); 52 47 53 48 54 @Override … … 90 96 assertThat(path.isResolved()).isTrue(); 91 97 remotePath = path; 92 Access Interfaceaccess = bindAccess(path);98 Access access = bindAccess(path); 93 99 assertThat(access).isInstanceOf(PropertiesAccess.class); 94 100 assertThat(access.get("name", String.class)).isEqualTo("a test name"); … … 167 173 } 168 174 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") 170 225 public void endWait() { 171 226 monitor.useFor(1.0); -
java/main/src/test/java/com/framsticks/model/ModelPackageTest.java
r90 r100 21 21 @Test(dataProvider = "classesList") 22 22 public void testFramsClass(Class<?> javaClass, String name, int paramCount, Object[][] paramsTests) throws InstantiationException, IllegalAccessException { 23 // log.info("testing " + name + " " + javaClass + " " + Package.class.getResource(filename));24 23 String filename = "/info/" + name + ".info"; 25 24 InputStream stream = ModelPackage.class.getResourceAsStream(filename); -
java/main/src/test/java/com/framsticks/params/FramsClassBuilderTest.java
r99 r100 34 34 @Test 35 35 public void checkProcedureParams() { 36 assertThat(framsClass.getParamCount()).isEqualTo( 5);36 assertThat(framsClass.getParamCount()).isEqualTo(8); 37 37 38 38 assertThat(framsClass.getParam("name")).isInstanceOf(StringParam.class); … … 80 80 "name:ResetHistory", 81 81 "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", 82 98 "" 83 99 ) -
java/main/src/test/java/com/framsticks/params/ParamBuilderTest.java
r96 r100 14 14 ParamBuilder builder; 15 15 FramsClass builderFramsClass; 16 Access Interfaceaccess;16 Access access; 17 17 18 18 @Test … … 34 34 MultiParamLoader loader = new MultiParamLoader(); 35 35 loader.setNewSource(source); 36 loader.addAccess Interface(access);36 loader.addAccess(access); 37 37 loader.addBreakCondition(MultiParamLoader.Status.AfterObject); 38 38 -
java/main/src/test/java/com/framsticks/parsers/F0ParserTest.java
r90 r100 24 24 25 25 private Schema schema; 26 private List<Access Interface> accesses;26 private List<Access> accesses; 27 27 private List<ModelComponent> components; 28 28 private Model model; … … 72 72 73 73 @Test(dependsOnMethods = {"readF0"}) 74 public void stripAccess Interface() {75 components = Util.stripAccess Interface(accesses, ModelComponent.class);74 public void stripAccess() { 75 components = Util.stripAccess(accesses, ModelComponent.class); 76 76 77 77 assertThat(components.get(1)).isInstanceOf(Part.class); … … 81 81 } 82 82 83 @Test(dependsOnMethods = {"stripAccess Interface"})83 @Test(dependsOnMethods = {"stripAccess"}) 84 84 public void buildModel() { 85 85 model = new ModelBuilder().addComponents(components).finish(); -
java/main/src/test/java/com/framsticks/test/TestConfiguration.java
r99 r100 6 6 import java.util.Set; 7 7 8 import org.apache.log 4j.Logger;9 import org.apache.log 4j.PropertyConfigurator;8 import org.apache.logging.log4j.Logger; 9 import org.apache.logging.log4j.LogManager; 10 10 import org.testng.annotations.*; 11 11 … … 21 21 public class TestConfiguration { 22 22 23 private static final Logger log = Log ger.getLogger(TestConfiguration.class);23 private static final Logger log = LogManager.getLogger(TestConfiguration.class); 24 24 25 25 @BeforeClass 26 26 public void setUpConfiguration() { 27 PropertyConfigurator.configure(TestConfiguration.class.getResource("/log4j.properties")); 28 log.info("testing " + this.getClass()); 27 log.info("testing {}", this.getClass()); 29 28 } 30 29 … … 86 85 @BeforeMethod 87 86 public void clearWaiters() { 88 waiters.clear(); 87 synchronized (waiters) { 88 waiters.clear(); 89 } 89 90 } 90 91 91 92 protected Dispatching.Waiter produceWaiter(double timeOut) { 92 93 Waiter waiter = new Waiter(timeOut, failOnException); 93 waiters.add(waiter); 94 synchronized (waiters) { 95 waiters.add(waiter); 96 } 94 97 return waiter; 95 98 } … … 98 101 @Override 99 102 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); 101 104 addAsyncAssertion(e); 102 105 }
Note: See TracChangeset
for help on using the changeset viewer.