コード例 #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());
      }
    }
  }
コード例 #3
0
  /** Check name and location wizard components are enabled/disabled */
  private void checkNameAndLocationWizardComponents(
      NewJavaFileNameLocationStepOperator nfnlso, String fileType, MBean mbean) {

    // Check text fields
    assertTrue(nfnlso.txtObjectName().isEnabled());
    assertTrue(nfnlso.txtObjectName().isEditable());
    assertTrue(nfnlso.txtProject().isEnabled());
    assertFalse(nfnlso.txtProject().isEditable());
    assertTrue(nfnlso.txtCreatedFile().isEnabled());
    assertFalse(nfnlso.txtCreatedFile().isEditable());
    assertTrue(getTextFieldOperator(MBEAN_DESCRIPTION_TEXT_FIELD, nfnlso).isEnabled());
    assertTrue(getTextFieldOperator(MBEAN_DESCRIPTION_TEXT_FIELD, nfnlso).isEditable());
    if (fileType.equals(FILE_TYPE_MBEAN_FROM_EXISTING_JAVA_CLASS)) {
      assertTrue(getTextFieldOperator(CLASS_TO_WRAP_TEXT_FIELD, nfnlso).isEnabled());
      assertTrue(getTextFieldOperator(CLASS_TO_WRAP_TEXT_FIELD, nfnlso).isEditable());
      assertTrue(getCheckBoxOperator(OBJECT_WRAPPED_AS_MXBEAN_CHECK_BOX, nfnlso).isEnabled());
    }

    // Check buttons
    assertTrue(nfnlso.btBack().isEnabled());
    // MBean from existing java class
    if (fileType.equals(FILE_TYPE_MBEAN_FROM_EXISTING_JAVA_CLASS)) {
      if (mbean == null || mbean.getClassToWrap() == "") {
        assertFalse(nfnlso.btNext().isEnabled());
      } else {
        assertTrue(nfnlso.btNext().isEnabled());
      }
      assertFalse(nfnlso.btFinish().isEnabled());
      assertTrue(getButtonOperator(CLASS_TO_WRAP_BROWSE_BUTTON, nfnlso).isEnabled());
    }
    // Standard MBean with metadata
    else if (fileType.equals(FILE_TYPE_STANDARD_MBEAN_WITH_METADATA)) {
      assertTrue(nfnlso.btNext().isEnabled());
      assertFalse(nfnlso.btFinish().isEnabled());
    }
    // Standard MBean and MXBean
    else {
      assertFalse(nfnlso.btNext().isEnabled());
      assertTrue(nfnlso.btFinish().isEnabled());
    }
    assertTrue(nfnlso.btCancel().isEnabled());
    assertTrue(nfnlso.btHelp().isEnabled());
  }