Skip to content

Commit

Permalink
Bugfix/synchronous exceptions (#23)
Browse files Browse the repository at this point in the history
* cleanup ArangoDBException from tests

* cleanup ArangoDBException from async interfaces

* bugfix async drop() invocations in tests

* cleanup creation of new CompletableFutures
  • Loading branch information
rashtao authored Aug 27, 2019
1 parent f5ddd9f commit 4b07572
Show file tree
Hide file tree
Showing 21 changed files with 471 additions and 593 deletions.
6 changes: 1 addition & 5 deletions src/main/java/com/arangodb/ArangoCollectionAsync.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ <T> CompletableFuture<MultiDocumentEntity<DocumentCreateEntity<T>>> insertDocume
* @param values
* a list of Objects that will be stored as documents
* @return information about the import
* @throws ArangoDBException
*/
CompletableFuture<DocumentImportEntity> importDocuments(final Collection<?> values);

Expand All @@ -143,7 +142,6 @@ <T> CompletableFuture<MultiDocumentEntity<DocumentCreateEntity<T>>> insertDocume
* @param options
* Additional options, can be null
* @return information about the import
* @throws ArangoDBException
*/
CompletableFuture<DocumentImportEntity> importDocuments(
final Collection<?> values,
Expand All @@ -155,7 +153,6 @@ CompletableFuture<DocumentImportEntity> importDocuments(
* @param values
* JSON-encoded array of objects that will be stored as documents
* @return information about the import
* @throws ArangoDBException
*/
CompletableFuture<DocumentImportEntity> importDocuments(final String values);

Expand All @@ -167,7 +164,6 @@ CompletableFuture<DocumentImportEntity> importDocuments(
* @param options
* Additional options, can be null
* @return information about the import
* @throws ArangoDBException
*/
CompletableFuture<DocumentImportEntity> importDocuments(final String values, final DocumentImportOptions options);

Expand Down Expand Up @@ -740,5 +736,5 @@ CompletableFuture<IndexEntity> ensureFulltextIndex(
* @return permissions of the user
* @since ArangoDB 3.2.0
*/
CompletableFuture<Permissions> getPermissions(final String user) throws ArangoDBException;
CompletableFuture<Permissions> getPermissions(final String user);
}
11 changes: 2 additions & 9 deletions src/main/java/com/arangodb/ArangoDBAsync.java
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,6 @@ private VstCommunicationSync.Builder syncBuilder(final HostHandler hostHandler)
* @param user
* The name of the user for which you want to query the databases
* @return
* @throws ArangoDBException
*/
CompletableFuture<Collection<String>> getAccessibleDatabasesFor(final String user);

Expand All @@ -672,7 +671,6 @@ private VstCommunicationSync.Builder syncBuilder(final HostHandler hostHandler)
* Returns the server role.
*
* @return the server role
* @throws ArangoDBException
*/
CompletableFuture<ServerRole> getRole();

Expand Down Expand Up @@ -772,8 +770,7 @@ private VstCommunicationSync.Builder syncBuilder(final HostHandler hostHandler)
* @since ArangoDB 3.2.0
* @return void
*/
CompletableFuture<Void> grantDefaultDatabaseAccess(final String user, final Permissions permissions)
throws ArangoDBException;
CompletableFuture<Void> grantDefaultDatabaseAccess(final String user, final Permissions permissions);

/**
* Sets the default access level for collections for the user <code>user</code>. You need permission to the _system
Expand All @@ -786,16 +783,14 @@ CompletableFuture<Void> grantDefaultDatabaseAccess(final String user, final Perm
* @since ArangoDB 3.2.0
* @return void
*/
CompletableFuture<Void> grantDefaultCollectionAccess(final String user, final Permissions permissions)
throws ArangoDBException;
CompletableFuture<Void> grantDefaultCollectionAccess(final String user, final Permissions permissions);

/**
* Generic Execute. Use this method to execute custom FOXX services.
*
* @param request
* VelocyStream request
* @return VelocyStream response
* @throws ArangoDBException
*/
CompletableFuture<Response> execute(final Request request);

Expand All @@ -815,7 +810,6 @@ CompletableFuture<Void> grantDefaultCollectionAccess(final String user, final Pe
* Returns the server's current loglevel settings.
*
* @return the server's current loglevel settings
* @throws ArangoDBException
*/
CompletableFuture<LogLevelEntity> getLogLevel();

Expand All @@ -825,7 +819,6 @@ CompletableFuture<Void> grantDefaultCollectionAccess(final String user, final Pe
* @param entity
* loglevel settings
* @return the server's current loglevel settings
* @throws ArangoDBException
*/
CompletableFuture<LogLevelEntity> setLogLevel(final LogLevelEntity entity);
}
32 changes: 10 additions & 22 deletions src/main/java/com/arangodb/ArangoDatabaseAsync.java
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,8 @@ public interface ArangoDatabaseAsync extends ArangoSerializationAccessor {
* @param permissions
* The permissions the user grant
* @since ArangoDB 3.2.0
* @throws ArangoDBException
*/
CompletableFuture<Void> grantDefaultCollectionAccess(final String user, final Permissions permissions)
throws ArangoDBException;
CompletableFuture<Void> grantDefaultCollectionAccess(final String user, final Permissions permissions);

/**
* Get specific database access level
Expand All @@ -269,7 +267,7 @@ CompletableFuture<Void> grantDefaultCollectionAccess(final String user, final Pe
* @return permissions of the user
* @since ArangoDB 3.2.0
*/
CompletableFuture<Permissions> getPermissions(final String user) throws ArangoDBException;
CompletableFuture<Permissions> getPermissions(final String user);

/**
* Performs a database query using the given {@code query} and {@code bindVars}, then returns a new
Expand All @@ -286,13 +284,12 @@ CompletableFuture<Void> grantDefaultCollectionAccess(final String user, final Pe
* @param type
* The type of the result (POJO class, VPackSlice, String for Json, or Collection/List/Map)
* @return cursor of the results
* @throws ArangoDBException
*/
<T> CompletableFuture<ArangoCursorAsync<T>> query(
final String query,
final Map<String, Object> bindVars,
final AqlQueryOptions options,
final Class<T> type) throws ArangoDBException;
final Class<T> type);

/**
* Performs a database query using the given {@code query}, then returns a new {@code ArangoCursor} instance for the
Expand All @@ -307,12 +304,11 @@ <T> CompletableFuture<ArangoCursorAsync<T>> query(
* @param type
* The type of the result (POJO class, VPackSlice, String for Json, or Collection/List/Map)
* @return cursor of the results
* @throws ArangoDBException
*/
<T> CompletableFuture<ArangoCursorAsync<T>> query(
final String query,
final AqlQueryOptions options,
final Class<T> type) throws ArangoDBException;
final Class<T> type);

/**
* Performs a database query using the given {@code query} and {@code bindVars}, then returns a new
Expand All @@ -327,12 +323,11 @@ <T> CompletableFuture<ArangoCursorAsync<T>> query(
* @param type
* The type of the result (POJO class, VPackSlice, String for Json, or Collection/List/Map)
* @return cursor of the results
* @throws ArangoDBException
*/
<T> CompletableFuture<ArangoCursorAsync<T>> query(
final String query,
final Map<String, Object> bindVars,
final Class<T> type) throws ArangoDBException;
final Class<T> type);

/**
* Performs a database query using the given {@code query}, then returns a new {@code ArangoCursor} instance for the
Expand All @@ -345,9 +340,8 @@ <T> CompletableFuture<ArangoCursorAsync<T>> query(
* @param type
* The type of the result (POJO class, VPackSlice, String for Json, or Collection/List/Map)
* @return cursor of the results
* @throws ArangoDBException
*/
<T> CompletableFuture<ArangoCursorAsync<T>> query(final String query, final Class<T> type) throws ArangoDBException;
<T> CompletableFuture<ArangoCursorAsync<T>> query(final String query, final Class<T> type);

/**
* Return an cursor from the given cursor-ID if still existing
Expand All @@ -360,10 +354,8 @@ <T> CompletableFuture<ArangoCursorAsync<T>> query(
* @param type
* The type of the result (POJO class, VPackSlice, String for Json, or Collection/List/Map)
* @return cursor of the results
* @throws ArangoDBException
*/
<T> CompletableFuture<ArangoCursorAsync<T>> cursor(final String cursorId, final Class<T> type)
throws ArangoDBException;
<T> CompletableFuture<ArangoCursorAsync<T>> cursor(final String cursorId, final Class<T> type);

/**
* Explain an AQL query and return information about it
Expand Down Expand Up @@ -684,10 +676,9 @@ <T> CompletableFuture<T> getDocument(final String id, final Class<T> type, final
*
* @see <a href="https://docs.arangodb.com/current/HTTP/Views/Getting.html#reads-all-views">API Documentation</a>
* @return list of information about all views
* @throws ArangoDBException
* @since ArangoDB 3.4.0
*/
CompletableFuture<Collection<ViewEntity>> getViews() throws ArangoDBException;
CompletableFuture<Collection<ViewEntity>> getViews();

/**
* Returns a {@code ArangoViewAsync} instance for the given view name.
Expand Down Expand Up @@ -718,9 +709,8 @@ <T> CompletableFuture<T> getDocument(final String id, final Class<T> type, final
* The type of the view
* @return information about the view
* @since ArangoDB 3.4.0
* @throws ArangoDBException
*/
CompletableFuture<ViewEntity> createView(String name, ViewType type) throws ArangoDBException;
CompletableFuture<ViewEntity> createView(String name, ViewType type);

/**
* Creates a ArangoSearch view with the given {@code options}, then returns view information from the server.
Expand All @@ -733,9 +723,7 @@ <T> CompletableFuture<T> getDocument(final String id, final Class<T> type, final
* Additional options, can be null
* @return information about the view
* @since ArangoDB 3.4.0
* @throws ArangoDBException
*/
CompletableFuture<ViewEntity> createArangoSearch(String name, ArangoSearchCreateOptions options)
throws ArangoDBException;
CompletableFuture<ViewEntity> createArangoSearch(String name, ArangoSearchCreateOptions options);

}
6 changes: 2 additions & 4 deletions src/main/java/com/arangodb/ArangoVertexCollectionAsync.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,8 @@ <T> CompletableFuture<VertexUpdateEntity> replaceVertex(
* @param type
* The type of the vertex-document (POJO class, VPackSlice or String for Json)
* @return information about the vertex
* @throws ArangoDBException
*/
<T> CompletableFuture<VertexUpdateEntity> updateVertex(final String key, final T value) throws ArangoDBException;
<T> CompletableFuture<VertexUpdateEntity> updateVertex(final String key, final T value);

/**
* Partially updates the vertex identified by document-key. The value must contain a document with the attributes to
Expand All @@ -171,12 +170,11 @@ <T> CompletableFuture<VertexUpdateEntity> replaceVertex(
* @param options
* Additional options, can be null
* @return information about the vertex
* @throws ArangoDBException
*/
<T> CompletableFuture<VertexUpdateEntity> updateVertex(
final String key,
final T value,
final VertexUpdateOptions options) throws ArangoDBException;
final VertexUpdateOptions options);

/**
* Removes a vertex
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/com/arangodb/ArangoViewAsync.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,13 @@ public interface ArangoViewAsync extends ArangoSerializationAccessor {
* Checks whether the view exists.
*
* @return true if the view exists, otherwise false
* @throws ArangoDBException
*/
CompletableFuture<Boolean> exists();

/**
* Deletes the view from the database.
*
* @see <a href= "https://docs.arangodb.com/current/HTTP/Views/Creating.html#drops-a-view">API Documentation</a>
* @throws ArangoDBException
*/
CompletableFuture<Void> drop();

Expand All @@ -70,7 +68,6 @@ public interface ArangoViewAsync extends ArangoSerializationAccessor {
* @param newName
* The new name
* @return information about the view
* @throws ArangoDBException
*/
CompletableFuture<ViewEntity> rename(String newName);

Expand All @@ -80,7 +77,6 @@ public interface ArangoViewAsync extends ArangoSerializationAccessor {
* @see <a href= "https://docs.arangodb.com/current/HTTP/Views/Getting.html#return-information-about-a-view">API
* Documentation</a>
* @return information about the view
* @throws ArangoDBException
*/
CompletableFuture<ViewEntity> getInfo();

Expand Down
Loading

0 comments on commit 4b07572

Please sign in to comment.