-func TestMatchesApiIds(t *testing.T) {
- apiId := "apiId"
- apiIds := []string{apiId, "otherApiId"}
- eventFilters := []eventsapi.CAPIFEventFilter{
- {},
- {
- ApiIds: &apiIds,
+func TestMatchEventTypeAndFilters(t *testing.T) {
+ notificationUrl := "url"
+ subId := "sub1"
+ apiIds := []string{"apiId"}
+ invokerIds := []string{"invokerId"}
+ serviceUnderTest := NewEventService(nil)
+ serviceUnderTest.addSubscription(subId, eventsapi.EventSubscription{
+ Events: []eventsapi.CAPIFEvent{
+ eventsapi.CAPIFEventSERVICEAPIAVAILABLE,
+ },
+ NotificationDestination: common29122.Uri(notificationUrl),
+ EventFilters: &[]eventsapi.CAPIFEventFilter{
+ {
+ ApiIds: &apiIds,
+ ApiInvokerIds: &invokerIds,
+ },
+ },
+ })
+ serviceUnderTest.addSubscription("other", eventsapi.EventSubscription{
+ Events: []eventsapi.CAPIFEvent{
+ eventsapi.CAPIFEventACCESSCONTROLPOLICYUNAVAILABLE,
+ },
+ NotificationDestination: common29122.Uri(notificationUrl),
+ })
+
+ event := eventsapi.EventNotification{
+ Events: eventsapi.CAPIFEventSERVICEAPIAVAILABLE,
+ EventDetail: &eventsapi.CAPIFEventDetail{
+ ApiIds: &apiIds,
+ ApiInvokerIds: &invokerIds,