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

wistefan / tmforum-api / #49

29 Sep 2023 06:20AM UTC coverage: 67.488% (-4.3%) from 71.815%
#49

push

web-flow
Notifications (#23)

* Squashed commits

* Added cache invalidation for entity deletion

* Updated error message

618 of 618 new or added lines in 86 files covered. (100.0%)

2794 of 4140 relevant lines covered (67.49%)

0.67 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/common/src/main/java/org/fiware/tmforum/common/caching/EntityIdKeyGenerator.java
1
package org.fiware.tmforum.common.caching;
2

3
import io.micronaut.cache.interceptor.CacheKeyGenerator;
4
import io.micronaut.core.annotation.AnnotationMetadata;
5
import lombok.extern.slf4j.Slf4j;
6
import org.fiware.ngsi.model.EntityVO;
7
import org.fiware.tmforum.common.exception.CachingException;
8

9
import java.net.URI;
10

11
/**
12
 * Generator for cache keys to be used for entity caches. It will use the entity-id as a cache-key.
13
 */
14
@Slf4j
×
15
public class EntityIdKeyGenerator implements CacheKeyGenerator {
×
16

17
        @Override
18
        public Object generateKey(AnnotationMetadata annotationMetadata, Object... params) {
19
                if (params.length < 1 || params.length > 2) {
×
20
                        throw new CachingException("No entity provided");
×
21
                }
22
                if (params.length == 1 && params[0] instanceof EntityVO entityVO) {
×
23
                        return entityVO.getId();
×
24
                } else if (params[0] instanceof URI) {
×
25
                        return params[0];
×
26
                }
27
                throw new CachingException(String.format("Key generator not supported for parameter type %s.", params[0].getClass()));
×
28
        }
29
}
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

© 2025 Coveralls, Inc