@Override public void execute() throws BuildException { if (port <= 0) { throw new BuildException("Port must be set to a positive integer"); } if (scripts == null && script == null) { throw new BuildException("Scripts must be specified as an embedded resource collection"); } if (scripts != null && script != null) { throw new BuildException( "Scripts can be specified either by the script attribute or as resource collections but not both."); } for (AddUser user : users) { user.validate(); } if (skip) { log("Skipping excution"); } else if (errorProperty == null) { doExecute(); } else { try { doExecute(); } catch (BuildException e) { final Project project = getProject(); project.setProperty(errorProperty, e.getMessage()); log(e, Project.MSG_DEBUG); } } }
private void doExecute() throws BuildException { for (AddUser userAdder : users) { userAdder.execute(); } final ExternalHostSystem host = new ExternalHostSystem(SUPPORTED_FEATURES, getHost(), getPort(), this, getShabang(), null); final ProtocolSessionBuilder builder = new ProtocolSessionBuilder(); if (scripts == null) { scripts = new Union(); scripts.add(new FileResource(script)); } for (Iterator<?> it = scripts.iterator(); it.hasNext(); ) { final Resource resource = (Resource) it.next(); try { final Runner runner = new Runner(); try { final InputStream inputStream = resource.getInputStream(); final String name = resource.getName(); builder.addProtocolLines( name == null ? "[Unknown]" : name, inputStream, runner.getTestElements()); runner.runSessions(host); } catch (UnsupportedOperationException e) { log("Resource cannot be read: " + resource.getName(), Project.MSG_WARN); } } catch (IOException e) { throw new BuildException("Cannot load script " + resource.getName(), e); } catch (Exception e) { log(e.getMessage(), Project.MSG_ERR); throw new BuildException( "[FAILURE] in script " + resource.getName() + "\n" + e.getMessage(), e); } } }
private void addAlunoActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_addAlunoActionPerformed AddUser addUser = new AddUser(UsuariosEnum.ALUNO); addUser.setVisible(true); } // GEN-LAST:event_addAlunoActionPerformed
private void addMonitorActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_addMonitorActionPerformed AddUser addUser = new AddUser(UsuariosEnum.MONITOR); addUser.setVisible(true); } // GEN-LAST:event_addMonitorActionPerformed