コード例 #1
0
  /** Update name and location wizard values */
  private void updateNameAndLocationWizardValues(
      NewJavaFileNameLocationStepOperator nfnlso, String fileType, MBean mbean) {

    nfnlso.setObjectName(mbean.getName());
    nfnlso.setPackage(mbean.getPackage());
    setTextFieldContent(MBEAN_DESCRIPTION_TEXT_FIELD, nfnlso, mbean.getDescription());
    if (fileType.equals(FILE_TYPE_MBEAN_FROM_EXISTING_JAVA_CLASS)) {
      setTextFieldContent(CLASS_TO_WRAP_TEXT_FIELD, nfnlso, mbean.getClassToWrap());
      setCheckBoxSelection(
          OBJECT_WRAPPED_AS_MXBEAN_CHECK_BOX, nfnlso, mbean.isObjectWrappedAsMXBean());
    }
  }
コード例 #2
0
  /** Check name and location wizard values */
  private void checkNameAndLocationWizardValues(
      NewJavaFileNameLocationStepOperator nfnlso,
      String fileType,
      String projectName,
      MBean mbean) {

    String createdFile = null;
    String interfaceFile = null;

    // Initialize created file and interface file values
    createdFile = mbean.getName() + ".java";
    if (fileType.equals(FILE_TYPE_MXBEAN)) {
      interfaceFile = mbean.getName() + "MXBean.java";
    } else {
      interfaceFile = mbean.getName() + "MBean.java";
    }

    // Check Name and Location Wizard title
    assertEquals("New " + fileType, nfnlso.getTitle());
    // Check Project value
    assertEquals(projectName, nfnlso.txtProject().getText());
    // Check Class Name value
    assertEquals(mbean.getName(), nfnlso.txtObjectName().getText());
    // Check Package value
    assertEquals(mbean.getPackage(), nfnlso.cboPackage().getSelectedItem());
    // Check Created File value
    assertTrue(nfnlso.txtCreatedFile().getText().endsWith(createdFile));
    // Check Interface File value
    assertTrue(getTextFieldContent(CREATED_FILE_TEXT_FIELD, nfnlso).endsWith(interfaceFile));
    // Check Description value
    assertEquals(mbean.getDescription(), getTextFieldContent(MBEAN_DESCRIPTION_TEXT_FIELD, nfnlso));

    // Check Class to Wrap if needed
    if (fileType.equals(FILE_TYPE_MBEAN_FROM_EXISTING_JAVA_CLASS)) {
      assertEquals(mbean.getClassToWrap(), getTextFieldContent(CLASS_TO_WRAP_TEXT_FIELD, nfnlso));
      if (mbean.isObjectWrappedAsMXBean()) {
        assertTrue(getCheckBoxOperator(OBJECT_WRAPPED_AS_MXBEAN_CHECK_BOX, nfnlso).isSelected());
      } else {
        assertFalse(getCheckBoxOperator(OBJECT_WRAPPED_AS_MXBEAN_CHECK_BOX, nfnlso).isSelected());
      }
    }
  }