+func TestMatchEventTypeAndFilters(t *testing.T) {
+ subId := "sub1"
+ apiIds := []string{"apiId"}
+ invokerIds := []string{"invokerId"}
+ aefId := "aefId"
+ aefIds := []string{aefId}
+ serviceUnderTest := NewEventService(nil)
+ serviceUnderTest.addSubscription(subId, eventsapi.EventSubscription{
+ Events: []eventsapi.CAPIFEvent{
+ eventsapi.CAPIFEventSERVICEAPIAVAILABLE,
+ },
+ EventFilters: &[]eventsapi.CAPIFEventFilter{
+ {
+ ApiIds: &apiIds,
+ ApiInvokerIds: &invokerIds,
+ AefIds: &aefIds,
+ },
+ },
+ })
+ serviceUnderTest.addSubscription("otherSameType", eventsapi.EventSubscription{
+ Events: []eventsapi.CAPIFEvent{
+ eventsapi.CAPIFEventACCESSCONTROLPOLICYUNAVAILABLE,
+ },
+ })
+ serviceUnderTest.addSubscription("other", eventsapi.EventSubscription{
+ Events: []eventsapi.CAPIFEvent{
+ eventsapi.CAPIFEventACCESSCONTROLPOLICYUNAVAILABLE,
+ },
+ })
+
+ event := eventsapi.EventNotification{
+ Events: eventsapi.CAPIFEventACCESSCONTROLPOLICYUNAVAILABLE,
+ }
+
+ // Only match type
+ matchingSubs := serviceUnderTest.getMatchingSubs(event)
+ assert.Len(t, matchingSubs, 2)
+
+ // Match with all filter ids
+ aefProfiles := []publishserviceapi.AefProfile{