aboutsummaryrefslogtreecommitdiffstats
path: root/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ListApplicationsHandlerTest.java
diff options
context:
space:
mode:
authorHarald Musum <musum@oath.com>2018-04-30 08:18:40 +0200
committerHarald Musum <musum@oath.com>2018-04-30 08:19:07 +0200
commit12f28d8a032c745802c389ad453868ffcf3f4528 (patch)
tree81df6dd05c5086672add3c76501422fbdada1cd4 /configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ListApplicationsHandlerTest.java
parent2596f890f1209e82778aba54b16461148a4b4aaa (diff)
Cleanup of creation of tenants and tenant repo
Diffstat (limited to 'configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ListApplicationsHandlerTest.java')
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ListApplicationsHandlerTest.java32
1 files changed, 17 insertions, 15 deletions
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 eeaed92bd65..f57e7f09b39 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
@@ -6,8 +6,10 @@ import com.yahoo.container.jdisc.HttpRequest;
import com.yahoo.container.jdisc.HttpResponse;
import com.yahoo.jdisc.http.HttpRequest.Method;
import com.yahoo.jdisc.Response;
+import com.yahoo.vespa.config.server.TestComponentRegistry;
import com.yahoo.vespa.config.server.application.TenantApplications;
import com.yahoo.vespa.config.server.http.SessionHandlerTest;
+import com.yahoo.vespa.config.server.tenant.TenantBuilder;
import com.yahoo.vespa.config.server.tenant.TenantRepository;
import org.junit.Test;
import org.junit.Before;
@@ -21,27 +23,27 @@ import static org.junit.Assert.assertThat;
import static com.yahoo.jdisc.http.HttpRequest.Method.*;
/**
- * @author lulf
- * @since 5.1
+ * @author Ulf Lilleengen
*/
public class ListApplicationsHandlerTest {
+ private static final TenantName mytenant = TenantName.from("mytenant");
+ private static final TenantName foobar = TenantName.from("foobar");
+
+ private final TestComponentRegistry componentRegistry = new TestComponentRegistry.Builder().build();
+
private TenantApplications applicationRepo, applicationRepo2;
private ListApplicationsHandler handler;
@Before
- public void setup() throws Exception {
- TestTenantBuilder testBuilder = new TestTenantBuilder();
- TenantName mytenant = TenantName.from("mytenant");
- TenantName foobar = TenantName.from("foobar");
- testBuilder.createTenant(mytenant);
- testBuilder.createTenant(foobar);
- applicationRepo = testBuilder.tenants().get(mytenant).getApplicationRepo();
- applicationRepo2 = testBuilder.tenants().get(foobar).getApplicationRepo();
- TenantRepository tenantRepository = testBuilder.createTenants();
- handler = new ListApplicationsHandler(
- ListApplicationsHandler.testOnlyContext(),
- tenantRepository,
- new Zone(Environment.dev, RegionName.from("us-east")));
+ public void setup() {
+ TenantRepository tenantRepository = new TenantRepository(componentRegistry, false);
+ tenantRepository.addTenant(TenantBuilder.create(componentRegistry, mytenant));
+ tenantRepository.addTenant(TenantBuilder.create(componentRegistry, foobar));
+ applicationRepo = tenantRepository.getTenant(mytenant).getApplicationRepo();
+ applicationRepo2 = tenantRepository.getTenant(foobar).getApplicationRepo();
+ handler = new ListApplicationsHandler(ListApplicationsHandler.testOnlyContext(),
+ tenantRepository,
+ new Zone(Environment.dev, RegionName.from("us-east")));
}
@Test