[smart-load-test commit] r147 - in trunk/smart-load-test: smart-load-test-engine-impl/src/main/java/com/smartitengineering...

0 views
Skip to first unread message

codesite...@google.com

unread,
Oct 29, 2008, 7:34:04 AM10/29/08
to smart-loa...@smartitengineering.com
Author: imyousuf
Date: Wed Oct 29 04:00:48 2008
New Revision: 147

Modified:

trunk/smart-load-test/smart-load-test-engine-impl/src/main/java/com/smartitengineering/loadtest/engine/impl/management/AbstracltTestCaseBatchCreator.java

trunk/smart-load-test/smart-load-test-engine-impl/src/main/java/com/smartitengineering/loadtest/engine/impl/management/DefaultTestCaseBatchCreator.java

trunk/smart-load-test/smart-load-test-engine/src/main/java/com/smartitengineering/loadtest/engine/events/BatchEvent.java

Log:
Add test instance name to batch event

The API is expanded so that batch events include test instance name, which
could be required for logging purpose.

Signed-off-by: Imran M Yousuf <imyo...@smartitengineering.com>

Modified:
trunk/smart-load-test/smart-load-test-engine-impl/src/main/java/com/smartitengineering/loadtest/engine/impl/management/AbstracltTestCaseBatchCreator.java
==============================================================================
---
trunk/smart-load-test/smart-load-test-engine-impl/src/main/java/com/smartitengineering/loadtest/engine/impl/management/AbstracltTestCaseBatchCreator.java
(original)
+++
trunk/smart-load-test/smart-load-test-engine-impl/src/main/java/com/smartitengineering/loadtest/engine/impl/management/AbstracltTestCaseBatchCreator.java
Wed Oct 29 04:00:48 2008
@@ -29,6 +29,7 @@
import java.util.Map;
import java.util.Properties;
import java.util.Set;
+import org.apache.commons.lang.StringUtils;

/**
*
@@ -73,7 +74,7 @@
}
initalProperties = testInstance.getProperties();
name = testInstance.getName();
- if (initalProperties == null || name == null || name.length()
<= 0) {
+ if (initalProperties == null || StringUtils.isEmpty(name)) {
throw new IllegalArgumentException();
}
}
@@ -146,7 +147,7 @@
*/
protected void fireBatchEvent() {
if (isNextBatchAvailable()) {
- BatchEvent batchEvent = new BatchEvent(getNextBatch());
+ BatchEvent batchEvent = new BatchEvent(getNextBatch(), name);
fireBatchEvent(batchEvent);
}
}

Modified:
trunk/smart-load-test/smart-load-test-engine-impl/src/main/java/com/smartitengineering/loadtest/engine/impl/management/DefaultTestCaseBatchCreator.java
==============================================================================
---
trunk/smart-load-test/smart-load-test-engine-impl/src/main/java/com/smartitengineering/loadtest/engine/impl/management/DefaultTestCaseBatchCreator.java
(original)
+++
trunk/smart-load-test/smart-load-test-engine-impl/src/main/java/com/smartitengineering/loadtest/engine/impl/management/DefaultTestCaseBatchCreator.java
Wed Oct 29 04:00:48 2008
@@ -99,7 +99,7 @@
Batch batch =
getBatch(new AbstractMap.SimpleEntry<ThreadGroup,
Map<Thread, TestCase>>(
new ThreadGroup(""), new HashMap<Thread, TestCase>()));
- fireBatchEvent(new BatchEvent(batch));
+ fireBatchEvent(new BatchEvent(batch, name));
}
}
}

Modified:
trunk/smart-load-test/smart-load-test-engine/src/main/java/com/smartitengineering/loadtest/engine/events/BatchEvent.java
==============================================================================
---
trunk/smart-load-test/smart-load-test-engine/src/main/java/com/smartitengineering/loadtest/engine/events/BatchEvent.java
(original)
+++
trunk/smart-load-test/smart-load-test-engine/src/main/java/com/smartitengineering/loadtest/engine/events/BatchEvent.java
Wed Oct 29 04:00:48 2008
@@ -18,6 +18,7 @@
package com.smartitengineering.loadtest.engine.events;

import
com.smartitengineering.loadtest.engine.management.TestCaseBatchCreator;
+import org.apache.commons.lang.StringUtils;

/**
* Represents a BatchEvent where batch creator is provided to the observer
so
@@ -27,6 +28,8 @@
public class BatchEvent {

private TestCaseBatchCreator.Batch batch;
+
+ private String testInstanceName;

/**
* Create a batch event with the provided batch creator. Observer can
get
@@ -35,12 +38,13 @@
* @param batchCreator The batch creator to provide to the observer
* @throws java.lang.IllegalArgumentException if batchCreator is null
*/
- public BatchEvent(TestCaseBatchCreator.Batch batch)
+ public BatchEvent(TestCaseBatchCreator.Batch batch, String
testInstanceName)
throws IllegalArgumentException {
- if (batch == null) {
+ if (batch == null || StringUtils.isEmpty(testInstanceName)) {
throw new IllegalArgumentException();
}
this.batch = batch;
+ this.testInstanceName = testInstanceName;
}

/**
@@ -49,5 +53,13 @@
*/
public TestCaseBatchCreator.Batch getBatch() {
return batch;
+ }
+
+ /**
+ * Return the name of the test instance causing the batch generation
+ * @return The name of the instance
+ */
+ public String getTestInstanceName() {
+ return testInstanceName;
}
}

Reply all
Reply to author
Forward
0 new messages