Skip to content

Commit

Permalink
Fix SubUpdaterTest.
Browse files Browse the repository at this point in the history
Signed-off-by: Yufei Cai <yufei.cai@bosch.io>
  • Loading branch information
yufei-cai committed Jul 27, 2022
1 parent 33c60ee commit 5b7d8fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Expand Up @@ -24,7 +24,7 @@
/**
* This class is the default implementation of the distributed data config.
*/
final class DefaultDistributedDataConfig implements DistributedDataConfig {
public final class DefaultDistributedDataConfig implements DistributedDataConfig {

private static final String CONFIG_PATH = "ddata";

Expand Down
Expand Up @@ -22,6 +22,8 @@
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;

import org.eclipse.ditto.internal.utils.ddata.DefaultDistributedDataConfig;
import org.eclipse.ditto.internal.utils.ddata.DistributedDataConfig;
import org.eclipse.ditto.internal.utils.pubsub.api.SubAck;
import org.eclipse.ditto.internal.utils.pubsub.api.Subscribe;
import org.eclipse.ditto.internal.utils.pubsub.config.PubSubConfig;
Expand Down Expand Up @@ -180,7 +182,8 @@ private static ActorRef mockActorRefWithAddress(final ActorRef originalRef, fina
}

@SuppressWarnings({"rawtypes", "unchecked"})
private static CompressedDData mockDistributedData(final Map<ActorRef, String> result) {
private CompressedDData mockDistributedData(final Map<ActorRef, String> result) {
final DistributedDataConfig ddataConfig = DefaultDistributedDataConfig.of(getTestConf().getConfig("ditto"));
final ORMultiMap map = Mockito.mock(ORMultiMap.class);
Mockito.when(map.getEntries()).thenReturn(result);
final var mock = Mockito.mock(CompressedDData.class);
Expand All @@ -189,6 +192,7 @@ private static CompressedDData mockDistributedData(final Map<ActorRef, String> r
Mockito.when(mock.getReader()).thenReturn(reader);
Mockito.when(mock.getWriter()).thenReturn(writer);
Mockito.when(mock.getSeeds()).thenReturn(List.of(1, 2));
Mockito.when(mock.getConfig()).thenReturn(ddataConfig);
Mockito.when(reader.get(any(), any())).thenReturn(CompletableFuture.completedStage(Optional.of(map)));
Mockito.when(reader.getAllShards(any())).thenReturn(CompletableFuture.completedStage(List.of(map)));
Mockito.when(writer.put(any(), any(), any())).thenReturn(CompletableFuture.completedStage(null));
Expand Down

0 comments on commit 5b7d8fd

Please sign in to comment.