Skip to content
This repository was archived by the owner on Sep 28, 2022. It is now read-only.

Add collection:list#82

Merged
scottinet merged 11 commits into
3-devfrom
KZL-1462-collection-list
Apr 20, 2020
Merged

Add collection:list#82
scottinet merged 11 commits into
3-devfrom
KZL-1462-collection-list

Conversation

@y-abs
Copy link
Copy Markdown
Contributor

@y-abs y-abs commented Apr 1, 2020

What does this PR do ?

This PR implements the collection:list method with its unit tests.

How should this be manually tested?

Clone this branch and run unit tests
./gradlew test

When it succeed, compile it

./gradlew jar

Initiate another java project by adding the compiled SDK as a dependency.

Then, run Kuzzle, create an index nyc-open-data, a yellow-taxi collection.
Finally, run this code

import io.kuzzle.sdk.*;
import io.kuzzle.sdk.Options.KuzzleOptions;
import io.kuzzle.sdk.Options.Protocol.WebSocketOptions;
import io.kuzzle.sdk.Protocol.WebSocket;

import java.util.concurrent.ConcurrentHashMap;

public class listCollection {
    private static Kuzzle kuzzle;

    public static void main(String[] args) {
        WebSocketOptions opts = new WebSocketOptions();
        opts.setAutoReconnect(true).setConnectionTimeout(42000);

        try {
            WebSocket ws = new WebSocket("localhost", opts);

            kuzzle = new Kuzzle(ws, (KuzzleOptions) null);

            kuzzle.connect();

           ConcurrentHashMap<String, Object> result = kuzzle.getCollectionController().list("nyc-open- 
           data").get();
           System.out.println(result);
            
        }  catch (Exception e) {
            e.printStackTrace();
        }

        kuzzle.disconnect();
    }
};

@y-abs y-abs self-assigned this Apr 1, 2020
}

public Integer getFrom() {
return from;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is returned when the uninitialized value is returned? The request contain a number or null?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If its uninitialized it returns null

| Arguments | Type | Description |
| --------- | ---------------------- | ------------- |
| `index` | <pre>String</pre> | Index name |
| `options` | <pre>ListOptions</pre> | List options |
Copy link
Copy Markdown
Contributor

@scottinet scottinet Apr 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should get rid of these optional parameters: kuzzleio/kuzzle#1592

I'd prefer if you remove them, but if you don't, then the default values for the from and size parameters should be null from this SDK's point of view.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've didnt see that, thanks

@y-abs y-abs requested a review from scottinet April 15, 2020 12:40
@scottinet scottinet merged commit b7aecda into 3-dev Apr 20, 2020
@scottinet scottinet deleted the KZL-1462-collection-list branch April 20, 2020 11:40
@jenow jenow mentioned this pull request May 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants