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

FIWARE / contract-management / #104

01 Oct 2026 07:34AM UTC coverage: 4.489% (+0.7%) from 3.796%
#104

Pull #28

vramperez
Remove unused exception constructors, explain the handler defer

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Pull Request #28: Add failure reasons, downstream error descriptions and configurable log output

218 of 379 new or added lines in 33 files covered. (57.52%)

9 existing lines in 6 files now uncovered.

1606 of 35773 relevant lines covered (4.49%)

0.04 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/notification/NotificationListener.java
1
package org.fiware.iam.tmforum.notification;
2

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

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

17
/**
18
 * Listener endpoint for TMForum notifications
19
 */
20
@Requires(condition = NotificationProperties.NotificationCondition.class)
21
@Slf4j
×
22
@Controller("${general.basepath:/}")
23
@RequiredArgsConstructor
24
public class NotificationListener {
25

26
    public static final String EVENT_TYPE_KEY = "eventType";
27
    private static final String EVENT_ID_KEY = "eventId";
28

29
    private final List<TMForumEventHandler> eventHandlers;
30

31
    @Post("/listener/event")
32
    public Mono<HttpResponse<?>> listenToEvent(@Body Map<String, Object> event) {
33
        log.debug("Received an Event: {}", event);
×
34
        if (!event.containsKey(EVENT_TYPE_KEY)) {
×
NEW
35
            throw new IllegalArgumentException("The notification does not contain an eventType, it contains only %s.".formatted(event.keySet()));
×
36
        }
37

38
        if (event.get(EVENT_TYPE_KEY) instanceof String eventType) {
×
NEW
39
            log.info("Received {} notification {}.", eventType, event.getOrDefault(EVENT_ID_KEY, "without eventId"));
×
40
            return eventHandlers.stream()
×
41
                    .filter(handler -> handler.isEventTypeSupported(eventType))
×
42
                    .findAny()
×
43
                    .orElseThrow(() -> new IllegalArgumentException("Event type %s is not supported.".formatted(eventType)))
×
44
                    .handleEvent(eventType, event)
×
NEW
45
                    .doOnNext(r -> log.debug("Answered {} with {}.", eventType, r.getStatus().getCode()));
×
46
        }
NEW
47
        throw new IllegalArgumentException("The eventType of the notification is not a string, but %s.".formatted(event.get(EVENT_TYPE_KEY)));
×
48
    }
49
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc