Examples of BoxResourceHub


Examples of com.box.boxjavalibv2.jacksonparser.BoxResourceHub

     * Create a resource hub, which directs the Jackson JSON processor to parse api responses into different objects.
     *
     * @return IBoxResourceHub
     */
    protected IBoxResourceHub createResourceHub() {
        return new BoxResourceHub();
    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonparsing.BoxResourceHub

        return tmp;
    }

    @SuppressWarnings({"unchecked", "rawtypes"})
    public static BoxObject getFromJSON(String json, Class cls) throws BoxRestException {
        BoxJSONParser jsonParser = new BoxJSONParser(new BoxResourceHub());
        return jsonParser.parseIntoBoxObjectQuietly(json, (Class<BoxObject>) cls);
    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonparsing.BoxResourceHub

        BoxConfigBuilder builder = new BoxConfigBuilder();
        return builder.build();
    }

    public static IBoxJSONParser getJsonParser() {
        return new BoxJSONParser(new BoxResourceHub());
    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonparsing.BoxResourceHub

        entity.setUnshared_at(date);

        String accessStr = String.format(ACCESS_STR, access);
        String dateStr = String.format(UNSHARED_STR, ISO8601DateParser.toString(date));

        String entityStr = entity.toJSONString(new BoxJSONParser(new BoxResourceHub()));
        Assert.assertFalse(entityStr.contains(PERMISSIONS_STR));
        Assert.assertTrue(entityStr.contains(accessStr));
        Assert.assertTrue(entityStr.contains(dateStr));
    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonparsing.BoxResourceHub

        String access = BoxSharedLinkAccess.OPEN;
        BoxSharedLinkRequestEntity entity = new BoxSharedLinkRequestEntity(access);
        entity.setPermissions(true);
        String accessStr = String.format(ACCESS_STR, access);

        String entityStr = entity.toJSONString(new BoxJSONParser(new BoxResourceHub()));
        Assert.assertFalse(entityStr.contains(PERMISSIONS_STR));
        Assert.assertTrue(entityStr.contains(accessStr));
        Assert.assertFalse(entityStr.contains("\"unshared_at\":"));

    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonparsing.BoxResourceHub

        String name = "testname";
        String value = "testvalue";
        MapJSONStringEntity entity = new MapJSONStringEntity();

        entity.put(name, value);
        Assert.assertEquals(String.format(json, name, value), entity.toJSONString(new BoxJSONParser(new BoxResourceHub())));
    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonparsing.BoxResourceHub

        entity = EasyMock.createMock(StringEntity.class);
    }

    @Test
    public void testCanParseBoxObject() throws IllegalStateException, IOException, BoxRestException, BoxJSONException {
        BoxResourceHub hub = new BoxResourceHub();
        EasyMock.reset(boxResponse, response, entity);
        inputStream = new ByteArrayInputStream((new BoxJSONParser(hub)).convertBoxObjectToJSONString(file).getBytes());
        EasyMock.expect(boxResponse.getHttpResponse()).andReturn(response);
        EasyMock.expect(response.getEntity()).andReturn(entity);
        EasyMock.expect(entity.getContent()).andReturn(inputStream);
View Full Code Here

Examples of com.box.boxjavalibv2.jsonparsing.BoxResourceHub

        statusLine = EasyMock.createMock(StatusLine.class);
    }

    @Test
    public void testCanParseBoxServerError() throws BoxRestException, IllegalStateException, IOException, BoxJSONException {
        BoxJSONParser jsonParser = new BoxJSONParser(new BoxResourceHub());
        EasyMock.reset(boxResponse, response, entity);
        inputStream = new ByteArrayInputStream(jsonParser.convertBoxObjectToJSONString(error).getBytes());
        EasyMock.expect(boxResponse.getHttpResponse()).andStubReturn(response);
        EasyMock.expect(response.getEntity()).andStubReturn(entity);
        EasyMock.expect(entity.getContent()).andStubReturn(inputStream);
View Full Code Here

Examples of com.box.boxjavalibv2.jsonparsing.BoxResourceHub

     * Create a resource hub
     *
     * @return IBoxResourceHub
     */
    protected IBoxResourceHub createResourceHub() {
        return new BoxResourceHub();
    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonparsing.BoxResourceHub

    }

    @Test
    public void prepareRequestTest() throws AuthFatalFailureException {
        try {
            DefaultBoxRequest request = new DefaultBoxRequest(config, new BoxJSONParser(new BoxResourceHub()), uri, restMethod, null);
            request.addQueryParam("a", "b");
            request.setEntity(requestEntity);
            request.prepareRequest();
            HttpRequestBase rawRequest = request.getRawRequest();
            Assert.assertEquals(HttpPost.class, rawRequest.getClass());
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.