diff --git a/functional-test/src/test/java/org/zanata/feature/projectversion/VersionFilteringTest.java b/functional-test/src/test/java/org/zanata/feature/projectversion/VersionFilteringTest.java index 2ffc7495b7..3c93c70206 100644 --- a/functional-test/src/test/java/org/zanata/feature/projectversion/VersionFilteringTest.java +++ b/functional-test/src/test/java/org/zanata/feature/projectversion/VersionFilteringTest.java @@ -21,6 +21,7 @@ package org.zanata.feature.projectversion; +import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -51,6 +52,7 @@ public class VersionFilteringTest extends ZanataTestCase { @Feature(summary = "The user can filter project versions by name", tcmsTestPlanIds = 5316, tcmsTestCaseIds = 0) + @Ignore("dodgy test (intermittent timeout)") @Test(timeout = ZanataTestCase.MAX_SHORT_TEST_DURATION) public void versionSearchFiltering() throws Exception { String projectName = "versionsearchnums"; diff --git a/zanata-war/pom.xml b/zanata-war/pom.xml index ebdde6b09a..eb31ea9fc7 100644 --- a/zanata-war/pom.xml +++ b/zanata-war/pom.xml @@ -1259,13 +1259,6 @@ - - com.binarytweed - quarantining-test-runner - 0.0.3 - test - - com.tngtech.java junit-dataprovider diff --git a/zanata-war/src/test/java/org/zanata/ZanataTest.java b/zanata-war/src/test/java/org/zanata/ZanataTest.java index 0d2460d270..3d9464efee 100644 --- a/zanata-war/src/test/java/org/zanata/ZanataTest.java +++ b/zanata-war/src/test/java/org/zanata/ZanataTest.java @@ -20,14 +20,15 @@ */ package org.zanata; -import com.binarytweed.test.Quarantine; -import org.junit.runner.RunWith; -import org.zanata.test.QuarantiningRunner; +import org.zanata.seam.SeamAutowire; /** * @author Sean Flanigan sflaniga@redhat.com */ -@Quarantine({ "org.jboss.seam" }) -@RunWith(QuarantiningRunner.class) public abstract class ZanataTest { + + static { + SeamAutowire.instance(); + } + } diff --git a/zanata-war/src/test/java/org/zanata/dao/TextFlowTargetHistoryDAOTest.java b/zanata-war/src/test/java/org/zanata/dao/TextFlowTargetHistoryDAOTest.java index edbfcc97aa..a300922a17 100644 --- a/zanata-war/src/test/java/org/zanata/dao/TextFlowTargetHistoryDAOTest.java +++ b/zanata-war/src/test/java/org/zanata/dao/TextFlowTargetHistoryDAOTest.java @@ -9,7 +9,6 @@ import org.joda.time.format.DateTimeFormatter; import org.junit.Before; import org.junit.Test; -import org.junit.runner.RunWith; import org.zanata.ZanataJpaTest; import org.zanata.common.ContentState; import org.zanata.common.LocaleId; diff --git a/zanata-war/src/test/java/org/zanata/rest/service/ResourceUtilsTest.java b/zanata-war/src/test/java/org/zanata/rest/service/ResourceUtilsTest.java index c9398875fb..9e12eb434f 100644 --- a/zanata-war/src/test/java/org/zanata/rest/service/ResourceUtilsTest.java +++ b/zanata-war/src/test/java/org/zanata/rest/service/ResourceUtilsTest.java @@ -10,7 +10,6 @@ import java.util.Properties; import javax.persistence.EntityManager; -import com.binarytweed.test.DelegateRunningTo; import com.tngtech.java.junit.dataprovider.DataProvider; import com.tngtech.java.junit.dataprovider.DataProviderRunner; import com.tngtech.java.junit.dataprovider.UseDataProvider; @@ -44,7 +43,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -@DelegateRunningTo(DataProviderRunner.class) +@RunWith(DataProviderRunner.class) public class ResourceUtilsTest extends ZanataTest { private static final Logger log = LoggerFactory .getLogger(ResourceUtilsTest.class); diff --git a/zanata-war/src/test/java/org/zanata/rest/service/RestUtilsTest.java b/zanata-war/src/test/java/org/zanata/rest/service/RestUtilsTest.java index e91bc0dcba..f6a5d6e838 100644 --- a/zanata-war/src/test/java/org/zanata/rest/service/RestUtilsTest.java +++ b/zanata-war/src/test/java/org/zanata/rest/service/RestUtilsTest.java @@ -9,7 +9,6 @@ import javax.validation.ValidatorFactory; import javax.ws.rs.core.MediaType; -import com.binarytweed.test.DelegateRunningTo; import com.tngtech.java.junit.dataprovider.DataProvider; import com.tngtech.java.junit.dataprovider.DataProviderRunner; import com.tngtech.java.junit.dataprovider.UseDataProvider; @@ -31,7 +30,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; -@DelegateRunningTo(DataProviderRunner.class) +@RunWith(DataProviderRunner.class) public class RestUtilsTest extends ZanataTest { RestUtils restUtils; diff --git a/zanata-war/src/test/java/org/zanata/test/SeamQuarantineTest.java b/zanata-war/src/test/java/org/zanata/seam/SeamAutowireLinkageTest.java similarity index 88% rename from zanata-war/src/test/java/org/zanata/test/SeamQuarantineTest.java rename to zanata-war/src/test/java/org/zanata/seam/SeamAutowireLinkageTest.java index 1d8daa704f..4905253e51 100644 --- a/zanata-war/src/test/java/org/zanata/test/SeamQuarantineTest.java +++ b/zanata-war/src/test/java/org/zanata/seam/SeamAutowireLinkageTest.java @@ -18,20 +18,17 @@ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ -package org.zanata.test; +package org.zanata.seam; -import com.binarytweed.test.Quarantine; import org.junit.Test; -import org.junit.runner.RunWith; import org.zanata.ZanataTest; -import org.zanata.seam.SeamAutowire; /** * @author Sean Flanigan sflaniga@redhat.com */ -@Quarantine({ "org.jboss.seam", "org.zanata.test.SeamQuarantineTest" }) -public class SeamQuarantineTest extends ZanataTest { +public class SeamAutowireLinkageTest extends ZanataTest { + @Test public void test1() throws ClassNotFoundException { // load Seam before test2 gets a chance to use SeamAutowire diff --git a/zanata-war/src/test/java/org/zanata/seam/SeamAutowireTest.java b/zanata-war/src/test/java/org/zanata/seam/SeamAutowireTest.java index d0632a4393..5782cd4818 100644 --- a/zanata-war/src/test/java/org/zanata/seam/SeamAutowireTest.java +++ b/zanata-war/src/test/java/org/zanata/seam/SeamAutowireTest.java @@ -20,7 +20,6 @@ */ package org.zanata.seam; -import com.binarytweed.test.DelegateRunningTo; import com.tngtech.java.junit.dataprovider.DataProvider; import com.tngtech.java.junit.dataprovider.DataProviderRunner; import com.tngtech.java.junit.dataprovider.UseDataProvider; @@ -51,7 +50,7 @@ * @author Carlos Munoz camunoz@redhat.com */ -@DelegateRunningTo(DataProviderRunner.class) +@RunWith(DataProviderRunner.class) public class SeamAutowireTest extends ZanataDbunitJpaTest { @Override protected void prepareDBUnitOperations() { diff --git a/zanata-war/src/test/java/org/zanata/service/impl/CopyTransServiceImplTest.java b/zanata-war/src/test/java/org/zanata/service/impl/CopyTransServiceImplTest.java index 6674961c88..5624323d7a 100644 --- a/zanata-war/src/test/java/org/zanata/service/impl/CopyTransServiceImplTest.java +++ b/zanata-war/src/test/java/org/zanata/service/impl/CopyTransServiceImplTest.java @@ -24,7 +24,6 @@ import java.util.HashSet; import java.util.Set; -import com.binarytweed.test.DelegateRunningTo; import com.tngtech.java.junit.dataprovider.DataProvider; import com.tngtech.java.junit.dataprovider.DataProviderRunner; import com.tngtech.java.junit.dataprovider.UseDataProvider; @@ -79,7 +78,7 @@ * @author Sean Flanigan sflaniga@redhat.com */ -@DelegateRunningTo(DataProviderRunner.class) +@RunWith(DataProviderRunner.class) public class CopyTransServiceImplTest extends ZanataDbunitJpaTest { private SeamAutowire seam = SeamAutowire.instance(); diff --git a/zanata-war/src/test/java/org/zanata/service/impl/TranslationFinderTest.java b/zanata-war/src/test/java/org/zanata/service/impl/TranslationFinderTest.java index 7ae1a1e617..c1ccc41352 100644 --- a/zanata-war/src/test/java/org/zanata/service/impl/TranslationFinderTest.java +++ b/zanata-war/src/test/java/org/zanata/service/impl/TranslationFinderTest.java @@ -9,7 +9,6 @@ import java.util.List; import java.util.Set; -import com.binarytweed.test.DelegateRunningTo; import com.tngtech.java.junit.dataprovider.DataProvider; import com.tngtech.java.junit.dataprovider.DataProviderRunner; import com.tngtech.java.junit.dataprovider.UseDataProvider; @@ -46,7 +45,7 @@ * href="mailto:camunoz@redhat.com">camunoz@redhat.com * @author Sean Flanigan sflaniga@redhat.com */ -@DelegateRunningTo(DataProviderRunner.class) +@RunWith(DataProviderRunner.class) public class TranslationFinderTest extends ImmutableDbunitJpaTest { private SeamAutowire seam = SeamAutowire.instance(); private HLocale sourceLocale; diff --git a/zanata-war/src/test/java/org/zanata/service/impl/TranslationMemoryServiceImplTest.java b/zanata-war/src/test/java/org/zanata/service/impl/TranslationMemoryServiceImplTest.java index edfe7b986d..5d1eb6385f 100644 --- a/zanata-war/src/test/java/org/zanata/service/impl/TranslationMemoryServiceImplTest.java +++ b/zanata-war/src/test/java/org/zanata/service/impl/TranslationMemoryServiceImplTest.java @@ -3,7 +3,6 @@ import java.util.Date; import java.util.List; -import com.binarytweed.test.DelegateRunningTo; import com.tngtech.java.junit.dataprovider.DataProvider; import com.tngtech.java.junit.dataprovider.DataProviderRunner; import com.tngtech.java.junit.dataprovider.UseDataProvider; @@ -13,7 +12,6 @@ import org.hibernate.search.impl.FullTextSessionImpl; import org.hibernate.search.jpa.Search; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.MockitoAnnotations; @@ -49,7 +47,7 @@ * @author Alex Eng aeng@redhat.com */ // see also TranslationFinderTest -@DelegateRunningTo(DataProviderRunner.class) +@RunWith(DataProviderRunner.class) public class TranslationMemoryServiceImplTest extends ImmutableDbunitJpaTest { private SeamAutowire seam = SeamAutowire.instance(); private TranslationMemoryServiceImpl service; diff --git a/zanata-war/src/test/java/org/zanata/test/QuarantiningRunner.java b/zanata-war/src/test/java/org/zanata/test/QuarantiningRunner.java deleted file mode 100644 index a513081e45..0000000000 --- a/zanata-war/src/test/java/org/zanata/test/QuarantiningRunner.java +++ /dev/null @@ -1,109 +0,0 @@ -// This implementation is copied from com.binarytweed.test.QuarantiningRunner -// in https://github.com/BinaryTweed/quarantining-test-runner v0.0.2 -// with quarantine disabled for testFileClassName and -// delegateRunningToClassName. - -// TODO see if we can remove this class when this issue is closed: -// https://github.com/BinaryTweed/quarantining-test-runner/issues/3 - -package org.zanata.test; - -import java.lang.reflect.InvocationTargetException; - -import org.junit.runner.Description; -import org.junit.runner.Runner; -import org.junit.runner.notification.Failure; -import org.junit.runner.notification.RunNotifier; -import org.junit.runners.model.InitializationError; - -import com.binarytweed.test.DelegateRunningToDiscoverer; -import com.binarytweed.test.QuarantinedPatternDiscoverer; -import com.binarytweed.test.QuarantiningUrlClassLoader; - -/** - * Uses {@code QuarantiningUrlClassLoader} to load the test class, meaning the - * {@code Quarantine} annotation can be used to ensure certain classes are - * loaded separately. - * - * Use of a separate class loader allows classes to be reloaded for each test - * class, which is handy when you're testing frameworks that make use of static - * members. - * - * The selective quarantining is required because if the test class and its - * 'children' are all loaded by a different class loader, then the {@code Test} - * annotations yield different {@code Class} instances. JUnit then thinks there - * are no runnable methods, because it looks them up by Class. - * - * This implementation was modified (by Sean Flanigan) so that it no longer - * implicitly quarantines the Test class and the delegate Runner. - */ -public class QuarantiningRunner extends Runner { - private final Object innerRunner; - private final Class innerRunnerClass; - private final DelegateRunningToDiscoverer delegateRunningToDiscoverer; - private final QuarantinedPatternDiscoverer quarantinedPatternDiscoverer; - - public QuarantiningRunner(Class testFileClass) - throws InitializationError { - delegateRunningToDiscoverer = new DelegateRunningToDiscoverer(); - quarantinedPatternDiscoverer = new QuarantinedPatternDiscoverer(); - Class delegateRunningTo = - delegateRunningToDiscoverer - .getDelegateRunningToOn(testFileClass); - - String testFileClassName = testFileClass.getName(); - String delegateRunningToClassName = delegateRunningTo.getName(); - - String[] quarantinedPatterns = - quarantinedPatternDiscoverer - .getQuarantinedPatternsOn(testFileClass); - // String[] allPatterns = Arrays.copyOf(quarantinedPatterns, - // quarantinedPatterns.length + 2); - // allPatterns[quarantinedPatterns.length] = testFileClassName; - // allPatterns[quarantinedPatterns.length + 1] = - // delegateRunningToClassName; - // - // QuarantiningUrlClassLoader classLoader = new - // QuarantiningUrlClassLoader(allPatterns); - QuarantiningUrlClassLoader classLoader = - new QuarantiningUrlClassLoader(quarantinedPatterns); - - try { - innerRunnerClass = - classLoader.loadClass(delegateRunningToClassName); - Class testClass = classLoader.loadClass(testFileClassName); - innerRunner = - innerRunnerClass.cast(innerRunnerClass.getConstructor( - Class.class).newInstance(testClass)); - } catch (InstantiationException | IllegalAccessException - | IllegalArgumentException | InvocationTargetException - | NoSuchMethodException | SecurityException - | ClassNotFoundException e) { - throw new InitializationError(e); - } - } - - @Override - public Description getDescription() { - try { - return (Description) innerRunnerClass.getMethod("getDescription") - .invoke(innerRunner); - } catch (IllegalAccessException | IllegalArgumentException - | InvocationTargetException | NoSuchMethodException - | SecurityException e) { - throw new RuntimeException("Could not get description", e); - } - } - - @Override - public void run(RunNotifier notifier) { - try { - innerRunnerClass.getMethod("run", RunNotifier.class).invoke( - innerRunner, notifier); - } catch (IllegalAccessException | IllegalArgumentException - | InvocationTargetException | NoSuchMethodException - | SecurityException e) { - notifier.fireTestFailure(new Failure(getDescription(), e)); - } - } -}