Skip to content

Commit 2655359

Browse files
author
DvirDukhan
authored
comply to 1.99.7 index operations reponses (#56)
* comply to 1.99.7 index operations reponses * comply to 1.99.7 index create and delete response
1 parent a2b4202 commit 2655359

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

src/main/java/com/redislabs/redisgraph/Statistics.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff 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

src/main/java/com/redislabs/redisgraph/impl/resultset/StatisticsImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff 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

src/test/java/com/redislabs/redisgraph/RedisGraphAPITest.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import org.junit.*;
1616

1717
import com.redislabs.redisgraph.Statistics.Label;
18-
import org.junit.rules.ExpectedException;
1918

2019
import 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

0 commit comments

Comments
 (0)