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

Add collection:update#93

Merged
jenow merged 7 commits into
3-devfrom
KZL-1462-collection-updateMapping
May 29, 2020
Merged

Add collection:update#93
jenow merged 7 commits into
3-devfrom
KZL-1462-collection-updateMapping

Conversation

@y-abs
Copy link
Copy Markdown
Contributor

@y-abs y-abs commented May 20, 2020

What does this PR do ?

This PR implements the collection:update 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 updateCollection {
    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);

            kuzzle.getCollectionController().update("mtp-open-data", "dark-taxi", mapping).get();
        }  catch (Exception e) {
            e.printStackTrace();
        }

        kuzzle.disconnect();
    }
};

Boyscout

Remove the useless DocumentControllerTest directory and put the test file one level upper with others controller tests files

@y-abs y-abs self-assigned this May 20, 2020
Comment thread doc/3/controllers/collection/update/index.md Outdated

```java
{
properties={
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.

You should add dydnamic and metadata in this example

y-abs and others added 2 commits May 28, 2020 02:02
Co-authored-by: Adrien Maret <amaret93@gmail.com>
@jenow jenow merged commit 07ec3f7 into 3-dev May 29, 2020
@jenow jenow deleted the KZL-1462-collection-updateMapping branch May 29, 2020 09:08
@Shiranuit Shiranuit mentioned this pull request Nov 20, 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