• 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

36.36
/src/main/java/org/fiware/iam/tmforum/SubscriptionHealthIndicator.java
1
package org.fiware.iam.tmforum;
2

3
import io.micronaut.core.async.publisher.AsyncSingleResultPublisher;
4
import io.micronaut.health.HealthStatus;
5
import io.micronaut.management.health.indicator.HealthIndicator;
6
import io.micronaut.management.health.indicator.HealthResult;
7
import jakarta.inject.Singleton;
8
import org.reactivestreams.Publisher;
9

10
import java.util.LinkedHashMap;
11
import java.util.Map;
12
import java.util.Optional;
13

14
/**
15
 * Indicator to collect the existence of all configured subscriptions towards TMForum
16
 */
17
@Singleton
18
public class SubscriptionHealthIndicator implements HealthIndicator {
1✔
19

20
        private final Map<String, Boolean> registrationMap = new LinkedHashMap<>();
1✔
21

22
        @Override
23
        public Publisher<HealthResult> getResult() {
24

NEW
25
                HealthResult.Builder healthResultBuilder = HealthResult.builder("Subscription Health");
×
NEW
26
                Optional<Boolean> optionalUnhealthy = registrationMap.values().stream().filter(key -> !key).findAny();
×
NEW
27
                if (optionalUnhealthy.isPresent()) {
×
NEW
28
                        return new AsyncSingleResultPublisher<>(() -> healthResultBuilder.status(HealthStatus.DOWN).build());
×
29
                } else {
NEW
30
                        return new AsyncSingleResultPublisher<>(() -> healthResultBuilder.status(HealthStatus.UP).build());
×
31
                }
32
        }
33

34
        public void initiateSubscriptionInMap(String key) {
35
                registrationMap.put(key, false);
1✔
36
        }
1✔
37

38
        public void setSubscriptionHealthy(String key) {
NEW
39
                registrationMap.put(key, true);
×
NEW
40
        }
×
41

42
}
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