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

Add collection:create#79

Merged
y-abs merged 10 commits into
3-devfrom
KZL-1462-collection-create
Apr 1, 2020
Merged

Add collection:create#79
y-abs merged 10 commits into
3-devfrom
KZL-1462-collection-create

Conversation

@y-abs
Copy link
Copy Markdown
Contributor

@y-abs y-abs commented Mar 26, 2020

What does this PR do ?

This PR implements the collection:create 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.
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 createCollection {
    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> mapping = new ConcurrentHashMap<>();
            ConcurrentHashMap<String, Object> properties = new ConcurrentHashMap<>();
            ConcurrentHashMap<String, Object> license = new ConcurrentHashMap<>();

            license.put("type", "keyword");
            properties.put("license", license);
            mapping.put("properties", properties);

            ConcurrentHashMap<String, Object> re = kuzzle.getCollectionController().create("nyc-open-data", "yellow-taxi").get();
            
        }  catch (Exception e) {
            e.printStackTrace();
        }

        kuzzle.disconnect();
    }
};

@y-abs y-abs self-assigned this Mar 26, 2020
Comment thread doc/3/controllers/collection/create/index.md Outdated
Comment thread doc/3/controllers/collection/create/index.md Outdated
y-abs and others added 2 commits March 27, 2020 14:09
Co-Authored-By: Sébastien Cottinet <scottinet@protonmail.com>
@y-abs y-abs requested a review from scottinet March 27, 2020 13:13
@y-abs y-abs merged commit e403d4d into 3-dev Apr 1, 2020
@y-abs y-abs deleted the KZL-1462-collection-create branch April 1, 2020 07:43
@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