Package com.streamreduce.core.model

Examples of com.streamreduce.core.model.Connection


    AWSClient awsClientUnderTest;

    @Before
    public void setUp() {
        Connection mockConnection = mock(Connection.class);
        when(mockConnection.getProviderId()).thenReturn(ProviderIdConstants.AWS_PROVIDER_ID);
        awsClientUnderTest = new AWSClient(mockConnection);
    }
View Full Code Here


    @Test
    public void testConvertOutboundConnectionToBucketName_UsesAccountId() throws Exception {
        ObjectId accountId = new ObjectId();
        Account acct = new Account.Builder().name("testacct").build();
        acct.setId(accountId);
        Connection mockConnection = mock(Connection.class);
        when(mockConnection.getAccount()).thenReturn(acct);

        OutboundConfiguration mockOutboundConfiguration = mock(OutboundConfiguration.class);
        when(mockOutboundConfiguration.getNamespace()).thenReturn(null);
        when(mockOutboundConfiguration.getOriginatingConnection()).thenReturn(mockConnection);
View Full Code Here

                            .protocol("s3")
                            .build()
            ) ;
        }

        Connection c = cb.build();
        c.setId(new ObjectId());

        return c;
    }
View Full Code Here

    }

    @Test
    @Ignore("Integration Tests depended on sensitive account keys, ignoring until better harness is in place.")
    public void testGetAllMessagesSearchParameterForSenderName() throws Exception {
        Connection c = testService.createSampleRssFeedPrivateConnectionAndRefresh(testUser);

        //Search for all messages from the Connection.alias sender name.  There should be 3 total (2 feed entries and 1 for creation).
        List<SobaMessage> messages = messageService.getAllMessages(testUser, null, null, 50, false, c.getAlias(), null, null, false);
        Assert.assertEquals(3, messages.size());
    }
View Full Code Here

                            .protocol("s3")
                            .build()
            ) ;
        }

        Connection connection = cb.build();
        connection.setId(new ObjectId());
        return cb.build();
    }
View Full Code Here

    @Test
    @Ignore("Integration Tests depended on sensitive account keys, ignoring until better harness is in place.")
    public void testGetAllMessagesSearchParameterDoesNotRevealPrivates() throws Exception {
        long beforeCreateConnectionTimestamp = System.currentTimeMillis();
        Connection c = testService.createSampleRssFeedPrivateConnectionAndRefresh(testUser);


        // The super user should not see those same messages.
        User superUser = userService.getSuperUser();
        superUser.setAccount(testUser.getAccount());
        List<SobaMessage> messagesForSuperUser = messageService.getAllMessages(superUser, beforeCreateConnectionTimestamp, null, 5, false, c.getAlias(), null, null, false);
        Assert.assertEquals(0, messagesForSuperUser.size());
    }
View Full Code Here

        String secretKey = cloudProps.getString("nodeable.aws.secretKey");
        return new ConnectionCredentials(accessKeyId,secretKey);
    }

    public static Connection createCloudConnection() {
        Connection c = new Connection.Builder()
                .credentials(createConnectionCredentialsForAWS())
                .description("This is Nodeable's AWS cloud.")
                .alias("Nodeable Cloud")
                .provider(ConnectionProvidersForTests.AWS_CLOUD_PROVIDER)
                .user(createTestUser())
                .authType(AuthType.USERNAME_PASSWORD)
                .build();

        c.setId(new ObjectId());

        return c;
    }
View Full Code Here

        account.setId(new ObjectId());

        User user = new User.Builder().username("hey").account(account).build();
        user.setId(new ObjectId());

        Connection connection = new Connection.Builder()
                .provider(ConnectionProvidersForTests.RSS_PROVIDER)
                .url("http://foo.url1.com/rss")
                .credentials(new ConnectionCredentials("ident", "pass"))
                .alias("connection1")
                .user(user)
                .authType(AuthType.NONE)
                .build();
        connection.setId(new ObjectId());

        return connection;

    }
View Full Code Here

        super.tearDown();
    }

    @Test
    public void testSendRawMessageAppearsInS3() throws Exception {
        Connection testIMGConnection = createAndMockForIMGConnectionWithOutboundTypes(OutboundDataType.RAW);
        testIMGConnection.setUser(testUser);
        testIMGConnection.setAccount(testAccount);
        testIMGConnection.setId(null);
        connectionService.createConnection(testIMGConnection);

        JSONObject imgPayload  = TestUtils.createValidSampleIMGPayload();
        Response response = gatewayResource.createCustomConnectionMessage(imgPayload); //magic happens here

        //Start verification
        if (response.getStatus() != 201) {
            ErrorMessage e = (ErrorMessage) response.getEntity();
            Assert.fail("Unable to verify test due to IMG failure.  Response has a status of " + response.getStatus() +
                    " and an error message of : " + e.getErrorMessage());
        }

        //Give enough time for this to trickle to SQS and back to server
        Thread.sleep(TimeUnit.SECONDS.toMillis(10));

        ConnectionCredentials s3Creds = new ArrayList<>(
                testIMGConnection.getOutboundConfigurations()).get(0).getCredentials();
        s3TestUtils = new S3TestUtils(s3Creds);

        String expectedBucketName = "com.streamreduce." + testIMGConnection.getAccount().getId();
        String prefix = "raw/" + testIMGConnection.getId() + "/";
        Blob payload = s3TestUtils.getFirstBlobFromS3ThatMatchesPrefix(expectedBucketName, prefix);

        JSONObject jsonPayload = JSONObject.fromObject(IOUtils.toString(payload.getPayload().getInput()));
        Assert.assertEquals(imgPayload,jsonPayload);
    }
View Full Code Here

    }

    private Connection createInvalidSenderWithNoIds() {
        User user = new User.Builder().username("hey").account(new Account.Builder().name("ho").build()).build();

        Connection connection = new Connection.Builder()
                .provider(ConnectionProvidersForTests.RSS_PROVIDER)
                .url("http://foo.url1.com/rss")
                .credentials(new ConnectionCredentials("ident", "pass"))
                .alias("connection1")
                .user(user)
View Full Code Here

TOP

Related Classes of com.streamreduce.core.model.Connection

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.