forked from apache/jmeter
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BZ 64752 - Add GraphQL/HTTP Request Sampler (apache#627)
* BZ-64752: adding GraphQL HTTP Sampler GUI components * BZ-64752: javadocs * BZ-64752: fixing tab selection problem; disable tab validation in graphql ui * BZ-64752: (de)serializing test element with graphql query and vars * BZ-64752: (de)serializing using gson * BZ-64752: removing unnecessary GraphQLHTTPSampler * BZ-64752: adding operationName input field * BZ-64752: support GET method * BZ-64752: init operationName from test elem * BZ-64752: adding a simple graphql test plan demo * BZ-64752: show advanced pane * BZ-64752: add gson info to lib/aareadme.txt * BZ-64752: screenshot and default constructor * BZ-64752: documentation on GraphQLHTTPRequest * BZ-64752: record in changes.xml * BZ-64752: add gson.jar to expected_release_jars.csv * BZ-64752: removing unnecessary, untranslated messages * BZ-64752: utility for graphql param serialization and unit test * BZ-64752: replace gson with jackson for graphql (de)serialization * BZ-64752: remove gson jar from expected release jars * BZ-64752: correcting French translation, thanks to pmouawad * BZ-64752: graphql http recording support * BZ-64752: checkbox option to switch on/off auto graphql req detection, true by default * BZ-64752: precise json content type checking; encode in GET * BZ-64752: French translation for graphql recording option, thanks to @ubikloadpack Co-authored-by: Woonsan Ko <[email protected]>
- Loading branch information
Showing
27 changed files
with
1,596 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
...tocol/http/src/main/java/org/apache/jmeter/protocol/http/config/GraphQLRequestParams.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to you under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.jmeter.protocol.http.config; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* Represents GraphQL request parameter input data for Query, Variables and Operation Name. | ||
*/ | ||
public class GraphQLRequestParams implements Serializable { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
private String operationName; | ||
|
||
private String query; | ||
|
||
private String variables; | ||
|
||
public GraphQLRequestParams() { | ||
} | ||
|
||
public GraphQLRequestParams(final String operationName, final String query, final String variables) { | ||
this.operationName = operationName; | ||
this.query = query; | ||
this.variables = variables; | ||
} | ||
|
||
public String getOperationName() { | ||
return operationName; | ||
} | ||
|
||
public void setOperationName(String operationName) { | ||
this.operationName = operationName; | ||
} | ||
|
||
public String getQuery() { | ||
return query; | ||
} | ||
|
||
public void setQuery(String query) { | ||
this.query = query; | ||
} | ||
|
||
public String getVariables() { | ||
return variables; | ||
} | ||
|
||
public void setVariables(String variables) { | ||
this.variables = variables; | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
...rc/main/java/org/apache/jmeter/protocol/http/config/gui/AbstractValidationTabbedPane.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to you under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.jmeter.protocol.http.config.gui; | ||
|
||
import javax.swing.JTabbedPane; | ||
|
||
/** | ||
* Abstract {@link JTabbedPane} to allow validating the requested tab index, updating states and changing the tab index | ||
* after the validation if necessary. | ||
*/ | ||
abstract class AbstractValidationTabbedPane extends JTabbedPane { | ||
|
||
private static final long serialVersionUID = 7014311238367882880L; | ||
|
||
/** | ||
* Flag whether the validation feature should be enabled or not, {@code true} by default. | ||
*/ | ||
private boolean validationEnabled = true; | ||
|
||
/** | ||
* {@inheritDoc} | ||
* <P> | ||
* Overridden to delegate to {@link #setSelectedIndex(int, boolean)} in order to validate the requested tab index by default. | ||
*/ | ||
@Override | ||
public void setSelectedIndex(int index) { | ||
setSelectedIndex(index, true); | ||
} | ||
|
||
/** | ||
* Apply some check rules by invoking {@link #getValidatedTabIndex(int, int)} | ||
* if {@link #isValidationEnabled()} returns true and the {@code check} input is true. | ||
* | ||
* @param index index to select | ||
* @param check flag whether to perform checks before setting the selected index | ||
*/ | ||
public void setSelectedIndex(int index, boolean check) { | ||
final int curIndex = super.getSelectedIndex(); | ||
|
||
if (!isValidationEnabled() || !check || curIndex == -1) { | ||
super.setSelectedIndex(index); | ||
return; | ||
} | ||
|
||
super.setSelectedIndex(getValidatedTabIndex(curIndex, index)); | ||
} | ||
|
||
/** | ||
* Validate the requested tab index ({@code newTabIndex}) and return a validated tab index after applying some check rules. | ||
* @param currentTabIndex current tab index | ||
* @param newTabIndex new requested tab index to validate | ||
* @return the validated tab index | ||
*/ | ||
abstract protected int getValidatedTabIndex(final int currentTabIndex, final int newTabIndex); | ||
|
||
/** | ||
* Return true if the validation feature should be enabled, {@code true} by default. | ||
* @return true if the validation feature should be enabled, {@code true} by default | ||
*/ | ||
protected boolean isValidationEnabled() { | ||
return validationEnabled; | ||
} | ||
|
||
/** | ||
* Set the flag whether the validation feature should be enabled or not. | ||
* @param validationEnabled flag whether the validation feature should be enabled or not | ||
*/ | ||
protected void setValidationEnabled(boolean validationEnabled) { | ||
this.validationEnabled = validationEnabled; | ||
} | ||
} |
Oops, something went wrong.