Class GraphQLHTTPSamplerGui

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, ClearGui, JMeterGUIComponent, Printable

public class GraphQLHTTPSamplerGui extends HttpTestSampleGui
GraphQL HTTP Sampler GUI which extends HttpTestSampleGui in order to provide more convenient UI elements for GraphQL query, variables and operationName.
See Also:
  • Constructor Details

    • GraphQLHTTPSamplerGui

      public GraphQLHTTPSamplerGui()
  • Method Details

    • assignDefaultValues

      public void assignDefaultValues(org.apache.jmeter.testelement.TestElement element)
      Description copied from interface: JMeterGUIComponent
      Configures default values for element after its creation. Plugin authors should call this once in their JMeterGUIComponent.createTestElement() implementation.
      Specified by:
      assignDefaultValues in interface JMeterGUIComponent
      Overrides:
      assignDefaultValues in class HttpTestSampleGui
      Parameters:
      element - test element to configure
    • modifyTestElement

      public void modifyTestElement(org.apache.jmeter.testelement.TestElement sampler)
      Description copied from class: HttpTestSampleGui
      Modifies a given TestElement to mirror the data in the gui components.

      GUI components are responsible for populating TestElements they create with the data currently held in the GUI components. This method should overwrite whatever data is currently in the TestElement as it is called after a user has filled out the form elements in the gui with new information.

      If you override AbstractJMeterGuiComponent, you might want using AbstractJMeterGuiComponent.bindingGroup instead of overriding modifyTestElement.

      The canonical implementation looks like this:

       @Override
       public void modifyTestElement(TestElement element) {
           super.modifyTestElement(element); // clear the element and assign basic fields like name, gui class, test class
           // Using the element setters (preferred):
           // If the field is empty, you probably want to remove the property instead of storing an empty string
           // See Streamline binding of UI elements to TestElement properties
           // for more details
           TestElementXYZ xyz = (TestElementXYZ) element;
           xyz.setState(StringUtils.defaultIfEmpty(guiState.getText(), null));
           xyz.setCode(StringUtils.defaultIfEmpty(guiCode.getText(), null));
           ... other GUI fields ...
           // or directly (do not use unless there is no setter for the field):
           element.setProperty(TestElementXYZ.STATE, StringUtils.defaultIfEmpty(guiState.getText(), null))
           element.setProperty(TestElementXYZ.CODE, StringUtils.defaultIfEmpty(guiCode.getText(), null))
           ... other GUI fields ...
       }
       
      Specified by:
      modifyTestElement in interface JMeterGUIComponent
      Overrides:
      modifyTestElement in class HttpTestSampleGui
      Parameters:
      sampler - the TestElement to modify
    • getStaticLabel

      public String getStaticLabel()
      Description copied from interface: JMeterGUIComponent
      Get the component's label. This label is used in drop down lists that give the user the option of choosing one type of component in a list of many. It should therefore be a descriptive name for the end user to see. It must be unique to the class. It is also used by Help to find the appropriate location in the documentation. Normally getLabelResource() should be overridden instead of this method; the definition of this method in AbstractJMeterGuiComponent is intended for general use.
      Specified by:
      getStaticLabel in interface JMeterGUIComponent
      Overrides:
      getStaticLabel in class AbstractJMeterGuiComponent
      Returns:
      GUI label for the component.
      See Also:
    • getDocAnchor

      public String getDocAnchor()
      Description copied from class: AbstractJMeterGuiComponent
      Compute Anchor value to find reference in documentation for a particular component
      Specified by:
      getDocAnchor in interface JMeterGUIComponent
      Overrides:
      getDocAnchor in class AbstractJMeterGuiComponent
      Returns:
      String anchor
    • createEmbeddedRsrcPanel

      protected JPanel createEmbeddedRsrcPanel()

      Overridden to hide the HTML embedded resource handling section as GraphQL responses are always in JSON.

      Overrides:
      createEmbeddedRsrcPanel in class HttpTestSampleGui
    • createUrlConfigGui

      protected UrlConfigGui createUrlConfigGui()
      Create a UrlConfigGui which is used as the Basic tab in the parameters configuration tabstrip.

      Overridden to create a GraphQLUrlConfigGui which extends UrlConfigGui for GraphQL specific UI elements.

      Overrides:
      createUrlConfigGui in class HttpTestSampleGui
      Returns:
      a UrlConfigGui which is used as the Basic tab