You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by mc...@apache.org on 2017/02/16 23:50:01 UTC

svn commit: r1783319 [2/2] - in /jmeter/trunk: src/jorphan/org/apache/jorphan/gui/ src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/ src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/ src/protocol/jms/org/apache/jmeter/protocol/jms/sam...

Added: jmeter/trunk/test/src/org/apache/jmeter/test/ResourceLocator.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/test/ResourceLocator.java?rev=1783319&view=auto
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/test/ResourceLocator.java (added)
+++ jmeter/trunk/test/src/org/apache/jmeter/test/ResourceLocator.java Thu Feb 16 23:50:00 2017
@@ -0,0 +1,51 @@
+/*
+ * 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.test;
+
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public interface ResourceLocator {
+
+    public static String getResource(Object instance, String path) {
+        return getResource(instance.getClass(), path);
+    }
+
+    public static String getResource(Class<?> basetype, String path) {
+        Path nioPath = getResourcePath(basetype, path);
+        return nioPath.toString();
+    }
+
+    public static Path getResourcePath(Object instance, String path) {
+        return getResourcePath(instance.getClass(), path);
+    }
+
+    public static Path getResourcePath(Class<?> basetype, String path) {
+        URL url = basetype.getResource(path);
+        if (url == null) return null;
+        Path nioPath;
+        try {
+            nioPath = Paths.get(url.toURI());
+        } catch (URISyntaxException e) {
+            throw new IllegalStateException(e);
+        }
+        return nioPath;
+    }
+}

Propchange: jmeter/trunk/test/src/org/apache/jmeter/test/ResourceLocator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jmeter/trunk/test/src/org/apache/jmeter/threads/JMeterContextServiceHelper.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/threads/JMeterContextServiceHelper.java?rev=1783319&view=auto
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/threads/JMeterContextServiceHelper.java (added)
+++ jmeter/trunk/test/src/org/apache/jmeter/threads/JMeterContextServiceHelper.java Thu Feb 16 23:50:00 2017
@@ -0,0 +1,41 @@
+/*
+ * 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.threads;
+
+import org.junit.rules.ExternalResource;
+
+public class JMeterContextServiceHelper extends ExternalResource {
+
+    @Override
+    protected void after() {
+        JMeterContextService.removeContext();
+    }
+
+    private JMeterContext instance;
+    public JMeterContext get() {
+        if (instance == null) {
+            JMeterContext jMeterContext = new JMeterContext();
+            JMeterContextService.replaceContext(jMeterContext);
+            initContext(jMeterContext);
+            instance = jMeterContext;
+        }
+        return instance;
+    }
+
+    protected void initContext(JMeterContext jMeterContext) {}
+}

Propchange: jmeter/trunk/test/src/org/apache/jmeter/threads/JMeterContextServiceHelper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1783319&r1=1783318&r2=1783319&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Thu Feb 16 23:50:00 2017
@@ -140,6 +140,7 @@ JMeter now requires Java 8. Ensure you u
 
 <h3>Other samplers</h3>
 <ul>
+	<li><pr>241</pr>Support variable for all JMS messages (bytes, object, ...) and sources (file, folder)</li>
     <li><bug>60585</bug>JMS Publisher and JMS Subscriber : Allow reconnection on error and pause between errors. Based on <pr>240</pr> from by Logan Mauzaize (logan.mauzaize at gmail.com) and Maxime Chassagneux (maxime.chassagneux at gmail.com).</li>
     <li><pr>259</pr>Refactored and reformatted SmtpSampler. Contributed by Graham Russell (graham at ham1.co.uk)</li>
 </ul>