File tree Expand file tree Collapse file tree 3 files changed +17
-2
lines changed
main/java/com/redislabs/redisgraph
test/java/com/redislabs/redisgraph Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,8 @@ public interface Statistics {
88 */
99 enum Label {
1010 LABELS_ADDED ("Labels added" ),
11- INDICES_ADDED ("Indices added" ),
11+ INDICES_ADDED ("Indices created" ),
12+ INDICES_DELETED ("Indices deleted" ),
1213 NODES_CREATED ("Nodes created" ),
1314 NODES_DELETED ("Nodes deleted" ),
1415 RELATIONSHIPS_DELETED ("Relationships deleted" ),
@@ -54,6 +55,8 @@ public static Label getEnum(String value) {
5455 int nodesDeleted ();
5556
5657 int indicesAdded ();
58+
59+ int indicesDeleted ();
5760
5861 int labelsAdded ();
5962
Original file line number Diff line number Diff line change @@ -93,6 +93,9 @@ public int indicesAdded() {
9393 }
9494
9595
96+ @ Override
97+ public int indicesDeleted () {return getIntValue (Label .INDICES_DELETED );}
98+
9699 /**
97100 *
98101 * @return number of labels added after query execution
Original file line number Diff line number Diff line change 1515import org .junit .*;
1616
1717import com .redislabs .redisgraph .Statistics .Label ;
18- import org .junit .rules .ExpectedException ;
1918
2019import static com .redislabs .redisgraph .Header .ResultSetColumnTypes .*;
2120
@@ -157,6 +156,16 @@ public void testIndex() {
157156 Assert .assertNotNull (createNonExistingIndexResult .getStatistics ().getStringValue (Label .INDICES_ADDED ));
158157 Assert .assertEquals (1 , createNonExistingIndexResult .getStatistics ().indicesAdded ());
159158
159+ ResultSet createExistingIndexResult = api .query ("social" , "CREATE INDEX ON :person(age)" );
160+ Assert .assertFalse (createExistingIndexResult .hasNext ());
161+ Assert .assertNotNull (createExistingIndexResult .getStatistics ().getStringValue (Label .INDICES_ADDED ));
162+ Assert .assertEquals (0 , createExistingIndexResult .getStatistics ().indicesAdded ());
163+
164+ ResultSet deleteExistingIndexResult = api .query ("social" , "DROP INDEX ON :person(age)" );
165+ Assert .assertFalse (deleteExistingIndexResult .hasNext ());
166+ Assert .assertNotNull (deleteExistingIndexResult .getStatistics ().getStringValue (Label .INDICES_DELETED ));
167+ Assert .assertEquals (1 , deleteExistingIndexResult .getStatistics ().indicesDeleted ());
168+
160169 }
161170
162171 @ Test
You can’t perform that action at this time.
0 commit comments