public Collection<String> getServerNames() {
   return Collections2.transform(
       PluginImpl.getInstance().getServers(),
       new Function<Hypervisor, String>() {
         public String apply(@Nullable Hypervisor input) {
           return input.getHypervisorHost();
         }
       });
 }
  /**
   * Tests {@link Team#doImportViewsSubmit(String, org.kohsuke.stapler.StaplerRequest,
   * org.kohsuke.stapler.StaplerResponse)}.
   *
   * @throws Exception if so
   */
  public void testDoImportViewsSubmit() throws Exception {
    FreeStyleProject p = createFreeStyleProject();
    User user = User.get("bob", true);
    MyViewsProperty property = user.getProperty(MyViewsProperty.class);
    ListView view1 = new ListView("view1");
    view1.add(p);
    property.addView(view1);
    ListView view2 = new ListView("view2");
    property.addView(view2);
    user.save();

    PluginImpl.getInstance().addTeam(new Team("Team1", "Description"));
    Team team = PluginImpl.getInstance().getTeams().get("Team1");
    StaplerRequest request = mock(StaplerRequest.class);
    StaplerResponse response = mock(StaplerResponse.class);

    team.doImportViewsSubmit(user.getId(), request, response);

    verify(response).sendRedirect2(Matchers.contains(team.getUrl()));

    TeamViewsProperty views = team.getProperty(TeamViewsProperty.class);
    Collection<View> collection = views.getViews();
    assertEquals(3, collection.size());

    boolean found1 = false;
    boolean found2 = false;
    for (View next : collection) {
      if (next.getViewName().equals("view1")) {
        found1 = true;
        assertNotSame(view1, next);
        assertEquals(1, next.getItems().size());
      } else if (next.getViewName().equals("view2")) {
        found2 = true;
        assertNotSame(view2, next);
      }
    }
    assertTrue(found1);
    assertTrue(found2);
  }
 /**
  * Tests that legacy causes in {@link PluginImpl#causes} gets converted during startup to a {@link
  * com.sonyericsson.jenkins.plugins.bfa.db.LocalFileKnowledgeBase}.
  *
  * @throws Exception if so.
  */
 @LocalData
 public void testLoadVersion1ConfigXml() throws Exception {
   KnowledgeBase knowledgeBase = PluginImpl.getInstance().getKnowledgeBase();
   Collection<FailureCause> causes = knowledgeBase.getCauses();
   assertEquals(3, causes.size());
   Indication indication = null;
   for (FailureCause c : causes) {
     assertNotNull(c.getName() + " should have an id", fixEmpty(c.getId()));
     if ("The Wrong".equals(c.getName())) {
       indication = c.getIndications().get(0);
     }
   }
   assertNotNull("Missing a cause!", indication);
   assertEquals(".+wrong.*", Whitebox.getInternalState(indication, "pattern").toString());
 }