ASF Bugzilla – Attachment 19763 Details for
Bug 41913
Let TransactionController create samples that contains the samples of the transaction
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Suggested patch
patch_for_41913.patch (text/plain), 5.06 KB, created by
Alf Hogemark
on 2007-03-21 02:27:26 UTC
(
hide
)
Description:
Suggested patch
Filename:
MIME Type:
Creator:
Alf Hogemark
Created:
2007-03-21 02:27:26 UTC
Size:
5.06 KB
patch
obsolete
>Index: C:/Documents and Settings/alf.hogemark/workspace/Jmeter 2.2/src/components/org/apache/jmeter/control/TransactionController.java >=================================================================== >--- C:/Documents and Settings/alf.hogemark/workspace/Jmeter 2.2/src/components/org/apache/jmeter/control/TransactionController.java (revision 520379) >+++ C:/Documents and Settings/alf.hogemark/workspace/Jmeter 2.2/src/components/org/apache/jmeter/control/TransactionController.java (working copy) >@@ -21,6 +21,7 @@ > import java.io.Serializable; > > import org.apache.jmeter.samplers.SampleEvent; >+import org.apache.jmeter.samplers.SampleListener; > import org.apache.jmeter.samplers.SampleResult; > import org.apache.jmeter.samplers.Sampler; > import org.apache.jmeter.threads.JMeterContext; >@@ -35,7 +36,7 @@ > * Transaction Controller to measure transaction times > * > */ >-public class TransactionController extends GenericController implements Controller, Serializable { >+public class TransactionController extends GenericController implements SampleListener, Controller, Serializable { > protected static final Logger log = LoggingManager.getLoggerForClass(); > > transient private String threadName; >@@ -75,11 +76,12 @@ > log_debug("+++++++++++++++++++++++++++++"); > calls = 0; > res = new SampleResult(); >+ res.setSampleLabel(getName()); >+ // Assume success >+ res.setSuccessful(true); > res.sampleStart(); > } > >- calls++; >- > returnValue = super.next(); > > if (returnValue == null) // Must be the end of the controller >@@ -89,11 +91,10 @@ > log_debug("already called"); > } else { > res.sampleEnd(); >- res.setSuccessful(true); >- res.setSampleLabel(getName()); >- res.setResponseCodeOK(); >- res.setResponseMessage("Called: " + calls); >- res.setThreadName(threadName); >+ res.setResponseMessage("Number of samples in transaction : " + calls); >+ if(res.isSuccessful()) { >+ res.setResponseCodeOK(); >+ } > > // TODO could these be done earlier (or just once?) > JMeterContext threadContext = getThreadContext(); >@@ -103,12 +104,38 @@ > if (pack == null) { > log.warn("Could not fetch SamplePackage"); > } else { >- lnf.notifyListeners(new SampleEvent(res, getName()), pack.getSampleListeners()); >+ SampleEvent event = new SampleEvent(res, getName()); >+ // We must set res to null now, before sending the event for the transaction, >+ // so that we can ignore that event in our sampleOccured method >+ res = null; >+ lnf.notifyListeners(event, pack.getSampleListeners()); > } >- res = null; > } > } >+ else { >+ // We have sampled one of our children >+ calls++; >+ } > > return returnValue; > } >+ >+ public void sampleOccurred(SampleEvent se) { >+ // Check if we have are still sampling our children >+ if(res != null) { >+ SampleResult sampleResult = se.getResult(); >+ res.setThreadName(sampleResult.getThreadName()); >+ res.setBytes(res.getBytes() + sampleResult.getBytes()); >+ if(!sampleResult.isSuccessful()) { >+ res.setSuccessful(false); >+ } >+ res.addSubResult(sampleResult); >+ } >+ } >+ >+ public void sampleStarted(SampleEvent e) { >+ } >+ >+ public void sampleStopped(SampleEvent e) { >+ } > } >Index: C:/Documents and Settings/alf.hogemark/workspace/Jmeter 2.2/src/components/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java >=================================================================== >--- C:/Documents and Settings/alf.hogemark/workspace/Jmeter 2.2/src/components/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java (revision 520379) >+++ C:/Documents and Settings/alf.hogemark/workspace/Jmeter 2.2/src/components/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java (working copy) >@@ -200,7 +200,7 @@ > addSubResults(currNode, res); > // Add any assertion that failed as children of the sample node > AssertionResult assertionResults[] = res.getAssertionResults(); >- int assertionIndex = 0; >+ int assertionIndex = currNode.getChildCount(); > for (int j = 0; j < assertionResults.length; j++) { > AssertionResult item = assertionResults[j]; > >@@ -231,6 +231,17 @@ > > treeModel.insertNodeInto(leafNode, currNode, leafIndex++); > addSubResults(leafNode, child); >+ // Add any assertion that failed as children of the sample node >+ AssertionResult assertionResults[] = child.getAssertionResults(); >+ int assertionIndex = leafNode.getChildCount(); >+ for (int j = 0; j < assertionResults.length; j++) { >+ AssertionResult item = assertionResults[j]; >+ >+ if (item.isFailure() || item.isError()) { >+ DefaultMutableTreeNode assertionNode = new DefaultMutableTreeNode(item); >+ treeModel.insertNodeInto(assertionNode, leafNode, assertionIndex++); >+ } >+ } > } > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 41913
:
19763
|
19777
|
19860
|
19861
|
20157
|
20158
|
20159
|
20237