Package com.streamreduce.core.model

Examples of com.streamreduce.core.model.ConnectionCredentials


        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


    public PingdomClient(Connection connection) {
        super(connection);
        this.connection = connection;

        ConnectionCredentials credentials = connection.getCredentials();
        if (credentials == null) {
            throw new IllegalArgumentException("Connection must have username/password credentials.");
        }

        apiKey = credentials.getApiKey();
        httpClient.getCredentialsProvider().setCredentials(new AuthScope(PINGDOM_HOST, 443),
                new UsernamePasswordCredentials(getConnectionCredentials().getIdentity(),
                        getConnectionCredentials().getCredential()));
    }
View Full Code Here

     * Pingdom requires both username/password and an API key.
     *
     * @throws InvalidCredentialsException
     */
    private void validateCredentials() throws InvalidCredentialsException {
        ConnectionCredentials creds = connection.getCredentials();
        if (creds == null || (creds.getIdentity() == null || creds.getCredential() == null || creds.getApiKey() == null)) {
            throw new InvalidCredentialsException("Connection credentials require a username, password and API key.");
        }
    }
View Full Code Here

    @BeforeClass
    public static void setUp() throws Exception {
        outboundConfigurationBuilder = new OutboundConfiguration.Builder()
                .protocol("webhdfs")
                .destination(testFileUrl)
                .credentials(new ConnectionCredentials("hadoop", null))
                .dataTypes(OutboundDataType.EVENT); //doesn't matter in this context
        WebHDFSClient webHDFSClient = new WebHDFSClient(outboundConfigurationBuilder.build());
        webHDFSClient.createFile("some content".getBytes("UTF-8"));
    }
View Full Code Here

    @AfterClass
    public static void tearDown() throws Exception {
        WebHDFSClient webHDFSClient = new WebHDFSClient(
                outboundConfigurationBuilder
                        .destination(testFileUrl)
                        .credentials(new ConnectionCredentials("hadoop", null))
                        .build());
        Assert.assertTrue(webHDFSClient.delete(true));

        webHDFSClient = new WebHDFSClient(
                outboundConfigurationBuilder
                        .destination(String.format("http://%s:%s/webhdfs/v1/mkdirstest", host, port))
                        .credentials(new ConnectionCredentials("hadoop", null))
                        .dataTypes(OutboundDataType.EVENT) //doesn't matter in this context
                        .build());
        Assert.assertTrue(webHDFSClient.delete(true));
    }
View Full Code Here

    @Test
    public void testValidateConnection_fileNotFound() throws Exception {
        WebHDFSClient webHDFSClient = new WebHDFSClient(
                outboundConfigurationBuilder
                        .destination(String.format("http://%s:%s/webhdfs/v1/foo", host, port))
                        .credentials(new ConnectionCredentials("hadoop", null))
                        .build());
        try {
            webHDFSClient.validateConnection();
            fail("Should have encountered IOException and didn't.");
        }
View Full Code Here

        testConnection = TestUtils.createCloudConnection();

        outboundConfiguration = new OutboundConfiguration.Builder()
                .protocol("webhdfs")
                .destination(testFileUrl)
                .credentials(new ConnectionCredentials("hadoop", null))
                .dataTypes(OutboundDataType.RAW, OutboundDataType.EVENT, OutboundDataType.RAW,
                        OutboundDataType.PROCESSED)
                .originatingConnection(testConnection)
                .build();
        outboundClient = new WebHDFSOutboundClient(outboundConfiguration);
View Full Code Here

    @Test
    public void testValidateConnection_invalidCredentials() throws Exception {
        WebHDFSClient webHDFSClient = new WebHDFSClient(
                outboundConfigurationBuilder
                        .destination(String.format("http://%s:%s/webhdfs/v1/", host, port))
                        .credentials(new ConnectionCredentials("root", null))
                        .build());
        try {
            webHDFSClient.validateConnection();
            fail("Should have encountered InvalidCredentialsException and didn't.");
        }
View Full Code Here

    @Test
    public void testReadFile() throws Exception {
        WebHDFSClient webHDFSClient = new WebHDFSClient(
                outboundConfigurationBuilder
                        .destination(testFileUrl)
                        .credentials(new ConnectionCredentials("hadoop", null))
                        .build());
        byte[] data = webHDFSClient.readFile();
        assertEquals(new String(data), "some content");
    }
View Full Code Here

    @Test
    public void testMkdirs() throws Exception {
        WebHDFSClient webHDFSClient = new WebHDFSClient(
                outboundConfigurationBuilder
                        .destination(String.format("http://%s:%s/webhdfs/v1/", host, port))
                        .credentials(new ConnectionCredentials("hadoop", null))
                        .build());
        Assert.assertFalse(webHDFSClient.exists("mkdirstest"));
        webHDFSClient.mkdirs("mkdirstest");
        Assert.assertTrue(webHDFSClient.exists("mkdirstest"));
    }
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.