summaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorHarald Musum <musum@yahoo-inc.com>2017-07-28 11:07:09 +0200
committerHarald Musum <musum@yahoo-inc.com>2017-07-28 11:07:09 +0200
commite97ac3f26481a5fc6a26b7fc9f17d4ae90141c9b (patch)
treed88461e8f8dad52a7267b62164fe986c1bbadf35 /configserver
parent5d8194bbc41bdb478af58f4bd8542617dca23446 (diff)
Minor refactoring of tests
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/ConfigServerBootstrapTest.java4
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/InjectedGlobalComponentRegistryTest.java3
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/SessionHandlerTest.java55
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationContentHandlerTest.java2
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java6
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ListApplicationsHandlerTest.java9
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionActiveHandlerTest.java59
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionContentHandlerTest.java2
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionCreateHandlerTest.java26
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java155
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/TenantHandlerTest.java27
11 files changed, 180 insertions, 168 deletions
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/ConfigServerBootstrapTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/ConfigServerBootstrapTest.java
index ec42f1130e4..49085971609 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/ConfigServerBootstrapTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/ConfigServerBootstrapTest.java
@@ -12,8 +12,8 @@ import com.yahoo.vespa.config.server.application.HttpProxy;
import com.yahoo.vespa.config.server.application.LogServerLogGrabber;
import com.yahoo.vespa.config.server.deploy.MockDeployer;
import com.yahoo.vespa.config.server.host.HostRegistries;
+import com.yahoo.vespa.config.server.http.SessionHandlerTest;
import com.yahoo.vespa.config.server.http.SimpleHttpFetcher;
-import com.yahoo.vespa.config.server.http.v2.SessionActiveHandlerTest;
import com.yahoo.vespa.config.server.monitoring.Metrics;
import com.yahoo.vespa.config.server.provision.HostProvisionerProvider;
import com.yahoo.vespa.config.server.rpc.UncompressedConfigResponseFactory;
@@ -56,7 +56,7 @@ public class ConfigServerBootstrapTest extends TestWithTenant {
tenants.writeTenantPath(tenant2);
applicationRepository = new ApplicationRepository(tenants,
- HostProvisionerProvider.withProvisioner(new SessionActiveHandlerTest.MockProvisioner()),
+ HostProvisionerProvider.withProvisioner(new SessionHandlerTest.MockProvisioner()),
curator,
new LogServerLogGrabber(),
new ApplicationConvergenceChecker(),
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/InjectedGlobalComponentRegistryTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/InjectedGlobalComponentRegistryTest.java
index 899089ae8cb..1f6744dcad7 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/InjectedGlobalComponentRegistryTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/InjectedGlobalComponentRegistryTest.java
@@ -9,6 +9,7 @@ import com.yahoo.config.provision.Zone;
import com.yahoo.vespa.config.server.application.PermanentApplicationPackage;
import com.yahoo.vespa.config.server.host.ConfigRequestHostLivenessTracker;
import com.yahoo.vespa.config.server.host.HostRegistries;
+import com.yahoo.vespa.config.server.http.SessionHandlerTest;
import com.yahoo.vespa.config.server.http.v2.SessionActiveHandlerTest;
import com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry;
import com.yahoo.vespa.config.server.monitoring.Metrics;
@@ -65,7 +66,7 @@ public class InjectedGlobalComponentRegistryTest {
defRepo = new StaticConfigDefinitionRepo();
permanentApplicationPackage = new PermanentApplicationPackage(configserverConfig);
hostRegistries = new HostRegistries();
- hostProvisionerProvider = HostProvisionerProvider.withProvisioner(new SessionActiveHandlerTest.MockProvisioner());
+ hostProvisionerProvider = HostProvisionerProvider.withProvisioner(new SessionHandlerTest.MockProvisioner());
zone = Zone.defaultZone();
globalComponentRegistry = new InjectedGlobalComponentRegistry(curator, configCurator, metrics, modelFactoryRegistry, serverDB, sessionPreparer, rpcServer, configserverConfig, generationCounter, defRepo, permanentApplicationPackage, hostRegistries, hostProvisionerProvider, zone);
}
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/SessionHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/SessionHandlerTest.java
index 448b2db2b71..2c677441c68 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/SessionHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/SessionHandlerTest.java
@@ -7,6 +7,12 @@ import com.yahoo.config.application.api.ApplicationPackage;
import com.yahoo.config.application.api.DeployLogger;
import com.yahoo.config.model.application.provider.FilesApplicationPackage;
import com.yahoo.config.model.test.MockApplicationPackage;
+import com.yahoo.config.provision.Capacity;
+import com.yahoo.config.provision.ClusterSpec;
+import com.yahoo.config.provision.HostFilter;
+import com.yahoo.config.provision.HostSpec;
+import com.yahoo.config.provision.ProvisionLogger;
+import com.yahoo.config.provision.Provisioner;
import com.yahoo.io.IOUtils;
import com.yahoo.transaction.NestedTransaction;
import com.yahoo.transaction.Transaction;
@@ -24,6 +30,8 @@ import com.yahoo.vespa.config.server.session.*;
import java.io.*;
import java.time.Instant;
+import java.util.Collection;
+import java.util.List;
import java.util.Optional;
/**
@@ -210,5 +218,52 @@ public class SessionHandlerTest {
}
}
+ public static class MockProvisioner implements Provisioner {
+ public boolean activated = false;
+ public boolean removed = false;
+ public boolean restarted = false;
+ public ApplicationId lastApplicationId;
+ public Collection<HostSpec> lastHosts;
+
+ @Override
+ public List<HostSpec> prepare(ApplicationId applicationId, ClusterSpec cluster, Capacity capacity, int groups, ProvisionLogger logger) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void activate(NestedTransaction transaction, ApplicationId application, Collection<HostSpec> hosts) {
+ transaction.commit();
+ activated = true;
+ lastApplicationId = application;
+ lastHosts = hosts;
+ }
+
+ @Override
+ public void remove(NestedTransaction transaction, ApplicationId application) {
+ removed = true;
+ lastApplicationId = application;
+ }
+
+ @Override
+ public void restart(ApplicationId application, HostFilter filter) {
+ restarted = true;
+ lastApplicationId = application;
+ }
+
+ }
+
+ public static class FailingMockProvisioner extends MockProvisioner {
+
+ @Override
+ public void activate(NestedTransaction transaction, ApplicationId application, Collection<HostSpec> hosts) {
+ throw new IllegalArgumentException("Cannot activate application");
+ }
+
+ @Override
+ public void remove(NestedTransaction transaction, ApplicationId application) {
+ throw new IllegalArgumentException("Cannot remove application");
+ }
+
+ }
}
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationContentHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationContentHandlerTest.java
index 12db588e14c..c3ac7c65266 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationContentHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationContentHandlerTest.java
@@ -58,7 +58,7 @@ public class ApplicationContentHandlerTest extends ContentHandlerTestBase {
testTenantBuilder.tenants().get(tenant2).getLocalSessionRepo().addSession(new MockSession(3l, FilesApplicationPackage.fromFile(new File("src/test/apps/content2"))));
testTenantBuilder.tenants().get(tenant1).getApplicationRepo().createPutApplicationTransaction(idTenant1, 2l).commit();
testTenantBuilder.tenants().get(tenant2).getApplicationRepo().createPutApplicationTransaction(idTenant2, 3l).commit();
- handler = new ApplicationHandler(command -> command.run(),
+ handler = new ApplicationHandler(Runnable::run,
AccessLog.voidAccessLog(),
Zone.defaultZone(),
new ApplicationRepository(testTenantBuilder.createTenants(),
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java
index 8c4fa1ffc6c..737d8aaa74b 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java
@@ -81,7 +81,7 @@ public class ApplicationHandlerTest {
private final static TenantName mytenantName = TenantName.from("mytenant");
private final static TenantName foobar = TenantName.from("foobar");
private Tenants tenants;
- private SessionActiveHandlerTest.MockProvisioner provisioner;
+ private SessionHandlerTest.MockProvisioner provisioner;
private MockStateApiFactory stateApiFactory = new MockStateApiFactory();
private final HttpProxy mockHttpProxy = mock(HttpProxy.class);
@@ -92,7 +92,7 @@ public class ApplicationHandlerTest {
testBuilder.createTenant(foobar).withReloadHandler(new MockReloadHandler());
tenants = testBuilder.createTenants();
- provisioner = new SessionActiveHandlerTest.MockProvisioner();
+ provisioner = new SessionHandlerTest.MockProvisioner();
mockHandler = createMockApplicationHandler(
provisioner,
new ApplicationConvergenceChecker(stateApiFactory),
@@ -254,7 +254,7 @@ public class ApplicationHandlerTest {
@Test
@Ignore
public void testFailingProvisioner() throws Exception {
- provisioner = new SessionActiveHandlerTest.FailingMockProvisioner();
+ provisioner = new SessionHandlerTest.FailingMockProvisioner();
mockHandler = createMockApplicationHandler(
provisioner,
new ApplicationConvergenceChecker(stateApiFactory),
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ListApplicationsHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ListApplicationsHandlerTest.java
index 5fb0abb369a..9e7853a8fdf 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ListApplicationsHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ListApplicationsHandlerTest.java
@@ -39,9 +39,10 @@ public class ListApplicationsHandlerTest {
applicationRepo = testBuilder.tenants().get(mytenant).getApplicationRepo();
applicationRepo2 = testBuilder.tenants().get(foobar).getApplicationRepo();
Tenants tenants = testBuilder.createTenants();
- handler = new ListApplicationsHandler(command -> {
- command.run();
- }, AccessLog.voidAccessLog(), tenants, new Zone(Environment.dev, RegionName.from("us-east")));
+ handler = new ListApplicationsHandler(Runnable::run,
+ AccessLog.voidAccessLog(),
+ tenants,
+ new Zone(Environment.dev, RegionName.from("us-east")));
}
@Test
@@ -94,7 +95,7 @@ public class ListApplicationsHandlerTest {
"[\"" + url + "quux/environment/dev/region/us-east/instance/foo\"]");
}
- void assertResponse(String url, int expectedStatus, String expectedResponse) throws IOException {
+ private void assertResponse(String url, int expectedStatus, String expectedResponse) throws IOException {
assertResponse(url, expectedStatus, expectedResponse, GET);
}
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionActiveHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionActiveHandlerTest.java
index 376966da358..5e10f364aeb 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionActiveHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionActiveHandlerTest.java
@@ -11,14 +11,9 @@ import com.yahoo.config.model.application.provider.FilesApplicationPackage;
import com.yahoo.config.model.application.provider.MockFileRegistry;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.ApplicationName;
-import com.yahoo.config.provision.Capacity;
-import com.yahoo.config.provision.ClusterSpec;
-import com.yahoo.config.provision.HostFilter;
import com.yahoo.config.provision.HostSpec;
import com.yahoo.config.provision.InstanceName;
import com.yahoo.config.provision.ProvisionInfo;
-import com.yahoo.config.provision.ProvisionLogger;
-import com.yahoo.config.provision.Provisioner;
import com.yahoo.config.provision.TenantName;
import com.yahoo.config.provision.Zone;
import com.yahoo.container.jdisc.HttpResponse;
@@ -27,7 +22,6 @@ import com.yahoo.jdisc.Response;
import com.yahoo.jdisc.http.HttpRequest;
import com.yahoo.path.Path;
import com.yahoo.slime.JsonFormat;
-import com.yahoo.transaction.NestedTransaction;
import com.yahoo.vespa.config.server.ApplicationRepository;
import com.yahoo.vespa.config.server.PathProvider;
import com.yahoo.vespa.config.server.SuperModelGenerationCounter;
@@ -70,9 +64,7 @@ import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.time.Clock;
-import java.util.Collection;
import java.util.Collections;
-import java.util.List;
import java.util.Optional;
import static com.yahoo.jdisc.Response.Status.*;
@@ -368,8 +360,7 @@ public class SessionActiveHandlerTest extends SessionHandlerTest {
}
private void writeApplicationId(SessionZooKeeperClient zkc, String applicationName) {
- ApplicationId id = ApplicationId.from(tenant,
- ApplicationName.from(applicationName), InstanceName.defaultName());
+ ApplicationId id = ApplicationId.from(tenant, ApplicationName.from(applicationName), InstanceName.defaultName());
zkc.writeApplicationId(id);
}
@@ -396,52 +387,4 @@ public class SessionActiveHandlerTest extends SessionHandlerTest {
new ConfigserverConfig(new ConfigserverConfig.Builder())));
}
- public static class MockProvisioner implements Provisioner {
-
- boolean activated = false;
- boolean removed = false;
- boolean restarted = false;
- ApplicationId lastApplicationId;
- Collection<HostSpec> lastHosts;
-
- @Override
- public List<HostSpec> prepare(ApplicationId applicationId, ClusterSpec cluster, Capacity capacity, int groups, ProvisionLogger logger) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void activate(NestedTransaction transaction, ApplicationId application, Collection<HostSpec> hosts) {
- transaction.commit();
- activated = true;
- lastApplicationId = application;
- lastHosts = hosts;
- }
-
- @Override
- public void remove(NestedTransaction transaction, ApplicationId application) {
- removed = true;
- lastApplicationId = application;
- }
-
- @Override
- public void restart(ApplicationId application, HostFilter filter) {
- restarted = true;
- lastApplicationId = application;
- }
-
- }
-
- public static class FailingMockProvisioner extends MockProvisioner {
-
- @Override
- public void activate(NestedTransaction transaction, ApplicationId application, Collection<HostSpec> hosts) {
- throw new IllegalArgumentException("Cannot activate application");
- }
-
- @Override
- public void remove(NestedTransaction transaction, ApplicationId application) {
- throw new IllegalArgumentException("Cannot remove application");
- }
-
- }
}
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionContentHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionContentHandlerTest.java
index b07fcb58344..16e7aad6d17 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionContentHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionContentHandlerTest.java
@@ -175,7 +175,7 @@ public class SessionContentHandlerTest extends ContentHandlerTestBase {
}
}, AccessLog.voidAccessLog(), testTenantBuilder.createTenants(),
new ApplicationRepository(testTenantBuilder.createTenants(),
- HostProvisionerProvider.withProvisioner(new SessionActiveHandlerTest.MockProvisioner()),
+ HostProvisionerProvider.withProvisioner(new SessionHandlerTest.MockProvisioner()),
new MockCurator(),
new LogServerLogGrabber(),
new ApplicationConvergenceChecker(),
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionCreateHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionCreateHandlerTest.java
index 73e325a7fa3..5dc337bf99e 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionCreateHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionCreateHandlerTest.java
@@ -47,15 +47,15 @@ public class SessionCreateHandlerTest extends SessionHandlerTest {
private static final TenantName tenant = TenantName.from("test");
- public static final HashMap<String, String> postHeaders = new HashMap<>();
+ private static final HashMap<String, String> postHeaders = new HashMap<>();
- protected String pathPrefix = "/application/v2/session/";
- protected String createdMessage = " created.\"";
- protected String tenantMessage = "";
+ private String pathPrefix = "/application/v2/session/";
+ private String createdMessage = " created.\"";
+ private String tenantMessage = "";
public File testApp = new File("src/test/apps/app");
- public LocalSessionRepo localSessionRepo;
- public TenantApplications applicationRepo;
+ private LocalSessionRepo localSessionRepo;
+ private TenantApplications applicationRepo;
static {
postHeaders.put(SessionCreateHandler.contentTypeHeader, SessionCreateHandler.APPLICATION_X_GZIP);
@@ -237,23 +237,17 @@ public class SessionCreateHandlerTest extends SessionHandlerTest {
return null;
}
- SessionCreateHandler createHandler(Tenants tenants) throws Exception {
+ private SessionCreateHandler createHandler(Tenants tenants) throws Exception {
TestTenantBuilder testTenantBuilder = new TestTenantBuilder();
final ConfigserverConfig configserverConfig = new ConfigserverConfig(new ConfigserverConfig.Builder());
- return new SessionCreateHandler(new Executor() {
- @SuppressWarnings("NullableProblems")
- @Override
- public void execute(Runnable command) {
- command.run();
- }
- }, AccessLog.voidAccessLog(), tenants, configserverConfig,
+ return new SessionCreateHandler(Runnable::run, AccessLog.voidAccessLog(), tenants, configserverConfig,
new ApplicationRepository(testTenantBuilder.createTenants(),
- HostProvisionerProvider.withProvisioner(new SessionActiveHandlerTest.MockProvisioner()),
+ HostProvisionerProvider.withProvisioner(new SessionHandlerTest.MockProvisioner()),
new MockCurator(),
new LogServerLogGrabber(),
new ApplicationConvergenceChecker(),
new HttpProxy(new SimpleHttpFetcher()),
- new ConfigserverConfig(new ConfigserverConfig.Builder())));
+ configserverConfig));
}
public HttpRequest post() throws FileNotFoundException {
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java
index 2d63dcf9b0b..3172a396eb0 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java
@@ -48,13 +48,12 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
-import java.util.concurrent.Executor;
import static com.yahoo.jdisc.Response.Status.*;
import static com.yahoo.jdisc.Response.Status.BAD_REQUEST;
import static com.yahoo.jdisc.Response.Status.NOT_FOUND;
+import static com.yahoo.vespa.config.server.http.HandlerTest.assertHttpStatusCodeErrorCodeAndMessage;
import static org.hamcrest.Matchers.containsString;
-import static org.hamcrest.Matchers.endsWith;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertEquals;
@@ -70,16 +69,17 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
private static final TenantName tenant = TenantName.from("test");
private TestTenantBuilder builder;
- protected Curator curator;
+ private Curator curator;
private SessionZooKeeperClient zooKeeperClient;
private LocalSessionRepo localRepo;
+ private TenantApplications applicationRepo;
private String preparedMessage = " prepared.\"}";
private String tenantMessage = "";
@Before
public void setupRepo() throws Exception {
- TenantApplications applicationRepo = new MemoryTenantApplications();
+ applicationRepo = new MemoryTenantApplications();
curator = new MockCurator();
localRepo = new LocalSessionRepo(applicationRepo);
pathPrefix = "/application/v2/tenant/" + tenant + "/session/";
@@ -92,16 +92,16 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
public void require_error_when_session_id_does_not_exist() throws Exception {
// No session with this id exists
HttpResponse response = createHandler().handle(SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, 9999L));
- HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(response, NOT_FOUND, HttpErrorResponse.errorCodes.NOT_FOUND, "Session 9999 was not found");
+ assertHttpStatusCodeErrorCodeAndMessage(response, NOT_FOUND, HttpErrorResponse.errorCodes.NOT_FOUND, "Session 9999 was not found");
}
@Test
public void require_error_when_session_id_not_a_number() throws Exception {
final String session = "notanumber/prepared";
HttpResponse response = createHandler().handle(SessionHandlerTest.createTestRequest(pathPrefix + session));
- HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(response, BAD_REQUEST,
- HttpErrorResponse.errorCodes.BAD_REQUEST,
- "Session id in request is not a number, request was 'http://" + hostname + ":" + port + pathPrefix + session + "'");
+ assertHttpStatusCodeErrorCodeAndMessage(response, BAD_REQUEST,
+ HttpErrorResponse.errorCodes.BAD_REQUEST,
+ "Session id in request is not a number, request was 'http://" + hostname + ":" + port + pathPrefix + session + "'");
}
@Test
@@ -112,16 +112,17 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
private void testUnsupportedMethod(com.yahoo.container.jdisc.HttpRequest request) throws Exception {
HttpResponse response = createHandler().handle(request);
- HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(response, METHOD_NOT_ALLOWED,
- HttpErrorResponse.errorCodes.METHOD_NOT_ALLOWED,
- "Method '" + request.getMethod().name() + "' is not supported");
+ assertHttpStatusCodeErrorCodeAndMessage(response, METHOD_NOT_ALLOWED,
+ HttpErrorResponse.errorCodes.METHOD_NOT_ALLOWED,
+ "Method '" + request.getMethod().name() + "' is not supported");
}
@Test
public void require_that_activate_url_is_returned_on_success() throws Exception {
MockSession session = new MockSession(1, null);
localRepo.addSession(session);
- HttpResponse response = createHandler().handle(SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, 1L));
+ HttpResponse response = createHandler().handle(
+ SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, 1L));
assertThat(session.getStatus(), is(Session.Status.PREPARE));
assertNotNull(response);
assertThat(response.getStatus(), is(OK));
@@ -130,7 +131,8 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
@Test
public void require_debug() throws Exception {
- HttpResponse response = createHandler().handle(SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, 9999L, "?debug=true"));
+ HttpResponse response = createHandler().handle(
+ SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, 9999L, "?debug=true"));
assertThat(response.getStatus(), is(NOT_FOUND));
assertThat(SessionHandlerTest.getRenderedString(response), containsString("NotFoundException"));
}
@@ -140,7 +142,8 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
MockSession session = new MockSession(1, null);
session.doVerboseLogging = true;
localRepo.addSession(session);
- HttpResponse response = createHandler().handle(SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, 1L, "?verbose=true"));
+ HttpResponse response = createHandler().handle(
+ SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, 1L, "?verbose=true"));
assertThat(response.getStatus(), is(OK));
assertThat(SessionHandlerTest.getRenderedString(response), containsString("debuglog"));
}
@@ -172,8 +175,10 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
sessHandler.handle(SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, 1L));
session.setStatus(Session.Status.PREPARE);
zooKeeperClient.writeStatus(Session.Status.PREPARE);
- HttpResponse getResponse = sessHandler.handle(SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.GET, Cmd.PREPARED, 1L));
- assertResponseContains(getResponse, "\"activate\":\"http://foo:1337" + pathPrefix + "1/active\",\"message\":\"Session 1" + preparedMessage);
+ HttpResponse getResponse = sessHandler.handle(
+ SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.GET, Cmd.PREPARED, 1L));
+ assertResponseContains(getResponse, "\"activate\":\"http://foo:1337" + pathPrefix +
+ "1/active\",\"message\":\"Session 1" + preparedMessage);
}
@Test
@@ -183,16 +188,18 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
SessionHandler sessHandler = createHandler(fromLocalSessionRepo(localRepo, Clock.systemUTC()));
session.setStatus(Session.Status.NEW);
zooKeeperClient.writeStatus(Session.Status.NEW);
- HttpResponse getResponse = sessHandler.handle(SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.GET, Cmd.PREPARED, 1L));
- HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(getResponse, BAD_REQUEST,
- HttpErrorResponse.errorCodes.BAD_REQUEST,
- "Session not prepared: 1");
+ HttpResponse getResponse = sessHandler.handle(
+ SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.GET, Cmd.PREPARED, 1L));
+ assertHttpStatusCodeErrorCodeAndMessage(getResponse, BAD_REQUEST,
+ HttpErrorResponse.errorCodes.BAD_REQUEST,
+ "Session not prepared: 1");
session.setStatus(Session.Status.ACTIVATE);
zooKeeperClient.writeStatus(Session.Status.ACTIVATE);
- getResponse = sessHandler.handle(SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.GET, Cmd.PREPARED, 1L));
- HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(getResponse, BAD_REQUEST,
- HttpErrorResponse.errorCodes.BAD_REQUEST,
- "Session is active: 1");
+ getResponse = sessHandler.handle(
+ SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.GET, Cmd.PREPARED, 1L));
+ assertHttpStatusCodeErrorCodeAndMessage(getResponse, BAD_REQUEST,
+ HttpErrorResponse.errorCodes.BAD_REQUEST,
+ "Session is active: 1");
}
@Test
@@ -201,10 +208,11 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
localRepo.addSession(session);
session.setStatus(Session.Status.ACTIVATE);
SessionHandler sessionHandler = createHandler(fromLocalSessionRepo(localRepo, Clock.systemUTC()));
- HttpResponse putResponse = sessionHandler.handle(SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, 1L));
- HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(putResponse, BAD_REQUEST,
- HttpErrorResponse.errorCodes.BAD_REQUEST,
- "Session is active: 1");
+ HttpResponse putResponse = sessionHandler.handle(
+ SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, 1L));
+ assertHttpStatusCodeErrorCodeAndMessage(putResponse, BAD_REQUEST,
+ HttpErrorResponse.errorCodes.BAD_REQUEST,
+ "Session is active: 1");
}
@Test
@@ -212,18 +220,19 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
MockSession session = new MockSession(1, null);
localRepo.addSession(session);
SessionHandler sessHandler = createHandler(fromLocalSessionRepo(localRepo, Clock.systemUTC()));
- HttpResponse getResponse = sessHandler.handle(SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.GET, Cmd.PREPARED, 9999L));
- HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(getResponse, NOT_FOUND,
- HttpErrorResponse.errorCodes.NOT_FOUND,
- "Session 9999 was not found");
+ HttpResponse getResponse = sessHandler.handle(
+ SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.GET, Cmd.PREPARED, 9999L));
+ assertHttpStatusCodeErrorCodeAndMessage(getResponse, NOT_FOUND,
+ HttpErrorResponse.errorCodes.NOT_FOUND,
+ "Session 9999 was not found");
}
-
@Test
public void require_that_tenant_is_in_response() throws Exception {
MockSession session = new MockSession(1, null);
localRepo.addSession(session);
- HttpResponse response = createHandler(addTestTenant()).handle(SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, 1L));
+ HttpResponse response = createHandler().handle(
+ SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, 1L));
assertNotNull(response);
assertThat(response.getStatus(), is(OK));
assertThat(session.getStatus(), is(Session.Status.PREPARE));
@@ -232,6 +241,7 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
@Test
public void require_that_preparing_with_multiple_tenants_work() throws Exception {
+ // Need different repos for 'default' tenant as opposed to the 'test' tenant
TenantApplications applicationRepoDefault = new MemoryTenantApplications();
LocalSessionRepo localRepoDefault = new LocalSessionRepo(applicationRepoDefault);
final TenantName tenantName = TenantName.defaultName();
@@ -245,7 +255,8 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
localRepoDefault.addSession(session);
pathPrefix = "/application/v2/tenant/default/session/";
- HttpResponse response = handler.handle(SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, sessionId));
+ HttpResponse response = handler.handle(
+ SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, sessionId));
assertNotNull(response);
assertThat(SessionHandlerTest.getRenderedString(response), response.getStatus(), is(OK));
assertThat(session.getStatus(), is(Session.Status.PREPARE));
@@ -254,7 +265,8 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
session = new MockSession(sessionId, null);
localRepo.addSession(session);
String applicationName = "myapp";
- pathPrefix = "/application/v2/tenant/" + tenant + "/session/" + sessionId + "/prepared?applicationName=" + applicationName;
+ pathPrefix = "/application/v2/tenant/" + tenant + "/session/" + sessionId +
+ "/prepared?applicationName=" + applicationName;
response = handler.handle(SessionHandlerTest.createTestRequest(pathPrefix));
assertNotNull(response);
assertThat(SessionHandlerTest.getRenderedString(response), response.getStatus(), is(OK));
@@ -263,7 +275,8 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
sessionId++;
session = new MockSession(sessionId, null);
localRepo.addSession(session);
- pathPrefix = "/application/v2/tenant/" + tenant + "/session/" + sessionId + "/prepared?applicationName=" + applicationName + "&instance=quux";
+ pathPrefix = "/application/v2/tenant/" + tenant + "/session/" + sessionId +
+ "/prepared?applicationName=" + applicationName + "&instance=quux";
response = handler.handle(SessionHandlerTest.createTestRequest(pathPrefix));
assertNotNull(response);
assertThat(SessionHandlerTest.getRenderedString(response), response.getStatus(), is(OK));
@@ -274,29 +287,35 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
public void require_that_config_change_actions_are_in_response() throws Exception {
MockSession session = new MockSession(1, null);
localRepo.addSession(session);
- HttpResponse response = createHandler(addTestTenant()).handle(SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, 1L));
+ HttpResponse response = createHandler().handle(
+ SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, 1L));
assertResponseContains(response, "\"configChangeActions\":{\"restart\":[],\"refeed\":[]}");
}
@Test
public void require_that_config_change_actions_are_logged_if_existing() throws Exception {
- List<ServiceInfo> services = Collections.singletonList(new ServiceInfo("serviceName", "serviceType", null,
- ImmutableMap.of("clustername", "foo", "clustertype", "bar"), "configId", "hostName"));
+ List<ServiceInfo> services = Collections.singletonList(
+ new ServiceInfo("serviceName", "serviceType", null,
+ ImmutableMap.of("clustername", "foo", "clustertype", "bar"), "configId", "hostName"));
ConfigChangeActions actions = new ConfigChangeActions(Arrays.asList(
new MockRestartAction("change", services),
new MockRefeedAction("change-id", false, "other change", services, "test")));
MockSession session = new MockSession(1, null, actions);
localRepo.addSession(session);
- HttpResponse response = createHandler(addTestTenant()).handle(SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, 1L));
- assertResponseContains(response, "Change(s) between active and new application that require restart:\\nIn cluster 'foo' of type 'bar");
- assertResponseContains(response, "Change(s) between active and new application that may require re-feed:\\nchange-id: Consider removing data and re-feed document type 'test'");
+ HttpResponse response = createHandler().handle(
+ SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, 1L));
+ assertResponseContains(response,
+ "Change(s) between active and new application that require restart:\\nIn cluster 'foo' of type 'bar");
+ assertResponseContains(response,
+ "Change(s) between active and new application that may require re-feed:\\nchange-id: Consider removing data and re-feed document type 'test'");
}
@Test
public void require_that_config_change_actions_are_not_logged_if_not_existing() throws Exception {
MockSession session = new MockSession(1, null);
localRepo.addSession(session);
- HttpResponse response = createHandler(addTestTenant()).handle(SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, 1L));
+ HttpResponse response = createHandler().handle(
+ SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, 1L));
assertResponseNotContains(response, "Change(s) between active and new application that require restart");
assertResponseNotContains(response, "Change(s) between active and new application that require re-feed");
}
@@ -306,7 +325,7 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
String message = "No nodes available";
SessionThrowingException session = new SessionThrowingException(new OutOfCapacityException(message));
localRepo.addSession(session);
- HttpResponse response = createHandler(addTestTenant())
+ HttpResponse response = createHandler()
.handle(SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, 1L));
assertEquals(400, response.getStatus());
Slime data = getData(response);
@@ -317,9 +336,10 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
@Test
public void test_application_lock_failure() throws InterruptedException, IOException {
String message = "Timed out after waiting PT1M to acquire lock '/provision/v1/locks/foo/bar/default'";
- SessionThrowingException session = new SessionThrowingException(new ApplicationLockException(new UncheckedTimeoutException(message)));
+ SessionThrowingException session =
+ new SessionThrowingException(new ApplicationLockException(new UncheckedTimeoutException(message)));
localRepo.addSession(session);
- HttpResponse response = createHandler(addTestTenant())
+ HttpResponse response = createHandler()
.handle(SessionHandlerTest.createTestRequest(pathPrefix, HttpRequest.Method.PUT, Cmd.PREPARED, 1L));
assertEquals(500, response.getStatus());
Slime data = getData(response);
@@ -335,12 +355,6 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
return data;
}
- private static void assertResponse(HttpResponse response, String activateString) throws IOException {
- // TODO Test when more logging is added
- //assertThat(baos.toString(), startsWith("{\"log\":[{\"time\":"));
- assertThat(SessionHandlerTest.getRenderedString(response), endsWith(activateString));
- }
-
private static void assertResponseContains(HttpResponse response, String string) throws IOException {
assertThat(SessionHandlerTest.getRenderedString(response), containsString(string));
}
@@ -349,7 +363,6 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
assertThat(SessionHandlerTest.getRenderedString(response), not(containsString(string)));
}
-
private SessionHandler createHandler() {
return createHandler(addTestTenant());
}
@@ -362,22 +375,16 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
return addTenant(tenant, localRepo, new RemoteSessionRepo(), new MockSessionFactory());
}
- private static SessionHandler createHandler(TestTenantBuilder builder) {
+ private SessionHandler createHandler(TestTenantBuilder builder) {
final ConfigserverConfig configserverConfig = new ConfigserverConfig(new ConfigserverConfig.Builder());
- return new SessionPrepareHandler(new Executor() {
- @SuppressWarnings("NullableProblems")
- @Override
- public void execute(Runnable command) {
- command.run();
- }
- }, AccessLog.voidAccessLog(), builder.createTenants(), configserverConfig,
+ return new SessionPrepareHandler(Runnable::run, AccessLog.voidAccessLog(), builder.createTenants(), configserverConfig,
new ApplicationRepository(builder.createTenants(),
- HostProvisionerProvider.withProvisioner(new SessionActiveHandlerTest.MockProvisioner()),
- new MockCurator(),
+ HostProvisionerProvider.withProvisioner(new MockProvisioner()),
+ curator,
new LogServerLogGrabber(),
new ApplicationConvergenceChecker(),
new HttpProxy(new SimpleHttpFetcher()),
- new ConfigserverConfig(new ConfigserverConfig.Builder())));
+ configserverConfig));
}
private TestTenantBuilder addTenant(TenantName tenantName,
@@ -387,20 +394,30 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest {
builder.createTenant(tenantName).withSessionFactory(sessionFactory)
.withLocalSessionRepo(localSessionRepo)
.withRemoteSessionRepo(remoteSessionRepo)
- .withApplicationRepo(new MemoryTenantApplications());
+ .withApplicationRepo(applicationRepo);
return builder;
}
public static class SessionThrowingException extends LocalSession {
private final RuntimeException exception;
- public SessionThrowingException(RuntimeException exception) {
- super(TenantName.defaultName(), 1, null, new SessionContext(null, new MockSessionZKClient(MockApplicationPackage.createEmpty()), null, null, new HostRegistry<>(), null));
+ SessionThrowingException(RuntimeException exception) {
+ super(TenantName.defaultName(), 1, null,
+ new SessionContext(null,
+ new MockSessionZKClient(MockApplicationPackage.createEmpty()),
+ null,
+ null,
+ new HostRegistry<>(),
+ null));
this.exception = exception;
}
@Override
- public ConfigChangeActions prepare(DeployLogger logger, PrepareParams params, Optional<ApplicationSet> application, Path tenantPath, Instant now) {
+ public ConfigChangeActions prepare(DeployLogger logger,
+ PrepareParams params,
+ Optional<ApplicationSet> application,
+ Path tenantPath,
+ Instant now) {
throw exception;
}
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/TenantHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/TenantHandlerTest.java
index 21e68b02a37..cf79770ad20 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/TenantHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/TenantHandlerTest.java
@@ -11,7 +11,6 @@ import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.ApplicationName;
import com.yahoo.config.provision.InstanceName;
import com.yahoo.config.provision.TenantName;
-import com.yahoo.container.jdisc.HttpResponse;
import com.yahoo.vespa.config.server.tenant.Tenant;
import org.junit.Before;
import org.junit.Test;
@@ -34,7 +33,7 @@ public class TenantHandlerTest extends TenantTest {
@Test
public void testTenantCreate() throws Exception {
assertNull(tenants.getTenant(a));
- TenantCreateResponse response = (TenantCreateResponse) putSync(
+ TenantCreateResponse response = putSync(
HttpRequest.createTestRequest("http://deploy.example.yahoo.com:80/application/v2/tenant/a", Method.PUT));
assertResponseEquals(response, "{\"message\":\"Tenant a created.\"}");
}
@@ -43,15 +42,11 @@ public class TenantHandlerTest extends TenantTest {
public void testTenantCreateWithAllPossibleCharactersInName() throws Exception {
TenantName tenantName = TenantName.from("aB-9999_foo");
assertNull(tenants.getTenant(tenantName));
- TenantCreateResponse response = (TenantCreateResponse) putSync(
+ TenantCreateResponse response = putSync(
HttpRequest.createTestRequest("http://deploy.example.yahoo.com:80/application/v2/tenant/" + tenantName, Method.PUT));
assertResponseEquals(response, "{\"message\":\"Tenant " + tenantName + " created.\"}");
}
- private HttpResponse putSync(HttpRequest testRequest) {
- return handler.handlePUT(testRequest);
- }
-
@Test(expected=NotFoundException.class)
public void testGetNonExisting() throws Exception {
handler.handleGET(HttpRequest.createTestRequest("http://deploy.example.yahoo.com:80/application/v2/tenant/x", Method.GET));
@@ -60,14 +55,16 @@ public class TenantHandlerTest extends TenantTest {
@Test
public void testGetExisting() throws Exception {
tenants.writeTenantPath(a);
- TenantGetResponse response = (TenantGetResponse) handler.handleGET(HttpRequest.createTestRequest("http://deploy.example.yahoo.com:80/application/v2/tenant/a", Method.GET));
+ TenantGetResponse response = (TenantGetResponse) handler.handleGET(
+ HttpRequest.createTestRequest("http://deploy.example.yahoo.com:80/application/v2/tenant/a", Method.GET));
assertResponseEquals(response, "{\"message\":\"Tenant 'a' exists.\"}");
}
@Test(expected=BadRequestException.class)
public void testCreateExisting() throws Exception {
assertNull(tenants.getTenant(a));
- TenantCreateResponse response = (TenantCreateResponse) putSync(HttpRequest.createTestRequest("http://deploy.example.yahoo.com:80/application/v2/tenant/a", Method.PUT));
+ TenantCreateResponse response = putSync(HttpRequest.createTestRequest(
+ "http://deploy.example.yahoo.com:80/application/v2/tenant/a", Method.PUT));
assertResponseEquals(response, "{\"message\":\"Tenant a created.\"}");
assertEquals(tenants.getTenant(a).getName(), a);
handler.handlePUT(HttpRequest.createTestRequest("http://deploy.example.yahoo.com:80/application/v2/tenant/a", Method.PUT));
@@ -77,7 +74,8 @@ public class TenantHandlerTest extends TenantTest {
public void testDelete() throws IOException, InterruptedException {
putSync(HttpRequest.createTestRequest("http://deploy.example.yahoo.com:80/application/v2/tenant/a", Method.PUT));
assertEquals(tenants.getTenant(a).getName(), a);
- TenantDeleteResponse delResp = (TenantDeleteResponse) handler.handleDELETE(HttpRequest.createTestRequest("http://deploy.example.yahoo.com:80/application/v2/tenant/a", Method.DELETE));
+ TenantDeleteResponse delResp = (TenantDeleteResponse) handler.handleDELETE(
+ HttpRequest.createTestRequest("http://deploy.example.yahoo.com:80/application/v2/tenant/a", Method.DELETE));
assertResponseEquals(delResp, "{\"message\":\"Tenant a deleted.\"}");
assertNull(tenants.getTenant(a));
}
@@ -89,8 +87,7 @@ public class TenantHandlerTest extends TenantTest {
assertEquals(a, tenant.getName());
int sessionId = 1;
- ApplicationId app = ApplicationId.from(a,
- ApplicationName.from("foo"), InstanceName.defaultName());
+ ApplicationId app = ApplicationId.from(a, ApplicationName.from("foo"), InstanceName.defaultName());
ApplicationHandlerTest.addMockApplication(tenant, app, sessionId, Clock.systemUTC());
try {
@@ -110,5 +107,9 @@ public class TenantHandlerTest extends TenantTest {
public void testIllegalNameSlashes() throws InterruptedException {
putSync(HttpRequest.createTestRequest("http://deploy.example.yahoo.com:80/application/v2/tenant/a/b", Method.PUT));
}
-
+
+ private TenantCreateResponse putSync(HttpRequest testRequest) {
+ return (TenantCreateResponse) handler.handlePUT(testRequest);
+ }
+
}