modules/common/cassandra-auth/src/main/java/org/rhq/cassandra/auth/SimpleAuthenticator.java
| 147 ++++++++++
modules/common/cassandra-auth/src/main/java/org/rhq/cassandra/auth/SimpleAuthority.java
| 145 +++++++++
modules/common/cassandra-common/pom.xml
| 4
modules/common/cassandra-common/src/main/java/org/rhq/cassandra/BootstrapDeployer.java
| 3
modules/common/cassandra-common/src/main/resources/access.properties
| 46 +++
modules/common/cassandra-common/src/main/resources/cassandra-1.2.0-beta2/conf/cassandra-env.sh
| 2
modules/common/cassandra-common/src/main/resources/cassandra-1.2.0-beta2/conf/cassandra.yaml
| 4
modules/common/cassandra-common/src/main/resources/cassandra.properties
| 16 +
modules/common/cassandra-common/src/main/resources/deploy.xml
| 23 +
modules/common/cassandra-common/src/main/resources/passwd.properties
| 23 +
modules/common/pom.xml
| 1
modules/enterprise/server/server-metrics/src/test/java/org/rhq/server/metrics/CassandraIntegrationTest.java
| 12
modules/enterprise/server/server-metrics/src/test/java/org/rhq/server/metrics/MetricsDAOTest.java
| 11
pom.xml
| 2
14 files changed, 425 insertions(+), 14 deletions(-)
New commits:
commit 57c1b62d95aab2013637b2b871f52d091c2a7f7b
Author: John Sanda <jsanda(a)redhat.com>
Date: Mon Dec 3 15:58:19 2012 -0500
adding initial support for authentication and authorization
diff --git
a/modules/common/cassandra-auth/src/main/java/org/rhq/cassandra/auth/SimpleAuthenticator.java
b/modules/common/cassandra-auth/src/main/java/org/rhq/cassandra/auth/SimpleAuthenticator.java
new file mode 100644
index 0000000..f3a7031
--- /dev/null
+++
b/modules/common/cassandra-auth/src/main/java/org/rhq/cassandra/auth/SimpleAuthenticator.java
@@ -0,0 +1,147 @@
+/*
+ *
+ * * RHQ Management Platform
+ * * Copyright (C) 2005-2012 Red Hat, Inc.
+ * * All rights reserved.
+ * *
+ * * This program is free software; you can redistribute it and/or modify
+ * * it under the terms of the GNU General Public License, version 2, as
+ * * published by the Free Software Foundation, and/or the GNU Lesser
+ * * General Public License, version 2.1, also as published by the Free
+ * * Software Foundation.
+ * *
+ * * This program is distributed in the hope that it will be useful,
+ * * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * * GNU General Public License and the GNU Lesser General Public License
+ * * for more details.
+ * *
+ * * You should have received a copy of the GNU General Public License
+ * * and the GNU Lesser General Public License along with this program;
+ * * if not, write to the Free Software Foundation, Inc.,
+ * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+package org.rhq.cassandra.auth;
+
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.MessageDigest;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.cassandra.auth.AuthenticatedUser;
+import org.apache.cassandra.auth.IAuthenticator;
+import org.apache.cassandra.exceptions.ConfigurationException;
+import org.apache.cassandra.io.util.FileUtils;
+import org.apache.cassandra.thrift.AuthenticationException;
+import org.apache.cassandra.utils.FBUtilities;
+import org.apache.cassandra.utils.Hex;
+
+/**
+ * @author John Sanda
+ */
+public class SimpleAuthenticator implements IAuthenticator {
+ public final static String PASSWD_FILENAME_PROPERTY = "passwd.properties";
+ public final static String PMODE_PROPERTY = "passwd.mode";
+ public static final String USERNAME_KEY = "username";
+ public static final String PASSWORD_KEY = "password";
+
+ public enum PasswordMode { PLAIN, MD5 }
+
+ public AuthenticatedUser defaultUser() {
+ // users must log in
+ return null;
+ }
+
+ public AuthenticatedUser authenticate(Map<? extends CharSequence, ? extends
CharSequence> credentials) throws
+ AuthenticationException {
+ String pmode_plain = System.getProperty(PMODE_PROPERTY);
+ PasswordMode mode = PasswordMode.PLAIN;
+
+ if (pmode_plain != null) {
+ try {
+ mode = PasswordMode.valueOf(pmode_plain);
+ } catch (Exception e) {
+ // this is not worth a StringBuffer
+ String mode_values = "";
+ for (PasswordMode pm : PasswordMode.values())
+ mode_values += "'" + pm + "', ";
+
+ mode_values += "or leave it unspecified.";
+ throw new AuthenticationException("The requested password check mode
'" + pmode_plain +
+ "' is not a valid mode. Possible values are " +
mode_values);
+ }
+ }
+
+ String pfilename = System.getProperty(PASSWD_FILENAME_PROPERTY);
+
+ String username = null;
+ CharSequence user = credentials.get(USERNAME_KEY);
+ if (user == null)
+ throw new AuthenticationException(
+ "Authentication request was missing the required key '" +
USERNAME_KEY + "'");
+ else
+ username = user.toString();
+
+ String password = null;
+ CharSequence pass = credentials.get(PASSWORD_KEY);
+ if (pass == null)
+ throw new AuthenticationException(
+ "Authentication request was missing the required key '" +
PASSWORD_KEY + "'");
+ else
+ password = pass.toString();
+
+ boolean authenticated = false;
+
+ InputStream in = null;
+ try {
+ in = new BufferedInputStream(new FileInputStream(pfilename));
+ Properties props = new Properties();
+ props.load(in);
+
+ // note we keep the message here and for the wrong password exactly the same
to prevent attackers from guessing what users are valid
+ if (props.getProperty(username) == null)
+ throw new AuthenticationException(authenticationErrorMessage(mode,
username));
+ switch (mode) {
+ case PLAIN:
+ authenticated = password.equals(props.getProperty(username));
+ break;
+ case MD5:
+ authenticated = MessageDigest
+
.isEqual(FBUtilities.threadLocalMD5Digest().digest(password.getBytes()),
+ Hex.hexToBytes(props.getProperty(username)));
+ break;
+ default:
+ throw new RuntimeException("Unknown PasswordMode " + mode);
+ }
+ } catch (IOException e) {
+ throw new RuntimeException(
+ "Authentication table file given by property " +
PASSWD_FILENAME_PROPERTY + " could not be opened: " +
+ e.getMessage());
+ } catch (Exception e) {
+ throw new RuntimeException("Unexpected authentication problem",
e);
+ } finally {
+ FileUtils.closeQuietly(in);
+ }
+
+ if (!authenticated) throw new
AuthenticationException(authenticationErrorMessage(mode, username));
+
+ return new AuthenticatedUser(username);
+ }
+
+ public void validateConfiguration() throws ConfigurationException {
+ String pfilename =
System.getProperty(SimpleAuthenticator.PASSWD_FILENAME_PROPERTY);
+ if (pfilename == null) {
+ throw new ConfigurationException("When using " +
this.getClass().getCanonicalName() + " " +
+ SimpleAuthenticator.PASSWD_FILENAME_PROPERTY + " properties must be
defined.");
+ }
+ }
+
+ static String authenticationErrorMessage(PasswordMode mode, String username) {
+ return String.format("Given password in password mode %s could not be
validated for user %s", mode, username);
+ }
+}
diff --git
a/modules/common/cassandra-auth/src/main/java/org/rhq/cassandra/auth/SimpleAuthority.java
b/modules/common/cassandra-auth/src/main/java/org/rhq/cassandra/auth/SimpleAuthority.java
new file mode 100644
index 0000000..6ab67e8
--- /dev/null
+++
b/modules/common/cassandra-auth/src/main/java/org/rhq/cassandra/auth/SimpleAuthority.java
@@ -0,0 +1,145 @@
+/*
+ *
+ * * RHQ Management Platform
+ * * Copyright (C) 2005-2012 Red Hat, Inc.
+ * * All rights reserved.
+ * *
+ * * This program is free software; you can redistribute it and/or modify
+ * * it under the terms of the GNU General Public License, version 2, as
+ * * published by the Free Software Foundation, and/or the GNU Lesser
+ * * General Public License, version 2.1, also as published by the Free
+ * * Software Foundation.
+ * *
+ * * This program is distributed in the hope that it will be useful,
+ * * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * * GNU General Public License and the GNU Lesser General Public License
+ * * for more details.
+ * *
+ * * You should have received a copy of the GNU General Public License
+ * * and the GNU Lesser General Public License along with this program;
+ * * if not, write to the Free Software Foundation, Inc.,
+ * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+package org.rhq.cassandra.auth;
+
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.cassandra.auth.AuthenticatedUser;
+import org.apache.cassandra.auth.IAuthority;
+import org.apache.cassandra.auth.Permission;
+import org.apache.cassandra.auth.Resources;
+import org.apache.cassandra.exceptions.ConfigurationException;
+import org.apache.cassandra.io.util.FileUtils;
+
+/**
+ * @author John Sanda
+ */
+public class SimpleAuthority implements IAuthority {
+ public final static String ACCESS_FILENAME_PROPERTY = "access.properties";
+ // magical property for WRITE permissions to the keyspaces list
+ public final static String KEYSPACES_WRITE_PROPERTY =
"<modify-keyspaces>";
+
+ public EnumSet<Permission> authorize(AuthenticatedUser user, List<Object>
resource) {
+ if (resource.size() < 2 || !Resources.ROOT.equals(resource.get(0)) ||
+ !Resources.KEYSPACES.equals(resource.get(1)))
+ return Permission.NONE;
+
+ String keyspace, columnFamily = null;
+ EnumSet<Permission> authorized = Permission.NONE;
+
+ // /cassandra/keyspaces
+ if (resource.size() == 2) {
+ keyspace = KEYSPACES_WRITE_PROPERTY;
+ authorized = EnumSet.of(Permission.READ);
+ }
+ // /cassandra/keyspaces/<keyspace name>
+ else if (resource.size() == 3) {
+ keyspace = (String) resource.get(2);
+ }
+ // /cassandra/keyspaces/<keyspace name>/<cf name>
+ else if (resource.size() == 4) {
+ keyspace = (String) resource.get(2);
+ columnFamily = (String) resource.get(3);
+ } else {
+ // We don't currently descend any lower in the hierarchy.
+ throw new UnsupportedOperationException();
+ }
+
+ String accessFilename = System.getProperty(ACCESS_FILENAME_PROPERTY);
+ InputStream in = null;
+ try {
+ in = new BufferedInputStream(new FileInputStream(accessFilename));
+ Properties accessProperties = new Properties();
+ accessProperties.load(in);
+
+ // Special case access to the keyspace list
+ if (keyspace == KEYSPACES_WRITE_PROPERTY) {
+ String kspAdmins =
accessProperties.getProperty(KEYSPACES_WRITE_PROPERTY);
+ for (String admin : kspAdmins.split(","))
+ if (admin.equals(user.username))
+ return Permission.ALL;
+ }
+
+ boolean canRead = false, canWrite = false;
+ String readers = null, writers = null;
+
+ if (columnFamily == null) {
+ readers = accessProperties.getProperty(keyspace +
".<ro>");
+ writers = accessProperties.getProperty(keyspace +
".<rw>");
+ } else {
+ readers = accessProperties.getProperty(keyspace + "." +
columnFamily + ".<ro>");
+ writers = accessProperties.getProperty(keyspace + "." +
columnFamily + ".<rw>");
+ }
+
+ if (readers != null) {
+ for (String reader : readers.split(",")) {
+ if (reader.equals(user.username)) {
+ canRead = true;
+ break;
+ }
+ }
+ }
+
+ if (writers != null) {
+ for (String writer : writers.split(",")) {
+ if (writer.equals(user.username)) {
+ canWrite = true;
+ break;
+ }
+ }
+ }
+
+ if (canWrite)
+ authorized = Permission.ALL;
+ else if (canRead)
+ authorized = EnumSet.of(Permission.READ);
+
+ } catch (IOException e) {
+ throw new RuntimeException(String.format("Authorization table file
'%s' could not be opened: %s",
+ accessFilename,
+ e.getMessage()));
+ } finally {
+ FileUtils.closeQuietly(in);
+ }
+
+ return authorized;
+ }
+
+ public void validateConfiguration() throws ConfigurationException {
+ String afilename = System.getProperty(ACCESS_FILENAME_PROPERTY);
+ if (afilename == null) {
+ throw new ConfigurationException(String.format("When using %s,
'%s' property must be defined.",
+ this.getClass().getCanonicalName(),
+ ACCESS_FILENAME_PROPERTY));
+ }
+ }
+}
diff --git a/modules/common/cassandra-common/pom.xml
b/modules/common/cassandra-common/pom.xml
index 2ef4b9d..438b155 100644
--- a/modules/common/cassandra-common/pom.xml
+++ b/modules/common/cassandra-common/pom.xml
@@ -121,6 +121,10 @@
<property name="cassandra.distro.filename"
value="cassandra.zip"/>
<property name="cassandra.distro.zip"
value="${project.build.outputDirectory}/${cassandra.distro.filename}"/>
+ <copy
file="${settings.localRepository}/org/rhq/rhq-cassandra-auth/${project.version}/rhq-cassandra-auth-${project.version}.jar"
+ todir="${cassandra.dir}/lib"/>
+ <move
file="${project.build.outputDirectory}/passwd.properties"
todir="${cassandra.dir}/conf"/>
+ <move
file="${project.build.outputDirectory}/access.properties"
todir="${cassandra.dir}/conf"/>
<zip basedir="${cassandra.dir}"
destfile="${cassandra.distro.zip}"/>
<delete dir="${cassandra.dir}"/>
<zip basedir="${project.build.outputDirectory}"
diff --git
a/modules/common/cassandra-common/src/main/java/org/rhq/cassandra/BootstrapDeployer.java
b/modules/common/cassandra-common/src/main/java/org/rhq/cassandra/BootstrapDeployer.java
index c4ea13c..ee3b633 100644
---
a/modules/common/cassandra-common/src/main/java/org/rhq/cassandra/BootstrapDeployer.java
+++
b/modules/common/cassandra-common/src/main/java/org/rhq/cassandra/BootstrapDeployer.java
@@ -220,7 +220,8 @@ public class BootstrapDeployer {
ProcessExecution cliExe =
ProcessExecutionUtility.createProcessExecution(script);
cliExe.setWaitForCompletion(30000L);
cliExe.setCaptureOutput(true);
- cliExe.setArguments(asList("-3", "--debug", "-f",
dbsetupFile.getAbsolutePath()));
+ cliExe.setArguments(asList("-3", "--debug", "-u",
"rhqadmin", "-p", "rhqadmin", "-f",
+ dbsetupFile.getAbsolutePath()));
ProcessExecutionResults results = systemInfo.executeProcess(cliExe);
String output = results.getCapturedOutput();
diff --git a/modules/common/cassandra-common/src/main/resources/access.properties
b/modules/common/cassandra-common/src/main/resources/access.properties
new file mode 100644
index 0000000..9119e14
--- /dev/null
+++ b/modules/common/cassandra-common/src/main/resources/access.properties
@@ -0,0 +1,46 @@
+# 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.
+
+# This is a sample access file for SimpleAuthority. The format of this file
+# is KEYSPACE[.COLUMNFAMILY].PERMISSION=USERS, where:
+#
+# * KEYSPACE is the keyspace name.
+# * COLUMNFAMILY is the column family name.
+# * PERMISSION is one of <ro> or <rw> for read-only or read-write
respectively.
+# * USERS is a comma delimited list of users from passwd.properties.
+#
+# See below for example entries.
+
+# NOTE: This file contains potentially sensitive information, please keep
+# this in mind when setting its mode and ownership.
+
+# The magical '<modify-keyspaces>' property lists users who can modify the
+# list of keyspaces: all users will be able to view the list of keyspaces.
+#<modify-keyspaces>=jsmith
+
+# Access to Keyspace1 (add/remove column families, etc).
+Keyspace1.<ro>=jsmith,Elvis Presley
+Keyspace1.<rw>=dilbert
+
+# Access to Standard1 (keyspace Keyspace1)
+#Keyspace1.Standard1.<rw>=jsmith,Elvis Presley,dilbert
+
+system.local.<ro>=rhqadmin
+system.peers.<ro>=rhqadmin
+system.schema_keyspaces.<ro>=rhqadmin
+system.schema_columnfamilies.<ro>=rhqadmin
+system.schema_columns.<ro>=rhqadmin
+rhq.<rw>=rhqadmin
\ No newline at end of file
diff --git
a/modules/common/cassandra-common/src/main/resources/cassandra-1.2.0-beta2/conf/cassandra-env.sh
b/modules/common/cassandra-common/src/main/resources/cassandra-1.2.0-beta2/conf/cassandra-env.sh
index 79b1369..a80b05b 100644
---
a/modules/common/cassandra-common/src/main/resources/cassandra-1.2.0-beta2/conf/cassandra-env.sh
+++
b/modules/common/cassandra-common/src/main/resources/cassandra-1.2.0-beta2/conf/cassandra-env.sh
@@ -145,6 +145,8 @@ JMX_PORT="@@jmx.port@(a)"
# starting cassandra.
JVM_EXTRA_OPTS="@@cassandra.ring.delay.property@@@@cassandra.ring.delay@(a)"
+JVM_EXTRA_OPTS="$JVM_EXTRA_OPTS
-Dpasswd.properties=@@rhq.cassandra.password.properties.file@(a)"
+JVM_EXTRA_OPTS="$JVM_EXTRA_OPTS
-Daccess.properties=@@rhq.cassandra.access.properties.file@(a)"
# enable assertions. disabling this in production will give a modest
# performance benefit (around 5%).
diff --git
a/modules/common/cassandra-common/src/main/resources/cassandra-1.2.0-beta2/conf/cassandra.yaml
b/modules/common/cassandra-common/src/main/resources/cassandra-1.2.0-beta2/conf/cassandra.yaml
index ae78ad2..bddb5b0 100644
---
a/modules/common/cassandra-common/src/main/resources/cassandra-1.2.0-beta2/conf/cassandra.yaml
+++
b/modules/common/cassandra-common/src/main/resources/cassandra-1.2.0-beta2/conf/cassandra.yaml
@@ -54,10 +54,10 @@ max_hints_delivery_threads: 2
# populate_io_cache_on_flush: false
# authentication backend, implementing IAuthenticator; used to identify users
-authenticator: org.apache.cassandra.auth.AllowAllAuthenticator
+authenticator: @@rhq.cassandra.authenticator(a)@
# authorization backend, implementing IAuthority; used to limit access/provide
permissions
-authority: org.apache.cassandra.auth.AllowAllAuthority
+authority: @@rhq.cassandra.authority(a)@
# The partitioner is responsible for distributing rows (by key) across
# nodes in the cluster. Any IPartitioner may be used, including your
diff --git a/modules/common/cassandra-common/src/main/resources/cassandra.properties
b/modules/common/cassandra-common/src/main/resources/cassandra.properties
index 799584a..a9201df 100644
--- a/modules/common/cassandra-common/src/main/resources/cassandra.properties
+++ b/modules/common/cassandra-common/src/main/resources/cassandra.properties
@@ -19,6 +19,22 @@ rhq.cassandra.bundle.version=1.0
# or increasing the number of nodes in the cluster will help even out the distribution.
rhq.cassandra.num-tokens=256
+# A class that performs authentication. The value should be a fully qualified class name
+# and implement IAuthenticator.
+rhq.cassandra.authenticator=org.rhq.cassandra.auth.SimpleAuthenticator
+
+# A class that performs authorization. Used to limit/provide permissions. The value
should
+# be a fully qualified class name and implement IAuthority.
+rhq.cassandra.authority=org.rhq.cassandra.auth.SimpleAuthority
+
+# The location of the password properties file used by SimpleAuthenticator. If a
relative
+# path is specified, its location is resolved relative to Cassandra's bin directory.
+rhq.cassandra.password.properties.file=../conf/passwd.properties
+
+# The location of the authorization properties file used by SimpleAuthority. If a
relative
+# path is specified, its location is resolved relative to Cassandra's bin directory.
+rhq.cassandra.access.properties.file=../conf/access.properties
+
# The maximum number of threads handling native CQL requests.
rhq.casandra.native-transport-max-threads=64
diff --git a/modules/common/cassandra-common/src/main/resources/deploy.xml
b/modules/common/cassandra-common/src/main/resources/deploy.xml
index 69b02e9..17d427a 100644
--- a/modules/common/cassandra-common/src/main/resources/deploy.xml
+++ b/modules/common/cassandra-common/src/main/resources/deploy.xml
@@ -120,6 +120,29 @@
defaultValue="9042"
type="integer"/>
+ <rhq:input-property name="rhq.cassandra.authenticator"
+ description="A class that performs authentication. The value
should be a fully qualified class name and implement IAuthenticator."
+ required="false"
+
defaultValue="org.rhq.cassandra.auth.SimpleAuthenticator"
+ type="string"/>
+
+ <rhq:input-property name="rhq.cassandra.authority"
+ description="A class that performs authorization. Used to
limit/provide permissions. The value should be a fully qualified class name and implement
IAuthority."
+ required="false"
+ defaultValue="org.rhq.cassandra.auth.SimpleAuthority"
+ type="string"/>
+
+ <rhq:input-property name="rhq.cassandra.password.properties.file"
+ description="The location of the password properties file
used by SimpleAuthenticator. If a relative path is specified, its location is resolved
relative to Cassandra's bin directory."
+ required="false"
+ defaultValue="../conf/passwd.properties"
+ type="file"/>
+
+ <rhq:input-property name="rhq.cassandra.access.properties.file"
+ description="The location of the authorization properties
file used by SimpleAuthority. If a relative path is specified, its location is resolved
relative to Cassandra's bin directory."
+ required="false"
+ defaultValue="../conf/access.properties"
+ type="file"/>
<rhq:deployment-unit name="cassandra"
preinstallTarget="pre-install" postinstallTarget="post-install">
<!--
diff --git a/modules/common/cassandra-common/src/main/resources/passwd.properties
b/modules/common/cassandra-common/src/main/resources/passwd.properties
new file mode 100644
index 0000000..708a1d0
--- /dev/null
+++ b/modules/common/cassandra-common/src/main/resources/passwd.properties
@@ -0,0 +1,23 @@
+# 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.
+#
+# This is a sample password file for SimpleAuthenticator. The format of
+# this file is username=password. If -Dpasswd.mode=MD5 then the password
+# is represented as an md5 digest, otherwise it is cleartext (keep this
+# in mind when setting file mode and ownership).
+
+#jsmith=havebadpass
+rhqadmin=rhqadmin
diff --git a/modules/common/pom.xml b/modules/common/pom.xml
index 30bf202..c11c096 100644
--- a/modules/common/pom.xml
+++ b/modules/common/pom.xml
@@ -30,6 +30,7 @@
<module>ant-bundle</module>
<module>drift</module>
<module>jboss-as-dmr-client</module>
+ <module>cassandra-auth</module>
<module>cassandra-common</module>
<module>cassandra-common-itests</module>
</modules>
diff --git
a/modules/enterprise/server/server-metrics/src/test/java/org/rhq/server/metrics/CassandraIntegrationTest.java
b/modules/enterprise/server/server-metrics/src/test/java/org/rhq/server/metrics/CassandraIntegrationTest.java
index 854e791..92a1607 100644
---
a/modules/enterprise/server/server-metrics/src/test/java/org/rhq/server/metrics/CassandraIntegrationTest.java
+++
b/modules/enterprise/server/server-metrics/src/test/java/org/rhq/server/metrics/CassandraIntegrationTest.java
@@ -27,6 +27,7 @@ package org.rhq.server.metrics;
import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.Session;
+import com.datastax.driver.core.SimpleAuthInfoProvider;
import org.joda.time.DateTime;
import org.testng.annotations.AfterClass;
@@ -48,10 +49,17 @@ public class CassandraIntegrationTest {
private DateTimeService dateTimeService;
@BeforeClass
- @DeployCluster
+ @DeployCluster(numNodes = 2)
public void deployCluster() throws Exception {
dateTimeService = new DateTimeService();
- Cluster cluster = Cluster.builder().addContactPoints("127.0.0.1",
"127.0.0.2").build();
+
+ SimpleAuthInfoProvider authInfoProvider = new SimpleAuthInfoProvider();
+ authInfoProvider.add("username",
"rhqadmin").add("password", "rhqadmin");
+
+ Cluster cluster = Cluster.builder()
+ .addContactPoints("127.0.0.1", "127.0.0.2")
+ .withAuthInfoProvider(authInfoProvider)
+ .build();
session = cluster.connect("rhq");
}
diff --git
a/modules/enterprise/server/server-metrics/src/test/java/org/rhq/server/metrics/MetricsDAOTest.java
b/modules/enterprise/server/server-metrics/src/test/java/org/rhq/server/metrics/MetricsDAOTest.java
index 7a9e669..4899bd6 100644
---
a/modules/enterprise/server/server-metrics/src/test/java/org/rhq/server/metrics/MetricsDAOTest.java
+++
b/modules/enterprise/server/server-metrics/src/test/java/org/rhq/server/metrics/MetricsDAOTest.java
@@ -41,9 +41,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import com.datastax.driver.core.Cluster;
-import com.datastax.driver.core.Session;
-
import org.joda.time.DateTime;
import org.joda.time.Hours;
import org.testng.annotations.BeforeClass;
@@ -61,15 +58,13 @@ public class MetricsDAOTest extends CassandraIntegrationTest {
private final long MINUTE = 60 * SECOND;
- private Session session;
-
private MetricsDAO dao;
@BeforeClass
public void initDAO() throws Exception {
- Cluster cluster = Cluster.builder().addContactPoints("127.0.0.1",
"127.0.0.2").build();
- session = cluster.connect("rhq");
-
+// Cluster cluster = Cluster.builder().addContactPoints("127.0.0.1",
"127.0.0.2").build();
+// session = cluster.connect("rhq");
+//
dao = new MetricsDAO(session);
}
diff --git a/pom.xml b/pom.xml
index 0780b74..dea634a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -142,7 +142,7 @@
<opencsv.version>1.8</opencsv.version>
<!-- cassandra dependency versions -->
- <cassandra.version>1.2.0-beta1</cassandra.version>
+ <cassandra.version>1.2.0-beta2</cassandra.version>
<cassandra.thrift.version>0.7.0</cassandra.thrift.version>
<cassandra.jdbc.version>1.2.0-SNAPSHOT</cassandra.jdbc.version>
<!--