|
JMeter example source code file (HTTPArgumentsPanel.java)
The JMeter HTTPArgumentsPanel.java source code/* * 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.gui; import java.util.Iterator; import javax.swing.JTable; import org.apache.jmeter.config.Arguments; import org.apache.jmeter.config.gui.ArgumentsPanel; import org.apache.jmeter.protocol.http.util.HTTPArgument; import org.apache.jmeter.testelement.TestElement; import org.apache.jmeter.testelement.property.PropertyIterator; import org.apache.jmeter.util.JMeterUtils; import org.apache.jorphan.gui.GuiUtils; import org.apache.jorphan.gui.ObjectTableModel; import org.apache.jorphan.reflect.Functor; /** * A GUI panel allowing the user to enter HTTP Parameters. * These have names and values, as well as check-boxes to determine whether or not to * include the "=" sign in the output and whether or not to encode the output. */ public class HTTPArgumentsPanel extends ArgumentsPanel { private static final long serialVersionUID = 240L; private static final String ENCODE_OR_NOT = "encode?"; //$NON-NLS-1$ private static final String INCLUDE_EQUALS = "include_equals"; //$NON-NLS-1$ @Override protected void initializeTableModel() { tableModel = new ObjectTableModel(new String[] { ArgumentsPanel.COLUMN_RESOURCE_NAMES_0, ArgumentsPanel.COLUMN_RESOURCE_NAMES_1, ENCODE_OR_NOT, INCLUDE_EQUALS }, HTTPArgument.class, new Functor[] { new Functor("getName"), //$NON-NLS-1$ new Functor("getValue"), //$NON-NLS-1$ new Functor("isAlwaysEncoded"), //$NON-NLS-1$ new Functor("isUseEquals") }, //$NON-NLS-1$ new Functor[] { new Functor("setName"), //$NON-NLS-1$ new Functor("setValue"), //$NON-NLS-1$ new Functor("setAlwaysEncoded"), //$NON-NLS-1$ new Functor("setUseEquals") }, //$NON-NLS-1$ new Class[] {String.class, String.class, Boolean.class, Boolean.class }); } public static boolean testFunctors(){ HTTPArgumentsPanel instance = new HTTPArgumentsPanel(); instance.initializeTableModel(); return instance.tableModel.checkFunctors(null,instance.getClass()); } @Override protected void sizeColumns(JTable table) { GuiUtils.fixSize(table.getColumn(INCLUDE_EQUALS), table); GuiUtils.fixSize(table.getColumn(ENCODE_OR_NOT), table); } @Override protected HTTPArgument makeNewArgument() { HTTPArgument arg = new HTTPArgument("", ""); arg.setAlwaysEncoded(false); arg.setUseEquals(true); return arg; } public HTTPArgumentsPanel() { super(JMeterUtils.getResString("paramtable")); //$NON-NLS-1$ } @Override public TestElement createTestElement() { stopTableEditing(); @SuppressWarnings("unchecked") // only contains Argument (or HTTPArgument) Iterator<HTTPArgument> modelData = (Iterator Other JMeter examples (source code examples)Here is a short list of links related to this JMeter HTTPArgumentsPanel.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.