ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ptupit...@apache.org
Subject [09/30] ignite git commit: IGNITE-3993: Added failing client tests to "ignored" test suite.
Date Mon, 03 Oct 2016 09:55:40 GMT
IGNITE-3993: Added failing client tests to "ignored" test suite.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d2563dac
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d2563dac
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d2563dac

Branch: refs/heads/master
Commit: d2563dacceea61b19bb6e083e29ebacc28fdd323
Parents: d595345
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Wed Sep 28 15:51:55 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Wed Sep 28 15:51:55 2016 +0300

----------------------------------------------------------------------
 .../client/ClientReconnectionSelfTest.java      |   4 +-
 .../client/router/TcpSslRouterSelfTest.java     |   7 +-
 .../client/suite/IgniteClientTestSuite.java     |  71 ++++++------
 .../ignite/testframework/IgniteTestSuite.java   | 116 ++++++++++++++++---
 .../apache/ignite/testsuites/IgniteIgnore.java  |   2 +-
 modules/ignored-tests/pom.xml                   |  46 ++++++++
 .../testsuites/IgniteIgnoredTestSuite.java      |   5 +-
 7 files changed, 192 insertions(+), 59 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d2563dac/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientReconnectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientReconnectionSelfTest.java
b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientReconnectionSelfTest.java
index 92c8e76..f1085b3 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientReconnectionSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientReconnectionSelfTest.java
@@ -24,6 +24,7 @@ import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.internal.client.impl.connection.GridClientConnectionResetException;
 import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.testsuites.IgniteIgnore;
 
 /**
  *
@@ -182,9 +183,8 @@ public class ClientReconnectionSelfTest extends GridCommonAbstractTest
{
      *
      * @throws Exception If failed.
      */
+    @IgniteIgnore(value = "https://issues.apache.org/jira/browse/IGNITE-590", forceFailure
= true)
     public void testIdleConnection() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-590");
-
         int srvsCnt = 4; // TODO: IGNITE-590 it may be wrong value. Need to investigate after
IGNITE-590 will be fixed.
         
         for (int i = 0; i < srvsCnt; i++)

http://git-wip-us.apache.org/repos/asf/ignite/blob/d2563dac/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpSslRouterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpSslRouterSelfTest.java
b/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpSslRouterSelfTest.java
index 1e2a2bd..3b47ae5 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpSslRouterSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpSslRouterSelfTest.java
@@ -20,17 +20,14 @@ package org.apache.ignite.internal.client.router;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.internal.client.ssl.GridSslContextFactory;
 import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testsuites.IgniteIgnore;
 
 /**
  *
  */
+@IgniteIgnore(value = "https://issues.apache.org/jira/browse/IGNITE-433", forceFailure =
true)
 public class TcpSslRouterSelfTest extends TcpRouterAbstractSelfTest {
     /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-433");
-    }
-
-    /** {@inheritDoc} */
     @Override protected boolean useSsl() {
         return true;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/d2563dac/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java
b/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java
index fdb5456..cc8f9fa 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java
@@ -57,6 +57,7 @@ import org.apache.ignite.internal.processors.rest.RestProcessorMultiStartSelfTes
 import org.apache.ignite.internal.processors.rest.RestProcessorStartSelfTest;
 import org.apache.ignite.internal.processors.rest.TaskCommandHandlerSelfTest;
 import org.apache.ignite.internal.processors.rest.protocols.tcp.TcpRestParserSelfTest;
+import org.apache.ignite.testframework.IgniteTestSuite;
 
 /**
  * Test suite includes all test that concern REST processors.
@@ -66,65 +67,65 @@ public class IgniteClientTestSuite extends TestSuite {
      * @return Suite that contains all tests for REST.
      */
     public static TestSuite suite() {
-        TestSuite suite = new TestSuite("Ignite Clients Test Suite");
+        TestSuite suite = new IgniteTestSuite("Ignite Clients Test Suite");
 
-        suite.addTest(new TestSuite(RouterFactorySelfTest.class));
+        suite.addTestSuite(RouterFactorySelfTest.class);
 
         // Parser standalone test.
-        suite.addTest(new TestSuite(TcpRestParserSelfTest.class));
+        suite.addTestSuite(TcpRestParserSelfTest.class);
 
         // Test memcache protocol with custom test client.
-        suite.addTest(new TestSuite(RestMemcacheProtocolSelfTest.class));
+        suite.addTestSuite(RestMemcacheProtocolSelfTest.class);
 
         // Test custom binary protocol with test client.
-        suite.addTest(new TestSuite(RestBinaryProtocolSelfTest.class));
+        suite.addTestSuite(RestBinaryProtocolSelfTest.class);
 
         // Test jetty rest processor
-        suite.addTest(new TestSuite(JettyRestProcessorSignedSelfTest.class));
-        suite.addTest(new TestSuite(JettyRestProcessorUnsignedSelfTest.class));
+        suite.addTestSuite(JettyRestProcessorSignedSelfTest.class);
+        suite.addTestSuite(JettyRestProcessorUnsignedSelfTest.class);
 
         // Test TCP rest processor with original memcache client.
-        suite.addTest(new TestSuite(ClientMemcachedProtocolSelfTest.class));
+        suite.addTestSuite(ClientMemcachedProtocolSelfTest.class);
 
-        suite.addTest(new TestSuite(RestProcessorStartSelfTest.class));
+        suite.addTestSuite(RestProcessorStartSelfTest.class);
 
         // Test cache flag conversion.
-        suite.addTest(new TestSuite(ClientCacheFlagsCodecTest.class));
+        suite.addTestSuite(ClientCacheFlagsCodecTest.class);
 
         // Test multi-start.
-        suite.addTest(new TestSuite(RestProcessorMultiStartSelfTest.class));
+        suite.addTestSuite(RestProcessorMultiStartSelfTest.class);
 
         // Test clients.
-        suite.addTest(new TestSuite(ClientDataImplSelfTest.class));
-        suite.addTest(new TestSuite(ClientComputeImplSelfTest.class));
-        suite.addTest(new TestSuite(ClientTcpSelfTest.class));
-        suite.addTest(new TestSuite(ClientTcpDirectSelfTest.class));
-        suite.addTest(new TestSuite(ClientTcpSslSelfTest.class));
-        suite.addTest(new TestSuite(ClientTcpSslDirectSelfTest.class));
+        suite.addTestSuite(ClientDataImplSelfTest.class);
+        suite.addTestSuite(ClientComputeImplSelfTest.class);
+        suite.addTestSuite(ClientTcpSelfTest.class);
+        suite.addTestSuite(ClientTcpDirectSelfTest.class);
+        suite.addTestSuite(ClientTcpSslSelfTest.class);
+        suite.addTestSuite(ClientTcpSslDirectSelfTest.class);
 
         // Test client with many nodes.
-        suite.addTest(new TestSuite(ClientTcpMultiNodeSelfTest.class));
-        suite.addTest(new TestSuite(ClientTcpDirectMultiNodeSelfTest.class));
-        suite.addTest(new TestSuite(ClientTcpSslMultiNodeSelfTest.class));
-        suite.addTest(new TestSuite(ClientTcpSslDirectMultiNodeSelfTest.class));
-        suite.addTest(new TestSuite(ClientTcpUnreachableMultiNodeSelfTest.class));
-        suite.addTest(new TestSuite(ClientPreferDirectSelfTest.class));
+        suite.addTestSuite(ClientTcpMultiNodeSelfTest.class);
+        suite.addTestSuite(ClientTcpDirectMultiNodeSelfTest.class);
+        suite.addTestSuite(ClientTcpSslMultiNodeSelfTest.class);
+        suite.addTestSuite(ClientTcpSslDirectMultiNodeSelfTest.class);
+        suite.addTestSuite(ClientTcpUnreachableMultiNodeSelfTest.class);
+        suite.addTestSuite(ClientPreferDirectSelfTest.class);
 
         // Test client with many nodes and in multithreaded scenarios
-        suite.addTest(new TestSuite(ClientTcpMultiThreadedSelfTest.class));
-        suite.addTest(new TestSuite(ClientTcpSslMultiThreadedSelfTest.class));
+        suite.addTestSuite(ClientTcpMultiThreadedSelfTest.class);
+        suite.addTestSuite(ClientTcpSslMultiThreadedSelfTest.class);
 
         // Test client authentication.
-        suite.addTest(new TestSuite(ClientTcpSslAuthenticationSelfTest.class));
+        suite.addTestSuite(ClientTcpSslAuthenticationSelfTest.class);
 
-        suite.addTest(new TestSuite(ClientTcpConnectivitySelfTest.class));
-        suite.addTest(new TestSuite(ClientReconnectionSelfTest.class));
+        suite.addTestSuite(ClientTcpConnectivitySelfTest.class);
+        suite.addTestSuite(ClientReconnectionSelfTest.class);
 
         // Rest task command handler test.
-        suite.addTest(new TestSuite(TaskCommandHandlerSelfTest.class));
+        suite.addTestSuite(TaskCommandHandlerSelfTest.class);
 
         // Default cache only test.
-        suite.addTest(new TestSuite(ClientDefaultCacheSelfTest.class));
+        suite.addTestSuite(ClientDefaultCacheSelfTest.class);
 
         suite.addTestSuite(ClientFutureAdapterSelfTest.class);
         suite.addTestSuite(ClientPropertiesConfigurationSelfTest.class);
@@ -134,13 +135,13 @@ public class IgniteClientTestSuite extends TestSuite {
         suite.addTestSuite(ClientByteUtilsTest.class);
 
         // Router tests.
-        suite.addTest(new TestSuite(TcpRouterSelfTest.class));
-        suite.addTest(new TestSuite(TcpSslRouterSelfTest.class));
-        suite.addTest(new TestSuite(TcpRouterMultiNodeSelfTest.class));
+        suite.addTestSuite(TcpRouterSelfTest.class);
+        suite.addTestSuite(TcpSslRouterSelfTest.class);
+        suite.addTestSuite(TcpRouterMultiNodeSelfTest.class);
 
-        suite.addTest(new TestSuite(ClientFailedInitSelfTest.class));
+        suite.addTestSuite(ClientFailedInitSelfTest.class);
 
-        suite.addTest(new TestSuite(ClientTcpTaskExecutionAfterTopologyRestartSelfTest.class));
+        suite.addTestSuite(ClientTcpTaskExecutionAfterTopologyRestartSelfTest.class);
 
         return suite;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/d2563dac/modules/core/src/test/java/org/apache/ignite/testframework/IgniteTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/IgniteTestSuite.java
b/modules/core/src/test/java/org/apache/ignite/testframework/IgniteTestSuite.java
index 6dad032..7db9664 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/IgniteTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/IgniteTestSuite.java
@@ -129,6 +129,8 @@ public class IgniteTestSuite extends TestSuite {
         if(!Modifier.isPublic(theClass.getModifiers()))
             addTest(warning("Class " + theClass.getName() + " is not public"));
         else {
+            IgnoreDescriptor clsIgnore = IgnoreDescriptor.forClass(theClass);
+
             Class superCls = theClass;
 
             int testAdded = 0;
@@ -140,7 +142,7 @@ public class IgniteTestSuite extends TestSuite {
                 Method[] methods = MethodSorter.getDeclaredMethods(superCls);
 
                 for (Method each : methods) {
-                    if (addTestMethod(each, names, theClass))
+                    if (addTestMethod(each, names, theClass, clsIgnore))
                         testAdded++;
                     else
                         testIgnored++;
@@ -158,9 +160,11 @@ public class IgniteTestSuite extends TestSuite {
      * @param m Test method.
      * @param names Test name list.
      * @param theClass Test class.
+     * @param clsIgnore Class ignore descriptor (if any).
      * @return Whether test method was added.
      */
-    private boolean addTestMethod(Method m, List<String> names, Class<?> theClass)
{
+    private boolean addTestMethod(Method m, List<String> names, Class<?> theClass,
+        @Nullable IgnoreDescriptor clsIgnore) {
         String name = m.getName();
 
         if (names.contains(name))
@@ -175,25 +179,20 @@ public class IgniteTestSuite extends TestSuite {
 
         names.add(name);
 
-        boolean hasIgnore = m.isAnnotationPresent(IgniteIgnore.class);
-
-        if (ignoredOnly) {
-            if (hasIgnore) {
-                IgniteIgnore ignore = m.getAnnotation(IgniteIgnore.class);
+        IgnoreDescriptor ignore = IgnoreDescriptor.forMethod(theClass, m);
 
-                String reason = ignore.value();
-
-                if (F.isEmpty(reason))
-                    throw new IllegalArgumentException("Reason is not set for ignored test
[class=" +
-                        theClass.getName() + ", method=" + name + ']');
+        if (ignore == null)
+            ignore = clsIgnore;
 
+        if (ignoredOnly) {
+            if (ignore != null) {
                 Test test = createTest(theClass, name);
 
                 if (ignore.forceFailure()) {
                     if (test instanceof GridAbstractTest)
-                        ((GridAbstractTest)test).forceFailure(ignore.value());
+                        ((GridAbstractTest)test).forceFailure(ignore.reason());
                     else
-                        test = new ForcedFailure(name, ignore.value());
+                        test = new ForcedFailure(name, ignore.reason());
                 }
 
                 addTest(test);
@@ -202,7 +201,7 @@ public class IgniteTestSuite extends TestSuite {
             }
         }
         else {
-            if (!hasIgnore) {
+            if (ignore == null) {
                 addTest(createTest(theClass, name));
 
                 return true;
@@ -251,6 +250,93 @@ public class IgniteTestSuite extends TestSuite {
     }
 
     /**
+     * Ignore descriptor.
+     */
+    private static class IgnoreDescriptor {
+        /** Reason. */
+        private final String reason;
+
+        /** Force failure. */
+        private final boolean forceFailure;
+
+        /**
+         * Get descriptor for class (if any).
+         *
+         * @param cls Class.
+         * @return Descriptor or {@code null}.
+         */
+        @Nullable public static IgnoreDescriptor forClass(Class cls) {
+            Class cls0 = cls;
+
+            while (Test.class.isAssignableFrom(cls0)) {
+                if (cls0.isAnnotationPresent(IgniteIgnore.class)) {
+                    IgniteIgnore ignore = (IgniteIgnore)cls0.getAnnotation(IgniteIgnore.class);
+
+                    String reason = ignore.value();
+
+                    if (F.isEmpty(reason))
+                        throw new IllegalArgumentException("Reason is not set for ignored
test [class=" +
+                            cls0.getName() + ']');
+
+                    return new IgnoreDescriptor(reason, ignore.forceFailure());
+                }
+
+                cls0 = cls0.getSuperclass();
+            }
+
+            return null;
+        }
+
+        /**
+         * Get descriptor for method (if any).
+         *
+         * @param cls Class.
+         * @param mthd Method.
+         * @return Descriptor or {@code null}.
+         */
+        @Nullable public static IgnoreDescriptor forMethod(Class cls, Method mthd) {
+            if (mthd.isAnnotationPresent(IgniteIgnore.class)) {
+                IgniteIgnore ignore = mthd.getAnnotation(IgniteIgnore.class);
+
+                String reason = ignore.value();
+
+                if (F.isEmpty(reason))
+                    throw new IllegalArgumentException("Reason is not set for ignored test
[class=" +
+                        cls.getName() + ", method=" + mthd.getName() + ']');
+
+                return new IgnoreDescriptor(reason, ignore.forceFailure());
+            }
+            else
+                return null;
+        }
+
+        /**
+         * Constructor.
+         *
+         * @param reason Reason.
+         * @param forceFailure Force failure.
+         */
+        private IgnoreDescriptor(String reason, boolean forceFailure) {
+            this.reason = reason;
+            this.forceFailure = forceFailure;
+        }
+
+        /**
+         * @return Reason.
+         */
+        public String reason() {
+            return reason;
+        }
+
+        /**
+         * @return Force failure.
+         */
+        public boolean forceFailure() {
+            return forceFailure;
+        }
+    }
+
+    /**
      * Test case simulating failure.
      */
     private static class ForcedFailure extends TestCase {

http://git-wip-us.apache.org/repos/asf/ignite/blob/d2563dac/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgnore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgnore.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgnore.java
index dbb1d7a..05af2a2 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgnore.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgnore.java
@@ -26,7 +26,7 @@ import java.lang.annotation.Target;
  * Annotation which indicates that the test is ignored.
  */
 @Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD})
+@Target({ElementType.METHOD, ElementType.TYPE})
 public @interface IgniteIgnore {
     /**
      * Reason for ignore (usually link to JIRA ticket).

http://git-wip-us.apache.org/repos/asf/ignite/blob/d2563dac/modules/ignored-tests/pom.xml
----------------------------------------------------------------------
diff --git a/modules/ignored-tests/pom.xml b/modules/ignored-tests/pom.xml
index 336485c..142754e 100644
--- a/modules/ignored-tests/pom.xml
+++ b/modules/ignored-tests/pom.xml
@@ -52,6 +52,20 @@
 
         <dependency>
             <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-clients</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-clients</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
             <artifactId>ignite-cloud</artifactId>
             <version>${project.version}</version>
         </dependency>
@@ -80,6 +94,12 @@
 
         <dependency>
             <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-indexing</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
             <artifactId>ignite-jta</artifactId>
             <version>${project.version}</version>
         </dependency>
@@ -100,6 +120,12 @@
 
         <dependency>
             <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-rest-http</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
             <artifactId>ignite-spring</artifactId>
             <version>${project.version}</version>
         </dependency>
@@ -128,6 +154,26 @@
 
         <!-- 3-rd party dependencies. -->
         <dependency>
+            <groupId>com.google.code.simple-spring-memcached</groupId>
+            <artifactId>spymemcached</artifactId>
+            <version>2.7.3</version>
+            <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>commons-codec</groupId>
+                    <artifactId>commons-codec</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>2.4</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
             <groupId>javax.resource</groupId>
             <artifactId>connector-api</artifactId>
             <version>1.5</version>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d2563dac/modules/ignored-tests/src/test/java/org/apache/ignite/testsuites/IgniteIgnoredTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/ignored-tests/src/test/java/org/apache/ignite/testsuites/IgniteIgnoredTestSuite.java
b/modules/ignored-tests/src/test/java/org/apache/ignite/testsuites/IgniteIgnoredTestSuite.java
index 2188cd6..fd92a35 100644
--- a/modules/ignored-tests/src/test/java/org/apache/ignite/testsuites/IgniteIgnoredTestSuite.java
+++ b/modules/ignored-tests/src/test/java/org/apache/ignite/testsuites/IgniteIgnoredTestSuite.java
@@ -37,13 +37,16 @@ public class IgniteIgnoredTestSuite extends TestSuite {
         /* --- AWS --- */
         suite.addTest(IgniteS3TestSuite.suite());
 
+        /* --- CLIENTS --- */
+        suite.addTest(org.apache.ignite.internal.client.suite.IgniteClientTestSuite.suite());
+
         /* --- CLOUDS --- */
         suite.addTest(IgniteCloudTestSuite.suite());
 
         /* --- JTA --- */
         suite.addTest(IgniteJtaTestSuite.suite());
 
-        /* --- Spring --- */
+        /* --- SPRING --- */
         suite.addTest(IgniteSpringTestSuite.suite());
 
         /* --- WEB SESSIONS --- */


Mime
View raw message