Examples of BoxJSONParser


Examples of com.box.boxjavalibv2.jsonparsing.BoxJSONParser

public class DefaultAuthHeaderAuthTest {

    @Test
    public void testSetAuth() throws BoxRestException, AuthFatalFailureException {
        DefaultBoxRequest request = new DefaultBoxRequest(TestUtils.getConfig(), new BoxJSONParser(new BoxResourceHub()), "fakeuri", RestMethod.GET, null);
        String token = "test token";
        String apiKey = "test api key";
        String deviceId = "f9h30fhflzkhg84ghgzhgr534653";
        String deviceName = "Galaxy Death Star";
        DefaultAuthHeaderAuth auth = new DefaultAuthHeaderAuth(token, apiKey, deviceId, deviceName);
View Full Code Here

Examples of com.box.boxjavalibv2.jsonparsing.BoxJSONParser

public class DefaultUsernamePasswordAuthTest {

    @Test
    public void testSetAuth() {
        try {
            DefaultBoxRequest request = new DefaultBoxRequest(TestUtils.getConfig(), new BoxJSONParser(new BoxResourceHub()), "/uri", RestMethod.GET, null);
            String userName = "testusername";
            String password = "testpassword";

            DefaultUsernamePasswordAuth auth = new DefaultUsernamePasswordAuth(userName, password);
            auth.setAuth(request);
View Full Code Here

Examples of com.box.boxjavalibv2.jsonparsing.BoxJSONParser

            inputStream = new ByteArrayInputStream(testObject.toString().getBytes());
            EasyMock.expect(boxResponse.getHttpResponse()).andReturn(response);
            EasyMock.expect(response.getEntity()).andReturn(entity);
            EasyMock.expect(entity.getContent()).andReturn(inputStream);
            EasyMock.replay(boxResponse, response, entity);
            DefaultBoxJSONResponseParser parser = new DefaultBoxJSONResponseParser(TestObject.class, new BoxJSONParser(new BoxResourceHub()));
            Object object = parser.parse(boxResponse);
            Assert.assertEquals(TestObject.class, object.getClass());
            TestObject tObject = (TestObject) object;
            Assert.assertEquals(fieldA, tObject.getFieldAWithAnnotation());
            Assert.assertEquals(fieldB, tObject.getFieldB());
View Full Code Here

Examples of com.box.boxjavalibv2.jsonparsing.BoxJSONParser

import com.box.restclientv2.requestsbase.DefaultBoxRequest;

public class MockRequest extends DefaultBoxRequest {

    public MockRequest() throws BoxRestException {
        super(TestUtils.getConfig(), new BoxJSONParser(new BoxResourceHub()), "uri", RestMethod.GET, null);
    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonparsing.BoxJSONParser

        }
    }

    private static BoxClient getAuthenticatedClient(String code) throws BoxRestException,     BoxServerException, AuthFatalFailureException {
        BoxResourceHub hub = new BoxResourceHub();
        BoxJSONParser parser = new BoxJSONParser(hub);
        IBoxConfig config = (new BoxConfigBuilder()).build();
        BoxClient client = new BoxClient(key, secret, hub, parser, config);
        BoxOAuthToken bt = client.getOAuthManager().createOAuth(code, key, secret, "http://localhost:" + PORT);
        client.authenticate(bt);
        return client;
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.