@Test(groups={"unit"}) public void testMultiGetColumnsAsMapSpecifyingNoColumnName() { Map<String,Map<String,String>> expectedResult = new HashMap<String,Map<String,String>>(); Map<String,String> properties = new HashMap<String, String>(); Iterator<String> itr = columnValues.iterator(); for (String columnName : columnNames) { properties.put(columnName, itr.next()); } for(String key : rowKeys) { expectedResult.put(key, properties); } Rows<String,String,String> rows = mock(Rows.class); when(executionResult.get()).thenReturn(rows); ColumnSlice<String,String> columnSlice = mock(ColumnSlice.class); Row<String,String,String> mockRow = mock(Row.class); when(mockRow.getKey()).thenReturn(rowKeys.get(0)).thenReturn(rowKeys.get(1)); when(mockRow.getColumnSlice()).thenReturn(columnSlice); HColumn<String,String> mockColumn = mock(HColumn.class); when(mockColumn.getName()).thenReturn(columnNames.get(0)).thenReturn(columnNames.get(1)). thenReturn(columnNames.get(0)).thenReturn(columnNames.get(1)); when(mockColumn.getValue()). thenReturn(columnValues.get(0)). thenReturn(columnValues.get(1)). thenReturn(columnValues.get(0)). thenReturn(columnValues.get(1)); List<HColumn<String,String>> columnList = Arrays.asList(mockColumn,mockColumn); when(columnSlice.getColumns()).thenReturn(columnList); Iterator<Row<String,String,String>> mockRowIterator = mock(Iterator.class); when(rows.iterator()).thenReturn(mockRowIterator); when(mockRowIterator.hasNext()).thenReturn(true).thenReturn(true).thenReturn(false); when(mockRowIterator.next()).thenReturn(mockRow).thenReturn(mockRow); Map<String,Map<String,String>> result = superColumnFamilyTestDao.multiGetColumnsAsMap(rowKeys, superColumnName); assertEquals(result, expectedResult); }
@Override public Map<K,Map<N,V>> multiGetColumnsAsMap(Collection<K> rowKeys, SN superColumnName, N... columnNames) { return basicMultiGetAsMap(rowKeys, superColumnName, columnNames); }
SuperColumnFamilyTemplate extends AbstractColumnFamilyTemplate<K,SN,V> implements SuperColumnFamilyOperations<K,SN,N,V> { @Override public Map<K,Map<N,V>> multiGetColumnsAsMap(Collection<K> rowKeys, SN superColumnName, N... columnNames) { return basicMultiGetAsMap(rowKeys, superColumnName, columnNames); } }
SuperColumnFamilyTemplate extends AbstractColumnFamilyTemplate<K,SN,V> implements SuperColumnFamilyOperations<K,SN,N,V> { @Override public Map<K,Map<N,V>> multiGetColumnsAsMap(Collection<K> rowKeys, SN superColumnName, N... columnNames) { return basicMultiGetAsMap(rowKeys, superColumnName, columnNames); } SuperColumnFamilyTemplate(Keyspace keyspace,
                                     @Nullable String columnFamily,
                                     Serializer<K> keySerializer,
                                     Serializer<SN> supercolumnNameSerializer,
                                     Serializer<N> subcolumnNameSerializer,
                                     Serializer<V> valueSerializer); }
SuperColumnFamilyTemplate extends AbstractColumnFamilyTemplate<K,SN,V> implements SuperColumnFamilyOperations<K,SN,N,V> { @Override public Map<K,Map<N,V>> multiGetColumnsAsMap(Collection<K> rowKeys, SN superColumnName, N... columnNames) { return basicMultiGetAsMap(rowKeys, superColumnName, columnNames); } SuperColumnFamilyTemplate(Keyspace keyspace,
                                     @Nullable String columnFamily,
                                     Serializer<K> keySerializer,
                                     Serializer<SN> supercolumnNameSerializer,
                                     Serializer<N> subcolumnNameSerializer,
                                     Serializer<V> valueSerializer); @Override V readColumnValue(K rowKey, SN superColumnName, N columnName); @Override Map<N,V> readColumnsAsMap(K rowKey, SN superColumnName, N... columnNames); @Override Map<N,V> readColumnsAsMap(K rowKey,
                                     SN superColumnName,
                                     N start,
                                     N finish,
                                     int count,
                                     boolean reversed); @Override List<T> readColumns(K rowKey, SN superColumnName, ColumnMapper<T,N,V> columnMapper); @Override List<T> readColumns(K rowKey,
                                   SN superColumnName,
                                   N start,
                                   N finish,
                                   int count,
                                   boolean reversed,
                                   ColumnMapper<T,N,V> columnMapper); @Override List<T> readColumnsWithTimestamps(K rowKey,
                                                 SN superColumnName,
                                                 N start,
                                                 N finish,
                                                 int count,
                                                 boolean reversed,
                                                 ColumnMapperWithTimestamps<T,N,V> columnMapper); @Override void visitColumns(K rowKey,
                                SN superColumnName,
                                N start,
                                N finish,
                                int count,
                                boolean reversed,
                                ColumnVisitor<N, V> columnVisitor); @Override Map<K,Map<N,V>> multiGetAsMap(Collection<K> rowKeys, SN superColumnName); @Override Map<K,Map<N,V>> multiGetColumnsAsMap(Collection<K> rowKeys, SN superColumnName, N... columnNames); @Override Map<K,List<T>> multiGetColumnRange(Iterable<K> rowKeys,
                                                   SN supercolumnName,
                                                   N start,
                                                   N finish,
                                                   int count,
                                                   boolean reversed,
                                                   ColumnMapper<T,N,V> columnMapper); @Override List<T> multiGetSuperColumn(Collection<K> rowKeys,
                                                 SN superColumnName,
                                                 SuperColumnMapper<T,K,SN,N,V> superColumnMapper); @Override List<T> multiGetAllSuperColumns(Collection<K> rowKeys, SuperColumnFamilyRowMapper<T,K,SN,N,V>
            superColumnFamilyRowMapper); @Override List<T> multiGetColumns(Collection<K> rowKeys,
                                             SN superColumnName,
                                             SuperColumnMapper<T,K,SN,N,V> superColumnMapper,
                                             N... columnNames); @Override Map<SN,Map<N,V>> readRowAsMap(K key); @Override List<T> readRow(K key, SuperColumnMapper<T,K,SN,N,V> superColumnMapper); @Override void writeColumns(K rowKey, SN superColumnName, Map<N,V> columnMap); @Override void writeColumns(K rowKey,
                                   SN superColumnName,
                                   Map<N,V> columnMap,
                                   @Nonnull BatchContext txnContext); @Override void writeColumn(K rowKey, SN superColumnName, N columnName, V columnValue); @Override void writeColumn(K rowKey,
                                  SN superColumnName,
                                  N columnName,
                                  V columnValue,
                                  @Nonnull BatchContext txnContext); @Override void deleteColumns(K rowKey, SN superColumnName, Iterable<N> subcolumnNames); @Override void deleteColumns(K rowKey,
                                    SN superColumnName,
                                    Iterable<N> subcolumnNames,
                                    @Nonnull BatchContext txnContext); @Override void deleteColumns(K rowKey, SN superColumnName, N start, N finish); @Override void deleteColumns(K rowKey, SN superColumnName, N start, N finish, @Nullable BatchContext batchContext); @Override void deleteSuperColumn(K rowKey, SN superColumnName); @Override void deleteSuperColumn(K rowKey, SN superColumnName, @Nonnull BatchContext txnContext); }
SuperColumnFamilyTemplate extends AbstractColumnFamilyTemplate<K,SN,V> implements SuperColumnFamilyOperations<K,SN,N,V> { @Override public Map<K,Map<N,V>> multiGetColumnsAsMap(Collection<K> rowKeys, SN superColumnName, N... columnNames) { return basicMultiGetAsMap(rowKeys, superColumnName, columnNames); } SuperColumnFamilyTemplate(Keyspace keyspace,
                                     @Nullable String columnFamily,
                                     Serializer<K> keySerializer,
                                     Serializer<SN> supercolumnNameSerializer,
                                     Serializer<N> subcolumnNameSerializer,
                                     Serializer<V> valueSerializer); @Override V readColumnValue(K rowKey, SN superColumnName, N columnName); @Override Map<N,V> readColumnsAsMap(K rowKey, SN superColumnName, N... columnNames); @Override Map<N,V> readColumnsAsMap(K rowKey,
                                     SN superColumnName,
                                     N start,
                                     N finish,
                                     int count,
                                     boolean reversed); @Override List<T> readColumns(K rowKey, SN superColumnName, ColumnMapper<T,N,V> columnMapper); @Override List<T> readColumns(K rowKey,
                                   SN superColumnName,
                                   N start,
                                   N finish,
                                   int count,
                                   boolean reversed,
                                   ColumnMapper<T,N,V> columnMapper); @Override List<T> readColumnsWithTimestamps(K rowKey,
                                                 SN superColumnName,
                                                 N start,
                                                 N finish,
                                                 int count,
                                                 boolean reversed,
                                                 ColumnMapperWithTimestamps<T,N,V> columnMapper); @Override void visitColumns(K rowKey,
                                SN superColumnName,
                                N start,
                                N finish,
                                int count,
                                boolean reversed,
                                ColumnVisitor<N, V> columnVisitor); @Override Map<K,Map<N,V>> multiGetAsMap(Collection<K> rowKeys, SN superColumnName); @Override Map<K,Map<N,V>> multiGetColumnsAsMap(Collection<K> rowKeys, SN superColumnName, N... columnNames); @Override Map<K,List<T>> multiGetColumnRange(Iterable<K> rowKeys,
                                                   SN supercolumnName,
                                                   N start,
                                                   N finish,
                                                   int count,
                                                   boolean reversed,
                                                   ColumnMapper<T,N,V> columnMapper); @Override List<T> multiGetSuperColumn(Collection<K> rowKeys,
                                                 SN superColumnName,
                                                 SuperColumnMapper<T,K,SN,N,V> superColumnMapper); @Override List<T> multiGetAllSuperColumns(Collection<K> rowKeys, SuperColumnFamilyRowMapper<T,K,SN,N,V>
            superColumnFamilyRowMapper); @Override List<T> multiGetColumns(Collection<K> rowKeys,
                                             SN superColumnName,
                                             SuperColumnMapper<T,K,SN,N,V> superColumnMapper,
                                             N... columnNames); @Override Map<SN,Map<N,V>> readRowAsMap(K key); @Override List<T> readRow(K key, SuperColumnMapper<T,K,SN,N,V> superColumnMapper); @Override void writeColumns(K rowKey, SN superColumnName, Map<N,V> columnMap); @Override void writeColumns(K rowKey,
                                   SN superColumnName,
                                   Map<N,V> columnMap,
                                   @Nonnull BatchContext txnContext); @Override void writeColumn(K rowKey, SN superColumnName, N columnName, V columnValue); @Override void writeColumn(K rowKey,
                                  SN superColumnName,
                                  N columnName,
                                  V columnValue,
                                  @Nonnull BatchContext txnContext); @Override void deleteColumns(K rowKey, SN superColumnName, Iterable<N> subcolumnNames); @Override void deleteColumns(K rowKey,
                                    SN superColumnName,
                                    Iterable<N> subcolumnNames,
                                    @Nonnull BatchContext txnContext); @Override void deleteColumns(K rowKey, SN superColumnName, N start, N finish); @Override void deleteColumns(K rowKey, SN superColumnName, N start, N finish, @Nullable BatchContext batchContext); @Override void deleteSuperColumn(K rowKey, SN superColumnName); @Override void deleteSuperColumn(K rowKey, SN superColumnName, @Nonnull BatchContext txnContext);  }