|
JMeter example source code file (ModuleController.java)
The JMeter ModuleController.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.control;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import javax.swing.tree.TreeNode;
import org.apache.jmeter.gui.GuiPackage;
import org.apache.jmeter.gui.tree.JMeterTreeNode;
import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.testelement.property.CollectionProperty;
import org.apache.jmeter.testelement.property.JMeterProperty;
import org.apache.jmeter.testelement.property.NullProperty;
import org.apache.jorphan.collections.HashTree;
import org.apache.jorphan.collections.ListedHashTree;
/**
* The goal of ModuleController is to add modularity to JMeter. The general idea
* is that web applications consist of small units of functionality (i.e. Logon,
* Create Account, Logoff...) which consist of requests that implement the
* functionality. These small units of functionality can be stored in
* SimpleControllers as modules that can be linked together quickly to form
* tests. ModuleController facilitates this by acting as a pointer to any
* controller that sits under the WorkBench. The controller and it's subelements
* will be substituted in place of the ModuleController at runtime. Config
* elements can be attached to the ModuleController to alter the functionality
* (which user logs in, which account is created, etc.) of the module.
*
*/
public class ModuleController extends GenericController implements ReplaceableController {
private static final long serialVersionUID = 240L;
private static final String NODE_PATH = "ModuleController.node_path";// $NON-NLS-1$
private JMeterTreeNode selectedNode = null;
/**
* No-arg constructor
*
* @see java.lang.Object#Object()
*/
public ModuleController() {
super();
}
@Override
public Object clone() {
ModuleController clone = (ModuleController) super.clone();
if (selectedNode == null) {
this.restoreSelected();
}
clone.selectedNode = selectedNode; // TODO ?? (JMeterTreeNode) selectedNode.clone();
return clone;
}
/**
* Sets the (@link JMeterTreeNode) which represents the controller which
* this object is pointing to. Used for building the test case upon
* execution.
*
* @param tn
* JMeterTreeNode
* @see org.apache.jmeter.gui.tree.JMeterTreeNode
*/
public void setSelectedNode(JMeterTreeNode tn) {
selectedNode = tn;
setNodePath();
}
/**
* Gets the (@link JMeterTreeNode) for the Controller
*
* @return JMeterTreeNode
*/
public JMeterTreeNode getSelectedNode() {
if (selectedNode == null){
restoreSelected();
}
return selectedNode;
}
private void setNodePath() {
List<String> nodePath = new ArrayList
Other JMeter examples (source code examples)Here is a short list of links related to this JMeter ModuleController.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.