• 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/OrganizationResolver.java
1
package org.fiware.iam.tmforum;
2

3
import io.micronaut.http.HttpResponse;
4
import io.micronaut.http.HttpStatus;
5
import jakarta.inject.Singleton;
6
import lombok.RequiredArgsConstructor;
7
import lombok.extern.slf4j.Slf4j;
8
import org.fiware.iam.exception.TMForumException;
9
import org.fiware.iam.tmforum.party.api.OrganizationApiClient;
10
import org.fiware.iam.tmforum.party.model.CharacteristicVO;
11
import org.fiware.iam.tmforum.party.model.OrganizationVO;
12
import reactor.core.publisher.Mono;
13

14
import java.util.Collection;
15
import java.util.stream.Stream;
16

17
@Singleton
UNCOV
18
@Slf4j
×
19
@RequiredArgsConstructor
20
public class OrganizationResolver {
21
        private static final String PARTY_CHARACTERISTIC_DID = "did";
22
        private static final String FIELD_NAME_PARTY_CHARACTERISTIC = "partyCharacteristic";
23

24
        private final OrganizationApiClient apiClient;
25

26

27
        //TODO Cache me if you can
28
        public Mono<String> getDID(String organizationId) {
NEW
29
                return apiClient.retrieveOrganization(organizationId, FIELD_NAME_PARTY_CHARACTERISTIC)
×
NEW
30
                                .filter(response -> response.getStatus().equals(HttpStatus.OK))
×
NEW
31
                                .map(HttpResponse::body)
×
NEW
32
                                .map(OrganizationVO::getPartyCharacteristic)
×
NEW
33
                                .map(l ->
×
NEW
34
                                                l.stream()
×
NEW
35
                                                                .filter(entry -> PARTY_CHARACTERISTIC_DID.equals(entry.getName()))
×
NEW
36
                                                                .map(CharacteristicVO::getValue)
×
NEW
37
                                                                .filter(e -> e instanceof String)
×
NEW
38
                                                                .map(e -> (String) e)
×
NEW
39
                                                                .findAny()
×
NEW
40
                                                                .orElseThrow(() -> new TMForumException("Could not find organizations DID (%s) in response.".formatted(organizationId)))
×
41
                                );
42
        }
43
}
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