@@ -54,6 +54,59 @@ public void simpleReadWrite() throws RocksDBException {
5454 }
5555 }
5656
57+ @ Test
58+ public void readKVAsWideColumn () throws RocksDBException {
59+ try (final RocksDB db = RocksDB .open (dbFolder .getRoot ().getAbsolutePath ())) {
60+ db .put (
61+ "someKey" .getBytes (StandardCharsets .UTF_8 ), "someValue" .getBytes (StandardCharsets .UTF_8 ));
62+
63+ List <WideColumn <byte []>> result = new ArrayList <>();
64+
65+ Status status = db .getEntity ("someKey" .getBytes (), result );
66+
67+ assertThat (status .getCode ()).isEqualTo (Status .Code .Ok );
68+
69+ assertThat (result ).isNotEmpty ();
70+
71+ assertThat (result .get (0 ).getName ()).isEqualTo (new byte [] {});
72+
73+ assertThat (result .get (0 ).getValue ()).isEqualTo ("someValue" .getBytes (StandardCharsets .UTF_8 ));
74+ }
75+ }
76+
77+ @ Test
78+ public void readWideColumnAsKV () throws RocksDBException {
79+ try (final RocksDB db = RocksDB .open (dbFolder .getRoot ().getAbsolutePath ())) {
80+ List <WideColumn <byte []>> wideColumns = new ArrayList <>();
81+
82+ wideColumns .add (new WideColumn <>("columnName" .getBytes (StandardCharsets .UTF_8 ),
83+ "columnValue" .getBytes (StandardCharsets .UTF_8 )));
84+ db .putEntity ("someKey" .getBytes (StandardCharsets .UTF_8 ), wideColumns );
85+
86+ byte [] status = db .get ("someKey" .getBytes ());
87+
88+ assertThat (status ).isNotNull ();
89+ }
90+ }
91+
92+ @ Test
93+ public void readWideDefaultColumnAsKV () throws RocksDBException {
94+ try (final RocksDB db = RocksDB .open (dbFolder .getRoot ().getAbsolutePath ())) {
95+ List <WideColumn <byte []>> wideColumns = new ArrayList <>();
96+
97+ wideColumns .add (new WideColumn <>("columnName" .getBytes (StandardCharsets .UTF_8 ),
98+ "columnValue" .getBytes (StandardCharsets .UTF_8 )));
99+ wideColumns .add (
100+ new WideColumn <>(new byte [] {}, "defaultColumnValue" .getBytes (StandardCharsets .UTF_8 )));
101+
102+ db .putEntity ("someKey" .getBytes (StandardCharsets .UTF_8 ), wideColumns );
103+
104+ byte [] status = db .get ("someKey" .getBytes ());
105+
106+ assertThat (status ).isNotNull ();
107+ assertThat (status ).isEqualTo ("defaultColumnValue" .getBytes (StandardCharsets .UTF_8 ));
108+ }
109+ }
57110 @ Test
58111 public void readWriteWithKeyOffset () throws RocksDBException {
59112 try (final RocksDB db = RocksDB .open (dbFolder .getRoot ().getAbsolutePath ())) {
0 commit comments