|
1 |
| package com.agical.rdoc.core.model.test.service; |
|
2 |
| |
|
3 |
| import java.io.OutputStream; |
|
4 |
| |
|
5 |
| import com.agical.rdoc.core.model.test.TestStructureBuilder; |
|
6 |
| import com.agical.rdoc.core.model.test.builder.TestStructureStreamBuilder; |
|
7 |
| import com.agical.rdoc.core.model.test.director.RMockEventTestStructureDirectorImpl; |
|
8 |
| import com.agical.rdoc.core.target.TargetProvider; |
|
9 |
| import com.agical.rmock.core.hub.Hub; |
|
10 |
| |
|
11 |
| |
|
12 |
| public class TestStructureServiceImpl implements TestStructureService { |
|
13 |
| private TargetProvider targetProvider = TargetProvider.NULL; |
|
14 |
| private RMockEventTestStructureDirectorImpl rMockEventTestStructureDirector; |
|
15 |
| private OutputStream os; |
|
16 |
| private TestStructureBuilder testStructureBuilder; |
|
17 |
| |
|
18 |
2
| public TestStructureServiceImpl() {
|
|
19 |
2
| super();
|
|
20 |
| |
|
21 |
| } |
|
22 |
| |
|
23 |
2
| TestStructureServiceImpl(Hub hub) {
|
|
24 |
2
| super();
|
|
25 |
| } |
|
26 |
| |
|
27 |
3
| public void beforeStructure(String name) {
|
|
28 |
3
| os = targetProvider.createRelativeOutputStream("teststructure.ser");
|
|
29 |
3
| testStructureBuilder = new TestStructureStreamBuilder(os);
|
|
30 |
3
| testStructureBuilder.begin(name);
|
|
31 |
3
| rMockEventTestStructureDirector = new RMockEventTestStructureDirectorImpl(testStructureBuilder);
|
|
32 |
| } |
|
33 |
| |
|
34 |
3
| public void beforeSuite(Object suite, String suiteName) {
|
|
35 |
3
| if( rMockEventTestStructureDirector == null ) {
|
|
36 |
0
| return;
|
|
37 |
| } |
|
38 |
3
| rMockEventTestStructureDirector.beforeSuite(suite, suiteName);
|
|
39 |
| } |
|
40 |
| |
|
41 |
3
| public void afterSuite() {
|
|
42 |
3
| if( rMockEventTestStructureDirector == null ) {
|
|
43 |
0
| return;
|
|
44 |
| } |
|
45 |
3
| rMockEventTestStructureDirector.afterSuite();
|
|
46 |
| } |
|
47 |
| |
|
48 |
239
| public void beforeTestCase(Object testInstance, String testName) {
|
|
49 |
239
| if( rMockEventTestStructureDirector == null ) {
|
|
50 |
0
| return;
|
|
51 |
| } |
|
52 |
239
| rMockEventTestStructureDirector.beforeTestCase(testInstance, testName);
|
|
53 |
| } |
|
54 |
| |
|
55 |
239
| public void afterTestCase() {
|
|
56 |
239
| if( rMockEventTestStructureDirector == null ) {
|
|
57 |
0
| return;
|
|
58 |
| } |
|
59 |
| |
|
60 |
239
| rMockEventTestStructureDirector.afterTestCase();
|
|
61 |
| } |
|
62 |
| |
|
63 |
3
| public void setTargetProvider(TargetProvider targetProvider) {
|
|
64 |
3
| this.targetProvider = targetProvider;
|
|
65 |
| } |
|
66 |
| |
|
67 |
3
| public void afterStructure() {
|
|
68 |
3
| testStructureBuilder.end();
|
|
69 |
| } |
|
70 |
| |
|
71 |
| |
|
72 |
| } |