diff options
Diffstat (limited to 'vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/OperationHandlerImplTest.java')
-rw-r--r-- | vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/OperationHandlerImplTest.java | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/OperationHandlerImplTest.java b/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/OperationHandlerImplTest.java index 374c91c13d3..e98e6babf84 100644 --- a/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/OperationHandlerImplTest.java +++ b/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/OperationHandlerImplTest.java @@ -107,7 +107,7 @@ public class OperationHandlerImplTest { VisitorControlHandler.CompletionCode completionCode = VisitorControlHandler.CompletionCode.SUCCESS; int bucketsVisited = 0; Map<String, String> bucketSpaces = new HashMap<>(); - SyncSession mockSyncSession = mock(MessageBusSyncSession.class); // MBus session needed to avoid setRoute throwing. + MessageBusSyncSession mockSyncSession = mock(MessageBusSyncSession.class); // MBus session needed to avoid setRoute throwing. OperationHandlerImplFixture() { bucketSpaces.put("foo", "global"); @@ -317,6 +317,25 @@ public class OperationHandlerImplTest { } @Test + public void get_route_has_default_value_if_no_cluster_is_provided() throws Exception { + OperationHandlerImplFixture fixture = new OperationHandlerImplFixture(); + OperationHandlerImpl handler = fixture.createHandler(); + handler.get(dummyGetUri(), Optional.empty(), Optional.empty()); + + // TODO shouldn't this be default-get? + verify(fixture.mockSyncSession).setRoute(eq("default")); + } + + @Test + public void provided_get_cluster_is_propagated_as_route_to_sync_session() throws Exception { + OperationHandlerImplFixture fixture = new OperationHandlerImplFixture(); + OperationHandlerImpl handler = fixture.createHandler(); + handler.get(dummyGetUri(), Optional.empty(), Optional.of("foo")); + + verify(fixture.mockSyncSession).setRoute(eq("[Storage:cluster=foo;clusterconfigid=configId]")); + } + + @Test public void api_root_visit_uri_requires_cluster_set() throws Exception { OperationHandlerImplFixture fixture = new OperationHandlerImplFixture(); OperationHandlerImpl handler = fixture.createHandler(); |