5 Commits
2.1 ... MiniAcc

Author SHA1 Message Date
Ryan Webb
9abbc25f4e forgot to do zookeeper 2015-02-20 15:00:10 -05:00
Ryan Webb
d717030169 Workaround just to see if tests run on mini 2015-02-20 14:32:37 -05:00
Ryan Webb
a2e0a9b6f9 Fix for missing variables
go travisci go
2015-02-20 14:27:33 -05:00
Ryan Webb
fffc731507 Updated tests to use mini.
Does not build on windows -- will fix after fixing on CI build
2015-02-20 14:19:06 -05:00
Ryan Webb
1f630eb3ef Next Snapshot 2015-02-20 12:32:25 -05:00
3 changed files with 55 additions and 62 deletions

View File

@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>edu.jhuapl.tinkerpop</groupId>
<artifactId>blueprints-accumulo-graph</artifactId>
<version>0.2.1</version>
<version>0.2.2-SNAPSHOT</version>
<name>blueprints-accumulo-graph</name>
<description>An Accumulo-backed implementation of the Tinkerpop Blueprints graph API.</description>
<packaging>jar</packaging>

View File

@@ -19,6 +19,8 @@ import java.io.IOException;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.attribute.FileAttribute;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@@ -75,7 +77,7 @@ implements Serializable {
/**
* Temp directory used by getInstance when a Mini InstanceType is used.
*/
private String miniClusterTempDir;
private File miniClusterTempDir;
private MiniAccumuloCluster accumuloMiniCluster;
@@ -254,6 +256,7 @@ implements Serializable {
InstanceType.Mini.equals(type)) {
setUser("root");
setPassword("");
setInstanceName("");
setCreate(true);
}
@@ -895,6 +898,20 @@ implements Serializable {
if (connector == null) {
Instance inst = null;
switch (getInstanceType()) {
case Mini:
if (miniClusterTempDir == null) {
miniClusterTempDir = Files.createTempDirectory("accumulo-mini").toFile();
}
accumuloMiniCluster = new MiniAccumuloCluster(miniClusterTempDir, ""); // conf.getString(PASSWORD)
try {
accumuloMiniCluster.start();
} catch (Exception ex) {
throw new AccumuloGraphException(ex);
}
this.setInstanceName(accumuloMiniCluster.getInstanceName());
this.setZooKeeperHosts(accumuloMiniCluster.getZooKeepers());
this.setPassword("");
case Distributed:
if (getInstanceName() == null) {
throw new IllegalArgumentException("Must specify instance name for distributed mode");
@@ -904,24 +921,7 @@ implements Serializable {
inst = new ZooKeeperInstance(getInstanceName(), getZooKeeperHosts());
break;
case Mini:
File dir = null;
if (miniClusterTempDir == null) {
dir = createTempDir();
dir.deleteOnExit();
} else {
// already set by setMiniClusterTempDir(), It should be cleaned up outside of this class.
dir = new File(miniClusterTempDir);
}
accumuloMiniCluster = new MiniAccumuloCluster(dir, ""); // conf.getString(PASSWORD)
try {
accumuloMiniCluster.start();
} catch (Exception ex) {
throw new AccumuloGraphException(ex);
}
inst = new ZooKeeperInstance(accumuloMiniCluster.getInstanceName(), accumuloMiniCluster.getZooKeepers());
throw new UnsupportedOperationException("TODO");
case Mock:
inst = new MockInstance(getInstanceName());
break;
@@ -971,7 +971,7 @@ implements Serializable {
* @param miniClusterTempDir
*/
public AccumuloGraphConfiguration setMiniClusterTempDir(String miniClusterTempDir) {
this.miniClusterTempDir = miniClusterTempDir;
this.miniClusterTempDir = new File(miniClusterTempDir);
return this;
}
@@ -1046,8 +1046,8 @@ implements Serializable {
checkPropertyValue(Keys.PASSWORD, getPassword(), false);
// no break intentional
case Mini:
checkPropertyValue(Keys.INSTANCE, getInstanceName(), false);
checkPropertyValue(Keys.PASSWORD, getPassword(), true);
// checkPropertyValue(Keys.INSTANCE, getInstanceName(), false);
// checkPropertyValue(Keys.PASSWORD, getPassword(), true);
// no break intentional
case Mock:
checkPropertyValue(Keys.GRAPH_NAME, getGraphName(), false);
@@ -1089,13 +1089,6 @@ implements Serializable {
}
}
private File createTempDir() throws IOException {
File temp = File.createTempFile(AccumuloGraphConfiguration
.class.getSimpleName(), ".mini.tmp");
Files.delete(temp.toPath());
Files.createDirectory(temp.toPath());
return temp;
}
/**
* Print out this configuration.

View File

@@ -1,32 +1,32 @@
/* Copyright 2014 The Johns Hopkins University Applied Physics Laboratory
*
* Licensed 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 edu.jhuapl.tinkerpop;
import com.tinkerpop.blueprints.Graph;
import com.tinkerpop.blueprints.GraphFactory;
import edu.jhuapl.tinkerpop.AccumuloGraphConfiguration.InstanceType;
public class AccumuloGraphTestUtils {
public static AccumuloGraphConfiguration generateGraphConfig(String graphDirectoryName) {
return new AccumuloGraphConfiguration().setInstanceType(InstanceType.Mock)
.setGraphName(graphDirectoryName).setCreate(true);
}
public static Graph makeGraph(String name) {
return GraphFactory.open(generateGraphConfig(name));
}
}
/* Copyright 2014 The Johns Hopkins University Applied Physics Laboratory
*
* Licensed 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 edu.jhuapl.tinkerpop;
import com.tinkerpop.blueprints.Graph;
import com.tinkerpop.blueprints.GraphFactory;
import edu.jhuapl.tinkerpop.AccumuloGraphConfiguration.InstanceType;
public class AccumuloGraphTestUtils {
public static AccumuloGraphConfiguration generateGraphConfig(String graphDirectoryName) {
return new AccumuloGraphConfiguration().setInstanceType(InstanceType.Mini)
.setGraphName(graphDirectoryName).setCreate(true);
}
public static Graph makeGraph(String name) {
return GraphFactory.open(generateGraphConfig(name));
}
}