Search in sources :

Example 51 with JsonObject

use of com.eclipsesource.json.JsonObject in project hazelcast by hazelcast.

the class SlowOperationDetector_JsonTest method testJSON_SlowEntryProcessor.

@Test
public void testJSON_SlowEntryProcessor() {
    for (int i = 0; i < 2; i++) {
        map.executeOnEntries(getSlowEntryProcessor(3));
    }
    map.executeOnEntries(getSlowEntryProcessor(4));
    map.executeOnEntries(getSlowEntryProcessor(3));
    awaitSlowEntryProcessors();
    logger.finest(getOperationStats(instance).toString());
    JsonObject firstLogJsonObject = getSlowOperationLogsJsonArray(instance).get(0).asObject();
    assertJSONContainsClassName(firstLogJsonObject, "SlowEntryProcessor");
    assertEqualsStringFormat("Expected %d invocations, but was %d", 4, firstLogJsonObject.get("invocations").asArray().size());
}
Also used : JsonObject(com.eclipsesource.json.JsonObject) Test(org.junit.Test) SlowTest(com.hazelcast.test.annotation.SlowTest)

Example 52 with JsonObject

use of com.eclipsesource.json.JsonObject in project box-android-sdk by box.

the class BoxUser method createFromId.

/**
     * A convenience method to create an empty user with just the id and type fields set. This allows
     * the ability to interact with the content sdk in a more descriptive and type safe manner
     *
     * @param userId the id of user to create
     * @return an empty BoxUser object that only contains id and type information
     */
public static BoxUser createFromId(String userId) {
    JsonObject object = new JsonObject();
    object.add(BoxCollaborator.FIELD_ID, userId);
    object.add(BoxCollaborator.FIELD_TYPE, BoxUser.TYPE);
    BoxUser user = new BoxUser();
    user.createFromJson(object);
    return user;
}
Also used : JsonObject(com.eclipsesource.json.JsonObject)

Example 53 with JsonObject

use of com.eclipsesource.json.JsonObject in project box-android-sdk by box.

the class BoxBookmark method createFromId.

/**
     * A convenience method to create an empty bookmark with just the id and type fields set. This allows
     * the ability to interact with the content sdk in a more descriptive and type safe manner
     *
     * @param bookmarkId the id of folder to create
     * @return an empty BoxBookmark object that only contains id and type information
     */
public static BoxBookmark createFromId(String bookmarkId) {
    JsonObject object = new JsonObject();
    object.add(BoxItem.FIELD_ID, bookmarkId);
    object.add(BoxItem.FIELD_TYPE, BoxBookmark.TYPE);
    return new BoxBookmark(object);
}
Also used : JsonObject(com.eclipsesource.json.JsonObject)

Example 54 with JsonObject

use of com.eclipsesource.json.JsonObject in project box-android-sdk by box.

the class BoxCollection method createFromId.

public static BoxCollection createFromId(String id) {
    JsonObject object = new JsonObject();
    object.add(FIELD_ID, id);
    return new BoxCollection(object);
}
Also used : JsonObject(com.eclipsesource.json.JsonObject)

Example 55 with JsonObject

use of com.eclipsesource.json.JsonObject in project box-android-sdk by box.

the class BoxRequestUpdateSharedItem method setAccess.

/**
     * Sets the shared link access for the item in the request.
     *
     * @param access    new shared link access for the item.
     * @return  request with the updated shared link access.
     */
public R setAccess(BoxSharedLink.Access access) {
    JsonObject jsonObject = getSharedLinkJsonObject();
    jsonObject.add(BoxSharedLink.FIELD_ACCESS, SdkUtils.getAsStringSafely(access));
    BoxSharedLink sharedLink = new BoxSharedLink(jsonObject);
    mBodyMap.put(BoxItem.FIELD_SHARED_LINK, sharedLink);
    return (R) this;
}
Also used : JsonObject(com.eclipsesource.json.JsonObject) BoxSharedLink(com.box.androidsdk.content.models.BoxSharedLink)

Aggregations

JsonObject (com.eclipsesource.json.JsonObject)126 Test (org.junit.Test)41 ParallelTest (com.hazelcast.test.annotation.ParallelTest)38 QuickTest (com.hazelcast.test.annotation.QuickTest)38 JsonArray (com.eclipsesource.json.JsonArray)14 JsonUtil.getString (com.hazelcast.util.JsonUtil.getString)12 HashMap (java.util.HashMap)12 Map (java.util.Map)9 JsonValue (com.eclipsesource.json.JsonValue)5 ExecuteScriptRequest (com.hazelcast.internal.management.request.ExecuteScriptRequest)5 BoxSharedLink (com.box.androidsdk.content.models.BoxSharedLink)4 WanPublisherConfig (com.hazelcast.config.WanPublisherConfig)4 ChangeClusterStateRequest (com.hazelcast.internal.management.request.ChangeClusterStateRequest)3 ChangeWanStateRequest (com.hazelcast.internal.management.request.ChangeWanStateRequest)3 ILogger (com.hazelcast.logging.ILogger)3 IOException (java.io.IOException)3 BoxEntity (com.box.androidsdk.content.models.BoxEntity)2 ParseException (com.eclipsesource.json.ParseException)2 ClusterState (com.hazelcast.cluster.ClusterState)2 MapConfig (com.hazelcast.config.MapConfig)2