Examples of MapJSONStringEntity


Examples of com.box.boxjavalibv2.jsonentities.MapJSONStringEntity

        String userId = "testuserid";
        String role = "testrole";
        BoxGroupMembershipRequestObject obj = BoxGroupMembershipRequestObject.addMembershipRequestObject(groupId, userId, role);
        Object groupObj = obj.getFromEntity(BoxGroupMembership.FIELD_GROUP);
        Assert.assertTrue(groupObj instanceof MapJSONStringEntity);
        MapJSONStringEntity groupEntity = (MapJSONStringEntity) groupObj;
        Assert.assertEquals(groupId, groupEntity.get(BoxGroup.FIELD_ID));

        Object userObj = obj.getFromEntity(BoxGroupMembership.FIELD_USER);
        Assert.assertTrue(userObj instanceof MapJSONStringEntity);
        MapJSONStringEntity userEntity = (MapJSONStringEntity) userObj;
        Assert.assertEquals(userId, userEntity.get(BoxUser.FIELD_ID));

        Assert.assertEquals(role, obj.getFromEntity(BoxGroupMembership.FIELD_ROLE));
    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonentities.MapJSONStringEntity

    @Test
    public void testParentInObject() throws BoxRestException, BoxJSONException {
        String parentid = "testid";
        BoxItemRestoreRequestObject obj = BoxItemRestoreRequestObject.restoreItemRequestObject().setNewParent(parentid);

        MapJSONStringEntity entity = (MapJSONStringEntity) obj.getFromEntity(PARENT);

        Assert.assertEquals(parentid, entity.get(BoxFolder.FIELD_ID));
    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonentities.MapJSONStringEntity

        String name = "testname";
        String parentid = "testid";
        BoxItemRestoreRequestObject obj = BoxItemRestoreRequestObject.restoreItemRequestObject().setNewName(name).setNewParent(parentid);

        Assert.assertEquals(name, obj.getFromEntity(NAME));
        MapJSONStringEntity entity = (MapJSONStringEntity) obj.getFromEntity(PARENT);

        Assert.assertEquals(parentid, entity.get(BoxFolder.FIELD_ID));
    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonentities.MapJSONStringEntity

        return me;
    }

    private static IBoxJSONStringEntity getMetadataBody(String parentId, String name) throws UnsupportedEncodingException, BoxRestException, BoxJSONException {
        MapJSONStringEntity parentEntity = new MapJSONStringEntity();
        parentEntity.put(Constants.ID, parentId);

        MapJSONStringEntity entity = new MapJSONStringEntity();
        entity.put(KEY_PARENT, parentEntity);
        entity.put(KEY_NAME, name);
        return entity;
    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonentities.MapJSONStringEntity

    /**
     * This is package protected, any class overriding this should be in a same package.
     */
    HttpEntity getEntity(IBoxJSONParser parser) throws BoxRestException, BoxJSONException, UnsupportedEncodingException {
        MapJSONStringEntity en = getJSONEntity();
        if (en == null) {
            return null;
        }
        try {
            return new StringEntity(en.toJSONString(parser), CharEncoding.UTF_8);
        }
        catch (UnsupportedEncodingException e) {
            throw new BoxRestException(e);
        }
    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonentities.MapJSONStringEntity

     *
     * @param parentId
     * @return
     */
    public BoxItemRestoreRequestObject setNewParent(final String parentId) {
        MapJSONStringEntity id = new MapJSONStringEntity();
        id.put(BoxFolder.FIELD_ID, parentId);
        put(BoxItem.FIELD_PARENT, id);
        return this;
    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonentities.MapJSONStringEntity

     *            access level
     * @param email
     *            email address
     */
    public void setUploadEmail(String access, String email) {
        MapJSONStringEntity entity = new MapJSONStringEntity();
        entity.put(BoxEmail.FIELD_ACCESS, access);
        entity.put(BoxEmail.FIELD_EMAIL, email);
        put(BoxFolder.FIELD_FOLDER_UPLOAD_EMAIL, entity);
    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonentities.MapJSONStringEntity

        BoxGroupMembershipRequestObject obj = new BoxGroupMembershipRequestObject();
        return obj.setRole(role);
    }

    public BoxGroupMembershipRequestObject setGroup(final String groupId) {
        MapJSONStringEntity groupEntity = new MapJSONStringEntity();
        groupEntity.put(BoxGroup.FIELD_ID, groupId);
        put(BoxGroupMembership.FIELD_GROUP, groupEntity);
        return this;
    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonentities.MapJSONStringEntity

        put(BoxGroupMembership.FIELD_ROLE, role);
        return this;
    }

    public BoxGroupMembershipRequestObject setUser(final String userId) {
        MapJSONStringEntity userEntity = new MapJSONStringEntity();
        userEntity.put(BoxUser.FIELD_ID, userId);
        put(BoxGroupMembership.FIELD_USER, userEntity);
        return this;
    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonentities.MapJSONStringEntity

            TestUtils.getConfig().getApiUrlPath().concat(UpdateUserLoginRequest.getUri(userId)), HttpStatus.SC_OK, RestMethod.PUT);

        HttpEntity entity = request.getRequestEntity();
        Assert.assertTrue(entity instanceof StringEntity);

        MapJSONStringEntity mEntity = new MapJSONStringEntity();
        mEntity.put("login", newLogin);
        assertEqualStringEntity(mEntity, entity);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.