• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

FIWARE / contract-management / #26

28 Jan 2025 10:59AM UTC coverage: 0.982% (-0.6%) from 1.629%
#26

push

web-flow
Merge pull request #3 from FIWARE/tpp-integration

Tpp integration

99 of 500 new or added lines in 14 files covered. (19.8%)

4 existing lines in 3 files now uncovered.

281 of 28625 relevant lines covered (0.98%)

0.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/org/fiware/iam/tmforum/NotificationListener.java
1
package org.fiware.iam.tmforum;
2

3
import io.micronaut.http.HttpResponse;
4
import io.micronaut.http.annotation.Body;
5
import io.micronaut.http.annotation.Controller;
6
import io.micronaut.http.annotation.Get;
7
import io.micronaut.http.annotation.Post;
8
import lombok.RequiredArgsConstructor;
9
import lombok.extern.slf4j.Slf4j;
10
import org.fiware.iam.tmforum.handlers.EventHandler;
11
import reactor.core.publisher.Mono;
12

13
import java.util.List;
14
import java.util.Map;
15

UNCOV
16
@Slf4j
×
17
@Controller("${general.basepath:/}")
18
@RequiredArgsConstructor
19
public class NotificationListener {
20

21
        public static final String EVENT_TYPE_KEY = "eventType";
22

23
        private final List<EventHandler> eventHandlers;
24

25
        @Post("listener/event")
26
        public Mono<HttpResponse<?>> listenToEvent(@Body Map<String, Object> event) {
NEW
27
                log.info("Received an Event: {}", event);
×
NEW
28
                if (!event.containsKey(EVENT_TYPE_KEY)) {
×
NEW
29
                        throw new IllegalArgumentException("Data did not contain the eventType.");
×
30
                }
31

NEW
32
                if (event.get(EVENT_TYPE_KEY) instanceof String eventType) {
×
NEW
33
                        return eventHandlers.stream()
×
NEW
34
                                        .filter(handler -> handler.isEventTypeSupported(eventType))
×
NEW
35
                                        .findAny()
×
NEW
36
                                        .orElseThrow(() -> new IllegalArgumentException("Event type %s is not supported.".formatted(eventType)))
×
NEW
37
                                        .handleEvent(eventType, event);
×
38
                }
NEW
39
                throw new IllegalArgumentException("Event type is invalid.");
×
40
        }
41
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc