You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2015/09/04 18:20:05 UTC
[1/4] incubator-tinkerpop git commit: Update javadoc.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/tp30 93bc0a820 -> b6784d9cc
Update javadoc.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/27322aba
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/27322aba
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/27322aba
Branch: refs/heads/tp30
Commit: 27322aba7d78f76547a42c740b2c75f931183d0c
Parents: 847642e
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Sep 4 10:14:45 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Sep 4 10:14:45 2015 -0400
----------------------------------------------------------------------
.../gremlin/driver/AuthProperties.java | 34 ++++++++++++++++++--
.../tinkerpop/gremlin/driver/Handler.java | 2 +-
2 files changed, 32 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/27322aba/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/AuthProperties.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/AuthProperties.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/AuthProperties.java
index 3fd464a..2c1b4d4 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/AuthProperties.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/AuthProperties.java
@@ -21,22 +21,50 @@ package org.apache.tinkerpop.gremlin.driver;
import java.util.HashMap;
import java.util.Map;
+/**
+ * Properties to supply to the {@link Cluster} for authentication purposes.
+ */
public class AuthProperties {
+
+ /**
+ * An enum of the available authorization properties.
+ */
public enum Property {
+ /**
+ * The username.
+ */
USERNAME,
+
+ /**
+ * The password.
+ */
PASSWORD,
+
+ /**
+ * The protocol for which the authentication is being performed (e.g., "ldap").
+ */
PROTOCOL,
+
+ /**
+ * The name used as the index into the configuration for the {@code LoginContext}.
+ */
JAAS_ENTRY
}
- private Map<Property, String> properties = new HashMap<>();
+ private final Map<Property, String> properties = new HashMap<>();
- public AuthProperties with(Property key, String value) {
+ /**
+ * Adds a {@link Property} with value to the authorization property set.
+ */
+ public AuthProperties with(final Property key, final String value) {
properties.put(key, value);
return this;
}
- public String get(Property key) {
+ /**
+ * Gets a property given the key.
+ */
+ public String get(final Property key) {
return properties.get(key);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/27322aba/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Handler.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Handler.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Handler.java
index 73df542..8871f13 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Handler.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Handler.java
@@ -129,7 +129,7 @@ final class Handler {
private Subject login() throws LoginException {
// Login if the user provided us with an entry into the JAAS config file
if (authProps.get(AuthProperties.Property.JAAS_ENTRY) != null) {
- LoginContext login = new LoginContext(authProps.get(AuthProperties.Property.JAAS_ENTRY));
+ final LoginContext login = new LoginContext(authProps.get(AuthProperties.Property.JAAS_ENTRY));
login.login();
return login.getSubject();
}
[4/4] incubator-tinkerpop git commit: Merge remote-tracking branch
'origin/tp30' into tp30
Posted by sp...@apache.org.
Merge remote-tracking branch 'origin/tp30' into tp30
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/b6784d9c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/b6784d9c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/b6784d9c
Branch: refs/heads/tp30
Commit: b6784d9ccdc57fe41ea3b23542299b50241381c1
Parents: 8881caf 93bc0a8
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Sep 4 12:19:48 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Sep 4 12:19:48 2015 -0400
----------------------------------------------------------------------
docs/preprocessor/preprocess.sh | 8 ++++++++
1 file changed, 8 insertions(+)
----------------------------------------------------------------------
[2/4] incubator-tinkerpop git commit: Added more javadoc.
Posted by sp...@apache.org.
Added more javadoc.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/7351675f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/7351675f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/7351675f
Branch: refs/heads/tp30
Commit: 7351675f39b2749f9b342b43497d3a2567de40ed
Parents: 27322ab
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Sep 4 12:18:24 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Sep 4 12:18:24 2015 -0400
----------------------------------------------------------------------
.../tinkerpop/gremlin/driver/Cluster.java | 46 ++++++++++++++++++++
1 file changed, 46 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7351675f/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
index a732ad5..9aeb9bf 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
@@ -71,6 +71,11 @@ public final class Cluster {
* Creates a {@link Client.ClusteredClient} instance to this {@code Cluster}, meaning requests will be routed to
* one or more servers (depending on the cluster configuration), where each request represents the entirety of a
* transaction. A commit or rollback (in case of error) is automatically executed at the end of the request.
+ * <p/>
+ * Note that calling this method does not imply that a connection is made to the server itself at this point.
+ * Therefore, if there is only one server specified in the {@code Cluster} and that server is not available an
+ * error will not be raised at this point. Connections get initialized in the {@link Client} when a request is
+ * submitted or can be directly initialized via {@link Client#init()}.
*/
public Client connect() {
return new Client.ClusteredClient(this);
@@ -81,6 +86,11 @@ public final class Cluster {
* a single server (randomly selected from the cluster), where the same bindings will be available on each request.
* Requests are bound to the same thread on the server and thus transactions may extend beyond the bounds of a
* single request. The transactions are managed by the user and must be committed or rolledback manually.
+ * <p/>
+ * Note that calling this method does not imply that a connection is made to the server itself at this point.
+ * Therefore, if there is only one server specified in the {@code Cluster} and that server is not available an
+ * error will not be raised at this point. Connections get initialized in the {@link Client} when a request is
+ * submitted or can be directly initialized via {@link Client#init()}.
*
* @param sessionId user supplied id for the session which should be unique (a UUID is ideal).
*/
@@ -178,6 +188,13 @@ public final class Cluster {
return manager.isClosing() && manager.close().isDone();
}
+ /**
+ * Gets the list of hosts that the {@code Cluster} was able to connect to. A {@link Host} is assumed unavailable
+ * until a connection to it is proven to be present. This will not happen until the the {@link Client} submits
+ * requests that succeed in reaching a server at the {@link Host} or {@link Client#init()} is called which
+ * initializes the {@link ConnectionPool} for the {@link Client} itself. The number of available hosts returned
+ * from this method will change as different servers come on and offline.
+ */
public List<URI> availableHosts() {
return Collections.unmodifiableList(allHosts().stream()
.filter(Host::isAvailable)
@@ -402,31 +419,52 @@ public final class Cluster {
return this;
}
+ /**
+ * Specifies the load balancing strategy to use on the client side.
+ */
public Builder loadBalancingStrategy(final LoadBalancingStrategy loadBalancingStrategy) {
this.loadBalancingStrategy = loadBalancingStrategy;
return this;
}
+ /**
+ * Specifies parameters for authentication to Gremlin Server.
+ */
public Builder authProperties(final AuthProperties authProps) {
this.authProps = authProps;
return this;
}
+ /**
+ * Sets the {@link AuthProperties.Property#USERNAME} and {@link AuthProperties.Property#PASSWORD} properties
+ * for authentication to Gremlin Server.
+ */
public Builder credentials(final String username, final String password) {
authProps = authProps.with(AuthProperties.Property.USERNAME, username).with(AuthProperties.Property.PASSWORD, password);
return this;
}
+ /**
+ * Sets the {@link AuthProperties.Property#PROTOCOL} properties for authentication to Gremlin Server.
+ */
public Builder protocol(final String protocol) {
this.authProps = authProps.with(AuthProperties.Property.PROTOCOL, protocol);
return this;
}
+ /**
+ * Sets the {@link AuthProperties.Property#JAAS_ENTRY} properties for authentication to Gremlin Server.
+ */
public Builder jaasEntry(final String jaasEntry) {
this.authProps = authProps.with(AuthProperties.Property.JAAS_ENTRY, jaasEntry);
return this;
}
+ /**
+ * Adds the address of a Gremlin Server to the list of servers a {@link Client} will try to contact to send
+ * requests to. The address should be parseable by {@link InetAddress#getByName(String)}. That's the only
+ * validation performed at this point. No connection to the host is attempted.
+ */
public Builder addContactPoint(final String address) {
try {
this.addresses.add(InetAddress.getByName(address));
@@ -436,12 +474,20 @@ public final class Cluster {
}
}
+ /**
+ * Add one or more the addresses of a Gremlin Servers to the list of servers a {@link Client} will try to
+ * contact to send requests to. The address should be parseable by {@link InetAddress#getByName(String)}.
+ * That's the only validation performed at this point. No connection to the host is attempted.
+ */
public Builder addContactPoints(final String... addresses) {
for (String address : addresses)
addContactPoint(address);
return this;
}
+ /**
+ * Sets the port that the Gremlin Servers will be listening on.
+ */
public Builder port(final int port) {
this.port = port;
return this;
[3/4] incubator-tinkerpop git commit: Improve gremlin driver tests.
Posted by sp...@apache.org.
Improve gremlin driver tests.
Ensure that availableHosts is tested before init() of the Client, after init() of the client and after the server goes down.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/8881caff
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/8881caff
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/8881caff
Branch: refs/heads/tp30
Commit: 8881caffe1cc6bab2682b4876047a3a85d83f209
Parents: 7351675
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Sep 4 12:18:31 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Sep 4 12:18:31 2015 -0400
----------------------------------------------------------------------
.../gremlin/server/GremlinDriverIntegrateTest.java | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/8881caff/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
index 407436c..326d746 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
@@ -332,7 +332,7 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
@Test
public void shouldCloseWithServerDown() throws Exception {
final Cluster cluster = Cluster.open();
- cluster.connect();
+ cluster.connect().init();
stopServer();
@@ -341,11 +341,14 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
@Test
public void shouldMarkHostDeadSinceServerIsDown() throws Exception {
- stopServer();
-
final Cluster cluster = Cluster.open();
- cluster.connect();
+ assertEquals(0, cluster.availableHosts().size());
+ cluster.connect().init();
+ assertEquals(1, cluster.availableHosts().size());
+
+ stopServer();
+ cluster.connect().init();
assertEquals(0, cluster.availableHosts().size());
cluster.close();