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; 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 * Returns UUIDS of not read user notification messages
* @param userid user identifier * @param userid user identifier

View File

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