diff options
Diffstat (limited to 'src/test/java/com/thinkaurelius')
49 files changed, 1533 insertions, 0 deletions
diff --git a/src/test/java/com/thinkaurelius/titan/CassandraStorageSetup.java b/src/test/java/com/thinkaurelius/titan/CassandraStorageSetup.java new file mode 100644 index 0000000..3b70533 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/CassandraStorageSetup.java @@ -0,0 +1,182 @@ +package com.thinkaurelius.titan; + +import static com.thinkaurelius.titan.diskstorage.cassandra.AbstractCassandraStoreManager.CASSANDRA_KEYSPACE; + +import java.io.File; +import java.io.IOException; +import java.time.Duration; +import java.util.concurrent.TimeUnit; + +import com.thinkaurelius.titan.diskstorage.cassandra.AbstractCassandraStoreManager; + +import com.thinkaurelius.titan.diskstorage.cassandra.utils.CassandraDaemonWrapper; +import com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration; +import com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration; + +import org.apache.commons.io.FileUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.base.Joiner; +import com.google.common.base.Preconditions; + +import static com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.*; + +public class CassandraStorageSetup { + + public static final String CONFDIR_SYSPROP = "test.cassandra.confdir"; + public static final String DATADIR_SYSPROP = "test.cassandra.datadir"; + + private static volatile Paths paths; + + private static final Logger log = LoggerFactory.getLogger(CassandraStorageSetup.class); + + private static synchronized Paths getPaths() { + if (null == paths) { + String yamlPath = "file://" + loadAbsoluteDirectoryPath("conf", CONFDIR_SYSPROP, true) + File.separator + "cassandra.yaml"; + String dataPath = loadAbsoluteDirectoryPath("data", DATADIR_SYSPROP, false); + paths = new Paths(yamlPath, dataPath); + } + return paths; + } + + private static ModifiableConfiguration getGenericConfiguration(String ks, String backend) { + ModifiableConfiguration config = buildGraphConfiguration(); + config.set(CASSANDRA_KEYSPACE, cleanKeyspaceName(ks)); + log.debug("Set keyspace name: {}", config.get(CASSANDRA_KEYSPACE)); + config.set(PAGE_SIZE,500); + config.set(CONNECTION_TIMEOUT, Duration.ofSeconds(60L)); + config.set(STORAGE_BACKEND, backend); + return config; + } + + + public static ModifiableConfiguration getEmbeddedConfiguration(String ks) { + ModifiableConfiguration config = getGenericConfiguration(ks, "embeddedcassandra"); + config.set(STORAGE_CONF_FILE, getPaths().yamlPath); + return config; + } + + public static ModifiableConfiguration getEmbeddedCassandraPartitionConfiguration(String ks) { + ModifiableConfiguration config = getEmbeddedConfiguration(ks); + config.set(IDS_FLUSH,false); + return config; + } + + public static WriteConfiguration getEmbeddedGraphConfiguration(String ks) { + return getEmbeddedConfiguration(ks).getConfiguration(); + } + + public static WriteConfiguration getEmbeddedCassandraPartitionGraphConfiguration(String ks) { + return getEmbeddedConfiguration(ks).getConfiguration(); + } + + public static ModifiableConfiguration getAstyanaxConfiguration(String ks) { + return getGenericConfiguration(ks, "astyanax"); + } + + public static ModifiableConfiguration getAstyanaxSSLConfiguration(String ks) { + return enableSSL(getGenericConfiguration(ks, "astyanax")); + } + + public static WriteConfiguration getAstyanaxGraphConfiguration(String ks) { + return getAstyanaxConfiguration(ks).getConfiguration(); + } + + public static ModifiableConfiguration getCassandraConfiguration(String ks) { + return getGenericConfiguration(ks, "cassandra"); + } + + public static WriteConfiguration getCassandraGraphConfiguration(String ks) { + return getCassandraConfiguration(ks).getConfiguration(); + } + + public static ModifiableConfiguration getCassandraThriftConfiguration(String ks) { + return getGenericConfiguration(ks, "cassandrathrift"); + } + + public static ModifiableConfiguration getCassandraThriftSSLConfiguration(String ks) { + return enableSSL(getGenericConfiguration(ks, "cassandrathrift")); + } + + public static WriteConfiguration getCassandraThriftGraphConfiguration(String ks) { + return getCassandraThriftConfiguration(ks).getConfiguration(); + } + + /** + * Load cassandra.yaml and data paths from the environment or from default + * values if nothing is set in the environment, then delete all existing + * data, and finally start Cassandra. + * <p> + * This method is idempotent. Calls after the first have no effect aside + * from logging statements. + */ + public static void startCleanEmbedded() { + startCleanEmbedded(getPaths()); + } + + /* + * Cassandra only accepts keyspace names 48 characters long or shorter made + * up of alphanumeric characters and underscores. + */ + public static String cleanKeyspaceName(String raw) { + Preconditions.checkNotNull(raw); + Preconditions.checkArgument(0 < raw.length()); + + if (48 < raw.length() || raw.matches("[^a-zA-Z_]")) { + return "strhash" + String.valueOf(Math.abs(raw.hashCode())); + } else { + return raw; + } + } + + private static ModifiableConfiguration enableSSL(ModifiableConfiguration mc) { + mc.set(AbstractCassandraStoreManager.SSL_ENABLED, true); + mc.set(STORAGE_HOSTS, new String[]{ "localhost" }); + mc.set(AbstractCassandraStoreManager.SSL_TRUSTSTORE_LOCATION, + Joiner.on(File.separator).join("target", "cassandra", "conf", "localhost-murmur-ssl", "test.truststore")); + mc.set(AbstractCassandraStoreManager.SSL_TRUSTSTORE_PASSWORD, "cassandra"); + return mc; + } + + private static void startCleanEmbedded(Paths p) { + if (!CassandraDaemonWrapper.isStarted()) { + try { + FileUtils.deleteDirectory(new File(p.dataPath)); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + CassandraDaemonWrapper.start(p.yamlPath); + } + + private static String loadAbsoluteDirectoryPath(String name, String prop, boolean mustExistAndBeAbsolute) { + String s = System.getProperty(prop); + + if (null == s) { + s = Joiner.on(File.separator).join(System.getProperty("user.dir"), "target", "cassandra", name, "localhost-bop"); + log.info("Set default Cassandra {} directory path {}", name, s); + } else { + log.info("Loaded Cassandra {} directory path {} from system property {}", new Object[] { name, s, prop }); + } + + if (mustExistAndBeAbsolute) { + File dir = new File(s); + Preconditions.checkArgument(dir.isDirectory(), "Path %s must be a directory", s); + Preconditions.checkArgument(dir.isAbsolute(), "Path %s must be absolute", s); + } + + return s; + } + + private static class Paths { + private final String yamlPath; + private final String dataPath; + + public Paths(String yamlPath, String dataPath) { + this.yamlPath = yamlPath; + this.dataPath = dataPath; + } + } +} diff --git a/src/test/java/com/thinkaurelius/titan/blueprints/thrift/ThriftGraphComputerProvider.java b/src/test/java/com/thinkaurelius/titan/blueprints/thrift/ThriftGraphComputerProvider.java new file mode 100644 index 0000000..c77fed4 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/blueprints/thrift/ThriftGraphComputerProvider.java @@ -0,0 +1,22 @@ +package com.thinkaurelius.titan.blueprints.thrift; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.blueprints.AbstractTitanGraphComputerProvider; +import com.thinkaurelius.titan.blueprints.AbstractTitanGraphProvider; +import com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration; +import com.thinkaurelius.titan.graphdb.olap.computer.FulgoraGraphComputer; +import org.apache.tinkerpop.gremlin.GraphProvider; + +/** + * @author Matthias Broecheler (me@matthiasb.com) + */ +@GraphProvider.Descriptor(computer = FulgoraGraphComputer.class) +public class ThriftGraphComputerProvider extends AbstractTitanGraphComputerProvider { + + @Override + public ModifiableConfiguration getTitanConfiguration(String graphName, Class<?> test, String testMethodName) { + CassandraStorageSetup.startCleanEmbedded(); + return CassandraStorageSetup.getCassandraThriftConfiguration(graphName); + } + +} diff --git a/src/test/java/com/thinkaurelius/titan/blueprints/thrift/ThriftGraphProvider.java b/src/test/java/com/thinkaurelius/titan/blueprints/thrift/ThriftGraphProvider.java new file mode 100644 index 0000000..ce8ee76 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/blueprints/thrift/ThriftGraphProvider.java @@ -0,0 +1,18 @@ +package com.thinkaurelius.titan.blueprints.thrift; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.blueprints.AbstractTitanGraphProvider; +import com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration; + +/** + * @author Matthias Broecheler (me@matthiasb.com) + */ +public class ThriftGraphProvider extends AbstractTitanGraphProvider { + + @Override + public ModifiableConfiguration getTitanConfiguration(String graphName, Class<?> test, String testMethodName) { + CassandraStorageSetup.startCleanEmbedded(); + return CassandraStorageSetup.getCassandraThriftConfiguration(graphName); + } + +} diff --git a/src/test/java/com/thinkaurelius/titan/blueprints/thrift/process/ThriftComputerTest.java b/src/test/java/com/thinkaurelius/titan/blueprints/thrift/process/ThriftComputerTest.java new file mode 100644 index 0000000..3109b8a --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/blueprints/thrift/process/ThriftComputerTest.java @@ -0,0 +1,25 @@ +package com.thinkaurelius.titan.blueprints.thrift.process; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.blueprints.thrift.ThriftGraphComputerProvider; +import com.thinkaurelius.titan.blueprints.thrift.ThriftGraphProvider; +import com.thinkaurelius.titan.core.TitanGraph; +import org.apache.tinkerpop.gremlin.GraphProviderClass; +import org.apache.tinkerpop.gremlin.process.ProcessComputerSuite; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; + +/** + * @author Matthias Broecheler (me@matthiasb.com) + */ +@RunWith(ProcessComputerSuite.class) +@GraphProviderClass(provider = ThriftGraphComputerProvider.class, graph = TitanGraph.class) +public class ThriftComputerTest { + +// TP3 ignores @BeforeClass -- the following method is never executed +// @BeforeClass +// public static void beforeSuite() { +// CassandraStorageSetup.startCleanEmbedded(); +// } + +}
\ No newline at end of file diff --git a/src/test/java/com/thinkaurelius/titan/blueprints/thrift/process/ThriftProcessTest.java b/src/test/java/com/thinkaurelius/titan/blueprints/thrift/process/ThriftProcessTest.java new file mode 100644 index 0000000..0feb338 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/blueprints/thrift/process/ThriftProcessTest.java @@ -0,0 +1,25 @@ +package com.thinkaurelius.titan.blueprints.thrift.process; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.blueprints.thrift.ThriftGraphProvider; +import com.thinkaurelius.titan.core.TitanGraph; +import org.apache.tinkerpop.gremlin.GraphProviderClass; +import org.apache.tinkerpop.gremlin.process.ProcessStandardSuite; +import org.apache.tinkerpop.gremlin.structure.StructureStandardSuite; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; + +/** + * @author Matthias Broecheler (me@matthiasb.com) + */ +@RunWith(ProcessStandardSuite.class) +@GraphProviderClass(provider = ThriftGraphProvider.class, graph = TitanGraph.class) +public class ThriftProcessTest { + +// TP3 ignores @BeforeClass -- the following method is never executed +// @BeforeClass +// public static void beforeSuite() { +// CassandraStorageSetup.startCleanEmbedded(); +// } + +} diff --git a/src/test/java/com/thinkaurelius/titan/blueprints/thrift/structure/ThriftStructureTest.java b/src/test/java/com/thinkaurelius/titan/blueprints/thrift/structure/ThriftStructureTest.java new file mode 100644 index 0000000..2d1d7eb --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/blueprints/thrift/structure/ThriftStructureTest.java @@ -0,0 +1,24 @@ +package com.thinkaurelius.titan.blueprints.thrift.structure; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.blueprints.thrift.ThriftGraphProvider; +import com.thinkaurelius.titan.core.TitanGraph; +import org.apache.tinkerpop.gremlin.GraphProviderClass; +import org.apache.tinkerpop.gremlin.structure.StructureStandardSuite; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; + +/** + * @author Matthias Broecheler (me@matthiasb.com) + */ +@RunWith(StructureStandardSuite.class) +@GraphProviderClass(provider = ThriftGraphProvider.class, graph = TitanGraph.class) +public class ThriftStructureTest { + +// TP3 ignores @BeforeClass -- the following method is never executed +// @BeforeClass +// public static void beforeSuite() { +// CassandraStorageSetup.startCleanEmbedded(); +// } + +} diff --git a/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/AbstractCassandraStoreTest.java b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/AbstractCassandraStoreTest.java new file mode 100644 index 0000000..623a742 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/AbstractCassandraStoreTest.java @@ -0,0 +1,136 @@ +package com.thinkaurelius.titan.diskstorage.cassandra; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.Collections; +import java.util.Map; + +import com.thinkaurelius.titan.diskstorage.BackendException; +import com.thinkaurelius.titan.diskstorage.configuration.Configuration; +import com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.collect.ImmutableMap; +import com.thinkaurelius.titan.diskstorage.KeyColumnValueStoreTest; +import com.thinkaurelius.titan.diskstorage.keycolumnvalue.StoreFeatures; +import com.thinkaurelius.titan.testcategory.OrderedKeyStoreTests; +import com.thinkaurelius.titan.testcategory.UnorderedKeyStoreTests; + +public abstract class AbstractCassandraStoreTest extends KeyColumnValueStoreTest { + + private static final Logger log = + LoggerFactory.getLogger(AbstractCassandraStoreTest.class); + private static final String TEST_CF_NAME = "testcf"; + private static final String DEFAULT_COMPRESSOR_PACKAGE = "org.apache.cassandra.io.compress"; + + public abstract ModifiableConfiguration getBaseStorageConfiguration(); + + public abstract AbstractCassandraStoreManager openStorageManager(Configuration c) throws BackendException; + + @Test + @Category({ UnorderedKeyStoreTests.class }) + public void testUnorderedConfiguration() { + if (!manager.getFeatures().hasUnorderedScan()) { + log.warn( + "Can't test key-unordered features on incompatible store. " + + "This warning could indicate reduced test coverage and " + + "a broken JUnit configuration. Skipping test {}.", + name.getMethodName()); + return; + } + + StoreFeatures features = manager.getFeatures(); + assertFalse(features.isKeyOrdered()); + assertFalse(features.hasLocalKeyPartition()); + } + + @Test + @Category({ OrderedKeyStoreTests.class }) + public void testOrderedConfiguration() { + if (!manager.getFeatures().hasOrderedScan()) { + log.warn( + "Can't test key-ordered features on incompatible store. " + + "This warning could indicate reduced test coverage and " + + "a broken JUnit configuration. Skipping test {}.", + name.getMethodName()); + return; + } + + StoreFeatures features = manager.getFeatures(); + assertTrue(features.isKeyOrdered()); + } + + @Test + public void testDefaultCFCompressor() throws BackendException { + + final String cf = TEST_CF_NAME + "_snappy"; + + AbstractCassandraStoreManager mgr = openStorageManager(); + + mgr.openDatabase(cf); + + Map<String, String> defaultCfCompressionOps = + new ImmutableMap.Builder<String, String>() + .put("sstable_compression", DEFAULT_COMPRESSOR_PACKAGE + "." + AbstractCassandraStoreManager.CF_COMPRESSION_TYPE.getDefaultValue()) + .put("chunk_length_kb", "64") + .build(); + + assertEquals(defaultCfCompressionOps, mgr.getCompressionOptions(cf)); + } + + @Test + public void testCustomCFCompressor() throws BackendException { + + final String cname = "DeflateCompressor"; + final int ckb = 128; + final String cf = TEST_CF_NAME + "_gzip"; + + ModifiableConfiguration config = getBaseStorageConfiguration(); + config.set(AbstractCassandraStoreManager.CF_COMPRESSION_TYPE,cname); + config.set(AbstractCassandraStoreManager.CF_COMPRESSION_BLOCK_SIZE,ckb); + + AbstractCassandraStoreManager mgr = openStorageManager(config); + + // N.B.: clearStorage() truncates CFs but does not delete them + mgr.openDatabase(cf); + + final Map<String, String> expected = ImmutableMap + .<String, String> builder() + .put("sstable_compression", + DEFAULT_COMPRESSOR_PACKAGE + "." + cname) + .put("chunk_length_kb", String.valueOf(ckb)).build(); + + assertEquals(expected, mgr.getCompressionOptions(cf)); + } + + @Test + public void testDisableCFCompressor() throws BackendException { + + final String cf = TEST_CF_NAME + "_nocompress"; + + ModifiableConfiguration config = getBaseStorageConfiguration(); + config.set(AbstractCassandraStoreManager.CF_COMPRESSION,false); + AbstractCassandraStoreManager mgr = openStorageManager(config); + + // N.B.: clearStorage() truncates CFs but does not delete them + mgr.openDatabase(cf); + + assertEquals(Collections.emptyMap(), mgr.getCompressionOptions(cf)); + } + + @Test + public void testTTLSupported() throws Exception { + StoreFeatures features = manager.getFeatures(); + assertTrue(features.hasCellTTL()); + } + + @Override + public AbstractCassandraStoreManager openStorageManager() throws BackendException { + return openStorageManager(getBaseStorageConfiguration()); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/CassandraTransactionTest.java b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/CassandraTransactionTest.java new file mode 100644 index 0000000..c602f97 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/CassandraTransactionTest.java @@ -0,0 +1,79 @@ +package com.thinkaurelius.titan.diskstorage.cassandra; + +import com.google.common.base.Preconditions; +import com.thinkaurelius.titan.diskstorage.BaseTransactionConfig; +import com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration; +import com.thinkaurelius.titan.diskstorage.util.StandardBaseTransactionConfig; +import com.thinkaurelius.titan.diskstorage.util.time.TimestampProviders; +import com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration; +import org.junit.Test; + +import static com.thinkaurelius.titan.diskstorage.cassandra.AbstractCassandraStoreManager.CASSANDRA_READ_CONSISTENCY; +import static com.thinkaurelius.titan.diskstorage.cassandra.AbstractCassandraStoreManager.CASSANDRA_WRITE_CONSISTENCY; +import static org.junit.Assert.*; + +public class CassandraTransactionTest { + + /* testRead/WriteConsistencyLevel have unnecessary code duplication + * that could be avoided by creating a common helper method that takes + * a ConfigOption parameter and a function that converts a + * CassandraTransaction to a consistency level by calling either + * ct.getReadConsistencyLevel() or .getWriteConsistencyLevel(), + * but it doesn't seem worth the complexity. + */ + + @Test + public void testWriteConsistencyLevel() { + int levelsChecked = 0; + + // Test whether CassandraTransaction honors the write consistency level option + for (CLevel writeLevel : CLevel.values()) { + StandardBaseTransactionConfig.Builder b = new StandardBaseTransactionConfig.Builder(); + ModifiableConfiguration mc = GraphDatabaseConfiguration.buildGraphConfiguration(); + mc.set(CASSANDRA_WRITE_CONSISTENCY, writeLevel.name()); + b.customOptions(mc); + b.timestampProvider(TimestampProviders.MICRO); + CassandraTransaction ct = new CassandraTransaction(b.build()); + assertEquals(writeLevel, ct.getWriteConsistencyLevel()); + levelsChecked++; + } + + // Sanity check: if CLevel.values was empty, something is wrong with the test + Preconditions.checkState(0 < levelsChecked); + } + + @Test + public void testReadConsistencyLevel() { + int levelsChecked = 0; + + // Test whether CassandraTransaction honors the write consistency level option + for (CLevel writeLevel : CLevel.values()) { + StandardBaseTransactionConfig.Builder b = new StandardBaseTransactionConfig.Builder(); + ModifiableConfiguration mc = GraphDatabaseConfiguration.buildGraphConfiguration(); + mc.set(CASSANDRA_READ_CONSISTENCY, writeLevel.name()); + b.timestampProvider(TimestampProviders.MICRO); + b.customOptions(mc); + CassandraTransaction ct = new CassandraTransaction(b.build()); + assertEquals(writeLevel, ct.getReadConsistencyLevel()); + levelsChecked++; + } + + // Sanity check: if CLevel.values was empty, something is wrong with the test + Preconditions.checkState(0 < levelsChecked); + } + + @Test + public void testTimestampProvider() { + BaseTransactionConfig txcfg = StandardBaseTransactionConfig.of(TimestampProviders.NANO); + CassandraTransaction ct = new CassandraTransaction(txcfg); + assertEquals(TimestampProviders.NANO, ct.getConfiguration().getTimestampProvider()); + + txcfg = StandardBaseTransactionConfig.of(TimestampProviders.MICRO); + ct = new CassandraTransaction(txcfg); + assertEquals(TimestampProviders.MICRO, ct.getConfiguration().getTimestampProvider()); + + txcfg = StandardBaseTransactionConfig.of(TimestampProviders.MILLI); + ct = new CassandraTransaction(txcfg); + assertEquals(TimestampProviders.MILLI, ct.getConfiguration().getTimestampProvider()); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/UUIDTest.java b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/UUIDTest.java new file mode 100644 index 0000000..356e8ce --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/UUIDTest.java @@ -0,0 +1,34 @@ +package com.thinkaurelius.titan.diskstorage.cassandra; + +import org.apache.cassandra.db.marshal.TimeUUIDType; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import com.thinkaurelius.titan.testcategory.StandaloneTests; + +import java.nio.ByteBuffer; +import java.util.UUID; + +import static org.junit.Assert.assertEquals; + +@Category({StandaloneTests.class}) +public class UUIDTest { + public static final String z = "00000000-0000-1000-0000-000000000000"; + public static final String v = "9451e273-7753-11e0-92df-e700f669bcfc"; + + @Test + public void timeUUIDComparison() { + TimeUUIDType ti = TimeUUIDType.instance; + + UUID zu = UUID.fromString(z); + UUID vu = UUID.fromString(v); + + ByteBuffer zb = ti.decompose(zu); + ByteBuffer vb = ti.decompose(vu); + + assertEquals(-1, ti.compare(zb, vb)); + assertEquals(1, zu.compareTo(vu)); + assertEquals(1, ti.compare(vb, zb)); + assertEquals(-1, vu.compareTo(zu)); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/astyanax/AstyanaxIDAuthorityTest.java b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/astyanax/AstyanaxIDAuthorityTest.java new file mode 100644 index 0000000..662b60a --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/astyanax/AstyanaxIDAuthorityTest.java @@ -0,0 +1,25 @@ +package com.thinkaurelius.titan.diskstorage.cassandra.astyanax; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.BackendException; +import com.thinkaurelius.titan.diskstorage.IDAuthorityTest; +import com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration; +import com.thinkaurelius.titan.diskstorage.keycolumnvalue.KeyColumnValueStoreManager; +import org.junit.BeforeClass; + +public class AstyanaxIDAuthorityTest extends IDAuthorityTest { + + public AstyanaxIDAuthorityTest(WriteConfiguration baseConfig) { + super(baseConfig); + } + + @BeforeClass + public static void startCassandra() { + CassandraStorageSetup.startCleanEmbedded(); + } + + @Override + public KeyColumnValueStoreManager openStorageManager() throws BackendException { + return new AstyanaxStoreManager(CassandraStorageSetup.getAstyanaxConfiguration(getClass().getSimpleName())); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/astyanax/AstyanaxLockStoreTest.java b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/astyanax/AstyanaxLockStoreTest.java new file mode 100644 index 0000000..9e47088 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/astyanax/AstyanaxLockStoreTest.java @@ -0,0 +1,21 @@ +package com.thinkaurelius.titan.diskstorage.cassandra.astyanax; + +import com.thinkaurelius.titan.diskstorage.BackendException; +import org.junit.BeforeClass; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.LockKeyColumnValueStoreTest; +import com.thinkaurelius.titan.diskstorage.keycolumnvalue.KeyColumnValueStoreManager; + +public class AstyanaxLockStoreTest extends LockKeyColumnValueStoreTest { + + @BeforeClass + public static void startCassandra() { + CassandraStorageSetup.startCleanEmbedded(); + } + + @Override + public KeyColumnValueStoreManager openStorageManager(int idx) throws BackendException { + return new AstyanaxStoreManager(CassandraStorageSetup.getAstyanaxConfiguration(getClass().getSimpleName())); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/astyanax/AstyanaxLogTest.java b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/astyanax/AstyanaxLogTest.java new file mode 100644 index 0000000..339261f --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/astyanax/AstyanaxLogTest.java @@ -0,0 +1,25 @@ +package com.thinkaurelius.titan.diskstorage.cassandra.astyanax; + +import com.thinkaurelius.titan.diskstorage.BackendException; +import org.junit.BeforeClass; +import org.junit.experimental.categories.Category; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.keycolumnvalue.KeyColumnValueStoreManager; +import com.thinkaurelius.titan.diskstorage.log.KCVSLogTest; +import com.thinkaurelius.titan.testcategory.SerialTests; + +@Category(SerialTests.class) +public class AstyanaxLogTest extends KCVSLogTest { + + @BeforeClass + public static void startCassandra() { + CassandraStorageSetup.startCleanEmbedded(); + } + + @Override + public KeyColumnValueStoreManager openStorageManager() throws BackendException { + return new AstyanaxStoreManager(CassandraStorageSetup.getAstyanaxConfiguration(getClass().getSimpleName())); + } + +} diff --git a/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/astyanax/AstyanaxMultiWriteStoreTest.java b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/astyanax/AstyanaxMultiWriteStoreTest.java new file mode 100644 index 0000000..6de8238 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/astyanax/AstyanaxMultiWriteStoreTest.java @@ -0,0 +1,21 @@ +package com.thinkaurelius.titan.diskstorage.cassandra.astyanax; + +import com.thinkaurelius.titan.diskstorage.BackendException; +import org.junit.BeforeClass; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.MultiWriteKeyColumnValueStoreTest; +import com.thinkaurelius.titan.diskstorage.keycolumnvalue.KeyColumnValueStoreManager; + +public class AstyanaxMultiWriteStoreTest extends MultiWriteKeyColumnValueStoreTest { + + @BeforeClass + public static void startCassandra() { + CassandraStorageSetup.startCleanEmbedded(); + } + + @Override + public KeyColumnValueStoreManager openStorageManager() throws BackendException { + return new AstyanaxStoreManager(CassandraStorageSetup.getAstyanaxConfiguration(getClass().getSimpleName())); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/astyanax/AstyanaxSSLStoreTest.java b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/astyanax/AstyanaxSSLStoreTest.java new file mode 100644 index 0000000..48213b0 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/astyanax/AstyanaxSSLStoreTest.java @@ -0,0 +1,21 @@ +package com.thinkaurelius.titan.diskstorage.cassandra.astyanax; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration; +import com.thinkaurelius.titan.testcategory.CassandraSSLTests; +import org.junit.BeforeClass; +import org.junit.experimental.categories.Category; + +@Category({ CassandraSSLTests.class }) +public class AstyanaxSSLStoreTest extends AstyanaxStoreTest { + + @BeforeClass + public static void startCassandra() { + CassandraStorageSetup.startCleanEmbedded(); + } + + @Override + public ModifiableConfiguration getBaseStorageConfiguration() { + return CassandraStorageSetup.getAstyanaxSSLConfiguration(getClass().getSimpleName()); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/astyanax/AstyanaxStoreTest.java b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/astyanax/AstyanaxStoreTest.java new file mode 100644 index 0000000..3719ff6 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/astyanax/AstyanaxStoreTest.java @@ -0,0 +1,28 @@ +package com.thinkaurelius.titan.diskstorage.cassandra.astyanax; + +import com.thinkaurelius.titan.diskstorage.BackendException; +import com.thinkaurelius.titan.diskstorage.configuration.Configuration; +import com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration; +import org.junit.BeforeClass; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.cassandra.AbstractCassandraStoreTest; +import com.thinkaurelius.titan.diskstorage.cassandra.AbstractCassandraStoreManager; + +public class AstyanaxStoreTest extends AbstractCassandraStoreTest { + + @BeforeClass + public static void startCassandra() { + CassandraStorageSetup.startCleanEmbedded(); + } + + @Override + public ModifiableConfiguration getBaseStorageConfiguration() { + return CassandraStorageSetup.getAstyanaxConfiguration(getClass().getSimpleName()); + } + + @Override + public AbstractCassandraStoreManager openStorageManager(Configuration c) throws BackendException { + return new AstyanaxStoreManager(c); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/embedded/EmbeddedIDAuthorityTest.java b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/embedded/EmbeddedIDAuthorityTest.java new file mode 100644 index 0000000..252889a --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/embedded/EmbeddedIDAuthorityTest.java @@ -0,0 +1,19 @@ +package com.thinkaurelius.titan.diskstorage.cassandra.embedded; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.BackendException; +import com.thinkaurelius.titan.diskstorage.IDAuthorityTest; +import com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration; +import com.thinkaurelius.titan.diskstorage.keycolumnvalue.KeyColumnValueStoreManager; + +public class EmbeddedIDAuthorityTest extends IDAuthorityTest { + + public EmbeddedIDAuthorityTest(WriteConfiguration baseConfig) { + super(baseConfig); + } + + @Override + public KeyColumnValueStoreManager openStorageManager() throws BackendException { + return new CassandraEmbeddedStoreManager(CassandraStorageSetup.getEmbeddedConfiguration(getClass().getSimpleName())); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/embedded/EmbeddedLockStoreTest.java b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/embedded/EmbeddedLockStoreTest.java new file mode 100644 index 0000000..960b802 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/embedded/EmbeddedLockStoreTest.java @@ -0,0 +1,14 @@ +package com.thinkaurelius.titan.diskstorage.cassandra.embedded; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.BackendException; +import com.thinkaurelius.titan.diskstorage.LockKeyColumnValueStoreTest; +import com.thinkaurelius.titan.diskstorage.keycolumnvalue.KeyColumnValueStoreManager; + +public class EmbeddedLockStoreTest extends LockKeyColumnValueStoreTest { + + @Override + public KeyColumnValueStoreManager openStorageManager(int idx) throws BackendException { + return new CassandraEmbeddedStoreManager(CassandraStorageSetup.getEmbeddedConfiguration(getClass().getSimpleName())); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/embedded/EmbeddedLogTest.java b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/embedded/EmbeddedLogTest.java new file mode 100644 index 0000000..36436e7 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/embedded/EmbeddedLogTest.java @@ -0,0 +1,24 @@ +package com.thinkaurelius.titan.diskstorage.cassandra.embedded; + +import com.thinkaurelius.titan.diskstorage.BackendException; +import org.junit.BeforeClass; +import org.junit.experimental.categories.Category; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.keycolumnvalue.KeyColumnValueStoreManager; +import com.thinkaurelius.titan.diskstorage.log.KCVSLogTest; +import com.thinkaurelius.titan.testcategory.SerialTests; + +@Category(SerialTests.class) +public class EmbeddedLogTest extends KCVSLogTest { + + @BeforeClass + public static void startCassandra() { + CassandraStorageSetup.startCleanEmbedded(); + } + + @Override + public KeyColumnValueStoreManager openStorageManager() throws BackendException { + return new CassandraEmbeddedStoreManager(CassandraStorageSetup.getEmbeddedConfiguration(getClass().getSimpleName())); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/embedded/EmbeddedMultiWriteStoreTest.java b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/embedded/EmbeddedMultiWriteStoreTest.java new file mode 100644 index 0000000..d4608c9 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/embedded/EmbeddedMultiWriteStoreTest.java @@ -0,0 +1,15 @@ +package com.thinkaurelius.titan.diskstorage.cassandra.embedded; + +import com.thinkaurelius.titan.diskstorage.BackendException; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.MultiWriteKeyColumnValueStoreTest; +import com.thinkaurelius.titan.diskstorage.keycolumnvalue.KeyColumnValueStoreManager; + +public class EmbeddedMultiWriteStoreTest extends MultiWriteKeyColumnValueStoreTest { + + @Override + public KeyColumnValueStoreManager openStorageManager() throws BackendException { + return new CassandraEmbeddedStoreManager(CassandraStorageSetup.getEmbeddedConfiguration(getClass().getSimpleName())); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/embedded/EmbeddedStoreTest.java b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/embedded/EmbeddedStoreTest.java new file mode 100644 index 0000000..e2a9bc0 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/embedded/EmbeddedStoreTest.java @@ -0,0 +1,42 @@ +package com.thinkaurelius.titan.diskstorage.cassandra.embedded; + +import static org.junit.Assert.assertTrue; + +import com.thinkaurelius.titan.diskstorage.BackendException; +import com.thinkaurelius.titan.diskstorage.configuration.Configuration; +import com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.cassandra.AbstractCassandraStoreTest; +import com.thinkaurelius.titan.diskstorage.cassandra.AbstractCassandraStoreManager; +import com.thinkaurelius.titan.diskstorage.keycolumnvalue.StoreFeatures; +import com.thinkaurelius.titan.testcategory.OrderedKeyStoreTests; + +public class EmbeddedStoreTest extends AbstractCassandraStoreTest { + + @BeforeClass + public static void startCassandra() { + CassandraStorageSetup.startCleanEmbedded(); + } + + @Override + public ModifiableConfiguration getBaseStorageConfiguration() { + return CassandraStorageSetup.getEmbeddedConfiguration(getClass().getSimpleName()); + } + + @Override + public AbstractCassandraStoreManager openStorageManager(Configuration c) throws BackendException { + return new CassandraEmbeddedStoreManager(c); + } + + @Test + @Category({ OrderedKeyStoreTests.class }) + public void testConfiguration() { + StoreFeatures features = manager.getFeatures(); + assertTrue(features.isKeyOrdered()); + assertTrue(features.hasLocalKeyPartition()); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/thrift/ThriftDistributedStoreManagerTest.java b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/thrift/ThriftDistributedStoreManagerTest.java new file mode 100644 index 0000000..9e16585 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/thrift/ThriftDistributedStoreManagerTest.java @@ -0,0 +1,30 @@ +package com.thinkaurelius.titan.diskstorage.cassandra.thrift; + +import com.thinkaurelius.titan.diskstorage.BackendException; +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.DistributedStoreManagerTest; + +public class ThriftDistributedStoreManagerTest extends DistributedStoreManagerTest<CassandraThriftStoreManager> { + + @BeforeClass + public static void startCassandra() { + CassandraStorageSetup.startCleanEmbedded(); + } + + @Before + public void setUp() throws BackendException { + manager = new CassandraThriftStoreManager( + CassandraStorageSetup.getCassandraThriftConfiguration(this.getClass().getSimpleName())); + store = manager.openDatabase("distributedcf"); + } + + @After + public void tearDown() throws BackendException { + if (null != manager) + manager.close(); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/thrift/ThriftIDAuthorityTest.java b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/thrift/ThriftIDAuthorityTest.java new file mode 100644 index 0000000..9e1881a --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/thrift/ThriftIDAuthorityTest.java @@ -0,0 +1,25 @@ +package com.thinkaurelius.titan.diskstorage.cassandra.thrift; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.BackendException; +import com.thinkaurelius.titan.diskstorage.IDAuthorityTest; +import com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration; +import com.thinkaurelius.titan.diskstorage.keycolumnvalue.KeyColumnValueStoreManager; +import org.junit.BeforeClass; + +public class ThriftIDAuthorityTest extends IDAuthorityTest { + + public ThriftIDAuthorityTest(WriteConfiguration baseConfig) { + super(baseConfig); + } + + @BeforeClass + public static void startCassandra() { + CassandraStorageSetup.startCleanEmbedded(); + } + + @Override + public KeyColumnValueStoreManager openStorageManager() throws BackendException { + return new CassandraThriftStoreManager(CassandraStorageSetup.getCassandraThriftConfiguration(this.getClass().getSimpleName())); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/thrift/ThriftLockStoreTest.java b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/thrift/ThriftLockStoreTest.java new file mode 100644 index 0000000..223d399 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/thrift/ThriftLockStoreTest.java @@ -0,0 +1,21 @@ +package com.thinkaurelius.titan.diskstorage.cassandra.thrift; + +import com.thinkaurelius.titan.diskstorage.BackendException; +import org.junit.BeforeClass; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.LockKeyColumnValueStoreTest; +import com.thinkaurelius.titan.diskstorage.keycolumnvalue.KeyColumnValueStoreManager; + +public class ThriftLockStoreTest extends LockKeyColumnValueStoreTest { + + @BeforeClass + public static void startCassandra() { + CassandraStorageSetup.startCleanEmbedded(); + } + + @Override + public KeyColumnValueStoreManager openStorageManager(int idx) throws BackendException { + return new CassandraThriftStoreManager(CassandraStorageSetup.getCassandraThriftConfiguration(this.getClass().getSimpleName())); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/thrift/ThriftLogTest.java b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/thrift/ThriftLogTest.java new file mode 100644 index 0000000..7123b5f --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/thrift/ThriftLogTest.java @@ -0,0 +1,25 @@ +package com.thinkaurelius.titan.diskstorage.cassandra.thrift; + +import com.thinkaurelius.titan.diskstorage.BackendException; +import org.junit.BeforeClass; +import org.junit.experimental.categories.Category; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.keycolumnvalue.KeyColumnValueStoreManager; +import com.thinkaurelius.titan.diskstorage.log.KCVSLogTest; +import com.thinkaurelius.titan.testcategory.SerialTests; + +@Category(SerialTests.class) +public class ThriftLogTest extends KCVSLogTest { + + @BeforeClass + public static void startCassandra() { + CassandraStorageSetup.startCleanEmbedded(); + } + + @Override + public KeyColumnValueStoreManager openStorageManager() throws BackendException { + return new CassandraThriftStoreManager(CassandraStorageSetup.getCassandraThriftConfiguration(this.getClass().getSimpleName())); + } + +} diff --git a/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/thrift/ThriftMultiWriteStoreTest.java b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/thrift/ThriftMultiWriteStoreTest.java new file mode 100644 index 0000000..cbfce61 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/thrift/ThriftMultiWriteStoreTest.java @@ -0,0 +1,21 @@ +package com.thinkaurelius.titan.diskstorage.cassandra.thrift; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.BackendException; +import com.thinkaurelius.titan.diskstorage.MultiWriteKeyColumnValueStoreTest; +import com.thinkaurelius.titan.diskstorage.keycolumnvalue.KeyColumnValueStoreManager; + +import org.junit.BeforeClass; + +public class ThriftMultiWriteStoreTest extends MultiWriteKeyColumnValueStoreTest { + + @BeforeClass + public static void startCassandra() { + CassandraStorageSetup.startCleanEmbedded(); + } + + @Override + public KeyColumnValueStoreManager openStorageManager() throws BackendException { + return new CassandraThriftStoreManager(CassandraStorageSetup.getCassandraThriftConfiguration(this.getClass().getSimpleName())); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/thrift/ThriftSSLStoreTest.java b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/thrift/ThriftSSLStoreTest.java new file mode 100644 index 0000000..ffc93b5 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/thrift/ThriftSSLStoreTest.java @@ -0,0 +1,22 @@ +package com.thinkaurelius.titan.diskstorage.cassandra.thrift; + + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration; +import com.thinkaurelius.titan.testcategory.CassandraSSLTests; +import org.junit.BeforeClass; +import org.junit.experimental.categories.Category; + +@Category({ CassandraSSLTests.class }) +public class ThriftSSLStoreTest extends ThriftStoreTest { + + @BeforeClass + public static void startCassandra() { + CassandraStorageSetup.startCleanEmbedded(); + } + + @Override + public ModifiableConfiguration getBaseStorageConfiguration() { + return CassandraStorageSetup.getCassandraThriftSSLConfiguration(this.getClass().getSimpleName()); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/thrift/ThriftStoreTest.java b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/thrift/ThriftStoreTest.java new file mode 100644 index 0000000..8254530 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/diskstorage/cassandra/thrift/ThriftStoreTest.java @@ -0,0 +1,28 @@ +package com.thinkaurelius.titan.diskstorage.cassandra.thrift; + +import com.thinkaurelius.titan.diskstorage.BackendException; +import com.thinkaurelius.titan.diskstorage.configuration.Configuration; +import com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration; +import org.junit.BeforeClass; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.cassandra.AbstractCassandraStoreTest; +import com.thinkaurelius.titan.diskstorage.cassandra.AbstractCassandraStoreManager; + +public class ThriftStoreTest extends AbstractCassandraStoreTest { + + @BeforeClass + public static void startCassandra() { + CassandraStorageSetup.startCleanEmbedded(); + } + + @Override + public ModifiableConfiguration getBaseStorageConfiguration() { + return CassandraStorageSetup.getCassandraThriftConfiguration(this.getClass().getSimpleName()); + } + + @Override + public AbstractCassandraStoreManager openStorageManager(Configuration c) throws BackendException { + return new CassandraThriftStoreManager(c); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/graphdb/CassandraGraphTest.java b/src/test/java/com/thinkaurelius/titan/graphdb/CassandraGraphTest.java new file mode 100644 index 0000000..0aab994 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/graphdb/CassandraGraphTest.java @@ -0,0 +1,95 @@ +package com.thinkaurelius.titan.graphdb; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.core.TitanFactory; +import com.thinkaurelius.titan.diskstorage.cassandra.AbstractCassandraStoreManager; +import com.thinkaurelius.titan.diskstorage.configuration.ConfigElement; +import com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration; +import com.thinkaurelius.titan.graphdb.database.StandardTitanGraph; +import com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx; +import org.junit.BeforeClass; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static com.thinkaurelius.titan.diskstorage.cassandra.AbstractCassandraStoreManager.*; + +/** + * @author Joshua Shinavier (http://fortytwo.net) + */ +public abstract class CassandraGraphTest extends TitanGraphTest { + + @BeforeClass + public static void startCassandra() { + CassandraStorageSetup.startCleanEmbedded(); + } + + @Override + protected boolean isLockingOptimistic() { + return true; + } + + @Test + public void testHasTTL() throws Exception { + assertTrue(features.hasCellTTL()); + } + + @Test + public void testGraphConfigUsedByThreadBoundTx() { + close(); + WriteConfiguration wc = getConfiguration(); + wc.set(ConfigElement.getPath(CASSANDRA_READ_CONSISTENCY), "ALL"); + wc.set(ConfigElement.getPath(CASSANDRA_WRITE_CONSISTENCY), "LOCAL_QUORUM"); + + graph = (StandardTitanGraph) TitanFactory.open(wc); + + StandardTitanTx tx = (StandardTitanTx)graph.getCurrentThreadTx(); + assertEquals("ALL", + tx.getTxHandle().getBaseTransactionConfig().getCustomOptions() + .get(AbstractCassandraStoreManager.CASSANDRA_READ_CONSISTENCY)); + assertEquals("LOCAL_QUORUM", + tx.getTxHandle().getBaseTransactionConfig().getCustomOptions() + .get(AbstractCassandraStoreManager.CASSANDRA_WRITE_CONSISTENCY)); + } + + @Test + public void testGraphConfigUsedByTx() { + close(); + WriteConfiguration wc = getConfiguration(); + wc.set(ConfigElement.getPath(CASSANDRA_READ_CONSISTENCY), "TWO"); + wc.set(ConfigElement.getPath(CASSANDRA_WRITE_CONSISTENCY), "THREE"); + + graph = (StandardTitanGraph) TitanFactory.open(wc); + + StandardTitanTx tx = (StandardTitanTx)graph.newTransaction(); + assertEquals("TWO", + tx.getTxHandle().getBaseTransactionConfig().getCustomOptions() + .get(AbstractCassandraStoreManager.CASSANDRA_READ_CONSISTENCY)); + assertEquals("THREE", + tx.getTxHandle().getBaseTransactionConfig().getCustomOptions() + .get(AbstractCassandraStoreManager.CASSANDRA_WRITE_CONSISTENCY)); + tx.rollback(); + } + + @Test + public void testCustomConfigUsedByTx() { + close(); + WriteConfiguration wc = getConfiguration(); + wc.set(ConfigElement.getPath(CASSANDRA_READ_CONSISTENCY), "ALL"); + wc.set(ConfigElement.getPath(CASSANDRA_WRITE_CONSISTENCY), "ALL"); + + graph = (StandardTitanGraph) TitanFactory.open(wc); + + StandardTitanTx tx = (StandardTitanTx)graph.buildTransaction() + .customOption(ConfigElement.getPath(CASSANDRA_READ_CONSISTENCY), "ONE") + .customOption(ConfigElement.getPath(CASSANDRA_WRITE_CONSISTENCY), "TWO").start(); + + assertEquals("ONE", + tx.getTxHandle().getBaseTransactionConfig().getCustomOptions() + .get(AbstractCassandraStoreManager.CASSANDRA_READ_CONSISTENCY)); + assertEquals("TWO", + tx.getTxHandle().getBaseTransactionConfig().getCustomOptions() + .get(AbstractCassandraStoreManager.CASSANDRA_WRITE_CONSISTENCY)); + tx.rollback(); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/graphdb/astyanax/AstyanaxGraphConcurrentTest.java b/src/test/java/com/thinkaurelius/titan/graphdb/astyanax/AstyanaxGraphConcurrentTest.java new file mode 100644 index 0000000..3a3c0b8 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/graphdb/astyanax/AstyanaxGraphConcurrentTest.java @@ -0,0 +1,24 @@ +package com.thinkaurelius.titan.graphdb.astyanax; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration; +import com.thinkaurelius.titan.graphdb.TitanGraphConcurrentTest; +import com.thinkaurelius.titan.testcategory.PerformanceTests; + +import org.junit.BeforeClass; +import org.junit.experimental.categories.Category; + +@Category({PerformanceTests.class}) +public class AstyanaxGraphConcurrentTest extends TitanGraphConcurrentTest { + + @BeforeClass + public static void startCassandra() { + CassandraStorageSetup.startCleanEmbedded(); + } + + + @Override + public WriteConfiguration getConfiguration() { + return CassandraStorageSetup.getAstyanaxGraphConfiguration(getClass().getSimpleName()); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/graphdb/astyanax/AstyanaxGraphPerformanceMemoryTest.java b/src/test/java/com/thinkaurelius/titan/graphdb/astyanax/AstyanaxGraphPerformanceMemoryTest.java new file mode 100644 index 0000000..c20e837 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/graphdb/astyanax/AstyanaxGraphPerformanceMemoryTest.java @@ -0,0 +1,21 @@ +package com.thinkaurelius.titan.graphdb.astyanax; + +import com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration; +import org.junit.BeforeClass; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.graphdb.TitanGraphPerformanceMemoryTest; + +public class AstyanaxGraphPerformanceMemoryTest extends TitanGraphPerformanceMemoryTest { + + @BeforeClass + public static void startCassandra() { + CassandraStorageSetup.startCleanEmbedded(); + } + + @Override + public WriteConfiguration getConfiguration() { + return CassandraStorageSetup.getAstyanaxGraphConfiguration(getClass().getSimpleName()); + } + +} diff --git a/src/test/java/com/thinkaurelius/titan/graphdb/astyanax/AstyanaxGraphTest.java b/src/test/java/com/thinkaurelius/titan/graphdb/astyanax/AstyanaxGraphTest.java new file mode 100644 index 0000000..70f595e --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/graphdb/astyanax/AstyanaxGraphTest.java @@ -0,0 +1,13 @@ +package com.thinkaurelius.titan.graphdb.astyanax; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration; +import com.thinkaurelius.titan.graphdb.CassandraGraphTest; + +public class AstyanaxGraphTest extends CassandraGraphTest { + + @Override + public WriteConfiguration getConfiguration() { + return CassandraStorageSetup.getAstyanaxGraphConfiguration(getClass().getSimpleName()); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/graphdb/astyanax/AstyanaxPartitionGraphTest.java b/src/test/java/com/thinkaurelius/titan/graphdb/astyanax/AstyanaxPartitionGraphTest.java new file mode 100644 index 0000000..c8fb206 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/graphdb/astyanax/AstyanaxPartitionGraphTest.java @@ -0,0 +1,21 @@ +package com.thinkaurelius.titan.graphdb.astyanax; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration; +import com.thinkaurelius.titan.graphdb.TitanGraphTest; +import com.thinkaurelius.titan.graphdb.TitanPartitionGraphTest; +import org.junit.BeforeClass; + +public class AstyanaxPartitionGraphTest extends TitanPartitionGraphTest { + + @BeforeClass + public static void startCassandra() { + CassandraStorageSetup.startCleanEmbedded(); + } + + @Override + public WriteConfiguration getBaseConfiguration() { + return CassandraStorageSetup.getAstyanaxGraphConfiguration(getClass().getSimpleName()); + } + +} diff --git a/src/test/java/com/thinkaurelius/titan/graphdb/embedded/EmbeddedEventualGraphTest.java b/src/test/java/com/thinkaurelius/titan/graphdb/embedded/EmbeddedEventualGraphTest.java new file mode 100644 index 0000000..4a4fc0f --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/graphdb/embedded/EmbeddedEventualGraphTest.java @@ -0,0 +1,21 @@ +package com.thinkaurelius.titan.graphdb.embedded; + +import org.junit.BeforeClass; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration; +import com.thinkaurelius.titan.graphdb.TitanEventualGraphTest; + +public class EmbeddedEventualGraphTest extends TitanEventualGraphTest { + + @BeforeClass + public static void startEmbeddedCassandra() { + CassandraStorageSetup.startCleanEmbedded(); + } + + @Override + public WriteConfiguration getConfiguration() { + return CassandraStorageSetup.getEmbeddedCassandraPartitionGraphConfiguration(getClass().getSimpleName()); + } + +} diff --git a/src/test/java/com/thinkaurelius/titan/graphdb/embedded/EmbeddedGraphConcurrentTest.java b/src/test/java/com/thinkaurelius/titan/graphdb/embedded/EmbeddedGraphConcurrentTest.java new file mode 100644 index 0000000..35cc582 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/graphdb/embedded/EmbeddedGraphConcurrentTest.java @@ -0,0 +1,28 @@ +package com.thinkaurelius.titan.graphdb.embedded; + +import org.junit.BeforeClass; +import org.junit.experimental.categories.Category; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration; +import com.thinkaurelius.titan.graphdb.TitanGraphConcurrentTest; +import com.thinkaurelius.titan.testcategory.PerformanceTests; + +/** + * @author Matthias Broecheler (me@matthiasb.com) + */ + +@Category({PerformanceTests.class}) +public class EmbeddedGraphConcurrentTest extends TitanGraphConcurrentTest { + + @BeforeClass + public static void startCassandra() { + CassandraStorageSetup.startCleanEmbedded(); + } + + @Override + public WriteConfiguration getConfiguration() { + return CassandraStorageSetup.getEmbeddedCassandraPartitionGraphConfiguration(getClass().getSimpleName()); + } + +} diff --git a/src/test/java/com/thinkaurelius/titan/graphdb/embedded/EmbeddedGraphMemoryPerformanceTest.java b/src/test/java/com/thinkaurelius/titan/graphdb/embedded/EmbeddedGraphMemoryPerformanceTest.java new file mode 100644 index 0000000..cd9d75d --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/graphdb/embedded/EmbeddedGraphMemoryPerformanceTest.java @@ -0,0 +1,25 @@ +package com.thinkaurelius.titan.graphdb.embedded; + +import org.junit.BeforeClass; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration; +import com.thinkaurelius.titan.graphdb.TitanGraphPerformanceMemoryTest; + +/** + * @author Matthias Broecheler (me@matthiasb.com) + */ + +public class EmbeddedGraphMemoryPerformanceTest extends TitanGraphPerformanceMemoryTest { + + @BeforeClass + public static void startCassandra() { + CassandraStorageSetup.startCleanEmbedded(); + } + + @Override + public WriteConfiguration getConfiguration() { + return CassandraStorageSetup.getEmbeddedCassandraPartitionGraphConfiguration(getClass().getSimpleName()); + } + +} diff --git a/src/test/java/com/thinkaurelius/titan/graphdb/embedded/EmbeddedGraphTest.java b/src/test/java/com/thinkaurelius/titan/graphdb/embedded/EmbeddedGraphTest.java new file mode 100644 index 0000000..a602e71 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/graphdb/embedded/EmbeddedGraphTest.java @@ -0,0 +1,13 @@ +package com.thinkaurelius.titan.graphdb.embedded; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration; +import com.thinkaurelius.titan.graphdb.CassandraGraphTest; + +public class EmbeddedGraphTest extends CassandraGraphTest { + + @Override + public WriteConfiguration getConfiguration() { + return CassandraStorageSetup.getEmbeddedCassandraPartitionGraphConfiguration(getClass().getSimpleName()); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/graphdb/embedded/EmbeddedPartitionGraphTest.java b/src/test/java/com/thinkaurelius/titan/graphdb/embedded/EmbeddedPartitionGraphTest.java new file mode 100644 index 0000000..4851b3f --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/graphdb/embedded/EmbeddedPartitionGraphTest.java @@ -0,0 +1,21 @@ +package com.thinkaurelius.titan.graphdb.embedded; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration; +import com.thinkaurelius.titan.graphdb.TitanEventualGraphTest; +import com.thinkaurelius.titan.graphdb.TitanPartitionGraphTest; +import org.junit.BeforeClass; + +public class EmbeddedPartitionGraphTest extends TitanPartitionGraphTest { + + @BeforeClass + public static void startEmbeddedCassandra() { + CassandraStorageSetup.startCleanEmbedded(); + } + + @Override + public WriteConfiguration getBaseConfiguration() { + return CassandraStorageSetup.getEmbeddedCassandraPartitionGraphConfiguration(getClass().getSimpleName()); + } + +} diff --git a/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftEventualGraphTest.java b/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftEventualGraphTest.java new file mode 100644 index 0000000..8fe1362 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftEventualGraphTest.java @@ -0,0 +1,21 @@ +package com.thinkaurelius.titan.graphdb.thrift; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration; +import com.thinkaurelius.titan.graphdb.TitanEventualGraphTest; +import com.thinkaurelius.titan.graphdb.TitanGraphTest; +import org.junit.BeforeClass; +import org.junit.experimental.categories.Category; + +public class ThriftEventualGraphTest extends TitanEventualGraphTest { + + @Override + public WriteConfiguration getConfiguration() { + return CassandraStorageSetup.getCassandraThriftGraphConfiguration(getClass().getSimpleName()); + } + + @BeforeClass + public static void beforeClass() { + CassandraStorageSetup.startCleanEmbedded(); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftGraphCacheTest.java b/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftGraphCacheTest.java new file mode 100644 index 0000000..17848d4 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftGraphCacheTest.java @@ -0,0 +1,28 @@ +package com.thinkaurelius.titan.graphdb.thrift; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.StorageSetup; +import com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration; +import com.thinkaurelius.titan.graphdb.TitanGraphTest; +import org.junit.BeforeClass; + +public class ThriftGraphCacheTest extends TitanGraphTest { + + @Override + public WriteConfiguration getConfiguration() { + return StorageSetup.addPermanentCache(CassandraStorageSetup.getCassandraThriftConfiguration(getClass().getSimpleName())); + } + + + @BeforeClass + public static void beforeClass() { + CassandraStorageSetup.startCleanEmbedded(); + } + + + + @Override + protected boolean isLockingOptimistic() { + return true; + } +} diff --git a/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftGraphConcurrentTest.java b/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftGraphConcurrentTest.java new file mode 100644 index 0000000..f1d4fe4 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftGraphConcurrentTest.java @@ -0,0 +1,24 @@ +package com.thinkaurelius.titan.graphdb.thrift; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration; +import com.thinkaurelius.titan.graphdb.TitanGraphConcurrentTest; +import com.thinkaurelius.titan.testcategory.PerformanceTests; + +import org.junit.BeforeClass; +import org.junit.experimental.categories.Category; + +@Category({PerformanceTests.class}) +public class ThriftGraphConcurrentTest extends TitanGraphConcurrentTest { + + @Override + public WriteConfiguration getConfiguration() { + return CassandraStorageSetup.getCassandraThriftGraphConfiguration(getClass().getSimpleName()); + } + + + @BeforeClass + public static void beforeClass() { + CassandraStorageSetup.startCleanEmbedded(); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftGraphIterativeTest.java b/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftGraphIterativeTest.java new file mode 100644 index 0000000..dd45c42 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftGraphIterativeTest.java @@ -0,0 +1,30 @@ +package com.thinkaurelius.titan.graphdb.thrift; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.BackendException; +import com.thinkaurelius.titan.diskstorage.cassandra.thrift.CassandraThriftStoreManager; +import com.thinkaurelius.titan.diskstorage.configuration.BasicConfiguration; +import com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration; +import com.thinkaurelius.titan.diskstorage.keycolumnvalue.KeyColumnValueStoreManager; +import com.thinkaurelius.titan.graphdb.TitanGraphIterativeBenchmark; +import com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration; +import org.junit.BeforeClass; + +public class ThriftGraphIterativeTest extends TitanGraphIterativeBenchmark { + + @Override + public WriteConfiguration getConfiguration() { + return CassandraStorageSetup.getCassandraThriftGraphConfiguration(getClass().getSimpleName()); + } + + @Override + public KeyColumnValueStoreManager openStorageManager() throws BackendException { + return new CassandraThriftStoreManager(new BasicConfiguration(GraphDatabaseConfiguration.ROOT_NS,getConfiguration(), BasicConfiguration.Restriction.NONE)); + } + + + @BeforeClass + public static void beforeClass() { + CassandraStorageSetup.startCleanEmbedded(); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftGraphPerformanceMemoryTest.java b/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftGraphPerformanceMemoryTest.java new file mode 100644 index 0000000..893b6c8 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftGraphPerformanceMemoryTest.java @@ -0,0 +1,22 @@ +package com.thinkaurelius.titan.graphdb.thrift; + +import com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration; +import org.apache.commons.configuration.Configuration; +import org.junit.BeforeClass; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.graphdb.TitanGraphPerformanceMemoryTest; + +public class ThriftGraphPerformanceMemoryTest extends TitanGraphPerformanceMemoryTest { + + @Override + public WriteConfiguration getConfiguration() { + return CassandraStorageSetup.getCassandraThriftGraphConfiguration(getClass().getSimpleName()); + } + + + @BeforeClass + public static void beforeClass() { + CassandraStorageSetup.startCleanEmbedded(); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftGraphSpeedTest.java b/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftGraphSpeedTest.java new file mode 100644 index 0000000..6f01f0b --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftGraphSpeedTest.java @@ -0,0 +1,56 @@ +package com.thinkaurelius.titan.graphdb.thrift; + +import com.thinkaurelius.titan.diskstorage.BackendException; +import com.thinkaurelius.titan.graphdb.SpeedTestSchema; +import org.junit.BeforeClass; +import org.junit.experimental.categories.Category; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.core.TitanFactory; +import com.thinkaurelius.titan.graphdb.TitanGraphSpeedTest; +import com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration; +import com.thinkaurelius.titan.graphdb.database.StandardTitanGraph; +import com.thinkaurelius.titan.testcategory.PerformanceTests; + +@Category({PerformanceTests.class}) +public class ThriftGraphSpeedTest extends TitanGraphSpeedTest { + + private static StandardTitanGraph graph; + private static SpeedTestSchema schema; + + private static final Logger log = + LoggerFactory.getLogger(ThriftGraphSpeedTest.class); + + public ThriftGraphSpeedTest() throws BackendException { + super(CassandraStorageSetup.getCassandraThriftGraphConfiguration(ThriftGraphSpeedTest.class.getSimpleName())); + } + + @BeforeClass + public static void beforeClass() { + CassandraStorageSetup.startCleanEmbedded(); + } + + @Override + protected StandardTitanGraph getGraph() throws BackendException { + + + if (null == graph) { + GraphDatabaseConfiguration graphconfig = new GraphDatabaseConfiguration(conf); + graphconfig.getBackend().clearStorage(); + log.debug("Cleared backend storage"); + graph = (StandardTitanGraph)TitanFactory.open(conf); + initializeGraph(graph); + } + return graph; + } + + @Override + protected SpeedTestSchema getSchema() { + if (null == schema) { + schema = SpeedTestSchema.get(); + } + return schema; + } +}
\ No newline at end of file diff --git a/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftGraphTest.java b/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftGraphTest.java new file mode 100644 index 0000000..e9a9ac9 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftGraphTest.java @@ -0,0 +1,13 @@ +package com.thinkaurelius.titan.graphdb.thrift; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration; +import com.thinkaurelius.titan.graphdb.CassandraGraphTest; + +public class ThriftGraphTest extends CassandraGraphTest { + + @Override + public WriteConfiguration getConfiguration() { + return CassandraStorageSetup.getCassandraThriftGraphConfiguration(getClass().getSimpleName()); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftOLAPTest.java b/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftOLAPTest.java new file mode 100644 index 0000000..8679da9 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftOLAPTest.java @@ -0,0 +1,20 @@ +package com.thinkaurelius.titan.graphdb.thrift; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration; +import com.thinkaurelius.titan.olap.OLAPTest; +import org.junit.BeforeClass; + +public class ThriftOLAPTest extends OLAPTest { + + @Override + public WriteConfiguration getConfiguration() { + return CassandraStorageSetup.getCassandraThriftGraphConfiguration(getClass().getSimpleName()); + } + + + @BeforeClass + public static void beforeClass() { + CassandraStorageSetup.startCleanEmbedded(); + } +} diff --git a/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftOperationCountingTest.java b/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftOperationCountingTest.java new file mode 100644 index 0000000..9bae61d --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftOperationCountingTest.java @@ -0,0 +1,25 @@ +package com.thinkaurelius.titan.graphdb.thrift; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration; +import com.thinkaurelius.titan.graphdb.TitanOperationCountingTest; +import org.junit.BeforeClass; + +public class ThriftOperationCountingTest extends TitanOperationCountingTest { + + @BeforeClass + public static void beforeClass() { + CassandraStorageSetup.startCleanEmbedded(); + } + + @Override + public WriteConfiguration getBaseConfiguration() { + return CassandraStorageSetup.getCassandraThriftGraphConfiguration(getClass().getSimpleName()); + } + + @Override + public boolean storeUsesConsistentKeyLocker() { + return true; + } + +} diff --git a/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftPartitionGraphTest.java b/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftPartitionGraphTest.java new file mode 100644 index 0000000..728e338 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/graphdb/thrift/ThriftPartitionGraphTest.java @@ -0,0 +1,21 @@ +package com.thinkaurelius.titan.graphdb.thrift; + +import com.thinkaurelius.titan.CassandraStorageSetup; +import com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration; +import com.thinkaurelius.titan.graphdb.TitanOperationCountingTest; +import com.thinkaurelius.titan.graphdb.TitanPartitionGraphTest; +import org.junit.BeforeClass; + +public class ThriftPartitionGraphTest extends TitanPartitionGraphTest { + + @BeforeClass + public static void beforeClass() { + CassandraStorageSetup.startCleanEmbedded(); + } + + @Override + public WriteConfiguration getBaseConfiguration() { + return CassandraStorageSetup.getCassandraThriftGraphConfiguration(getClass().getSimpleName()); + } + +} diff --git a/src/test/java/com/thinkaurelius/titan/testcategory/CassandraSSLTests.java b/src/test/java/com/thinkaurelius/titan/testcategory/CassandraSSLTests.java new file mode 100644 index 0000000..d1e3dd8 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/testcategory/CassandraSSLTests.java @@ -0,0 +1,10 @@ +package com.thinkaurelius.titan.testcategory; + +/** + * This is a JUnit category for tests that need to run against Cassandra + * configured for SSL-based client authentication. + * + * If you rename or move this class, then you must also update mentions of it in + * the Cassandra module's pom.xml. + */ +public interface CassandraSSLTests { } diff --git a/src/test/java/com/thinkaurelius/titan/testcategory/StandaloneTests.java b/src/test/java/com/thinkaurelius/titan/testcategory/StandaloneTests.java new file mode 100644 index 0000000..722c314 --- /dev/null +++ b/src/test/java/com/thinkaurelius/titan/testcategory/StandaloneTests.java @@ -0,0 +1,9 @@ +package com.thinkaurelius.titan.testcategory; + +/** + * This is a JUnit category for tests that don't need a Cassandra server. + * + * If you rename or move this class, then you must also update mentions of it in + * the Cassandra module's pom.xml. + */ +public class StandaloneTests { } |