Skip to content

Commit aabe64a

Browse files
committed
use existing arangoDB.getVersion().getLicense()
1 parent 319f66b commit aabe64a

File tree

5 files changed

+13
-64
lines changed

5 files changed

+13
-64
lines changed

src/main/java/com/arangodb/ArangoDB.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import com.arangodb.entity.LogEntity;
3333
import com.arangodb.entity.LogLevelEntity;
3434
import com.arangodb.entity.Permissions;
35-
import com.arangodb.entity.ServerLicense;
3635
import com.arangodb.entity.ServerRole;
3736
import com.arangodb.entity.UserEntity;
3837
import com.arangodb.internal.ArangoContext;
@@ -712,14 +711,6 @@ public synchronized ArangoDB build() {
712711
*/
713712
ServerRole getRole() throws ArangoDBException;
714713

715-
/**
716-
* Returns the server license.
717-
*
718-
* @return the server license
719-
* @throws ArangoDBException
720-
*/
721-
ServerLicense getLicense() throws ArangoDBException;
722-
723714
/**
724715
* Create a new user. This user will not have access to any database. You need permission to the _system database in
725716
* order to execute this call.

src/main/java/com/arangodb/entity/ServerLicense.java

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/main/java/com/arangodb/internal/ArangoDBImpl.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import com.arangodb.entity.LogEntity;
3535
import com.arangodb.entity.LogLevelEntity;
3636
import com.arangodb.entity.Permissions;
37-
import com.arangodb.entity.ServerLicense;
3837
import com.arangodb.entity.ServerRole;
3938
import com.arangodb.entity.UserEntity;
4039
import com.arangodb.internal.ArangoExecutor.ResponseDeserializer;
@@ -196,11 +195,6 @@ public ServerRole getRole() throws ArangoDBException {
196195
return executor.execute(getRoleRequest(), getRoleResponseDeserializer());
197196
}
198197

199-
@Override
200-
public ServerLicense getLicense() throws ArangoDBException {
201-
return executor.execute(getLicenseRequest(), getLicenseResponseDeserializer());
202-
}
203-
204198
@Override
205199
public UserEntity createUser(final String user, final String passwd) throws ArangoDBException {
206200
return executor.execute(createUserRequest(db().name(), user, passwd, new UserCreateOptions()),

src/main/java/com/arangodb/internal/InternalArangoDB.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
import com.arangodb.entity.LogLevelEntity;
2929
import com.arangodb.entity.Permissions;
30-
import com.arangodb.entity.ServerLicense;
3130
import com.arangodb.entity.ServerRole;
3231
import com.arangodb.entity.UserEntity;
3332
import com.arangodb.internal.ArangoExecutor.ResponseDeserializer;
@@ -76,20 +75,6 @@ public ServerRole deserialize(final Response response) throws VPackException {
7675
};
7776
}
7877

79-
protected Request getLicenseRequest() {
80-
return request(ArangoRequestParam.SYSTEM, RequestType.GET, PATH_API_VERSION);
81-
}
82-
83-
protected ResponseDeserializer<ServerLicense> getLicenseResponseDeserializer() {
84-
return new ResponseDeserializer<ServerLicense>() {
85-
@Override
86-
public ServerLicense deserialize(final Response response) throws VPackException {
87-
System.out.println(response.getBody().toString());
88-
return util().deserialize(response.getBody().get("license"), ServerLicense.class);
89-
}
90-
};
91-
}
92-
9378
protected Request createDatabaseRequest(final String name) {
9479
final Request request = request(ArangoRequestParam.SYSTEM, RequestType.POST,
9580
InternalArangoDatabase.PATH_API_DATABASE);

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
import org.junit.Test;
4545
import org.junit.runner.RunWith;
4646
import org.junit.runners.Parameterized;
47+
import org.slf4j.Logger;
48+
import org.slf4j.LoggerFactory;
4749

4850
import com.arangodb.ArangoDB.Builder;
4951
import com.arangodb.entity.AqlExecutionExplainEntity;
@@ -69,7 +71,6 @@
6971
import com.arangodb.entity.QueryEntity;
7072
import com.arangodb.entity.QueryExecutionState;
7173
import com.arangodb.entity.QueryTrackingPropertiesEntity;
72-
import com.arangodb.entity.ServerLicense;
7374
import com.arangodb.entity.ServerRole;
7475
import com.arangodb.entity.TraversalEntity;
7576
import com.arangodb.model.AqlFunctionDeleteOptions;
@@ -92,6 +93,8 @@
9293
*/
9394
@RunWith(Parameterized.class)
9495
public class ArangoDatabaseTest extends BaseTest {
96+
97+
Logger LOG = LoggerFactory.getLogger(ArangoDatabaseTest.class);
9598

9699
private static final String COLLECTION_NAME = "db_test";
97100
private static final String GRAPH_NAME = "graph_test";
@@ -168,21 +171,26 @@ public void createCollectionWithReplicationFactor() {
168171

169172
@Test
170173
public void createSatelliteCollection() {
171-
if (arangoDB.getRole() == ServerRole.SINGLE) {
174+
175+
if (arangoDB.getVersion().getLicense() == ArangoDBVersion.License.COMMUNITY) {
176+
LOG.info("Skip Test on COMMUNITY VERSION");
172177
return;
173178
}
174179

175-
if (arangoDB.getLicense() == ServerLicense.community) {
180+
if (arangoDB.getRole() == ServerRole.SINGLE) {
181+
LOG.info("Skip Test on SINGLE SERVER");
176182
return;
177183
}
178184

179185
try {
180-
final CollectionEntity result = db.createCollection(COLLECTION_NAME,
181-
new CollectionCreateOptions().satellite(true));
186+
187+
final CollectionEntity result = db.createCollection(COLLECTION_NAME, new CollectionCreateOptions().satellite(true));
188+
182189
assertThat(result, is(notNullValue()));
183190
assertThat(result.getId(), is(notNullValue()));
184191
assertThat(db.collection(COLLECTION_NAME).getProperties().getReplicationFactor(), is(nullValue()));
185192
assertThat(db.collection(COLLECTION_NAME).getProperties().getSatellite(), is(true));
193+
186194
} finally {
187195
db.collection(COLLECTION_NAME).drop();
188196
}

0 commit comments

Comments
 (0)