ConfigSentinelClient extends AbstractComponent { @Inject public ConfigSentinelClient() { } @Inject  ConfigSentinelClient(); @Override void deconstruct();  }
@Test public void testConfigSentinelClient() { ConfigSentinelDummy configsentinel = new ConfigSentinelDummy(); List<VespaService> services = new ArrayList<>(); VespaService docproc = new VespaService("docprocservice", "docproc/cluster.x.indexing/0"); VespaService searchnode4 = new VespaService("searchnode4", "search/cluster.x/g0/c1/r1"); VespaService qrserver = new VespaService("qrserver", "container/qrserver.0"); services.add(searchnode4); services.add(qrserver); services.add(docproc); try (MockConfigSentinelClient client = new MockConfigSentinelClient(configsentinel)) { client.updateServiceStatuses(services); assertThat(qrserver.getPid(), is(6520)); assertThat(qrserver.getState(), is("RUNNING")); assertThat(qrserver.isAlive(), is(true)); assertThat(searchnode4.getPid(), is(6534)); assertThat(searchnode4.getState(), is("RUNNING")); assertThat(searchnode4.isAlive(), is(true)); assertThat(docproc.getPid(), is(-1)); assertThat(docproc.getState(), is("FINISHED")); assertThat(docproc.isAlive(), is(false)); configsentinel.reConfigure(); client.ping(docproc); assertThat(docproc.getPid(), is(100)); assertThat(docproc.getState(), is("RUNNING")); assertThat(docproc.isAlive(), is(true)); assertThat(qrserver.isAlive(), is(true)); client.updateServiceStatuses(services); assertThat(docproc.getPid(), is(100)); assertThat(docproc.getState(), is("RUNNING")); assertThat(docproc.isAlive(), is(true)); assertThat(qrserver.isAlive(), is(false)); } }