[ 
https://issues.apache.org/jira/browse/GEODE-7424?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gang Yan updated GEODE-7424:
----------------------------
    Description: 
# WHAT
  1. endpoint: [POST] `management/v1/indexes`
  1. parameter:  "name(indexID)",  "expression", "region", "type",  "group"
  1. expected result: create index by specified parameters
  1. type: default is "range"
  1. region is required
  1. name(indexID) is required
  1. expression is required
  1. "hash" type is not supported.

### Acceptance Criteria
 - Scenario: normal case, 80%
 - Scenario: name(indexID) duplicated, ERROR
 - Scenario: region does not exist, ERROR

```gherkin
Scenario:  normal case, 80%
Given a cluster is running with REST API for Management
AND A&A
AND user has permission of "CLUSTER:MANAGE:QUERY"
When the user curl [POST] `management/v1/indexes`
AND with the request body as Note[1]
AND the name of index is NOT duplicated
Then an index is created under the specified region
AND it can be found in [GET] `management/v1/indexes`
AND it is same as the user specified
```

```gherkin
Scenario:  name(indexID) duplicated, ERROR
Given a cluster is running with REST API for Management
AND A&A
AND user has permission of "CLUSTER:MANAGE:QUERY"
When the user curl [POST] `management/v1/indexes`
AND with the request body as Note[1]
AND the name of index is duplicated
Then an index is not created
AND get an error msg: "Index "Foo6name3" already exists.  Create failed due to 
duplicate name."
AND it can not be found in [GET] `management/v1/indexes`
```

```gherkin
Scenario:  region does not exist, ERROR
Given a cluster is running with REST API for Management
AND A&A
AND user has permission of "CLUSTER:MANAGE:QUERY"
When the user curl [POST] `management/v1/indexes`
AND with the request body as Note[1]
AND the name of index is not duplicated
AND the specified region does not exist
Then an index is not created
AND get an error msg: "Region /Foo7 does not exist."
AND it can not be found in [GET] `management/v1/indexes`
```

### Note
1.  request body
```JSON
{
            "name": "Foo6name3",
            "expression": "name3",
            "regionPath": "/Foo6",
             “group”:“”,
             “type”:“” range|key
        }
```

  was:
# WHAT
  1. endpoint: [POST] `management/v1/indexes`
  1. parameter:  "name",  "expression", "region", "type",  "group"
  1. expected result: create index by specified parameters


> Ability: can create index in RESTAPI for Management
> ---------------------------------------------------
>
>                 Key: GEODE-7424
>                 URL: https://issues.apache.org/jira/browse/GEODE-7424
>             Project: Geode
>          Issue Type: New Feature
>          Components: management, rest (admin)
>            Reporter: Gang Yan
>            Priority: Major
>
> # WHAT
>   1. endpoint: [POST] `management/v1/indexes`
>   1. parameter:  "name(indexID)",  "expression", "region", "type",  "group"
>   1. expected result: create index by specified parameters
>   1. type: default is "range"
>   1. region is required
>   1. name(indexID) is required
>   1. expression is required
>   1. "hash" type is not supported.
> ### Acceptance Criteria
>  - Scenario: normal case, 80%
>  - Scenario: name(indexID) duplicated, ERROR
>  - Scenario: region does not exist, ERROR
> ```gherkin
> Scenario:  normal case, 80%
> Given a cluster is running with REST API for Management
> AND A&A
> AND user has permission of "CLUSTER:MANAGE:QUERY"
> When the user curl [POST] `management/v1/indexes`
> AND with the request body as Note[1]
> AND the name of index is NOT duplicated
> Then an index is created under the specified region
> AND it can be found in [GET] `management/v1/indexes`
> AND it is same as the user specified
> ```
> ```gherkin
> Scenario:  name(indexID) duplicated, ERROR
> Given a cluster is running with REST API for Management
> AND A&A
> AND user has permission of "CLUSTER:MANAGE:QUERY"
> When the user curl [POST] `management/v1/indexes`
> AND with the request body as Note[1]
> AND the name of index is duplicated
> Then an index is not created
> AND get an error msg: "Index "Foo6name3" already exists.  Create failed due 
> to duplicate name."
> AND it can not be found in [GET] `management/v1/indexes`
> ```
> ```gherkin
> Scenario:  region does not exist, ERROR
> Given a cluster is running with REST API for Management
> AND A&A
> AND user has permission of "CLUSTER:MANAGE:QUERY"
> When the user curl [POST] `management/v1/indexes`
> AND with the request body as Note[1]
> AND the name of index is not duplicated
> AND the specified region does not exist
> Then an index is not created
> AND get an error msg: "Region /Foo7 does not exist."
> AND it can not be found in [GET] `management/v1/indexes`
> ```
> ### Note
> 1.  request body
> ```JSON
> {
>             "name": "Foo6name3",
>             "expression": "name3",
>             "regionPath": "/Foo6",
>              “group”:“”,
>              “type”:“” range|key
>         }
> ```



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to