24
24
import org .junit .Before ;
25
25
import org .junit .runner .RunWith ;
26
26
import org .mockito .Mock ;
27
- import org .slf4j .Logger ;
28
- import org .slf4j .LoggerFactory ;
29
27
import org .springframework .beans .factory .annotation .Autowired ;
30
28
import org .springframework .boot .test .context .SpringBootTest ;
31
29
import org .springframework .http .HttpStatus ;
35
33
import java .io .IOException ;
36
34
import java .net .URL ;
37
35
import java .util .ArrayList ;
36
+ import java .util .HashMap ;
37
+ import java .util .List ;
38
+ import java .util .Map ;
38
39
39
40
import static org .mockito .Mockito .*;
40
41
41
42
@ RunWith (SpringJUnit4ClassRunner .class )
42
43
@ SpringBootTest
43
44
public class FlowTest extends FlowTestBase {
44
- private static Logger log = LoggerFactory .getLogger (FlowTest .class );
45
45
46
- private static String upStreamResultFile = "upStreamResultFile.json" ;
46
+ private static final String UPSTREAM_RESULT_FILE = "upStreamResultFile.json" ;
47
+ private static final String RULES_FILE_PATH = "src/test/resources/ArtifactRules_new.json" ;
48
+ private static final String EVENTS_FILE_PATH = "src/test/resources/test_events.json" ;
49
+ private static final String AGGREGATED_OBJECT_FILE_PATH = "src/test/resources/AggregatedDocumentInternalComposition.json" ;
50
+ private static final String AGGREGATED_OBJECT_ID = "6acc3c87-75e0-4b6d-88f5-b1a5d4e62b43" ;
47
51
48
52
@ Autowired
49
53
private UpStreamEventsHandler upStreamEventsHandler ;
@@ -54,20 +58,30 @@ public class FlowTest extends FlowTestBase {
54
58
@ Before
55
59
public void before () throws IOException {
56
60
upStreamEventsHandler .setEventRepositoryQueryService (erQueryService );
57
- inputFilePath = "src/test/resources/AggregatedDocumentInternalComposition.json" ;
58
61
59
- final URL upStreamResult = this .getClass ().getClassLoader ().getResource (upStreamResultFile );
62
+ final URL upStreamResult = this .getClass ().getClassLoader ().getResource (UPSTREAM_RESULT_FILE );
60
63
ObjectMapper objectMapper = new ObjectMapper ();
61
64
ObjectNode objectNode = objectMapper .createObjectNode ();
62
65
objectNode .set ("upstreamLinkObjects" , objectMapper .readTree (upStreamResult ));
63
66
objectNode .set ("downstreamLinkObjects" , objectMapper .createArrayNode ());
64
67
65
- when (erQueryService .getEventStreamDataById (anyString (), any (SearchOption .class ), anyInt (), anyInt (),
66
- anyBoolean ())) .thenReturn (new ResponseEntity <>(objectNode , HttpStatus .OK ));
68
+ when (erQueryService .getEventStreamDataById (anyString (), any (SearchOption .class ), anyInt (), anyInt (), anyBoolean ()))
69
+ .thenReturn (new ResponseEntity <>(objectNode , HttpStatus .OK ));
67
70
}
68
71
69
- protected ArrayList <String > getEventNamesToSend () {
70
- ArrayList <String > eventNames = new ArrayList <>();
72
+ @ Override
73
+ String setRulesFilePath () {
74
+ return RULES_FILE_PATH ;
75
+ }
76
+
77
+ @ Override
78
+ String setEventsFilePath () {
79
+ return EVENTS_FILE_PATH ;
80
+ }
81
+
82
+ @ Override
83
+ List <String > setEventNamesToSend () {
84
+ List <String > eventNames = new ArrayList <>();
71
85
eventNames .add ("event_EiffelConfidenceLevelModifiedEvent_3_2" );
72
86
eventNames .add ("event_EiffelArtifactPublishedEvent_3" );
73
87
eventNames .add ("event_EiffelArtifactCreatedEvent_3" );
@@ -79,7 +93,13 @@ protected ArrayList<String> getEventNamesToSend() {
79
93
eventNames .add ("event_EiffelTestCaseTriggeredEvent_3_1" );
80
94
eventNames .add ("event_EiffelTestCaseStartedEvent_3_1" );
81
95
eventNames .add ("event_EiffelTestCaseFinishedEvent_3_1" );
82
-
83
96
return eventNames ;
84
97
}
98
+
99
+ @ Override
100
+ Map <String , String > setCheckInfo () {
101
+ Map <String , String > checkInfo = new HashMap <>();
102
+ checkInfo .put (AGGREGATED_OBJECT_ID , AGGREGATED_OBJECT_FILE_PATH );
103
+ return checkInfo ;
104
+ }
85
105
}
0 commit comments