Package com.streamreduce.util

Examples of com.streamreduce.util.JSONObjectBuilder


    @Autowired
    ConnectionResource connectionResource;

    @Test
    public void testCreateConnection_pingdom() throws Exception {
        JSONObject connectionObject = new JSONObjectBuilder()
                .add("alias", "Test Pingdom Connection")
                .add("description", "Test Pingdom Connection")
                .add("visibility", "ACCOUNT")
                .add("providerId", "pingdom")
                .add("type", "feed")
                .add("authType", "USERNAME_PASSWORD_WITH_API_KEY")
                .add("credentials", new JSONObjectBuilder()
                        .add("identity", "integrations@nodeable.com")
                        .add("credential", "n0debelly!")
                        .add("api_key", "uchthbctjlcfjp1msah1u596usepm57p")
                        .build())
                .add("inbound", true)
View Full Code Here


        Assert.assertNotNull(createConnectionResponseDTO);
    }

    @Test
    public void testCreateConnection_WebHDFS_invalidUrl() throws Exception {
        JSONObject connectionObject = new JSONObjectBuilder()
                .add("providerId", "custom")
                .add("alias", "addfsfsf")
                .add("type", "gateway")
                .add("visibility", "ACCOUNT")
                .add("credentials", new JSONObjectBuilder().build())
                .add("authType", "API_KEY")
                .array("outboundConfigurations", new JSONObjectBuilder()
                        .add("credentials", new JSONObjectBuilder()
                                .add("username", "df")
                                .build())
                        .add("protocol", "webhdfs")
                        .add("destination", "as")
                        .array("dataTypes", "INSIGHT")
View Full Code Here

        Assert.assertEquals(errorMessage.getErrorMessage(), "The destination URL was invalid: no protocol: as/");
    }

    @Test
    public void testUpdateConnection_WebHDFS_invalidUrl() throws Exception {
        JSONObject connectionObject = new JSONObjectBuilder()
                .add("providerId", "rss")
                .add("alias", "Test Bad RSS Feed 1")
                .add("type", "feed")
                .add("url", SAMPLE_FEED_FILE_PATH)
                .add("visibility", "ACCOUNT")
                .add("credentials", new JSONObjectBuilder().build())
                .add("authType", "USERNAME_PASSWORD")
                .array("outboundConfigurations", new JSONObjectBuilder()
                        .add("credentials", new JSONObjectBuilder()
                                .add("username", "hadoop")
                                .build())
                        .add("protocol", "webhdfs")
                        .add("destination", String.format("http://%s:%s/webhdfs/v1/", webhdfsProperties.getString("webhdfs.host"), webhdfsProperties.getString("webhdfs.port")))
                        .array("dataTypes", "INSIGHT")
                        .build())
                .build();

        JSONObject updateObject = new JSONObjectBuilder()
                .add("alias", "Test Bad RSS Feed 1")
                .array("outboundConfigurations", new JSONObjectBuilder()
                        .add("credentials", new JSONObjectBuilder()
                                .add("username", "df")
                                .build())
                        .add("protocol", "webhdfs")
                        .add("destination", "as")
                        .array("dataTypes", "INSIGHT")
View Full Code Here

    }

    @Test
    public void testAddConnectionWithOutboundConfiguration() throws Exception {
        String testBucketName = getTestBucketName();
        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")
                .add("authType", "NONE")
                .add("url", SAMPLE_FEED_FILE_PATH)
                .add("inbound", true)
                .array("outboundConfigurations", new JSONObjectBuilder()
                        .add("protocol", "s3")
                        .add("credentials", new JSONObjectBuilder()
                                .add("username", cloudProperties.getString("nodeable.aws.accessKeyId"))
                                .add("password", cloudProperties.getString("nodeable.aws.secretKey"))
                                .build())
                        .add("destination", "us-west-2")
                        .add("namespace", testBucketName)
View Full Code Here

    }

    @Test
    public void testUpdateConnectionWithOutboundConfiguration() throws Exception {
        //Create a connection to be used as an outbound connection first so we can re-use its id.
        JSONObject createConnectionObject = new JSONObjectBuilder()
                .add("alias", "Feed Connection, Ya'll")
                .add("description", "Feed Connection, Ya'll")
                .add("visibility", "ACCOUNT")
                .add("providerId", "rss")
                .add("type", "feed")
                .add("authType", "NONE")
                .add("url", SAMPLE_FEED_FILE_PATH)
                .add("inbound", true)
                .build();

        String testBucketName = getTestBucketName();
        JSONObject updateConnectionObject = new JSONObjectBuilder()
                .add("alias", "Feed Connection, Ya'll")
                .array("outboundConfigurations", new JSONObjectBuilder()
                        .add("credentials", new JSONObjectBuilder()
                                .add("username", cloudProperties.getString("nodeable.aws.accessKeyId"))
                                .add("password", cloudProperties.getString("nodeable.aws.secretKey"))
                                .build())
                        .add("protocol", "s3")
                        .add("destination", "us-west-2")
View Full Code Here

        testConnection.setProviderId(ProviderIdConstants.CUSTOM_PROVIDER_ID);
        testAccount = testConnection.getAccount();
        accountDAO.save(testAccount);
        userDAO.save(testConnection.getUser());
        connectionDAO.save(testConnection);
        inventoryService.createInventoryItem(testConnection, new JSONObjectBuilder().add("inventoryItemId",SAMPLE_EXTERNAL_ID).build());

    }
View Full Code Here

    }

    @Test
    public void testGetByExternalIdNotDeleted() throws Exception {
        InventoryItem deletedItem = inventoryService.createInventoryItem(testConnection,
                new JSONObjectBuilder().add("inventoryItemId",SAMPLE_EXTERNAL_ID).build());
        inventoryService.markInventoryItemDeleted(deletedItem);

        List<InventoryItem> inventoryItems = inventoryItemDAO.getByExternalId(SAMPLE_EXTERNAL_ID);
        assertEquals(2, inventoryItems.size());
View Full Code Here


    @Test
    @Ignore
    public void testEmail() throws Exception {
        JSONObject json = new JSONObjectBuilder()
                .add("recipient", "integrations@nodeable.com")
                .add("subject", "Testing email endpoint - subject")
                .add("body", "Testing email endpoint - body")
                .build();
        String url = getUrl() + "/" + userMessage.getMessageId() + "/email";
View Full Code Here

        List list = Lists.newArrayList(1,2,3,4);
        user.setConfigValue("foo",list );
        assertEquals(list , user.getConfig().get("foo"));

        //Map (based on JSONObject)
        JSONObject jsonObject = new JSONObjectBuilder().add("a","bar").add("b",5).build();
        user.setConfigValue("foo",jsonObject );
        assertEquals(new HashMap(jsonObject), user.getConfig().get("foo"));
    }
View Full Code Here

        String expectedApiKey = RandomStringUtils.randomAlphanumeric(10);
        String expectedOAuthToken = RandomStringUtils.randomAlphanumeric(10);
        String expectedOAuthTokenSecret = RandomStringUtils.randomAlphanumeric(10);

        Connection connection = TestUtils.createCloudConnection();
        JSONObject jsonObject = new JSONObjectBuilder()
                .add("credentials",new JSONObjectBuilder()
                    .add("identity",expectedIdentity)
                    .add("credential",expectedCredential)
                    .add("api_key",expectedApiKey)
                    .add("oauthToken",expectedOAuthToken)
                    .add("oauthTokenSecret",expectedOAuthTokenSecret)
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.