camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] camel git commit: Skip tests on CI
Date Tue, 20 Sep 2016 07:18:35 GMT
Skip tests on CI


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

Branch: refs/heads/master
Commit: 096cefaeaf7784c86b8a1178cd352449cd0d763c
Parents: 3a7f0fc
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Tue Sep 20 09:08:46 2016 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Sep 20 09:18:26 2016 +0200

----------------------------------------------------------------------
 .../component/cassandra/CassandraUnitUtils.java | 52 +++++++++++++++-----
 1 file changed, 39 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/096cefae/components/camel-cassandraql/src/test/java/org/apache/camel/component/cassandra/CassandraUnitUtils.java
----------------------------------------------------------------------
diff --git a/components/camel-cassandraql/src/test/java/org/apache/camel/component/cassandra/CassandraUnitUtils.java
b/components/camel-cassandraql/src/test/java/org/apache/camel/component/cassandra/CassandraUnitUtils.java
index 6f4bb1c..475407b 100644
--- a/components/camel-cassandraql/src/test/java/org/apache/camel/component/cassandra/CassandraUnitUtils.java
+++ b/components/camel-cassandraql/src/test/java/org/apache/camel/component/cassandra/CassandraUnitUtils.java
@@ -24,6 +24,8 @@ import org.cassandraunit.dataset.CQLDataSet;
 import org.cassandraunit.dataset.cql.ClassPathCQLDataSet;
 import org.cassandraunit.utils.EmbeddedCassandraServerHelper;
 
+import static org.apache.camel.component.cassandra.BaseCassandraTest.canTest;
+
 /**
  * Util methods to manage Cassandra in Unit tests
  */
@@ -40,47 +42,71 @@ public final class CassandraUnitUtils {
      * Create Cassandra JUnit Rule.
      */
     public static CassandraCQLUnit cassandraCQLUnit() {
-        if (cassandraCQLUnit == null) {
-            cassandraCQLUnit = cassandraCQLUnit("BasicDataSet.cql");
+        if (canTest()) {
+            if (cassandraCQLUnit == null) {
+                cassandraCQLUnit = cassandraCQLUnit("BasicDataSet.cql");
+            }
         }
         return cassandraCQLUnit;
     }
 
     public static CassandraCQLUnit cassandraCQLUnit(String dataSetCql) {
-        return cassandraCQLUnit(cqlDataSet(dataSetCql));
+        if (canTest()) {
+            return cassandraCQLUnit(cqlDataSet(dataSetCql));
+        } else {
+            return null;
+        }
     }
 
     public static CQLDataSet cqlDataSet(String dataSetCql) {
-        return new ClassPathCQLDataSet(dataSetCql, KEYSPACE);
+        if (canTest()) {
+            return new ClassPathCQLDataSet(dataSetCql, KEYSPACE);
+        } else {
+            return null;
+        }
     }
 
     public static void loadCQLDataSet(Session session, String dataSetCql) {
-        CQLDataLoader loader = new CQLDataLoader(session);
-        loader.load(cqlDataSet(dataSetCql));
+        if (canTest()) {
+            CQLDataLoader loader = new CQLDataLoader(session);
+            loader.load(cqlDataSet(dataSetCql));
+        }
     }
 
     public static CassandraCQLUnit cassandraCQLUnit(CQLDataSet dataset) {
-        return new CassandraCQLUnit(dataset, "/camel-cassandra.yaml");
+        if (canTest()) {
+            return new CassandraCQLUnit(dataset, "/camel-cassandra.yaml");
+        } else {
+            return null;
+        }
     }
 
     /**
      * Start embedded Cassandra.
      */
     public static void startEmbeddedCassandra() throws Exception {
-        EmbeddedCassandraServerHelper.startEmbeddedCassandra("/camel-cassandra.yaml", "target/camel-cassandra",
30000);
+        if (canTest()) {
+            EmbeddedCassandraServerHelper.startEmbeddedCassandra("/camel-cassandra.yaml",
"target/camel-cassandra", 30000);
+        }
     }
 
     /**
      * Clean embedded Cassandra.
      */
     public static void cleanEmbeddedCassandra() throws Exception {
-        EmbeddedCassandraServerHelper.cleanEmbeddedCassandra();
+        if (canTest()) {
+            EmbeddedCassandraServerHelper.cleanEmbeddedCassandra();
+        }
     }
 
     public static Cluster cassandraCluster() {
-        return Cluster.builder()
-                .addContactPoint(HOST)
-                .withClusterName("camel-cluster")
-                .build();
+        if (canTest()) {
+            return Cluster.builder()
+                    .addContactPoint(HOST)
+                    .withClusterName("camel-cluster")
+                    .build();
+        } else {
+            return null;
+        }
     }
 }


Mime
View raw message