Repository: tinkerpop Updated Branches: refs/heads/master 850e159b8 -> 20c5f8493
TINKERPOP-1477 Made DependencyGrabberTest an integration test This test has had a tendency to fail on travis and some other environments for some time now - probably better than as an integration test. CTR Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/0070d3db Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/0070d3db Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/0070d3db Branch: refs/heads/master Commit: 0070d3dbd1154c8608ac360046f0650842a77c59 Parents: bdef1a4 Author: Stephen Mallette <[email protected]> Authored: Wed Sep 28 17:41:42 2016 -0400 Committer: Stephen Mallette <[email protected]> Committed: Wed Sep 28 17:41:42 2016 -0400 ---------------------------------------------------------------------- .../util/DependencyGrabberIntegrateTest.java | 102 +++++++++++++++++++ .../groovy/util/DependencyGrabberTest.java | 102 ------------------- 2 files changed, 102 insertions(+), 102 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/0070d3db/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabberIntegrateTest.java ---------------------------------------------------------------------- diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabberIntegrateTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabberIntegrateTest.java new file mode 100644 index 0000000..7b3bba8 --- /dev/null +++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabberIntegrateTest.java @@ -0,0 +1,102 @@ +/* + * 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.util; + +import groovy.lang.GroovyClassLoader; +import java.io.File; +import org.apache.commons.io.FileUtils; +import org.apache.tinkerpop.gremlin.TestHelper; +import org.apache.tinkerpop.gremlin.groovy.plugin.Artifact; +import org.junit.AfterClass; +import org.junit.Test; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +/** + * @author Jason Plurad (http://github.com/pluradj) + */ +public class DependencyGrabberIntegrateTest { + private static final GroovyClassLoader dummyClassLoader = new GroovyClassLoader(); + private static final File extTestDir = new File(System.getProperty("user.dir"), TestHelper.makeTestDataDirectory(DependencyGrabberIntegrateTest.class)); + private static final DependencyGrabber dg = new DependencyGrabber(dummyClassLoader, extTestDir.getAbsolutePath()); + + @AfterClass + public static void tearDown() { + FileUtils.deleteQuietly(extTestDir); + } + + @Test + public void shouldInstallAndUninstallDependencies() { + final String pkg = "org.apache.tinkerpop"; + final String name = "tinkergraph-gremlin"; + final String ver = "3.0.1-incubating"; + final Artifact a = new Artifact(pkg, name, ver); + + // install the plugin + final File pluginDir = new File(extTestDir, name); + dg.copyDependenciesToPath(a); + assertTrue(pluginDir.exists()); + + // delete the plugin + dg.deleteDependenciesFromPath(a); + assertFalse(pluginDir.exists()); + } + + @Test(expected=IllegalStateException.class) + public void shouldThrowIllegalStateException() { + final String pkg = "org.apache.tinkerpop"; + final String name = "gremlin-groovy"; + final String ver = "3.0.1-incubating"; + final Artifact a = new Artifact(pkg, name, ver); + + // install the plugin for the first time + final File pluginDir = new File(extTestDir, name); + dg.copyDependenciesToPath(a); + assertTrue(pluginDir.exists()); + + // attempt to install plugin a second time + try { + dg.copyDependenciesToPath(a); + } catch (IllegalStateException ise) { + // validate that the plugin dir wasn't deleted by accident + assertTrue(pluginDir.exists()); + // throw the IllegalStateException + throw ise; + } + } + + @Test(expected=RuntimeException.class) + public void shouldThrowRuntimeException() { + final String pkg = "org.apache.tinkerpop"; + final String name = "gremlin-bogus"; + final String ver = "3.0.1-incubating"; + final Artifact a = new Artifact(pkg, name, ver); + + // attempt to install bogus plugin + try { + dg.copyDependenciesToPath(a); + } catch (RuntimeException re) { + // validate that the plugin dir was deleted + final File pluginDir = new File(extTestDir, name); + assertFalse(pluginDir.exists()); + // throw the RuntimeException + throw re; + } + } +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/0070d3db/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabberTest.java ---------------------------------------------------------------------- diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabberTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabberTest.java deleted file mode 100644 index f32b757..0000000 --- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/util/DependencyGrabberTest.java +++ /dev/null @@ -1,102 +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.util; - -import groovy.lang.GroovyClassLoader; -import java.io.File; -import org.apache.commons.io.FileUtils; -import org.apache.tinkerpop.gremlin.TestHelper; -import org.apache.tinkerpop.gremlin.groovy.plugin.Artifact; -import org.junit.AfterClass; -import org.junit.Test; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -/** - * @author Jason Plurad (http://github.com/pluradj) - */ -public class DependencyGrabberTest { - private static final GroovyClassLoader dummyClassLoader = new GroovyClassLoader(); - private static final File extTestDir = new File(System.getProperty("user.dir"), TestHelper.makeTestDataDirectory(DependencyGrabberTest.class)); - private static final DependencyGrabber dg = new DependencyGrabber(dummyClassLoader, extTestDir.getAbsolutePath()); - - @AfterClass - public static void tearDown() { - FileUtils.deleteQuietly(extTestDir); - } - - @Test - public void shouldInstallAndUninstallDependencies() { - final String pkg = "org.apache.tinkerpop"; - final String name = "tinkergraph-gremlin"; - final String ver = "3.0.1-incubating"; - final Artifact a = new Artifact(pkg, name, ver); - - // install the plugin - final File pluginDir = new File(extTestDir, name); - dg.copyDependenciesToPath(a); - assertTrue(pluginDir.exists()); - - // delete the plugin - dg.deleteDependenciesFromPath(a); - assertFalse(pluginDir.exists()); - } - - @Test(expected=IllegalStateException.class) - public void shouldThrowIllegalStateException() { - final String pkg = "org.apache.tinkerpop"; - final String name = "gremlin-groovy"; - final String ver = "3.0.1-incubating"; - final Artifact a = new Artifact(pkg, name, ver); - - // install the plugin for the first time - final File pluginDir = new File(extTestDir, name); - dg.copyDependenciesToPath(a); - assertTrue(pluginDir.exists()); - - // attempt to install plugin a second time - try { - dg.copyDependenciesToPath(a); - } catch (IllegalStateException ise) { - // validate that the plugin dir wasn't deleted by accident - assertTrue(pluginDir.exists()); - // throw the IllegalStateException - throw ise; - } - } - - @Test(expected=RuntimeException.class) - public void shouldThrowRuntimeException() { - final String pkg = "org.apache.tinkerpop"; - final String name = "gremlin-bogus"; - final String ver = "3.0.1-incubating"; - final Artifact a = new Artifact(pkg, name, ver); - - // attempt to install bogus plugin - try { - dg.copyDependenciesToPath(a); - } catch (RuntimeException re) { - // validate that the plugin dir was deleted - final File pluginDir = new File(extTestDir, name); - assertFalse(pluginDir.exists()); - // throw the RuntimeException - throw re; - } - } -}
