This commit is contained in:
Massimiliano Assante 2016-04-04 10:54:38 +00:00
parent 59424dc2ab
commit c759739bec
2 changed files with 27 additions and 58 deletions

View File

@ -1036,31 +1036,6 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
}
return toReturn;
}
/**
*
* @param userid user identifier
* @return simply return a list of user messages notifications UUID in chronological order from the oldest to the more recent
*/
private ArrayList<String> getUserMessagesNotificationsIds(String userid) {
OperationResult<Rows<String, String>> result = null;
try {
result = conn.getKeyspace().prepareQuery(cf_UserMessageNotifications)
.getKeySlice(userid)
.execute();
} catch (ConnectionException e) {
e.printStackTrace();
}
ArrayList<String> toReturn = new ArrayList<String>();
// Iterate rows and their columns
for (Row<String, String> row : result.getResult()) {
for (Column<String> column : row.getColumns()) {
toReturn.add(column.getStringValue());
}
}
return toReturn;
}
/**
* Returns UUIDS of not read user notification messages
* @param userid user identifier

View File

@ -18,7 +18,10 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import com.google.gwt.thirdparty.guava.common.collect.ImmutableMap;
import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
import com.netflix.astyanax.model.ColumnFamily;
import com.netflix.astyanax.serializers.StringSerializer;
public class DatabookCassandraTest {
private static DBCassandraAstyanaxImpl store;
@ -190,39 +193,30 @@ public class DatabookCassandraTest {
// }
// /**
// * use exclusively to add a new (Dynamic) CF to a keyspace
// */
// @Test
// public void addInvitesDynamicColumnFamilies() {
// System.out.println("addInvitesColumnFamilies");
// ColumnFamily<String, String> cf_HashtagsCounter = new ColumnFamily<String, String>(
// DBCassandraAstyanaxImpl.VRE_INVITES, // Column Family Name
// StringSerializer.get(), // Key Serializer
// StringSerializer.get()); // Column Serializer
// ColumnFamily<String, String> cf_HashtagTimeline = new ColumnFamily<String, String>(
// DBCassandraAstyanaxImpl.EMAIL_INVITES, // Column Family Name
// StringSerializer.get(), // Key Serializer
// StringSerializer.get()); // Column Serializer
//
// try {
// new CassandraClusterConnection(false).getKeyspace().createColumnFamily(cf_HashtagsCounter, ImmutableMap.<String, Object>builder()
// .put("default_validation_class", "UTF8Type")
// .put("key_validation_class", "UTF8Type")
// .put("comparator_type", "UTF8Type")
// .build());
//
// new CassandraClusterConnection(false).getKeyspace().createColumnFamily(cf_HashtagTimeline, ImmutableMap.<String, Object>builder()
// .put("default_validation_class", "UTF8Type")
// .put("key_validation_class", "UTF8Type")
// .put("comparator_type", "UTF8Type")
// .build());
//
// } catch (ConnectionException e) {
// e.printStackTrace();
// }
// System.out.println("addInvitesColumnFamilies END");
// }
// /**
// * use exclusively to add a new (Dynamic) CF to a keyspace
// */
// @Test
// public void addInvitesDynamicColumnFamilies() {
// System.out.println("UserNotificationsUnread");
// ColumnFamily<String, String> cf_UserNotificationsUnreadTimeline = new ColumnFamily<String, String>(
// DBCassandraAstyanaxImpl.USER_NOTIFICATIONS_UNREAD, // Column Family Name
// StringSerializer.get(), // Key Serializer
// StringSerializer.get()); // Column Serializer
//
// try {
//
// new CassandraClusterConnection(false).getKeyspace().createColumnFamily(cf_UserNotificationsUnreadTimeline, ImmutableMap.<String, Object>builder()
// .put("default_validation_class", "UTF8Type")
// .put("key_validation_class", "UTF8Type")
// .put("comparator_type", "UTF8Type")
// .build());
//
// } catch (ConnectionException e) {
// e.printStackTrace();
// }
// System.out.println("UserNotificationsUnread END");
// }
// private List<String> getKeys() {