Skip to content

Commit b2a9dd1

Browse files
committed
fixed smartJoinAttribute test
1 parent 3c6a473 commit b2a9dd1

File tree

1 file changed

+32
-4
lines changed

1 file changed

+32
-4
lines changed

src/test/java/com/arangodb/ArangoDatabaseTest.java

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import java.util.Iterator;
3939
import java.util.Map;
4040
import java.util.concurrent.ExecutionException;
41+
import java.util.concurrent.TimeUnit;
4142
import java.util.concurrent.atomic.AtomicInteger;
4243

4344
import org.junit.Ignore;
@@ -173,7 +174,7 @@ public void createCollectionWithReplicationFactor() {
173174
@Test
174175
public void createSatelliteCollection() {
175176

176-
if (arangoDB.getVersion().getLicense() == ArangoDBVersion.License.COMMUNITY) {
177+
if (arangoDB.getVersion().getLicense() == License.COMMUNITY) {
177178
LOG.info("Skip Test on COMMUNITY VERSION");
178179
return;
179180
}
@@ -247,18 +248,45 @@ public void createCollectionWithSmartJoinAttribute() {
247248
}
248249

249250
try {
250-
251-
final CollectionEntity result = db.createCollection(COLLECTION_NAME, new CollectionCreateOptions().smartJoinAttribute("test123"));
251+
final CollectionEntity result = db.createCollection(COLLECTION_NAME, new CollectionCreateOptions().smartJoinAttribute("test123").shardKeys("_key:"));
252252

253253
assertThat(result, is(notNullValue()));
254254
assertThat(result.getId(), is(notNullValue()));
255255
assertThat(db.collection(COLLECTION_NAME).getProperties().getSmartJoinAttribute(), is("test123"));
256256

257+
} catch (Exception e) {
258+
System.out.println(e);
259+
assertTrue(false);
257260
} finally {
258-
db.collection(COLLECTION_NAME).drop();
261+
try {
262+
db.collection(COLLECTION_NAME).drop();
263+
} catch (Exception e) {
264+
System.out.println(e);
265+
}
259266
}
260267
}
261268

269+
@Test
270+
public void createCollectionWithSmartJoinAttributeWrong() {
271+
if (arangoDB.getVersion().getLicense() == License.COMMUNITY) {
272+
LOG.info("Skip Test on COMMUNITY SERVER");
273+
return;
274+
}
275+
276+
try {
277+
db.createCollection(COLLECTION_NAME, new CollectionCreateOptions().smartJoinAttribute("test123"));
278+
} catch (ArangoDBException e) {
279+
assertThat(e.getErrorNum(), is(4006));
280+
assertThat(e.getResponseCode(), is(500));
281+
} finally {
282+
try {
283+
db.collection(COLLECTION_NAME).drop();
284+
assertTrue(false);
285+
} catch (Exception e) {
286+
System.out.println(e);
287+
}
288+
}
289+
}
262290

263291
@Test
264292
public void createCollectionWithNumberOfShardsAndShardKey() {

0 commit comments

Comments
 (0)