Package com.streamreduce.core.model

Examples of com.streamreduce.core.model.ConnectionCredentials


    @Test(expected = InvalidCredentialsException.class)
    public void testCreateJiraWithInvalidCredentials() throws Exception {
        Connection tmpConnection = new Connection.Builder()
                .alias("Nodeable Jira")
                .description("Nodeable's Jira instance.")
                .credentials(new ConnectionCredentials("fakeusername", "fakepassword"))
                .provider(connectionProviderFactory.connectionProviderFromId(ProviderIdConstants.JIRA_PROVIDER_ID))
                .url(jiraProperties.getString("nodeable.jira.url"))
                .authType(AuthType.USERNAME_PASSWORD)
                .user(testUser)
                .build();
View Full Code Here


                .account(testAccount)
                .alias("Test GitHub Connection")
                .description("This is a test GitHub connection.")
                .user(testUser)
                .authType(AuthType.USERNAME_PASSWORD)
                .credentials(new ConnectionCredentials("somegithubusername", "somegithubpassword"))
                .build();

        Event event = eventService.createEvent(EventId.CREATE, connection, null);

        Assert.assertNotNull(event);
View Full Code Here

    @Test
    public void testGitHubConnectionCRUD() throws Exception {
        Connection tmpConnection = new Connection.Builder()
                .alias("Nodeable GitHub")
                .description("Nodeable's GitHub instance.")
                .credentials(new ConnectionCredentials("fakeusername", "fakepassword"))
                .provider(connectionProviderFactory.connectionProviderFromId(ProviderIdConstants.GITHUB_PROVIDER_ID))
                .user(testUser)
                .authType(AuthType.USERNAME_PASSWORD)
                .build();

        /* Test creating an invalid connection (invalid credentials) */
        try {
            connectionService.createConnection(tmpConnection);
            fail("Should not be able to create a Jira connection with invalid credentials.");
        } catch (InvalidCredentialsException e) {
            // Expected
        }

        tmpConnection.setCredentials(new ConnectionCredentials(gitHubProperties.getString("nodeable.github.username"),
                gitHubProperties.getString("nodeable.github.password")));

        /* Test creating a valid connection */
        Connection connection = connectionService.createConnection(tmpConnection);

        assertNotNull(connection.getId());

        /* Verify the projects returned look like what we expect.  (This is fragile and depends on us knowing
           the projects the GitHub user we're testing with watches, owns and has access to as part of an org.
         */
        validateGitHubProjectHostingInventoryItems(connection);
        pollForProjectHostingActivity(connection);

        /* Test reading a connection (invalid id) */
        try {
            connectionService.getConnection(new ObjectId());
            fail("Should not be able to find a GitHub connection with an invalid id.");
        } catch (ConnectionNotFoundException e) {
            // Expected
        }

        /* Test reading a connection */
        connection = connectionService.getConnection(connection.getId());

        assertNotNull(connection);

        /* Test reading all GitHub connections */
        assertEquals(1, connectionService.getConnections(ProjectHostingProvider.TYPE, testUser).size());

        /* Test updating a connection (invalid credentials) */
        connection.setCredentials(new ConnectionCredentials("fakeusername", "fakepassword"));

        try {
            connectionService.createConnection(connection);
            fail("Should not be able to create a GitHub connection with invalid credentials.");
        } catch (InvalidCredentialsException e) {
            // Expected
        }

        /* Test updating a connection */
        connection.setCredentials(new ConnectionCredentials(gitHubProperties.getString("nodeable.github.username"),
                gitHubProperties.getString("nodeable.github.password")));
        connection.setDescription("Updated description.");

        connection = connectionService.updateConnection(connection);

View Full Code Here

public class OutboundClientFactoryTest {

    @Test
    public void testOutboundConnectionForS3ReturnsS3OutboundClient() {
        OutboundConfiguration outboundAWSConnection = new OutboundConfiguration.Builder()
                .credentials(new ConnectionCredentials("user", "pass" ))
                .dataTypes(OutboundDataType.RAW)
                .protocol("s3")
                .build();

        OutboundClient outboundClient = new OutboundClientFactory()
View Full Code Here

    }

    @Test
    public void testOutboundConnectionForWebHDFSReturnsWebHDFSOutboundClient() {
        OutboundConfiguration outboundAWSConnection = new OutboundConfiguration.Builder()
                .credentials(new ConnectionCredentials("user", "pass" ))
                .dataTypes(OutboundDataType.RAW)
                .destination("http://www.test.com/webhdfs/v1/")
                .protocol("webhdfs")
                .build();
View Full Code Here

    public static ConnectionCredentials createConnectionCredentialsForAWS() {
        ResourceBundle cloudProps = ResourceBundle.getBundle("cloud");
        String accessKeyId = cloudProps.getString("nodeable.aws.accessKeyId");
        String secretKey = cloudProps.getString("nodeable.aws.secretKey");
        return new ConnectionCredentials(accessKeyId,secretKey);
    }
View Full Code Here

        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());
View Full Code Here

        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)
                .authType(AuthType.NONE)
                .build();
View Full Code Here

        }

        //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() + "/";
View Full Code Here

            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());
        }

        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() + "/";
View Full Code Here

TOP

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

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.