You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2009/11/03 16:54:13 UTC

svn commit: r832462 - in /jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers: BSFTimer.java BSFTimerBeanInfo.java BSFTimerResources.properties

Author: sebb
Date: Tue Nov  3 15:54:12 2009
New Revision: 832462

URL: http://svn.apache.org/viewvc?rev=832462&view=rev
Log:
Add BSF Timer implementation

Added:
    jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BSFTimer.java   (with props)
    jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BSFTimerBeanInfo.java   (with props)
    jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BSFTimerResources.properties   (with props)

Added: jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BSFTimer.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BSFTimer.java?rev=832462&view=auto
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BSFTimer.java (added)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BSFTimer.java Tue Nov  3 15:54:12 2009
@@ -0,0 +1,50 @@
+/*
+ * 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.timers;
+
+import org.apache.bsf.BSFException;
+import org.apache.bsf.BSFManager;
+import org.apache.jmeter.testbeans.TestBean;
+import org.apache.jmeter.util.BSFTestElement;
+import org.apache.jorphan.logging.LoggingManager;
+import org.apache.log.Logger;
+
+public class BSFTimer extends BSFTestElement implements Cloneable, Timer, TestBean {
+    private static final Logger log = LoggingManager.getLoggerForClass();
+
+    private static final long serialVersionUID = 4;
+
+    /** {@inheritDoc} */
+    public long delay() {
+        long delay = 0;
+        try {
+            BSFManager mgr = getManager();
+            if (mgr == null) {
+                return 0; 
+            }
+            Object o = evalFileOrScript(mgr);
+            delay = Long.valueOf(o.toString()).longValue();
+        } catch (NumberFormatException e) {
+            log.warn("Problem in BSF script "+e);
+        } catch (BSFException e) {
+            log.warn("Problem in BSF script "+e);
+        }
+        return delay;
+    }
+}

Propchange: jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BSFTimer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BSFTimer.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BSFTimerBeanInfo.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BSFTimerBeanInfo.java?rev=832462&view=auto
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BSFTimerBeanInfo.java (added)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BSFTimerBeanInfo.java Tue Nov  3 15:54:12 2009
@@ -0,0 +1,29 @@
+/*
+ * 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.timers;
+
+import org.apache.jmeter.util.BSFBeanInfoSupport;
+
+public class BSFTimerBeanInfo extends BSFBeanInfoSupport {
+
+    public BSFTimerBeanInfo() {
+        super(BSFTimer.class);
+    }
+
+}

Propchange: jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BSFTimerBeanInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BSFTimerBeanInfo.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BSFTimerResources.properties
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BSFTimerResources.properties?rev=832462&view=auto
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BSFTimerResources.properties (added)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BSFTimerResources.properties Tue Nov  3 15:54:12 2009
@@ -0,0 +1,28 @@
+#   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.
+
+displayName=BSF Timer
+scriptingLanguage.displayName=Script language (e.g. beanshell, javascript, jexl)
+scriptLanguage.displayName=Language
+scriptLanguage.shortDescription=Name of BSF language, e.g. beanshell, javascript, jexl
+scripting.displayName=Script (variables: ctx vars props log)
+script.displayName=Script
+script.shortDescription=Script in the appropriate BSF language
+parameterGroup.displayName=Parameters to be passed to script (=> String Parameters and String []args)
+parameters.displayName=Parameters
+parameters.shortDescription=Parameters to be passed to the file or script
+filenameGroup.displayName=Script file (overrides script)
+filename.displayName=File Name
+filename.shortDescription=Script file (overrides script)
\ No newline at end of file

Propchange: jakarta/jmeter/trunk/src/components/org/apache/jmeter/timers/BSFTimerResources.properties
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org