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

FIWARE / contract-management / #69

30 Oct 2025 07:38AM UTC coverage: 1.686% (+0.04%) from 1.651%
#69

Pull #12

wistefan
improve organization creation and cleanup
Pull Request #12: Support for central marketplace and policy creation

117 of 1238 new or added lines in 31 files covered. (9.45%)

5 existing lines in 2 files now uncovered.

587 of 34807 relevant lines covered (1.69%)

0.02 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)
NEW
21
@Slf4j
×
22
@Controller("${general.basepath:/}")
23
@RequiredArgsConstructor
24
public class NotificationListener {
25

26
    public static final String EVENT_TYPE_KEY = "eventType";
27

28
    private final List<TMForumEventHandler> eventHandlers;
29

30
    @Post("/listener/event")
31
    public Mono<HttpResponse<?>> listenToEvent(@Body Map<String, Object> event) {
NEW
32
        log.debug("Received an Event: {}", event);
×
NEW
33
        if (!event.containsKey(EVENT_TYPE_KEY)) {
×
NEW
34
            throw new IllegalArgumentException("Data did not contain the eventType.");
×
35
        }
36

NEW
37
        if (event.get(EVENT_TYPE_KEY) instanceof String eventType) {
×
NEW
38
            return eventHandlers.stream()
×
NEW
39
                    .filter(handler -> handler.isEventTypeSupported(eventType))
×
NEW
40
                    .findAny()
×
NEW
41
                    .orElseThrow(() -> new IllegalArgumentException("Event type %s is not supported.".formatted(eventType)))
×
NEW
42
                    .handleEvent(eventType, event)
×
NEW
43
                    .doOnNext(r -> log.debug("Returned {} for {}", r, eventType));
×
44
        }
NEW
45
        throw new IllegalArgumentException("Event type is invalid.");
×
46
    }
47
}
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