TINKERPOP-1562 ImportCustomizer has become an interface

This is a breaking change unfortunately, but this was not a feature that was 
published or used in 3.2.3 so I don't expect wide usage.


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

Branch: refs/heads/TINKERPOP-1562
Commit: 11f57acf6d69ba0105e1ba2d3315e8aa3436d877
Parents: a28100f
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Nov 22 06:33:22 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Dec 1 06:41:42 2016 -0500

----------------------------------------------------------------------
 .../giraph/jsr223/GiraphGremlinPlugin.java      |   4 +-
 .../gremlin/console/plugin/PluggedIn.groovy     |   3 +-
 .../gremlin/jsr223/CoreGremlinModule.java       |   2 +-
 .../gremlin/jsr223/CoreGremlinPlugin.java       |   2 +-
 .../gremlin/jsr223/DefaultImportCustomizer.java | 112 +++++++++++++++++++
 .../gremlin/jsr223/ImportCustomizer.java        |  85 +-------------
 .../gremlin/jsr223/ImportGremlinPlugin.java     |   2 +-
 .../gremlin/jsr223/ImportGremlinPluginTest.java |  12 +-
 ...aultDefaultImportCustomizerProviderTest.java |  90 +++++++++++++++
 .../DefaultImportCustomizerProviderTest.java    |  90 ---------------
 .../jsr223/GremlinServerGremlinPlugin.java      |   4 +-
 .../jsr223/GremlinEnabledScriptEngineTest.java  |   3 +-
 12 files changed, 221 insertions(+), 188 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/11f57acf/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinPlugin.java
----------------------------------------------------------------------
diff --git 
a/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinPlugin.java
 
b/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinPlugin.java
index a96ac86..ee49ed5 100644
--- 
a/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinPlugin.java
+++ 
b/giraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/giraph/jsr223/GiraphGremlinPlugin.java
@@ -29,7 +29,7 @@ import 
org.apache.tinkerpop.gremlin.giraph.process.computer.GiraphWorkerContext;
 import org.apache.tinkerpop.gremlin.giraph.process.computer.MemoryAggregator;
 import org.apache.tinkerpop.gremlin.giraph.process.computer.PassThroughMemory;
 import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
-import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
 
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
@@ -39,7 +39,7 @@ public final class GiraphGremlinPlugin extends 
AbstractGremlinPlugin {
     private static final GiraphGremlinPlugin instance = new 
GiraphGremlinPlugin();
 
     private GiraphGremlinPlugin() {
-        super(MODULE_NAME, ImportCustomizer.build().addClassImports(
+        super(MODULE_NAME, DefaultImportCustomizer.build().addClassImports(
                 EmptyOutEdges.class,
                 GiraphComputation.class,
                 GiraphGraphComputer.class,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/11f57acf/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
----------------------------------------------------------------------
diff --git 
a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
 
b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
index def49ed..053a072 100644
--- 
a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
+++ 
b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/plugin/PluggedIn.groovy
@@ -24,8 +24,7 @@ import 
org.apache.tinkerpop.gremlin.groovy.plugin.PluginAcceptor
 import org.apache.tinkerpop.gremlin.groovy.plugin.PluginInitializationException
 import org.apache.tinkerpop.gremlin.groovy.plugin.RemoteAcceptor
 import org.apache.tinkerpop.gremlin.groovy.plugin.RemoteException
-import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer
-import org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin
+import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer
 import org.apache.tinkerpop.gremlin.jsr223.console.ConsoleCustomizer
 import org.codehaus.groovy.tools.shell.Groovysh
 import org.codehaus.groovy.tools.shell.IO

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/11f57acf/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
----------------------------------------------------------------------
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
index 6869064..d398f89 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinModule.java
@@ -33,7 +33,7 @@ public final class CoreGremlinModule implements GremlinModule 
{
 
     private static final String MODULE_NAME = "tinkerpop.core";
 
-    private static final ImportCustomizer gremlinCore = 
ImportCustomizer.build()
+    private static final ImportCustomizer gremlinCore = 
DefaultImportCustomizer.build()
             .addClassImports(CoreImports.getClassImports())
             .addEnumImports(CoreImports.getEnumImports())
             .addMethodImports(CoreImports.getMethodImports()).create();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/11f57acf/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java
----------------------------------------------------------------------
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java
index 3f5ac2c..410b222 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreGremlinPlugin.java
@@ -31,7 +31,7 @@ public final class CoreGremlinPlugin implements GremlinPlugin 
{
 
     private static final String MODULE_NAME = "tinkerpop.core";
 
-    private static final ImportCustomizer gremlinCore = 
ImportCustomizer.build()
+    private static final ImportCustomizer gremlinCore = 
DefaultImportCustomizer.build()
             .addClassImports(CoreImports.getClassImports())
             .addEnumImports(CoreImports.getEnumImports())
             .addMethodImports(CoreImports.getMethodImports()).create();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/11f57acf/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java
----------------------------------------------------------------------
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java
new file mode 100644
index 0000000..85d6531
--- /dev/null
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizer.java
@@ -0,0 +1,112 @@
+/*
+ * 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.jsr223;
+
+import org.apache.tinkerpop.gremlin.util.CoreImports;
+
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Simple implementation of the {@link ImportCustomizer} which allows direct 
setting of all the different import types.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class DefaultImportCustomizer implements ImportCustomizer {
+    /**
+     * @deprecated As of release 3.2.4, not replaced.
+     */
+    @Deprecated
+    public static final ImportCustomizer GREMLIN_CORE = 
DefaultImportCustomizer.build()
+            .addClassImports(CoreImports.getClassImports())
+            .addEnumImports(CoreImports.getEnumImports())
+            .addMethodImports(CoreImports.getMethodImports()).create();
+
+    private final Set<Class> classImports;
+    private final Set<Method> methodImports;
+    private final Set<Enum> enumImports;
+
+    private DefaultImportCustomizer(final Builder builder) {
+        classImports = builder.classImports;
+        methodImports = builder.methodImports;
+        enumImports = builder.enumImports;
+    }
+
+    public Set<Class> getClassImports() {
+        return Collections.unmodifiableSet(classImports);
+    }
+
+    public Set<Method> getMethodImports() {
+        return Collections.unmodifiableSet(methodImports);
+    }
+
+    public Set<Enum> getEnumImports() {
+        return Collections.unmodifiableSet(enumImports);
+    }
+
+    public static Builder build() {
+        return new Builder();
+    }
+
+    public static class Builder {
+        private Set<Class> classImports = new HashSet<>();
+        private Set<Method> methodImports = new HashSet<>();
+        private Set<Enum> enumImports = new HashSet<>();
+
+        private Builder() {}
+
+        public Builder addClassImports(final Class... clazz) {
+            classImports.addAll(Arrays.asList(clazz));
+            return this;
+        }
+
+        public Builder addClassImports(final Collection<Class> classes) {
+            classImports.addAll(classes);
+            return this;
+        }
+
+        public Builder addMethodImports(final Method... method) {
+            methodImports.addAll(Arrays.asList(method));
+            return this;
+        }
+
+        public Builder addMethodImports(final Collection<Method> methods) {
+            methodImports.addAll(methods);
+            return this;
+        }
+
+        public Builder addEnumImports(final Enum... e) {
+            enumImports.addAll(Arrays.asList(e));
+            return this;
+        }
+
+        public Builder addEnumImports(final Collection<Enum> enums) {
+            enumImports.addAll(enums);
+            return this;
+        }
+
+        public DefaultImportCustomizer create() {
+            return new DefaultImportCustomizer(this);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/11f57acf/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java
----------------------------------------------------------------------
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java
index 2f0e08c..7eced82 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java
@@ -18,13 +18,7 @@
  */
 package org.apache.tinkerpop.gremlin.jsr223;
 
-import org.apache.tinkerpop.gremlin.util.CoreImports;
-
 import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
 import java.util.Set;
 
 /**
@@ -32,82 +26,11 @@ import java.util.Set;
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
-public class ImportCustomizer implements Customizer {
-
-    /**
-     * @deprecated As of release 3.2.4, not replaced.
-     */
-    @Deprecated
-    public static final ImportCustomizer GREMLIN_CORE = 
ImportCustomizer.build()
-            .addClassImports(CoreImports.getClassImports())
-            .addEnumImports(CoreImports.getEnumImports())
-            .addMethodImports(CoreImports.getMethodImports()).create();
-
-    private final Set<Class> classImports;
-    private final Set<Method> methodImports;
-    private final Set<Enum> enumImports;
-
-    private ImportCustomizer(final Builder builder) {
-        classImports = builder.classImports;
-        methodImports = builder.methodImports;
-        enumImports = builder.enumImports;
-    }
-
-    public Set<Class> getClassImports() {
-        return Collections.unmodifiableSet(classImports);
-    }
-
-    public Set<Method> getMethodImports() {
-        return Collections.unmodifiableSet(methodImports);
-    }
-
-    public Set<Enum> getEnumImports() {
-        return Collections.unmodifiableSet(enumImports);
-    }
-
-    public static Builder build() {
-        return new Builder();
-    }
-
-    public static class Builder {
-        private Set<Class> classImports = new HashSet<>();
-        private Set<Method> methodImports = new HashSet<>();
-        private Set<Enum> enumImports = new HashSet<>();
-
-        private Builder() {}
-
-        public Builder addClassImports(final Class... clazz) {
-            classImports.addAll(Arrays.asList(clazz));
-            return this;
-        }
-
-        public Builder addClassImports(final Collection<Class> classes) {
-            classImports.addAll(classes);
-            return this;
-        }
-
-        public Builder addMethodImports(final Method... method) {
-            methodImports.addAll(Arrays.asList(method));
-            return this;
-        }
-
-        public Builder addMethodImports(final Collection<Method> methods) {
-            methodImports.addAll(methods);
-            return this;
-        }
+public interface ImportCustomizer extends Customizer {
 
-        public Builder addEnumImports(final Enum... e) {
-            enumImports.addAll(Arrays.asList(e));
-            return this;
-        }
+    public Set<Class> getClassImports();
 
-        public Builder addEnumImports(final Collection<Enum> enums) {
-            enumImports.addAll(enums);
-            return this;
-        }
+    public Set<Method> getMethodImports();
 
-        public ImportCustomizer create() {
-            return new ImportCustomizer(this);
-        }
-    }
+    public Set<Enum> getEnumImports();
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/11f57acf/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPlugin.java
----------------------------------------------------------------------
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPlugin.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPlugin.java
index f99ee68..a5ac278 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPlugin.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPlugin.java
@@ -40,7 +40,7 @@ public final class ImportGremlinPlugin extends 
AbstractGremlinPlugin {
     private static final String MODULE_NAME = "tinkerpop.import";
 
     private ImportGremlinPlugin(final Builder builder) {
-        super(MODULE_NAME, builder.appliesTo, ImportCustomizer.build()
+        super(MODULE_NAME, builder.appliesTo, DefaultImportCustomizer.build()
                                                 
.addClassImports(builder.classImports)
                                                 
.addEnumImports(builder.enumImports)
                                                 
.addMethodImports(builder.methodImports).create());

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/11f57acf/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPluginTest.java
----------------------------------------------------------------------
diff --git 
a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPluginTest.java
 
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPluginTest.java
index 428fc57..59c64df 100644
--- 
a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPluginTest.java
+++ 
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/ImportGremlinPluginTest.java
@@ -49,7 +49,7 @@ public class ImportGremlinPluginTest {
         final ImportGremlinPlugin module = ImportGremlinPlugin.build()
                 
.classImports(Collections.singletonList(Graph.class.getCanonicalName())).create();
 
-        final ImportCustomizer customizer = (ImportCustomizer) 
module.getCustomizers().get()[0];
+        final DefaultImportCustomizer customizer = (DefaultImportCustomizer) 
module.getCustomizers().get()[0];
         assertEquals(1, module.getCustomizers().get().length);
         assertThat(customizer.getClassImports(), hasItems(Graph.class));
         assertEquals(1, customizer.getClassImports().size());
@@ -61,7 +61,7 @@ public class ImportGremlinPluginTest {
         final ImportGremlinPlugin module = ImportGremlinPlugin.build()
                 
.methodImports(Collections.singletonList(Gremlin.class.getCanonicalName() + 
"#*")).create();
 
-        final ImportCustomizer customizer = (ImportCustomizer) 
module.getCustomizers().get()[0];
+        final DefaultImportCustomizer customizer = (DefaultImportCustomizer) 
module.getCustomizers().get()[0];
         assertEquals(1, module.getCustomizers().get().length);
         assertThat(customizer.getMethodImports(), hasItems(zeroArgs));
 
@@ -75,7 +75,7 @@ public class ImportGremlinPluginTest {
         final ImportGremlinPlugin module = ImportGremlinPlugin.build()
                 
.methodImports(Collections.singletonList(toMethodDescriptor(zeroArgs))).create();
 
-        final ImportCustomizer customizer = (ImportCustomizer) 
module.getCustomizers().get()[0];
+        final DefaultImportCustomizer customizer = (DefaultImportCustomizer) 
module.getCustomizers().get()[0];
         assertEquals(1, module.getCustomizers().get().length);
         assertThat(customizer.getMethodImports(), hasItems(zeroArgs));
         assertEquals(1, customizer.getMethodImports().size());
@@ -87,7 +87,7 @@ public class ImportGremlinPluginTest {
         final ImportGremlinPlugin module = ImportGremlinPlugin.build()
                 
.methodImports(Collections.singletonList(toMethodDescriptor(singleArg))).create();
 
-        final ImportCustomizer customizer = (ImportCustomizer) 
module.getCustomizers().get()[0];
+        final DefaultImportCustomizer customizer = (DefaultImportCustomizer) 
module.getCustomizers().get()[0];
         assertEquals(1, module.getCustomizers().get().length);
         assertThat(customizer.getMethodImports(), hasItems(singleArg));
         assertEquals(1, customizer.getMethodImports().size());
@@ -110,7 +110,7 @@ public class ImportGremlinPluginTest {
         final ImportGremlinPlugin module = ImportGremlinPlugin.build()
                 
.enumImports(Collections.singletonList(T.class.getCanonicalName() + 
"#*")).create();
 
-        final ImportCustomizer customizer = (ImportCustomizer) 
module.getCustomizers().get()[0];
+        final DefaultImportCustomizer customizer = (DefaultImportCustomizer) 
module.getCustomizers().get()[0];
         assertEquals(1, module.getCustomizers().get().length);
         assertThat(customizer.getEnumImports(), hasItems(T.id, T.key, T.label, 
T.value));
         assertEquals(4, customizer.getEnumImports().size());
@@ -121,7 +121,7 @@ public class ImportGremlinPluginTest {
         final ImportGremlinPlugin module = ImportGremlinPlugin.build()
                 
.enumImports(Collections.singletonList(T.class.getCanonicalName() + "#" + 
T.id.name())).create();
 
-        final ImportCustomizer customizer = (ImportCustomizer) 
module.getCustomizers().get()[0];
+        final DefaultImportCustomizer customizer = (DefaultImportCustomizer) 
module.getCustomizers().get()[0];
         assertEquals(1, module.getCustomizers().get().length);
         assertThat(customizer.getEnumImports(), hasItems(T.id));
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/11f57acf/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/DefaultDefaultImportCustomizerProviderTest.java
----------------------------------------------------------------------
diff --git 
a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/DefaultDefaultImportCustomizerProviderTest.java
 
b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/DefaultDefaultImportCustomizerProviderTest.java
new file mode 100644
index 0000000..9a3785f
--- /dev/null
+++ 
b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/DefaultDefaultImportCustomizerProviderTest.java
@@ -0,0 +1,90 @@
+/*
+ * 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.groovy;
+
+import org.apache.tinkerpop.gremlin.groovy.loaders.SugarLoader;
+import org.junit.Test;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class DefaultDefaultImportCustomizerProviderTest {
+    static {
+        SugarLoader.load();
+    }
+
+    @Test
+    public void shouldReturnDefaultImports() {
+        final DefaultImportCustomizerProvider provider = new 
DefaultImportCustomizerProvider();
+        assertImportsInProvider(provider);
+    }
+
+    @Test
+    public void shouldReturnWithExtraStaticImports() {
+        final Set<String> statics = new HashSet<>();
+        statics.add("com.test.This.*");
+        statics.add("com.test.That.OTHER");
+        final DefaultImportCustomizerProvider provider = new 
DefaultImportCustomizerProvider(new HashSet<>(), statics);
+        assertImportsInProvider(provider);
+    }
+
+    @Test
+    public void shouldReturnWithExtraImports() {
+        final Set<String> imports = new HashSet<>();
+        imports.add("com.test.that.*");
+        imports.add("com.test.that.That");
+        final DefaultImportCustomizerProvider provider = new 
DefaultImportCustomizerProvider(imports, new HashSet<>());
+        assertImportsInProvider(provider);
+    }
+
+    @Test
+    public void shouldReturnWithBothImportTypes() {
+        final Set<String> imports = new HashSet<>();
+        imports.add("com.test.that.*");
+        imports.add("com.test.that.That");
+
+        final Set<String> statics = new HashSet<>();
+        statics.add("com.test.This.*");
+        statics.add("com.test.That.OTHER");
+
+        final DefaultImportCustomizerProvider provider = new 
DefaultImportCustomizerProvider(imports, statics);
+        assertImportsInProvider(provider);
+    }
+
+    private static void 
assertImportsInProvider(DefaultImportCustomizerProvider provider) {
+        final Set<String> allImports = provider.getAllImports();
+
+        final Set<String> imports = provider.getImports();
+        final Set<String> staticImports = provider.getStaticImports();
+        final Set<String> extraImports = provider.getExtraImports();
+        final Set<String> extraStaticImports = 
provider.getExtraStaticImports();
+
+        assertEquals(imports.size() + staticImports.size() + 
extraImports.size() + extraStaticImports.size(), allImports.size());
+        assertTrue(allImports.containsAll(imports));
+        assertTrue(allImports.containsAll(staticImports));
+        assertTrue(allImports.containsAll(extraImports));
+        assertTrue(allImports.containsAll(extraStaticImports));
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/11f57acf/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/DefaultImportCustomizerProviderTest.java
----------------------------------------------------------------------
diff --git 
a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/DefaultImportCustomizerProviderTest.java
 
b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/DefaultImportCustomizerProviderTest.java
deleted file mode 100644
index 74df889..0000000
--- 
a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/DefaultImportCustomizerProviderTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.groovy;
-
-import org.apache.tinkerpop.gremlin.groovy.loaders.SugarLoader;
-import org.junit.Test;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class DefaultImportCustomizerProviderTest {
-    static {
-        SugarLoader.load();
-    }
-
-    @Test
-    public void shouldReturnDefaultImports() {
-        final DefaultImportCustomizerProvider provider = new 
DefaultImportCustomizerProvider();
-        assertImportsInProvider(provider);
-    }
-
-    @Test
-    public void shouldReturnWithExtraStaticImports() {
-        final Set<String> statics = new HashSet<>();
-        statics.add("com.test.This.*");
-        statics.add("com.test.That.OTHER");
-        final DefaultImportCustomizerProvider provider = new 
DefaultImportCustomizerProvider(new HashSet<>(), statics);
-        assertImportsInProvider(provider);
-    }
-
-    @Test
-    public void shouldReturnWithExtraImports() {
-        final Set<String> imports = new HashSet<>();
-        imports.add("com.test.that.*");
-        imports.add("com.test.that.That");
-        final DefaultImportCustomizerProvider provider = new 
DefaultImportCustomizerProvider(imports, new HashSet<>());
-        assertImportsInProvider(provider);
-    }
-
-    @Test
-    public void shouldReturnWithBothImportTypes() {
-        final Set<String> imports = new HashSet<>();
-        imports.add("com.test.that.*");
-        imports.add("com.test.that.That");
-
-        final Set<String> statics = new HashSet<>();
-        statics.add("com.test.This.*");
-        statics.add("com.test.That.OTHER");
-
-        final DefaultImportCustomizerProvider provider = new 
DefaultImportCustomizerProvider(imports, statics);
-        assertImportsInProvider(provider);
-    }
-
-    private static void 
assertImportsInProvider(DefaultImportCustomizerProvider provider) {
-        final Set<String> allImports = provider.getAllImports();
-
-        final Set<String> imports = provider.getImports();
-        final Set<String> staticImports = provider.getStaticImports();
-        final Set<String> extraImports = provider.getExtraImports();
-        final Set<String> extraStaticImports = 
provider.getExtraStaticImports();
-
-        assertEquals(imports.size() + staticImports.size() + 
extraImports.size() + extraStaticImports.size(), allImports.size());
-        assertTrue(allImports.containsAll(imports));
-        assertTrue(allImports.containsAll(staticImports));
-        assertTrue(allImports.containsAll(extraImports));
-        assertTrue(allImports.containsAll(extraStaticImports));
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/11f57acf/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinPlugin.java
----------------------------------------------------------------------
diff --git 
a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinPlugin.java
 
b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinPlugin.java
index e8826ae..a08aa76 100644
--- 
a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinPlugin.java
+++ 
b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/jsr223/GremlinServerGremlinPlugin.java
@@ -20,7 +20,7 @@ package org.apache.tinkerpop.gremlin.server.jsr223;
 
 import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinPlugin;
 import org.apache.tinkerpop.gremlin.jsr223.GremlinPlugin;
-import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.DefaultImportCustomizer;
 import org.apache.tinkerpop.gremlin.server.util.LifeCycleHook;
 
 /**
@@ -33,7 +33,7 @@ public final class GremlinServerGremlinPlugin extends 
AbstractGremlinPlugin {
     private static final GremlinServerGremlinPlugin instance = new 
GremlinServerGremlinPlugin();
 
     private GremlinServerGremlinPlugin() {
-        super(MODULE_NAME, 
ImportCustomizer.build().addClassImports(LifeCycleHook.class, 
LifeCycleHook.Context.class).create());
+        super(MODULE_NAME, 
DefaultImportCustomizer.build().addClassImports(LifeCycleHook.class, 
LifeCycleHook.Context.class).create());
     }
 
     public static GremlinServerGremlinPlugin instance() {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/11f57acf/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
----------------------------------------------------------------------
diff --git 
a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
 
b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
index 9910a4c..723d898 100644
--- 
a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
+++ 
b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
@@ -25,7 +25,6 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.junit.Test;
 
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
 
@@ -68,7 +67,7 @@ public class GremlinEnabledScriptEngineTest {
 
             @Override
             public Optional<Customizer[]> getCustomizers(final String 
scriptEngineName) {
-                return Optional.of(new Customizer[] {ImportCustomizer.build()
+                return Optional.of(new Customizer[] 
{DefaultImportCustomizer.build()
                         .addClassImports(java.awt.Color.class)
                         .addClassImports(java.sql.CallableStatement.class)
                         .create() });

Reply via email to