Beispiel #1
0
  private void addButtonActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_addButtonActionPerformed
    DefaultTableModel model = (DefaultTableModel) this.outputTable.getModel();
    outputTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
    if (testCaseComboBox.getSelectedItem().equals("- none selected -")) {
      JOptionPane.showMessageDialog(
          new JFrame(),
          "No test case selected, Please select any test case",
          "Dialog",
          JOptionPane.ERROR_MESSAGE);
      return;
    }
    String test = this.testCaseComboBox.getSelectedItem().toString();

    if (test.equalsIgnoreCase("EchoCallbackDemo")) {
      EchoCallbackDemo echoTest = new EchoCallbackDemo();
      echoTest.addObserver(this);
      echoTest.configure();
      model.addRow(new Object[] {testCaseComboBox.getSelectedItem(), "Not Started"});
      testCaseMap.put(echoTest, testCaseComboBox.getSelectedItem().toString());
    } else if (test.equalsIgnoreCase("PlayRecordTest")) {
      PlayRecordTest playRecordTest = new PlayRecordTest();
      playRecordTest.addObserver(this);
      playRecordTest.configure();
      model.addRow(new Object[] {testCaseComboBox.getSelectedItem(), "Not Started"});
      testCaseMap.put(playRecordTest, testCaseComboBox.getSelectedItem().toString());
    } else if (test.equalsIgnoreCase("ConnectTest")) {
      ConnectTest connectTest = new ConnectTest();
      connectTest.addObserver(this);
      connectTest.configure();
      model.addRow(new Object[] {testCaseComboBox.getSelectedItem(), "Not Started"});
      testCaseMap.put(connectTest, testCaseComboBox.getSelectedItem().toString());
    } else if (test.equalsIgnoreCase("JoinTest")) {
      JoinTest joinTest = new JoinTest();
      joinTest.addObserver(this);
      joinTest.configure();
      model.addRow(new Object[] {testCaseComboBox.getSelectedItem(), "Not Started"});
      testCaseMap.put(joinTest, testCaseComboBox.getSelectedItem().toString());
    } else if (test.equalsIgnoreCase("SimpleConferenceTest")) {
      SimpleConferenceTest simpleConferenceTest = new SimpleConferenceTest();
      simpleConferenceTest.addObserver(this);
      simpleConferenceTest.configure();
      model.addRow(new Object[] {testCaseComboBox.getSelectedItem(), "Not Started"});
      testCaseMap.put(simpleConferenceTest, testCaseComboBox.getSelectedItem().toString());
    } else if (test.equalsIgnoreCase("SimpleIVRTest")) {
      SimpleIVRTest simpleIVR = new SimpleIVRTest();
      simpleIVR.addObserver(this);
      simpleIVR.configure();
      model.addRow(new Object[] {testCaseComboBox.getSelectedItem(), "Not Started"});
      testCaseMap.put(simpleIVR, testCaseComboBox.getSelectedItem().toString());
    } else if (test.equalsIgnoreCase("LoadTest")) {
      LoadTest loadTest = new LoadTest();
      loadTest.addObserver(this);
      loadTest.configure();
      model.addRow(new Object[] {testCaseComboBox.getSelectedItem(), "Not Started"});
      testCaseMap.put(loadTest, testCaseComboBox.getSelectedItem().toString());
    }
  } // GEN-LAST:event_addButtonActionPerformed
Beispiel #2
0
 @Override
 public void update(Observable o, Object o1) {
   String message = (String) o1;
   if (message.contains("Count")) {
     System.out.println(message);
     message = message.replace("Count:", "");
     for (int i = 1; i < Integer.parseInt(message); i++) {
       DefaultTableModel model = (DefaultTableModel) this.outputTable.getModel();
       model.addRow(new Object[] {testCaseComboBox.getSelectedItem(), "Not Started"});
       if (testCaseComboBox.getSelectedItem().toString().equalsIgnoreCase("EchoCallbackDemo")) {
         EchoCallbackDemo echoTest = new EchoCallbackDemo();
         echoTest.addObserver(this);
         testCaseMap.put(echoTest, testCaseComboBox.getSelectedItem().toString());
       } else if (testCaseComboBox
           .getSelectedItem()
           .toString()
           .equalsIgnoreCase("PlayRecordTest")) {
         PlayRecordTest playRecordTest = new PlayRecordTest();
         playRecordTest.addObserver(this);
         testCaseMap.put(playRecordTest, testCaseComboBox.getSelectedItem().toString());
       } else if (testCaseComboBox.getSelectedItem().toString().equalsIgnoreCase("ConnectTest")) {
         ConnectTest connectTest = new ConnectTest();
         connectTest.addObserver(this);
         testCaseMap.put(connectTest, testCaseComboBox.getSelectedItem().toString());
       } else if (testCaseComboBox.getSelectedItem().toString().equalsIgnoreCase("JoinTest")) {
         JoinTest joinTest = new JoinTest();
         joinTest.addObserver(this);
         testCaseMap.put(joinTest, testCaseComboBox.getSelectedItem().toString());
       } else if (testCaseComboBox
           .getSelectedItem()
           .toString()
           .equalsIgnoreCase("SimpleConferenceTest")) {
         SimpleConferenceTest confTest = new SimpleConferenceTest();
         confTest.addObserver(this);
         testCaseMap.put(confTest, testCaseComboBox.getSelectedItem().toString());
       } else if (testCaseComboBox
           .getSelectedItem()
           .toString()
           .equalsIgnoreCase("SimpleIVRTest")) {
         SimpleIVRTest simpleIVR = new SimpleIVRTest();
         simpleIVR.addObserver(this);
         testCaseMap.put(simpleIVR, testCaseComboBox.getSelectedItem().toString());
       } else if (testCaseComboBox.getSelectedItem().toString().equalsIgnoreCase("LoadTest")) {
         LoadTest loadTest = new LoadTest();
         loadTest.addObserver(this);
         testCaseMap.put(loadTest, testCaseComboBox.getSelectedItem().toString());
       }
     }
   } else if (message.contains("CANCELLED")) {
     DefaultTableModel dtm = (DefaultTableModel) this.outputTable.getModel();
     int nRow = dtm.getRowCount(), nCol = dtm.getColumnCount();
     int j = 0;
     for (int i = 0; i < nRow; i++) {
       if (o.getClass().getSimpleName().equalsIgnoreCase(dtm.getValueAt(i, j).toString())) {
         dtm.removeRow(i);
         break;
       }
     }
   } else {
     DefaultTableModel dtm = (DefaultTableModel) this.outputTable.getModel();
     int nRow = dtm.getRowCount(), nCol = dtm.getColumnCount();
     int j = 0;
     for (int i = 0; i < nRow; i++) {
       if (dtm.getValueAt(i, j + 1).toString().equalsIgnoreCase("SUCCESS")
           || dtm.getValueAt(i, j + 1).toString().equalsIgnoreCase("FAILURE")) {
         continue;
       }
       if (o.getClass().getSimpleName().equalsIgnoreCase(dtm.getValueAt(i, j).toString())) {
         dtm.setValueAt(message, i, j + 1);
         if (message.equalsIgnoreCase("Call Connected")) {
           this.cancelButton.setEnabled(false);
         }
         break;
       }
     }
   }
 }