-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
gh-85 Fix type of SolrShardingMetricsContainer#rawData Merge confirmed by @kerkhofsd
- Loading branch information
Showing
2 changed files
with
61 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...java/eu/xenit/alfred/telemetry/binder/solr/sharding/SolrShardingMetricsContainerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package eu.xenit.alfred.telemetry.binder.solr.sharding; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.contains; | ||
import static org.mockito.Mockito.when; | ||
|
||
import java.util.HashMap; | ||
import java.util.HashSet; | ||
import org.alfresco.repo.index.shard.Floc; | ||
import org.alfresco.repo.index.shard.Shard; | ||
import org.alfresco.repo.index.shard.ShardRegistry; | ||
import org.alfresco.repo.index.shard.ShardState; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.Mock; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
|
||
@ExtendWith(MockitoExtension.class) | ||
class SolrShardingMetricsContainerTest { | ||
|
||
@Mock | ||
private ShardRegistry shardRegistry; | ||
|
||
private SolrShardingMetricsContainer container; | ||
|
||
@BeforeEach | ||
void setup() { | ||
container = new SolrShardingMetricsContainer(shardRegistry); | ||
} | ||
|
||
@Test | ||
void refresh() { | ||
Floc floc = new Floc(); | ||
HashMap<Floc, HashMap<Shard, HashSet<ShardState>>> flocs = new HashMap<>(); | ||
flocs.put(floc, new HashMap<>()); | ||
when(shardRegistry.getFlocs()).thenReturn(flocs); | ||
|
||
container.refresh(); | ||
assertThat(container.getFlocs(), contains(floc)); | ||
} | ||
|
||
} |