InfinispanSpanCache implements SpanCache, ServiceLifecycle { @Override public Set<Span> getChildren(String tenant, String id) { if (id == null) { throw new NullPointerException("Id should not be null!"); } Set<Span> children = childrenCache.get(id); return children == null ? null : Collections.unmodifiableSet(children); } InfinispanSpanCache();  InfinispanSpanCache(CacheContainer cacheContainer); @Override @PostConstruct void init(); @Override Span get(String tenantId, String id); @Override void store(String tenantId, List<Span> spans); @Override void store(String tenantId, List<Span> spans, Function<Span, String> cacheKeyEntrySupplier); @Override Set<Span> getChildren(String tenant, String id); @Override Set<Span> getTrace(String tenant, String id);  }
@Test public void testGetChildren() throws CacheException { Span parent = new Span(); parent.setId("parent"); storeOne(spanCache, parent); Span childServerSpan = new Span(null, serverAnnotations()); childServerSpan.setId("child1"); childServerSpan.setParentId("parent"); storeOne(spanCache, childServerSpan); Span childClientSpan = new Span(null, clientAnnotations()); childClientSpan.setId("child2"); childClientSpan.setParentId("parent"); storeOne(spanCache, childClientSpan); Span childClientSpan2 = new Span(); childClientSpan2.setId("child3"); childClientSpan2.setParentId("parent"); storeOne(spanCache, childClientSpan2); Assert.assertEquals(new HashSet<>(Arrays.asList(childClientSpan, childClientSpan2)), new HashSet<>(spanCache.getChildren(null, parent.getId()))); }
@Test public void testGetChildrenEmpty() { Assert.assertNull(spanCache.getChildren(null, "id")); }