Package com.streamreduce.util

Examples of com.streamreduce.util.JSONObjectBuilder


    public Response getOAuthDetailsForProvider(@PathParam("providerId") String providerId) {
        try {
            OAuthEnabledConnectionProvider connectionProvider =
                    connectionProviderFactory.oauthEnabledConnectionProviderFromId(providerId);
            String authorizationUrl = connectionProvider.getAuthorizationUrl();
            JSONObject providerOAuthDetail = new JSONObjectBuilder()
                    .add("authorizationUrl",authorizationUrl)
                    .build();
            return Response.ok(providerOAuthDetail).build();
        } catch (NoSuchElementException e) {
            return error(providerId + " is not a registered oauth provider in Nodeable",
View Full Code Here


        when(mockUserService.createUser(user)).thenThrow(new InvalidUserAliasException("worst test ever"));

        ReflectionTestUtils.setField(adminUserVerificationResource,"userService",mockUserService);

        Response response = adminUserVerificationResource.completeUserSignupProcess("", new ObjectId().toString(),
                new JSONObjectBuilder()
                        .add("password", "password")
                        .add("alias", "maynard@toolband.com")
                        .add("fullname", "MJK")
                        .add("accountName", "TOOLBAND").build());
View Full Code Here

        when(mockUserService.createUser(user)).thenThrow(new InvalidUserAliasException("worst test ever"));

        ReflectionTestUtils.setField(adminUserVerificationResource,"userService",mockUserService);

        Response response = adminUserVerificationResource.completeUserInviteProcess("", new ObjectId().toString(),
                new JSONObjectBuilder()
                        .add("password", "password")
                        .add("alias", "maynard@toolband.com")
                        .add("fullname", "MJK")
                        .add("accountName", "TOOLBAND").build());
View Full Code Here

        sobaMessage.setId(new ObjectId());

        testUser.getConfig().put(User.ConfigKeys.RECEIVES_COMMENT_NOTIFICATIONS, false);

        testSenderUser.setId(new ObjectId());
        JSONObject payload = new JSONObjectBuilder()
                .add("subject", "Test Subject")
                .add("body", "Test Body")
                .add("recipient", "testuser@nodeable.com")
                .build();
View Full Code Here

                        .name(Constants.NODEABLE_SUPER_ACCOUNT_NAME)
                        .build();
                rootAccount = userService.createAccount(account);
            }

            JSONObject config = new JSONObjectBuilder().add("icon", "/images/nodebelly.jpg").build();

            // we are bypassing the lifecycle here, but still firing proper events
            User user = new User.Builder()
                    .username(Constants.NODEABLE_SYSTEM_USERNAME)
                    .password(superUserPassword)
                    .accountLocked(false)
                    .fullname("Nodeable")
                    .userStatus(User.UserStatus.ACTIVATED)
                    .roles(userService.getAdminRoles())
                    .account(rootAccount)
                    .alias("nodeable")
                    .userConfig(config)
                    .build();

            userService.createUser(user);
        }

        // create it if it doesn't exist
        if (getUser(Constants.NODEABLE_SUPER_USERNAME) == null) {

            JSONObject config = new JSONObjectBuilder().add("icon", "/images/nodebelly.jpg").build();

            // we are bypassing the lifecycle here, but still firing proper events
            User user = new User.Builder()
                    .username(Constants.NODEABLE_SUPER_USERNAME)
                    .password(superUserPassword)
View Full Code Here

    public Response getConfigValueByKey(@PathParam("key") String key) {
        User currentUser = securityService.getCurrentUser();
        Map<String,Object> userConfig = currentUser.getConfig();
        if (userConfig.containsKey(key)) {
            return Response.ok(
                    new JSONObjectBuilder().add(key, userConfig.get(key)).build()
            ).build();
        } else {
            return error(key + " does not exist", Response.status(Response.Status.NOT_FOUND));
        }
    }
View Full Code Here

        }
    }

    @Test
    public void testAddConnectionWithNoOutboundConfiguration() throws Exception {
        JSONObject connectionObject = new JSONObjectBuilder()
                .add("alias", "Feed Connection, Ya'll")
                .add("description", "Feed Connection, Ya'll")
                .add("visibility", "ACCOUNT")
                .add("providerId", "rss")
                .add("type", "feed")
View Full Code Here

    @Test
    public void testGetConnectionsByExternalId() {
        String externalId = "abcdef123456789";

        JSONObject connectionObject = new JSONObjectBuilder()
                .add("alias", "Feed Connection, Ya'll")
                .add("description", "Feed Connection, Ya'll")
                .add("visibility", "ACCOUNT")
                .add("providerId", "rss")
                .add("type", "feed")
View Full Code Here

    }

    @Test
    public void testConfigPOST() throws Exception {
        //Asserts that a config can be appended to and modified with the values of a new JSONObject
        JSONObject newConfigValues = new JSONObjectBuilder()
                .add("foo", 1)
                .add("bar", new JSONArray())
                .add(User.ConfigKeys.RECEIVES_COMMENT_NOTIFICATIONS, false)
                .build();
View Full Code Here

    @Test
    public void testConfigKeyPOST_arrayWithNull() {
        //Tests SOBA-2079 when passing in [null] as a key value in a JSONObject
        JSONArray array = new JSONArray();
        array.add(null);
        JSONObject newConfigValues = new JSONObjectBuilder()
                .add("foo", array)
                .build();
        Response responsePOST = userResource.setConfigValues(newConfigValues);
        assertEquals(Response.Status.OK.getStatusCode(), responsePOST.getStatus());
        JSONObject responseBody = (JSONObject) responsePOST.getEntity();
View Full Code Here

TOP

Related Classes of com.streamreduce.util.JSONObjectBuilder

Copyright © 2018 www.massapicom. 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.