Search in sources :

Example 1 with MockReloadHandler

use of com.yahoo.vespa.config.server.MockReloadHandler in project vespa by vespa-engine.

the class TenantApplicationsTest method require_that_reload_handler_is_called_when_apps_are_removed.

@Test
public void require_that_reload_handler_is_called_when_apps_are_removed() throws Exception {
    ApplicationId foo = createApplicationId("foo");
    writeApplicationData(foo, 3L);
    writeApplicationData(createApplicationId("bar"), 4L);
    MockReloadHandler reloadHandler = new MockReloadHandler();
    TenantApplications repo = createZKAppRepo(reloadHandler);
    assertNull(reloadHandler.lastRemoved);
    repo.deleteApplication(foo).commit();
    long endTime = System.currentTimeMillis() + 60_000;
    while (System.currentTimeMillis() < endTime && reloadHandler.lastRemoved == null) {
        Thread.sleep(100);
    }
    assertNotNull(reloadHandler.lastRemoved);
    assertThat(reloadHandler.lastRemoved.serializedForm(), is(foo.serializedForm()));
}
Also used : MockReloadHandler(com.yahoo.vespa.config.server.MockReloadHandler) ApplicationId(com.yahoo.config.provision.ApplicationId) Test(org.junit.Test)

Example 2 with MockReloadHandler

use of com.yahoo.vespa.config.server.MockReloadHandler in project vespa by vespa-engine.

the class ApplicationHandlerTest method setup.

@Before
public void setup() {
    TestTenantBuilder testBuilder = new TestTenantBuilder();
    testBuilder.createTenant(mytenantName).withReloadHandler(new MockReloadHandler());
    testBuilder.createTenant(foobar).withReloadHandler(new MockReloadHandler());
    tenants = testBuilder.createTenants();
    provisioner = new SessionHandlerTest.MockProvisioner();
    mockHandler = createMockApplicationHandler(provisioner, new ApplicationConvergenceChecker(stateApiFactory), mockHttpProxy, new MockLogServerLogGrabber());
    listApplicationsHandler = new ListApplicationsHandler(ListApplicationsHandler.testOnlyContext(), tenants, Zone.defaultZone());
}
Also used : ApplicationConvergenceChecker(com.yahoo.vespa.config.server.application.ApplicationConvergenceChecker) SessionHandlerTest(com.yahoo.vespa.config.server.http.SessionHandlerTest) MockReloadHandler(com.yahoo.vespa.config.server.MockReloadHandler) Before(org.junit.Before)

Aggregations

MockReloadHandler (com.yahoo.vespa.config.server.MockReloadHandler)2 ApplicationId (com.yahoo.config.provision.ApplicationId)1 ApplicationConvergenceChecker (com.yahoo.vespa.config.server.application.ApplicationConvergenceChecker)1 SessionHandlerTest (com.yahoo.vespa.config.server.http.SessionHandlerTest)1 Before (org.junit.Before)1 Test (org.junit.Test)1