private void restartServer() {
   ServersView serversView = new ServersView();
   serversView.open();
   Server server = serversView.getServer(getServerFullName(serversView.getServers(), SERVER_NAME));
   server.clean();
   server.restart();
 }
  /*
   * Deploy and undeploy quickstart on running server
   */
  protected void deployUndeployQuickstart(Quickstart qstart, String serverName) {
    new ConsoleView().clearConsole();
    ProjectExplorer explorer = new ProjectExplorer();

    findDeployableProjects(qstart, explorer);

    ServersView serversView = new ServersView();
    serversView.open();
    String fullServerName = getServerFullName(serversView.getServers(), serverName);
    Server server = serversView.getServer(fullServerName);

    for (String deployableProjectName : qstart.getDeployableProjectNames()) {
      try {
        // deploy
        deployProject(deployableProjectName, explorer);
        // check deploy status
        checkDeployedProject(qstart, fullServerName);
        // undeploy
        unDeployModule(
            qstart.getName().equals("template") ? "QUICKSTART_NAME" : qstart.getName(), server);
      } catch (CoreLayerException ex) {
        new DefaultShell("Server Error");
        new OkButton().click();
      }
    }
  }
 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);
 }
  public static void modifyAndRepublishApplication(String applicationName) {
    TreeViewerHandler treeViewerHandler = TreeViewerHandler.getInstance();
    ProjectExplorer explorer = new ProjectExplorer();
    explorer.getProject(applicationName).getProjectItem("diy", "index.html").open();

    TextEditor editor = new TextEditor("index.html");
    editor.setText(ID407CreateApplicationFromExistingAndChangeRemoteNameTest.HTML_TEXT);
    editor.save();
    editor.close();

    ServersView servers = new ServersView();
    servers.open();
    treeViewerHandler.getTreeItem(new DefaultTree(), applicationName + " at OpenShift").select();

    new ContextMenu(OpenShiftLabel.ContextMenu.PUBLISH).select();

    try {
      new WaitUntil(new ShellWithTextIsAvailable("Identify Yourself"), TimePeriod.NORMAL);
      new DefaultShell("Identify Yourself").setFocus();
      new PushButton("OK").click();
    } catch (WaitTimeoutExpiredException ex) {
    }

    new WaitUntil(
        new ShellWithTextIsAvailable(OpenShiftLabel.Shell.PUBLISH_CHANGES), TimePeriod.LONG);

    new DefaultShell(OpenShiftLabel.Shell.PUBLISH_CHANGES);
    new DefaultStyledText(0).setText("Commit message");

    new WaitUntil(
        new ButtonWithTextIsEnabled(new PushButton(OpenShiftLabel.Button.COMMIT_PUBLISH)),
        TimePeriod.NORMAL);

    new PushButton(OpenShiftLabel.Button.COMMIT_PUBLISH).click();

    new WaitWhile(new JobIsRunning(), TimePeriod.LONG);

    AbstractWait.sleep(TimePeriod.NORMAL);

    try {
      new WaitUntil(
          new ApplicationIsDeployedSuccessfully(
              Datastore.USERNAME, Datastore.DOMAIN, applicationName, "OpSh"),
          TimePeriod.VERY_LONG);
      // PASS
    } catch (WaitTimeoutExpiredException ex) {
      fail(
          "Application has not been deployed successfully. Browser does not "
              + "contain text of existing project which has been deployed.");
    }
  }