private void restartServer() {
   ServersView serversView = new ServersView();
   serversView.open();
   Server server = serversView.getServer(getServerFullName(serversView.getServers(), SERVER_NAME));
   server.clean();
   server.restart();
 }
 private String getServerFullName(List<Server> servers, String partOfName) {
   for (Server srv : servers) {
     if (srv.getLabel().getName().contains(partOfName)) {
       return srv.getLabel().getName();
     }
   }
   return null;
 }
 protected void checkServerStatus() {
   ServersView serversView = new ServersView();
   serversView.open();
   Server server = serversView.getServer(getServerFullName(serversView.getServers(), SERVER_NAME));
   assertTrue("Server has not been started!", server.getLabel().getState() == ServerState.STARTED);
   // assertTrue("Server has not been
   // synchronized!",server.getLabel().getPublishState() ==
   // ServerPublishState.SYNCHRONIZED);
 }
 public boolean test() {
   ServersView serversView = new ServersView();
   serversView.open();
   Server server = serversView.getServer(serverNameLabel);
   ServerModule serverModule = server.getModule(new RegexMatcher(".*" + projectName + ".*"));
   ModuleLabel moduleLabel = serverModule.getLabel();
   ServerState moduleState = moduleLabel.getState();
   return moduleState == ServerState.STARTED;
 }
 protected void checkServerViewForStatus(String projectName, String serverNameLabel) {
   ServersView serversView = new ServersView();
   serversView.open();
   Server server = serversView.getServer(serverNameLabel);
   ServerModule serverModule = server.getModule(new RegexMatcher(".*" + projectName + ".*"));
   ModuleLabel moduleLabel = serverModule.getLabel();
   ServerState moduleState = moduleLabel.getState();
   org.junit.Assert.assertTrue("Module has not been started!", moduleState == ServerState.STARTED);
 }
 @Test
 public void testRemoveConfiguredModules() {
   ModifyModulesDialog dialog = server.addAndRemoveModules();
   ModifyModulesPage page = new ModifyModulesPage();
   page.add(PROJECT_1, PROJECT_3);
   if (!page.getConfiguredModules().isEmpty()) {
     page.removeAll();
   }
   dialog.finish();
 }
  @Test
  public void addTwo_removeAll() {
    ModifyModulesDialog dialog = server.addAndRemoveModules();
    ModifyModulesPage page = new ModifyModulesPage();
    page.add(PROJECT_1, PROJECT_3);
    dialog.finish();

    List<ServerModule> modules = server.getModules();
    assertThat(modules.size(), is(2));
    assertThat(modules.get(0).getLabel().getName(), is(PROJECT_1));
    assertThat(modules.get(1).getLabel().getName(), is(PROJECT_3));

    server.addAndRemoveModules();
    page = new ModifyModulesPage();
    page.removeAll();
    dialog.finish();

    modules = server.getModules();
    assertThat(modules.size(), is(0));
  }
 private void unDeployModule(String moduleName, Server server) {
   log.info("UNDEPLOYING MODULE" + moduleName + " ON SERVER " + server.getLabel());
   ServerModule serverModule = server.getModule(new RegexMatcher(".*" + moduleName + ".*"));
   serverModule.remove();
   new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG);
 }