]> gerrit.simantics Code Review - simantics/platform.git/blob
7b86380183c7fbf2a231c17547dac3195171c52e
[simantics/platform.git] /
1 package org.simantics.modeling.tests.cases;
2
3 import org.simantics.db.testing.base.CommandList;
4 import org.simantics.db.testing.base.CommandListImpl;
5 import org.simantics.db.testing.base.CommandSequenceTest;
6 import org.simantics.db.testing.common.Command;
7 import org.simantics.db.testing.common.CommandSequenceEnvironment;
8 import org.simantics.diagram.stubs.DiagramResource;
9 import org.simantics.modeling.tests.commands.CollectMemory;
10 import org.simantics.modeling.tests.commands.WaitActiveExperiment;
11 import org.simantics.modeling.tests.commands.WaitMapping;
12 import org.simantics.modeling.tests.commands.WriteHeapDump;
13
14 public class ModelingCommandSequenceTest extends CommandSequenceTest {
15
16         protected WaitActiveExperiment waitExperiment = new WaitActiveExperiment();
17         protected WaitMapping waitMapping = new WaitMapping();
18         protected CollectMemory collectMemory = new CollectMemory();
19         protected WriteHeapDump heapDump = new WriteHeapDump(getClass().getSimpleName()+ ".hprof");
20
21         protected DiagramResource DIA;
22
23         @Override
24         protected void initialize(CommandSequenceEnvironment environment) throws Exception {
25                 
26                 DIA = DiagramResource.getInstance(environment.getSession());
27                 
28         }
29         
30         protected void createBeforeSequence(CommandList result) throws Exception {
31         }
32
33         protected void createAfterSequence(CommandList result) throws Exception {
34         }
35
36         protected void createSequence(CommandList result) throws Exception {
37         }
38
39         @Override
40         protected Command[] beforeSequence(CommandSequenceEnvironment environment) throws Exception {
41                 CommandListImpl result = new CommandListImpl();
42                 createBeforeSequence(result);
43                 return result.toArray();
44         }
45
46         
47         @Override
48         protected Command[] newSequence() throws Exception {
49                 CommandListImpl result = new CommandListImpl();
50                 createSequence(result);
51                 return result.toArray();
52         }
53
54
55         @Override
56         protected Command[] afterSequence(CommandSequenceEnvironment environment) throws Exception {
57                 CommandListImpl result = new CommandListImpl();
58                 createAfterSequence(result);
59                 return result.toArray();
60         }
61         
62 }