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

FIWARE / contract-management / #68

29 Oct 2025 11:26AM UTC coverage: 1.686% (+0.04%) from 1.651%
#68

Pull #12

wistefan
fixes from pr review
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/dsp/RainbowCatalogHandler.java
1
package org.fiware.iam.dsp;
2

3
import io.micronaut.context.annotation.Requires;
4
import io.micronaut.http.HttpResponse;
5
import io.micronaut.http.HttpStatus;
6
import jakarta.inject.Singleton;
7
import lombok.RequiredArgsConstructor;
8
import lombok.extern.slf4j.Slf4j;
9
import org.fiware.iam.configuration.GeneralProperties;
10
import org.fiware.iam.handlers.CatalogHandler;
11
import org.fiware.iam.tmforum.productcatalog.model.CatalogVO;
12
import org.fiware.rainbow.api.CatalogApiClient;
13
import org.fiware.rainbow.model.NewCatalogVO;
14
import reactor.core.publisher.Mono;
15

16
/**
17
 * Handler to manage catalog events and exchange them with Rainbow.
18
 */
19
@Requires(condition = GeneralProperties.RainbowCondition.class)
20
@RequiredArgsConstructor
21
@Singleton
NEW
22
@Slf4j
×
23
public class RainbowCatalogHandler implements CatalogHandler {
24

25
    private final CatalogApiClient catalogApiClient;
26
    private final RainbowMapper rainbowMapper;
27

28
    @Override
29
    public Mono<HttpResponse<?>> handleCatalogCreation(CatalogVO catalogVO) {
NEW
30
        NewCatalogVO rainbowCatalog = rainbowMapper.map(catalogVO);
×
NEW
31
        return catalogApiClient.createCatalog(rainbowCatalog)
×
NEW
32
                .onErrorMap(t -> new IllegalArgumentException("Was not able create the catalog %s".formatted(rainbowCatalog), t))
×
NEW
33
                .map(HttpResponse::ok);
×
34
    }
35

36
    @Override
37
    public Mono<HttpResponse<?>> handleCatalogStateChange(CatalogVO catalogVO) {
NEW
38
        return catalogApiClient.updateCatalogById(catalogVO.getId(), rainbowMapper.map(catalogVO)).map(res -> {
×
NEW
39
            if (res.getStatus().getCode() >= 200 && res.getStatus().getCode() < 300) {
×
NEW
40
                return HttpResponse.noContent();
×
41
            }
NEW
42
            return HttpResponse.status(HttpStatus.BAD_GATEWAY);
×
43
        });
44
    }
45

46
    @Override
47
    public Mono<HttpResponse<?>> handleCatalogDeletion(CatalogVO catalogVO) {
NEW
48
        return catalogApiClient.deleteCatalogById(catalogVO.getId()).map(res -> {
×
NEW
49
            if (res.getStatus().getCode() >= 200 && res.getStatus().getCode() < 300) {
×
NEW
50
                return HttpResponse.noContent();
×
51
            }
NEW
52
            return HttpResponse.status(HttpStatus.BAD_GATEWAY);
×
53
        });
54
    }
55
}
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