Skip to content
This repository was archived by the owner on Mar 11, 2022. It is now read-only.

Commit 561dc2d

Browse files
author
Tom Blench
committed
Use runtime check instead of categories
1 parent 6efd50b commit 561dc2d

File tree

4 files changed

+11
-43
lines changed

4 files changed

+11
-43
lines changed

cloudant-sync-datastore-core/build.gradle

+1-13
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,11 @@ test {
5353
'com.cloudant.common.SystemTest', \
5454
'com.cloudant.common.RequireRunningCouchDB', \
5555
'com.cloudant.common.PerformanceTest', \
56-
'com.cloudant.common.RequireRunningProxy', \
57-
'com.cloudant.common.RequireCloudant'
56+
'com.cloudant.common.RequireRunningProxy'
5857
}
5958
}
6059

6160
task integrationTest(type: Test, dependsOn: testClasses) {
62-
useJUnit {
63-
excludeCategories \
64-
'com.cloudant.common.SystemTest', \
65-
'com.cloudant.common.PerformanceTest', \
66-
'com.cloudant.common.RequireRunningProxy', \
67-
'com.cloudant.common.RequireCloudant'
68-
}
69-
}
70-
71-
task integrationTestCloudant(type: Test, dependsOn: testClasses) {
7261
useJUnit {
7362
excludeCategories \
7463
'com.cloudant.common.SystemTest', \
@@ -77,7 +66,6 @@ task integrationTestCloudant(type: Test, dependsOn: testClasses) {
7766
}
7867
}
7968

80-
8169
task performanceTest(type: Test, dependsOn: testClasses) {
8270
useJUnit {
8371
includeCategories

cloudant-sync-datastore-core/src/test/java/com/cloudant/common/RequireCloudant.java

-22
This file was deleted.

cloudant-sync-datastore-core/src/test/java/com/cloudant/sync/internal/mazha/CouchClientSelectorChangesTest.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@
1616

1717
import static org.hamcrest.Matchers.hasSize;
1818

19-
import com.cloudant.common.RequireCloudant;
20-
2119
import org.junit.Assert;
2220
import org.junit.Before;
2321
import org.junit.Test;
2422
import org.junit.experimental.categories.Category;
2523

26-
@Category(RequireCloudant.class)
2724
public class CouchClientSelectorChangesTest extends CouchClientTestBase {
2825

2926
@Before
@@ -33,14 +30,16 @@ public void setUp() {
3330
}
3431

3532
@Test
36-
public void changes_selector() {
33+
public void changes_selector() throws Exception {
34+
org.junit.Assume.assumeTrue(ClientTestUtils.isCouchDBV2(client.getRootUri()));
3735
String animalBirdSelector = "{\"selector\":{\"class\":\"bird\"}}";
3836
ChangesResult changes = client.changes(animalBirdSelector, null, 5);
3937
Assert.assertThat(changes.getResults(), hasSize(2));
4038
}
4139

4240
@Test
43-
public void changes_selectorAndMoreThanLimitNumberOfDocs() {
41+
public void changes_selectorAndMoreThanLimitNumberOfDocs() throws Exception {
42+
org.junit.Assume.assumeTrue(ClientTestUtils.isCouchDBV2(client.getRootUri()));
4443
String animalMammalSelector = "{\"selector\":{\"class\":\"mammal\"}}";
4544
ChangesResult firstChangeSet = client.changes(animalMammalSelector, null, 5);
4645
Assert.assertThat(firstChangeSet.getResults(), hasSize(5));

cloudant-sync-datastore-core/src/test/java/com/cloudant/sync/internal/replication/PullStrategySelectorTest.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@
1414

1515
package com.cloudant.sync.internal.replication;
1616

17-
import com.cloudant.common.RequireCloudant;
1817
import com.cloudant.sync.internal.mazha.AnimalDb;
18+
import com.cloudant.sync.internal.mazha.ClientTestUtils;
1919

2020
import org.junit.Assert;
2121
import org.junit.Test;
2222
import org.junit.experimental.categories.Category;
2323

24-
@Category(RequireCloudant.class)
2524
public class PullStrategySelectorTest extends ReplicationTestBase {
2625

2726
// we use this utility method rather than ReplicationTestBase.pull() because some
@@ -36,6 +35,7 @@ private void pull(PullStrategy replicator, int expectedDocs) throws Exception {
3635

3736
@Test
3837
public void pull_filterSelectorBirdFromAnimalDb_twoDocShouldBePulled() throws Exception {
38+
org.junit.Assume.assumeTrue(ClientTestUtils.isCouchDBV2(remoteDb.couchClient.getRootUri()));
3939
String selector ="{\"selector\":{\"class\":\"bird\"}}";
4040
PullStrategy replicator = super.getPullStrategy(selector);
4141

@@ -55,6 +55,7 @@ public void pull_filterSelectorBirdFromAnimalDb_twoDocShouldBePulled() throws Ex
5555
public void
5656
pull_filterSelectorMammalFromAnimalDbUsingParameterizedFilter_eightDocShouldBePulled()
5757
throws Exception {
58+
org.junit.Assume.assumeTrue(ClientTestUtils.isCouchDBV2(remoteDb.couchClient.getRootUri()));
5859
String selector = "{\"selector\":{\"class\":\"mammal\"}}";
5960
PullStrategy replicator = super.getPullStrategy(selector);
6061

@@ -74,6 +75,7 @@ public void pull_filterSelectorBirdFromAnimalDb_twoDocShouldBePulled() throws Ex
7475
@Test
7576
public void pull_filterSelectorSmallFromAnimalDbUsingIntegerFilter_eightDocShouldBePulled()
7677
throws Exception {
78+
org.junit.Assume.assumeTrue(ClientTestUtils.isCouchDBV2(remoteDb.couchClient.getRootUri()));
7779
String selector = "{\"selector\":{\"max_length\":{\"$lte\":2}}}";
7880
PullStrategy replicator = super.getPullStrategy(selector);
7981

@@ -92,7 +94,8 @@ public void pull_filterSelectorSmallFromAnimalDbUsingIntegerFilter_eightDocShoul
9294
@Test
9395
public void pull_filterSelectorSmallFromAnimalDbUsingNullFilter_eightDocShouldBePulled()
9496
throws Exception {
95-
String selector = "{\"selector\":{\"chinese_name\":\"\u718a\u732b\"}}";
97+
org.junit.Assume.assumeTrue(ClientTestUtils.isCouchDBV2(remoteDb.couchClient.getRootUri()));
98+
String selector = "{\"selector\":{\"chinese_name\":\"\u718a\u732b\"}}";
9699
PullStrategy replicator = super.getPullStrategy(selector);
97100

98101
Assert.assertEquals(0, datastore.getDocumentCount());

0 commit comments

Comments
 (0)