From 32188a9d0f070ee75ec0505b4b34c19e6635de3a Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Wed, 25 May 2016 08:36:57 +0000 Subject: [PATCH] Since I introduced the use of PatternFactory.createOrGetPerl5CompiledPattern() in Minilang Regexp class at r1542960 the IfRegexpTest class and test are no longer needed. Tested with "java -jar ofbiz.jar --test component=minilang --test suitename=MinilangTests" git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1745451 13f79535-47bb-0310-9956-ffa450edef68 --- .../method/ifops/test/IfRegexpTest.java | 87 ------------------- framework/minilang/testdef/MinilangTests.xml | 4 - 2 files changed, 91 deletions(-) delete mode 100644 framework/minilang/src/org/ofbiz/minilang/method/ifops/test/IfRegexpTest.java diff --git a/framework/minilang/src/org/ofbiz/minilang/method/ifops/test/IfRegexpTest.java b/framework/minilang/src/org/ofbiz/minilang/method/ifops/test/IfRegexpTest.java deleted file mode 100644 index bcda4a0a4c..0000000000 --- a/framework/minilang/src/org/ofbiz/minilang/method/ifops/test/IfRegexpTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * 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.ofbiz.minilang.method.ifops.test; - -import java.util.Locale; -import org.ofbiz.base.util.Debug; -import org.ofbiz.base.util.UtilMisc; -import org.ofbiz.minilang.MiniLangException; -import org.ofbiz.minilang.SimpleMethod; -import org.ofbiz.minilang.method.MethodContext; -import org.ofbiz.service.LocalDispatcher; -import org.ofbiz.service.testtools.OFBizTestCase; - -public class IfRegexpTest extends OFBizTestCase { - - private static final String module = IfRegexpTest.class.getName(); - - public IfRegexpTest(String name) { - super(name); - } - - public void testIfRegexpThreadSafety() throws Exception { - MyThread t1 = new MyThread(null, dispatcher); - MyThread t2 = new MyThread(t1, dispatcher); - - t1.start(); - Thread.sleep(1000); - t2.start(); - - try { - t1.join(15000); - } catch (InterruptedException e) { - // if within 15 secs no problem has occurred, assume success - } - - assertTrue(t1.success); - assertTrue(t2.success); - } - - private static class MyThread extends Thread { - private boolean stopNow = false; - private boolean success = true; - private final MyThread friend; - private final LocalDispatcher dispatcher; - - public MyThread(MyThread friend, LocalDispatcher dispatcher) { - this.friend = friend; - this.dispatcher = dispatcher; - } - - @Override - public void run() { - int tryCount = 0; - while (!stopNow) { - MethodContext methodContext = new MethodContext(dispatcher.getDispatchContext(), UtilMisc.toMap("locale", Locale.getDefault()), null); - try { - tryCount++; - String responseCode = SimpleMethod.runSimpleMethod("component://minilang/script/org/ofbiz/minilang/method/ifops/IfRegexpTests.xml", "testIfRegexp", methodContext); - if (!"success".equals(methodContext.getEnv("responseMessage"))) { - success = false; - Debug.logError("ResponseCode not success: [" + responseCode + "], tryCount: [" + tryCount + "], envMap: [" + methodContext.getEnvMap() + "]", module); - if (friend != null) friend.stopNow = true; - break; - } - } catch (MiniLangException e) { - throw new RuntimeException(e); - } - } - }; - } -} diff --git a/framework/minilang/testdef/MinilangTests.xml b/framework/minilang/testdef/MinilangTests.xml index 7f2081230c..f2481c4fce 100644 --- a/framework/minilang/testdef/MinilangTests.xml +++ b/framework/minilang/testdef/MinilangTests.xml @@ -22,10 +22,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd"> - - - -