tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject [3/3] tinkerpop git commit: Merge branch 'tp32'
Date Tue, 11 Apr 2017 16:48:20 GMT
Merge branch 'tp32'

Conflicts:
	gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/a2caef21
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/a2caef21
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/a2caef21

Branch: refs/heads/master
Commit: a2caef218e54b0b18a75ea792502fb59c60c580a
Parents: 42ebe9f e4372b2
Author: Stephen Mallette <spmva@genoprime.com>
Authored: Tue Apr 11 12:48:00 2017 -0400
Committer: Stephen Mallette <spmva@genoprime.com>
Committed: Tue Apr 11 12:48:00 2017 -0400

----------------------------------------------------------------------
 .../src/reference/gremlin-applications.asciidoc | 21 +++++++
 .../upgrade/release-3.2.x-incubating.asciidoc   | 22 +++++++
 .../tinkerpop/gremlin/server/Settings.java      | 11 ++++
 .../server/op/AbstractEvalOpProcessor.java      | 21 ++++++-
 .../tinkerpop/gremlin/server/op/OpLoader.java   |  8 +++
 .../gremlin/server/op/session/Session.java      |  5 +-
 .../server/op/session/SessionOpProcessor.java   |  7 +++
 .../server/op/standard/StandardOpProcessor.java | 18 ++++++
 .../AbstractGremlinServerIntegrationTest.java   |  5 ++
 .../GremlinServerAuditLogIntegrateTest.java     | 16 ++---
 .../server/GremlinServerIntegrateTest.java      | 62 ++++++++++++++++++++
 11 files changed, 184 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a2caef21/docs/src/reference/gremlin-applications.asciidoc
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a2caef21/docs/src/upgrade/release-3.2.x-incubating.asciidoc
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a2caef21/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/Settings.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a2caef21/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java
----------------------------------------------------------------------
diff --cc gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java
index c6e2ab1,edc484c..182bc72
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java
@@@ -70,6 -71,38 +70,18 @@@ public abstract class AbstractEvalOpPro
      public static final Timer evalOpTimer = MetricManager.INSTANCE.getTimer(name(GremlinServer.class,
"op", "eval"));
  
      /**
+      * The maximum number of parameters that can be passed on a script evaluation request.
+      */
+     public static final String CONFIG_MAX_PARAMETERS = "maxParameters";
+ 
+     /**
+      * Default number of parameters allowed on a script evaluation request.
+      */
+     public static final int DEFAULT_MAX_PARAMETERS = 16;
+ 
+     protected int maxParameters = DEFAULT_MAX_PARAMETERS;
+ 
+     /**
 -     * Captures the "error" count as a reportable metric for Gremlin Server.
 -     *
 -     * @deprecated As of release 3.1.1-incubating, not replaced. Direct usage is discouraged
with sub-classes as
 -     * error counts are captured more globally for error messages written down the pipeline
to
 -     * {@link GremlinResponseFrameEncoder}.
 -     */
 -    @Deprecated
 -    static final Meter errorMeter = MetricManager.INSTANCE.getMeter(name(GremlinServer.class,
"errors"));
 -
 -    /**
 -     * Regex for validating that binding variables.
 -     *
 -     * @deprecated As of release 3.1.2-incubating, not replaced. This {@code Pattern} is
not used internally.
 -     * Deprecated rather than just removing as it's possible that someone else might be
using it when developing
 -     * custom {@link OpProcessor} implementations.
 -     */
 -    @Deprecated
 -    protected static final Pattern validBindingName = Pattern.compile("[a-zA-Z$_][a-zA-Z0-9$_]*");
 -
 -    /**
       * This may or may not be the full set of invalid binding keys.  It is dependent on
the static imports made to
       * Gremlin Server.  This should get rid of the worst offenders though and provide a
good message back to the
       * calling client.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a2caef21/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/Session.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a2caef21/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/SessionOpProcessor.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a2caef21/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerAuditLogIntegrateTest.java
----------------------------------------------------------------------
diff --cc gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerAuditLogIntegrateTest.java
index d2d764c,0000000..5d90f9c
mode 100644,000000..100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerAuditLogIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerAuditLogIntegrateTest.java
@@@ -1,374 -1,0 +1,374 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + *
 + * http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing,
 + * software distributed under the License is distributed on an
 + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 + * KIND, either express or implied.  See the License for the
 + * specific language governing permissions and limitations
 + * under the License.
 + */
 +package org.apache.tinkerpop.gremlin.server;
 +
 +import org.apache.http.client.methods.CloseableHttpResponse;
 +import org.apache.http.client.methods.HttpGet;
 +import org.apache.http.impl.client.CloseableHttpClient;
 +import org.apache.http.impl.client.HttpClients;
 +import org.apache.http.util.EntityUtils;
 +import org.apache.log4j.Logger;
 +import org.apache.log4j.spi.LoggingEvent;
 +import static org.apache.log4j.Level.INFO;
 +import org.apache.tinkerpop.gremlin.driver.Client;
 +import org.apache.tinkerpop.gremlin.driver.Cluster;
 +import org.apache.tinkerpop.gremlin.driver.Channelizer;
 +import org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer;
 +import org.apache.tinkerpop.gremlin.server.channel.NioChannelizer;
 +import org.apache.tinkerpop.shaded.jackson.databind.JsonNode;
 +import org.apache.tinkerpop.shaded.jackson.databind.ObjectMapper;
 +import org.apache.tinkerpop.gremlin.server.auth.AllowAllAuthenticator;
 +import org.apache.tinkerpop.gremlin.server.auth.Krb5Authenticator;
 +import org.apache.tinkerpop.gremlin.server.auth.SimpleAuthenticator;
 +import static org.apache.tinkerpop.gremlin.server.GremlinServerAuthKrb5IntegrateTest.TESTCONSOLE;
 +import static org.apache.tinkerpop.gremlin.server.GremlinServer.AUDIT_LOGGER_NAME;
 +import org.apache.tinkerpop.gremlin.util.Log4jRecordingAppender;
 +import org.slf4j.LoggerFactory;
 +
 +import java.util.*;
 +import java.util.regex.Matcher;
 +import java.util.regex.Pattern;
 +import java.util.stream.Stream;
 +
 +import org.junit.After;
 +import org.junit.Before;
 +import org.junit.Test;
 +import static org.junit.Assert.assertEquals;
 +import static org.junit.Assert.assertFalse;
 +import static org.junit.Assert.assertTrue;
 +
- 
 +/**
-  * @author Marc de Lignie
++ * Test audit logs  and like other descendants of AbstractGremlinServerIntegrationTest this
test suite assumes that
++ * tests are run sequentially and thus the server and kdcServer variables can be reused.
 + *
-  * Note: like other descendents of AbstractGremlinServerIntegrationTest this test suite
assumes that tests are
-  *       run sequentially and thus the server and kdcServer variables can be reused.
++ * @author Marc de Lignie
 + */
 +public class GremlinServerAuditLogIntegrateTest extends AbstractGremlinServerIntegrationTest
{
 +    private static final org.slf4j.Logger logger = LoggerFactory.getLogger(GremlinServerAuditLogIntegrateTest.class);
 +    private Log4jRecordingAppender recordingAppender = null;
 +
 +    private final ObjectMapper mapper = new ObjectMapper();
 +    private final Base64.Encoder encoder = Base64.getUrlEncoder();
 +
 +    private static final boolean AUDIT_LOG_ENABLED = true;
 +    private static final boolean AUDIT_LOG_DISABLED = false;
 +    private static final String TESTCONSOLE2 = "GremlinConsole2";
 +
 +    private KdcFixture kdcServer;
 +
 +    @Before
 +    @Override
 +    public void setUp() throws Exception {
 +        try {
 +            final String buildDir = System.getProperty("build.dir");
 +            kdcServer = new KdcFixture(buildDir +
 +                    "/test-classes/org/apache/tinkerpop/gremlin/server/gremlin-console-jaas.conf");
 +            kdcServer.setUp();
 +        } catch(Exception e)  {
 +            logger.warn(e.getMessage());
 +        }
 +        super.setUp();
 +    }
 +
 +    @Before
 +    public void setupForEachTest() {
 +        recordingAppender = new Log4jRecordingAppender();
 +        final Logger rootLogger = Logger.getRootLogger();
 +        rootLogger.addAppender(recordingAppender);
 +    }
 +
 +    @After
 +    public void teardownForEachTest() throws Exception {
 +        final Logger rootLogger = Logger.getRootLogger();
 +        rootLogger.removeAppender(recordingAppender);
 +        kdcServer.close();
 +    }
 +
 +    /**
 +     * Configure specific Gremlin Server settings for specific tests.
 +     */
 +    @Override
 +    public Settings overrideSettings(final Settings settings) {
 +        settings.host = kdcServer.hostname;
 +        final Settings.SslSettings sslConfig = new Settings.SslSettings();
 +        sslConfig.enabled = false;
 +        settings.ssl = sslConfig;
 +        final Settings.AuthenticationSettings authSettings = new Settings.AuthenticationSettings();
 +        settings.authentication = authSettings;
 +        authSettings.enableAuditLog = AUDIT_LOG_ENABLED;
 +        authSettings.className = Krb5Authenticator.class.getName();
 +        final Map<String,Object> authConfig = new HashMap<>();
 +        authSettings.config = authConfig;
 +
 +        final String nameOfTest = name.getMethodName();
 +        switch (nameOfTest) {
 +            case "shouldAuditLogWithAllowAllAuthenticator":
-                 authSettings.className = AllowAllAuthenticator.class.getName();
++                authSettings.authenticator = AllowAllAuthenticator.class.getName();
 +                break;
 +            case "shouldAuditLogWithSimpleAuthenticator":
-                 authSettings.className = SimpleAuthenticator.class.getName();
++                authSettings.authenticator = SimpleAuthenticator.class.getName();
 +                authConfig.put(SimpleAuthenticator.CONFIG_CREDENTIALS_DB, "conf/tinkergraph-credentials.properties");
 +                break;
 +            case "shouldNotAuditLogWhenDisabled":
 +                authSettings.enableAuditLog = AUDIT_LOG_DISABLED;
 +            case "shouldAuditLogWithKrb5Authenticator":
 +            case "shouldAuditLogTwoClientsWithKrb5Authenticator":
 +                authConfig.put("keytab", kdcServer.serviceKeytabFile.getAbsolutePath());
 +                authConfig.put("principal", kdcServer.serverPrincipal);
 +                break;
 +            case "shouldAuditLogWithNioTransport":
 +                settings.channelizer = NioChannelizer.class.getName();
 +                authConfig.put("keytab", kdcServer.serviceKeytabFile.getAbsolutePath());
 +                authConfig.put("principal", kdcServer.serverPrincipal);
 +                break;
 +            case "shouldAuditLogWithHttpTransport":
 +                settings.host = "localhost";
 +                settings.channelizer = HttpChannelizer.class.getName();
-                 authSettings.className = SimpleAuthenticator.class.getName();
++                authSettings.authenticator = SimpleAuthenticator.class.getName();
 +                authConfig.put(SimpleAuthenticator.CONFIG_CREDENTIALS_DB, "conf/tinkergraph-credentials.properties");
 +                break;
 +        }
 +        return settings;
 +    }
 +
 +    @Test
 +    public void shouldAuditLogWithAllowAllAuthenticator() throws Exception {
 +
 +        final Cluster cluster = TestClientFactory.build().addContactPoint(kdcServer.hostname).create();
 +        final Client client = cluster.connect();
 +
 +        try {
 +            assertEquals(2, client.submit("1+1").all().get().get(0).getInt());
 +            assertEquals(3, client.submit("1+2").all().get().get(0).getInt());
 +            assertEquals(4, client.submit("1+3").all().get().get(0).getInt());
 +        } finally {
 +            cluster.close();
 +        }
 +
 +        // WebSocketChannelizer does not add SaslAuthenticationHandler for AllowAllAuthenticator,
 +        // so no authenticated user log line available
 +        assertTrue(recordingAppender.logMatchesAny(AUDIT_LOGGER_NAME, INFO, "User with address
.*? requested: 1\\+1"));
 +        assertTrue(recordingAppender.logMatchesAny(AUDIT_LOGGER_NAME, INFO, "User with address
.*? requested: 1\\+2"));
 +        assertTrue(recordingAppender.logMatchesAny(AUDIT_LOGGER_NAME, INFO, "User with address
.*? requested: 1\\+3"));
 +    }
 +
 +    @Test
 +    public void shouldAuditLogWithSimpleAuthenticator() throws Exception {
 +        final String username = "stephen";
 +        final String password = "password";
 +
 +        final Cluster cluster = TestClientFactory.build().credentials(username, password)
 +                .addContactPoint(kdcServer.hostname).create();
 +        final Client client = cluster.connect();
 +
 +        try {
 +            assertEquals(2, client.submit("1+1").all().get().get(0).getInt());
 +            assertEquals(3, client.submit("1+2").all().get().get(0).getInt());
 +            assertEquals(4, client.submit("1+3").all().get().get(0).getInt());
++            assertEquals(5, client.submit("1+4").all().get().get(0).getInt());
 +        } finally {
 +            cluster.close();
 +        }
 +
 +        final String simpleAuthenticatorName = SimpleAuthenticator.class.getSimpleName();
 +        final String authMsg = recordingAppender.getMessages().stream()
-                 .filter( msg -> msg.toString().contains("by " + simpleAuthenticatorName)
).iterator().next();
++                .filter(msg -> msg.contains("by " + simpleAuthenticatorName)).iterator().next();
 +        final Matcher m = Pattern.compile(".*?([\\d.:]+).*?").matcher(authMsg);
 +        m.find();
 +        final String address = m.group(1);
 +
 +        assertTrue(recordingAppender.logContainsAny(AUDIT_LOGGER_NAME, INFO,
 +                String.format("User %s with address %s authenticated by %s", username, address,
simpleAuthenticatorName)));
 +        assertTrue(recordingAppender.logContainsAny(AUDIT_LOGGER_NAME, INFO,
 +                String.format("User with address %s requested: 1+1", address)));
 +        assertTrue(recordingAppender.logContainsAny(AUDIT_LOGGER_NAME, INFO,
 +                String.format("User with address %s requested: 1+2", address)));
 +        assertTrue(recordingAppender.logContainsAny(AUDIT_LOGGER_NAME, INFO,
 +                String.format("User with address %s requested: 1+3", address)));
 +    }
 +
 +    @Test
 +    public void shouldAuditLogWithKrb5Authenticator() throws Exception {
 +        final Cluster cluster = TestClientFactory.build().jaasEntry(TESTCONSOLE)
 +                .protocol(kdcServer.serverPrincipalName).addContactPoint(kdcServer.hostname).create();
 +        final Client client = cluster.connect();
 +        try {
 +            assertEquals(2, client.submit("1+1").all().get().get(0).getInt());
 +            assertEquals(3, client.submit("1+2").all().get().get(0).getInt());
 +            assertEquals(4, client.submit("1+3").all().get().get(0).getInt());
 +        } finally {
 +            cluster.close();
 +        }
 +
 +        final List<LoggingEvent> log = recordingAppender.getEvents();
 +        final Stream<LoggingEvent> auditEvents = log.stream().filter(event -> event.getLoggerName().equals(AUDIT_LOGGER_NAME));
 +        final LoggingEvent authEvent = auditEvents
 +                .filter(event -> event.getMessage().toString().contains("Krb5Authenticator")).iterator().next();
 +        final String authMsg = authEvent.getMessage().toString();
 +        final Matcher m = Pattern.compile(".*?([\\d.:]+).*?").matcher(authMsg);
 +        m.find();
 +        final String address = m.group(1);
 +        assertTrue(authEvent.getLevel() == INFO && authMsg.equals(
 +                String.format("User %s with address %s authenticated by Krb5Authenticator",
kdcServer.clientPrincipalName, address)));
 +        assertTrue(log.stream().anyMatch(item -> item.getLevel() == INFO &&
 +                item.getMessage().toString().equals(String.format("User with address %s
requested: 1+1", address))));
 +        assertTrue(log.stream().anyMatch(item -> item.getLevel() == INFO &&
 +                item.getMessage().toString().equals(String.format("User with address %s
requested: 1+2", address))));
 +        assertTrue(log.stream().anyMatch(item -> item.getLevel() == INFO &&
 +                item.getMessage().toString().equals(String.format("User with address %s
requested: 1+3", address))));
 +    }
 +
 +    @Test
 +    public void shouldNotAuditLogWhenDisabled() throws Exception {
 +        final Cluster cluster = TestClientFactory.build().jaasEntry(TESTCONSOLE)
 +                .protocol(kdcServer.serverPrincipalName).addContactPoint(kdcServer.hostname).create();
 +        final Client client = cluster.connect();
 +        try {
 +            assertEquals(2, client.submit("1+1").all().get().get(0).getInt());
 +            assertEquals(3, client.submit("1+2").all().get().get(0).getInt());
 +            assertEquals(4, client.submit("1+3").all().get().get(0).getInt());
 +        } finally {
 +            cluster.close();
 +        }
 +
 +        final List<LoggingEvent> log = recordingAppender.getEvents();
 +        assertFalse(log.stream().anyMatch(item -> item.getLevel() == INFO &&
 +                item.getMessage().toString().matches("User .*? with address .*? authenticated
by Krb5Authenticator")));
 +        assertFalse(log.stream().anyMatch(item -> item.getLevel() == INFO &&
 +                item.getMessage().toString().matches("User with address .*? requested: 1\\+1")));
 +        assertFalse(log.stream().anyMatch(item -> item.getLevel() == INFO &&
 +                item.getMessage().toString().matches("User with address .*? requested: 1\\+2")));
 +        assertFalse(log.stream().anyMatch(item -> item.getLevel() == INFO &&
 +            item.getMessage().toString().matches("User with address .*? requested: 1\\+3")));
 +    }
 +
 +    @Test
 +    public void shouldAuditLogWithNioTransport() throws Exception {
 +        final Cluster cluster = TestClientFactory.build().channelizer(Channelizer.NioChannelizer.class.getName())
 +                .jaasEntry(TESTCONSOLE).protocol(kdcServer.serverPrincipalName).addContactPoint(kdcServer.hostname).create();
 +        final Client client = cluster.connect();
 +        try {
 +            assertEquals(2, client.submit("1+1").all().get().get(0).getInt());
 +            assertEquals(3, client.submit("1+2").all().get().get(0).getInt());
 +            assertEquals(4, client.submit("1+3").all().get().get(0).getInt());
 +        } finally {
 +            cluster.close();
 +        }
 +
 +        final List<LoggingEvent> log = recordingAppender.getEvents();
 +        final Stream<LoggingEvent> auditEvents = log.stream().filter(event -> event.getLoggerName().equals(AUDIT_LOGGER_NAME));
 +        final LoggingEvent authEvent = auditEvents
 +                .filter(event -> event.getMessage().toString().contains("Krb5Authenticator")).iterator().next();
 +        final String authMsg = authEvent.getMessage().toString();
 +        final Matcher m = Pattern.compile(".*?([\\d.:]+).*?").matcher(authMsg);
 +        m.find();
 +        final String address = m.group(1);
 +        assertTrue(authEvent.getLevel() == INFO && authMsg.equals(
 +                String.format("User %s with address %s authenticated by Krb5Authenticator",
kdcServer.clientPrincipalName, address)));
 +        assertTrue(log.stream().anyMatch(item -> item.getLevel() == INFO &&
 +                item.getMessage().toString().equals(String.format("User with address %s
requested: 1+1", address))));
 +        assertTrue(log.stream().anyMatch(item -> item.getLevel() == INFO &&
 +                item.getMessage().toString().equals(String.format("User with address %s
requested: 1+2", address))));
 +        assertTrue(log.stream().anyMatch(item -> item.getLevel() == INFO &&
 +                item.getMessage().toString().equals(String.format("User with address %s
requested: 1+3", address))));
 +    }
 +
 +    @Test
 +    public void shouldAuditLogWithHttpTransport() throws Exception {
 +        final CloseableHttpClient httpclient = HttpClients.createDefault();
 +        final HttpGet httpget = new HttpGet(TestClientFactory.createURLString("?gremlin=1-1"));
 +        httpget.addHeader("Authorization", "Basic " + encoder.encodeToString("stephen:password".getBytes()));
 +
 +        try (final CloseableHttpResponse response = httpclient.execute(httpget)) {
 +            assertEquals(200, response.getStatusLine().getStatusCode());
 +            assertEquals("application/json", response.getEntity().getContentType().getValue());
 +            final String json = EntityUtils.toString(response.getEntity());
 +            final JsonNode node = mapper.readTree(json);
 +            assertEquals(0, node.get("result").get("data").get(0).intValue());
 +        }
 +
 +        final List<LoggingEvent> log = recordingAppender.getEvents();
 +        final Stream<LoggingEvent> auditEvents = log.stream().filter(event -> event.getLoggerName().equals(AUDIT_LOGGER_NAME));
 +        final LoggingEvent authEvent = auditEvents
 +                .filter(event -> event.getMessage().toString().contains("SimpleAuthenticator")).iterator().next();
 +        final String authMsg = authEvent.getMessage().toString();
 +        final Matcher m = Pattern.compile(".*?([\\d.:]+).*?").matcher(authMsg);
 +        m.find();
 +        final String address = m.group(1);
 +        assertTrue(authEvent.getLevel() == INFO && authMsg.equals(
 +                String.format("User %s with address %s authenticated by SimpleAuthenticator",
"stephen", address)));
 +        assertTrue(log.stream().anyMatch(item -> item.getLevel() == INFO &&
 +                item.getMessage().toString().equals(String.format("User with address %s
requested: 1-1", address))));
 +    }
 +
 +    @Test
 +    public void shouldAuditLogTwoClientsWithKrb5Authenticator() throws Exception {
 +        final Cluster cluster = TestClientFactory.build().jaasEntry(TESTCONSOLE)
 +                .protocol(kdcServer.serverPrincipalName).addContactPoint(kdcServer.hostname).create();
 +        final Client client = cluster.connect();
 +        final Cluster cluster2 = TestClientFactory.build().jaasEntry(TESTCONSOLE2)
 +                .protocol(kdcServer.serverPrincipalName).addContactPoint(kdcServer.hostname).create();
 +        final Client client2 = cluster2.connect();
 +        try {
 +            assertEquals(2, client.submit("1+1").all().get().get(0).getInt());
 +            assertEquals(22, client2.submit("11+11").all().get().get(0).getInt());
 +            assertEquals(3, client.submit("1+2").all().get().get(0).getInt());
 +            assertEquals(23, client2.submit("11+12").all().get().get(0).getInt());
 +            assertEquals(24, client2.submit("11+13").all().get().get(0).getInt());
 +            assertEquals(4, client.submit("1+3").all().get().get(0).getInt());
 +        } finally {
 +            cluster.close();
 +            cluster2.close();
 +        }
 +        final List<LoggingEvent> log = recordingAppender.getEvents();
 +        final Stream<LoggingEvent> auditEvents = log.stream().filter(event -> event.getLoggerName().equals(AUDIT_LOGGER_NAME));
 +        final Iterator<LoggingEvent> authEvents = auditEvents
 +                .filter(event -> event.getMessage().toString().contains("Krb5Authenticator")).iterator();
 +
 +        // First client
 +        final LoggingEvent authEvent = authEvents.next();
 +        final String authMsg = authEvent.getMessage().toString();
 +        final Matcher m = Pattern.compile(".*?([\\d.:]{13,21}).*?").matcher(authMsg);
 +        m.find();
 +        final String address = m.group(1);
 +        assertTrue(authEvent.getLevel() == INFO && authMsg.equals(
 +                String.format("User %s with address %s authenticated by Krb5Authenticator",
kdcServer.clientPrincipalName, address)));
 +        assertTrue(log.stream().anyMatch(item -> item.getLevel() == INFO &&
 +                item.getMessage().toString().equals(String.format("User with address %s
requested: 1+1", address))));
 +        assertTrue(log.stream().anyMatch(item -> item.getLevel() == INFO &&
 +                item.getMessage().toString().equals(String.format("User with address %s
requested: 1+2", address))));
 +        assertTrue(log.stream().anyMatch(item -> item.getLevel() == INFO &&
 +                item.getMessage().toString().equals(String.format("User with address %s
requested: 1+3", address))));
 +
 +        // Second client
 +        final LoggingEvent authEvent2 = authEvents.next();
 +        final String authMsg2 = authEvent2.getMessage().toString();
 +        final Matcher m2 = Pattern.compile(".*?([\\d.:]{13,21}).*?").matcher(authMsg2);
 +        m2.find();
 +        final String address2 = m2.group(1);
 +        assertTrue(authEvent2.getLevel() == INFO && authMsg2.equals(
 +                String.format("User %s with address %s authenticated by Krb5Authenticator",
kdcServer.clientPrincipalName2, address2)));
 +        assertTrue(log.stream().anyMatch(item -> item.getLevel() == INFO &&
 +                item.getMessage().toString().equals(String.format("User with address %s
requested: 11+11", address2))));
 +        assertTrue(log.stream().anyMatch(item -> item.getLevel() == INFO &&
 +                item.getMessage().toString().equals(String.format("User with address %s
requested: 11+12", address2))));
 +        assertTrue(log.stream().anyMatch(item -> item.getLevel() == INFO &&
 +                item.getMessage().toString().equals(String.format("User with address %s
requested: 11+13", address2))));
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a2caef21/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
----------------------------------------------------------------------
diff --cc gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
index ae50699,8f90462..be4dbc9
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
@@@ -206,20 -217,26 +215,29 @@@ public class GremlinServerIntegrateTes
                  defaultSettings.port = TestClientFactory.PORT;
                  return settings;
              case "shouldUseSimpleSandbox":
 -                settings.scriptEngines.get("gremlin-groovy").config = getScriptEngineConfForSimpleSandbox();
 +                settings.scriptEngines.get("gremlin-groovy").plugins.put(GroovyCompilerGremlinPlugin.class.getName(),
getScriptEngineConfForSimpleSandbox());
 +                // remove the script because it isn't used in the test but also because
it's not CompileStatic ready
 +                settings.scriptEngines.get("gremlin-groovy").plugins.remove(ScriptFileGremlinPlugin.class.getName());
                  break;
              case "shouldUseInterpreterMode":
 -                settings.scriptEngines.get("gremlin-groovy").config = getScriptEngineConfForInterpreterMode();
 +                settings.scriptEngines.get("gremlin-groovy").plugins.put(GroovyCompilerGremlinPlugin.class.getName(),
getScriptEngineConfForInterpreterMode());
                  break;
              case "shouldReceiveFailureTimeOutOnScriptEvalOfOutOfControlLoop":
 -                settings.scriptEngines.get("gremlin-groovy").config = getScriptEngineConfForTimedInterrupt();
 +                settings.scriptEngines.get("gremlin-groovy").plugins.put(GroovyCompilerGremlinPlugin.class.getName(),
getScriptEngineConfForTimedInterrupt());
                  break;
              case "shouldUseBaseScript":
 +                settings.scriptEngines.get("gremlin-groovy").plugins.put(GroovyCompilerGremlinPlugin.class.getName(),
getScriptEngineConfForBaseScript());
                  settings.scriptEngines.get("gremlin-groovy").config = getScriptEngineConfForBaseScript();
                  break;
+             case "shouldReturnInvalidRequestArgsWhenBindingCountExceedsAllowable":
+                 final Settings.ProcessorSettings processorSettingsSmall = new Settings.ProcessorSettings();
+                 processorSettingsSmall.className = StandardOpProcessor.class.getName();
+                 processorSettingsSmall.config = new HashMap<String,Object>() {{
+                     put(AbstractEvalOpProcessor.CONFIG_MAX_PARAMETERS, 1);
+                 }};
+                 settings.processors.clear();
+                 settings.processors.add(processorSettingsSmall);
+                 break;
          }
  
          return settings;


Mime
View raw message