Skip to content

Commit d966bc9

Browse files
author
michele
committed
skip acquireHostList for async tests
1 parent d92cf26 commit d966bc9

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed

src/test/java/com/arangodb/async/ArangoDBTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
import com.arangodb.velocypack.exception.VPackException;
3030
import com.arangodb.velocystream.Request;
3131
import com.arangodb.velocystream.RequestType;
32+
import org.junit.ClassRule;
3233
import org.junit.Test;
34+
import org.junit.rules.TestRule;
3335

3436
import java.util.Collection;
3537
import java.util.HashMap;
@@ -50,6 +52,9 @@ public class ArangoDBTest {
5052
private static final String USER = "mit dem mund";
5153
private static final String PW = "machts der hund";
5254

55+
@ClassRule
56+
public static TestRule acquireHostListRule = TestUtils.acquireHostListRule;
57+
5358
@Test
5459
public void getVersion() throws InterruptedException, ExecutionException {
5560
final ArangoDBAsync arangoDB = new ArangoDBAsync.Builder().build();

src/test/java/com/arangodb/async/BaseTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@
2525
import com.arangodb.entity.ServerRole;
2626
import org.junit.AfterClass;
2727
import org.junit.BeforeClass;
28+
import org.junit.ClassRule;
29+
import org.junit.rules.TestRule;
2830

2931
import java.util.concurrent.ExecutionException;
3032

33+
3134
/**
3235
* @author Mark Vollmary
3336
*/
@@ -37,6 +40,9 @@ public abstract class BaseTest {
3740
static ArangoDBAsync arangoDB;
3841
static ArangoDatabaseAsync db;
3942

43+
@ClassRule
44+
public static TestRule acquireHostListRule = TestUtils.acquireHostListRule;
45+
4046
@BeforeClass
4147
public static void init() throws InterruptedException, ExecutionException {
4248
if (arangoDB == null) {
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package com.arangodb.async;/*
2+
* DISCLAIMER
3+
*
4+
* Copyright 2016 ArangoDB GmbH, Cologne, Germany
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*
18+
* Copyright holder is ArangoDB GmbH, Cologne, Germany
19+
*/
20+
21+
22+
import org.junit.rules.TestRule;
23+
24+
import java.io.IOException;
25+
import java.io.InputStream;
26+
import java.util.Properties;
27+
28+
import static org.junit.Assume.assumeTrue;
29+
30+
/**
31+
* @author Michele Rastelli
32+
*/
33+
public class TestUtils {
34+
public static TestRule acquireHostListRule = (base, description) -> {
35+
assumeTrue(!TestUtils.isAcquireHostList());
36+
return base;
37+
};
38+
39+
private static boolean isAcquireHostList() {
40+
InputStream in = TestUtils.class.getResourceAsStream("/arangodb.properties");
41+
final Properties properties = new Properties();
42+
try {
43+
properties.load(in);
44+
} catch (IOException e) {
45+
e.printStackTrace();
46+
return false;
47+
}
48+
return Boolean.parseBoolean(String.valueOf(properties.get("arangodb.acquireHostList")));
49+
}
50+
51+
}

0 commit comments

Comments
 (0)