minor bug fix when no notifications settings were selected
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/social-networking-library@76890 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
7c05ce61bc
commit
804f9f569a
|
@ -934,6 +934,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
if (i < channelsNo-1)
|
||||
valueToInsert += ",";
|
||||
}
|
||||
if (channelsNo == 0) { //in case no channels were selected
|
||||
valueToInsert = "";
|
||||
_log.trace("No Channels selected for " + nType + " by " + userid);
|
||||
}
|
||||
m.withRow(cf_UserNotificationsPreferences, userid).putColumn(nType.toString(), valueToInsert, null);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import static org.junit.Assert.assertTrue;
|
|||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -18,22 +17,13 @@ import org.gcube.portal.databook.shared.Notification;
|
|||
import org.gcube.portal.databook.shared.NotificationChannelType;
|
||||
import org.gcube.portal.databook.shared.NotificationType;
|
||||
import org.gcube.portal.databook.shared.PrivacyLevel;
|
||||
import org.gcube.portal.databook.shared.ex.ColumnNameNotFoundException;
|
||||
import org.gcube.portal.databook.shared.ex.FeedIDNotFoundException;
|
||||
import org.gcube.portal.databook.shared.ex.FeedTypeNotFoundException;
|
||||
import org.gcube.portal.databook.shared.ex.NotificationChannelTypeNotFoundException;
|
||||
import org.gcube.portal.databook.shared.ex.NotificationTypeNotFoundException;
|
||||
import org.gcube.portal.databook.shared.ex.PrivacyLevelTypeNotFoundException;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
|
||||
import com.netflix.astyanax.ddl.ColumnFamilyDefinition;
|
||||
import com.netflix.astyanax.model.ColumnFamily;
|
||||
import com.netflix.astyanax.serializers.StringSerializer;
|
||||
|
||||
public class DatabookCassandraTest {
|
||||
private static DatabookStore store;
|
||||
|
||||
|
@ -103,8 +93,9 @@ public class DatabookCassandraTest {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testNotificationPreferences() {
|
||||
public void testSingleNotificationPreference() {
|
||||
try {
|
||||
for (NotificationChannelType channel : store.getUserNotificationChannels("antonio.gioia", NotificationType.LIKE)) {
|
||||
System.out.println(channel);
|
||||
|
@ -112,7 +103,6 @@ public class DatabookCassandraTest {
|
|||
} catch (NotificationChannelTypeNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NotificationTypeNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
};
|
||||
HashMap<NotificationType, NotificationChannelType[]> toCreate = new HashMap<NotificationType, NotificationChannelType[]>();
|
||||
|
@ -127,21 +117,15 @@ public class DatabookCassandraTest {
|
|||
toCreate.put(NotificationType.values()[i], NotificationChannelType.values());
|
||||
}
|
||||
store.setUserNotificationPreferences("antonio.gioia", toCreate);
|
||||
|
||||
|
||||
|
||||
try {
|
||||
try {
|
||||
for (NotificationChannelType channel : store.getUserNotificationChannels("antonio.gioia", NotificationType.WP_FOLDER_RENAMED)) { //i == 3
|
||||
System.out.println(channel);
|
||||
}
|
||||
} catch (NotificationTypeNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
for (NotificationChannelType channel : store.getUserNotificationChannels("antonio.gioia", NotificationType.WP_FOLDER_RENAMED)) { //i == 3
|
||||
System.out.println(channel);
|
||||
}
|
||||
} catch (NotificationChannelTypeNotFoundException e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue