Skip to content

added getLicense method, fixed enterprise only test #258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 10, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/com/arangodb/ArangoDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ public synchronized ArangoDB build() {
* @throws ArangoDBException
*/
ServerRole getRole() throws ArangoDBException;

/**
* Create a new user. This user will not have access to any database. You need permission to the _system database in
* order to execute this call.
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/arangodb/internal/ArangoDBImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@

/**
* @author Mark Vollmary
* @author Heiko Kernbach
*
*/
public class ArangoDBImpl extends InternalArangoDB<ArangoExecutorSync> implements ArangoDB {
Expand Down Expand Up @@ -193,7 +194,7 @@ public ArangoDBVersion getVersion() throws ArangoDBException {
public ServerRole getRole() throws ArangoDBException {
return executor.execute(getRoleRequest(), getRoleResponseDeserializer());
}

@Override
public UserEntity createUser(final String user, final String passwd) throws ArangoDBException {
return executor.execute(createUserRequest(db().name(), user, passwd, new UserCreateOptions()),
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/arangodb/internal/InternalArangoDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@

/**
* @author Mark Vollmary
* @author Heiko Kernbach
*
*/
public abstract class InternalArangoDB<E extends ArangoExecutor> extends ArangoExecuteable<E> {

private static final String PATH_API_ADMIN_LOG = "/_admin/log";
private static final String PATH_API_ADMIN_LOG_LEVEL = "/_admin/log/level";
private static final String PATH_API_ROLE = "/_admin/server/role";
private static final String PATH_API_VERSION = "/_api/version";
protected static final String PATH_ENDPOINTS = "/_api/cluster/endpoints";
private static final String PATH_API_USER = "/_api/user";

Expand All @@ -72,7 +74,7 @@ public ServerRole deserialize(final Response response) throws VPackException {
}
};
}

protected Request createDatabaseRequest(final String name) {
final Request request = request(ArangoRequestParam.SYSTEM, RequestType.POST,
InternalArangoDatabase.PATH_API_DATABASE);
Expand Down
18 changes: 16 additions & 2 deletions src/test/java/com/arangodb/ArangoDatabaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.arangodb.ArangoDB.Builder;
import com.arangodb.entity.AqlExecutionExplainEntity;
Expand Down Expand Up @@ -91,6 +93,8 @@
*/
@RunWith(Parameterized.class)
public class ArangoDatabaseTest extends BaseTest {

Logger LOG = LoggerFactory.getLogger(ArangoDatabaseTest.class);

private static final String COLLECTION_NAME = "db_test";
private static final String GRAPH_NAME = "graph_test";
Expand Down Expand Up @@ -167,16 +171,26 @@ public void createCollectionWithReplicationFactor() {

@Test
public void createSatelliteCollection() {

if (arangoDB.getVersion().getLicense() == ArangoDBVersion.License.COMMUNITY) {
LOG.info("Skip Test on COMMUNITY VERSION");
return;
}

if (arangoDB.getRole() == ServerRole.SINGLE) {
LOG.info("Skip Test on SINGLE SERVER");
return;
}

try {
final CollectionEntity result = db.createCollection(COLLECTION_NAME,
new CollectionCreateOptions().satellite(true));

final CollectionEntity result = db.createCollection(COLLECTION_NAME, new CollectionCreateOptions().satellite(true));

assertThat(result, is(notNullValue()));
assertThat(result.getId(), is(notNullValue()));
assertThat(db.collection(COLLECTION_NAME).getProperties().getReplicationFactor(), is(nullValue()));
assertThat(db.collection(COLLECTION_NAME).getProperties().getSatellite(), is(true));

} finally {
db.collection(COLLECTION_NAME).drop();
}
Expand Down