Cassandra.createKeyspace(keyspace, function(err, created) {
                assert.ok(!err);
                assert.ok(created);

                // Check that the keyspace exists
                Cassandra.keyspaceExists(keyspace, function(err, exists) {
                    assert.ok(!err);
                    assert.ok(exists);

                    // Check that a non-existing keyspace doesn't exist
                    var nonExistingKeyspace = TestsUtil.generateTestCassandraName();
                    Cassandra.keyspaceExists(nonExistingKeyspace, function(err, exists) {
                        assert.ok(!err);
                        assert.ok(!exists);

                        // Drop the created keyspace
                        Cassandra.dropKeyspace(keyspace, function(err, dropped) {
                            assert.ok(!err);
                            assert.ok(dropped);

                            // Check that a non-existing keyspace can't be dropped
                            Cassandra.dropKeyspace(keyspace, function(err, dropped) {
                                assert.ok(err);
                                callback();
                            });
                        });
                    });
                });
            });
Exemplo n.º 2
0
            Cassandra.createKeyspace(keyspace, function(err, created) {
                assert.ok(!err);
                assert.ok(created);

                // Check that the keyspace exists
                Cassandra.keyspaceExists(keyspace, function(err, exists) {
                    assert.ok(!err);
                    assert.ok(exists);

                    // Check that a non-existing keyspace doesn't exist
                    var nonExistingKeyspace = 'keyspacetest' + Math.floor(Math.random() * 100000000);
                    Cassandra.keyspaceExists(nonExistingKeyspace, function(err, exists) {
                        assert.ok(!err);
                        assert.ok(!exists);

                        // Drop the created keyspace
                        Cassandra.dropKeyspace(keyspace, function(err, dropped) {
                            assert.ok(!err);
                            assert.ok(dropped);

                            // Check that a non-existing keyspace can't be dropped
                            Cassandra.dropKeyspace(keyspace, function(err, dropped) {
                                assert.ok(err);
                                callback();
                            });
                        });
                    });
                });
            });