コード例 #1
0
  public void testEmptyProvider() throws IOException {
    assertEquals(1, ServerRegistry.getInstance().getProviders().size());

    ServerInstanceProvider provider = ServerRegistry.getInstance().getProviders().iterator().next();
    assertTrue(provider instanceof MockInstanceProvider);
    ((MockInstanceProvider) provider).clear();
    assertTrue(provider.getInstances().isEmpty());
  }
コード例 #2
0
    public void stateChanged(ChangeEvent e) {
      final ServerRegistry registry = (ServerRegistry) e.getSource();

      List<ServerInstance> current = new ArrayList<ServerInstance>();
      for (ServerInstanceProvider provider : registry.getProviders()) {
        current.addAll(provider.getInstances());
      }

      List<ServerInstance> expected = steps.get(stepIndex++);
      assertEquals(expected.size(), current.size());

      for (ServerInstance instance : expected) {
        current.remove(instance);
      }

      assertTrue(current.isEmpty());
    }