Package com.streamreduce.core.model

Examples of com.streamreduce.core.model.ConnectionCredentials


    public void testSerializeAndDeserialize_EqualsAndHashCode() throws Exception {
        OutboundConfiguration outboundConfiguration = new OutboundConfiguration.Builder()
                .protocol("s3")
                .destination("us-east")
                .namespace("my.foo.bucket")
                .credentials(new ConnectionCredentials("foo", "bar"))
                .dataTypes(OutboundDataType.PROCESSED).build();
        OutboundConfigurationServiceDTO dtoBefore = new OutboundConfigurationServiceDTO(outboundConfiguration);
        ObjectMapper mapper = new ObjectMapper();
        String json = mapper.writeValueAsString(dtoBefore);
        OutboundConfigurationServiceDTO dtoAfter = mapper.reader(OutboundConfigurationServiceDTO.class).readValue(json);
View Full Code Here


        // Should be a duplicate due to the credentials
        assertNotNull(jsonToObject(makeRequest(connectionsBaseUrl + "/", "POST", json, authnToken),
                TypeFactory.defaultInstance().constructType(ErrorMessage.class)));

        // Set some different credentials so validation fails for the duplicate alias instead of duplicate credentials
        json.put("credentials", new ConnectionCredentials("FAKEUSERNAME", "FAKEPASSWORD"));

        // Should be a duplicate due to the name
        assertNotNull(jsonToObject(makeRequest(connectionsBaseUrl + "/", "POST", json, authnToken),
                TypeFactory.defaultInstance().constructType(ErrorMessage.class)));
View Full Code Here

        // Should be a duplicate due to the credentials
        assertNotNull(jsonToObject(makeRequest(connectionsBaseUrl + "/", "POST", json, authnToken),
                TypeFactory.defaultInstance().constructType(ErrorMessage.class)));

        // Set some different credentials so validation fails for the duplicate alias instead of duplicate credentials
        json.put("credentials", new ConnectionCredentials("FAKEUSERNAME", "FAKEPASSWORD"));

        // Should be a duplicate due to the name
        assertNotNull(jsonToObject(makeRequest(connectionsBaseUrl + "/", "POST", json, authnToken),
                TypeFactory.defaultInstance().constructType(ErrorMessage.class)));
View Full Code Here

            String name = jp.getCurrentName();
            String value = jp.getText();
            keyValues.put(name,value);
        }

        ConnectionCredentials cc = new ConnectionCredentials();
        cc.setIdentity(keyValues.get("identity"));
        cc.setCredential(keyValues.get("credential"));
        cc.setApiKey(keyValues.get("apiKey"));
        cc.setOauthToken(keyValues.get("oauthToken"));
        cc.setOauthTokenSecret(keyValues.get("oauthTokenSecret"));
        cc.setOauthVerifier(keyValues.get("oauthVerifier"));

        ConnectionCredentialsEncrypter credentialsEncrypter = new ConnectionCredentialsEncrypter();
        credentialsEncrypter.decrypt(cc);

        return cc;
View Full Code Here

    @Override
    public void serialize(ConnectionCredentials connectionCredentials, JsonGenerator jgen, SerializerProvider provider)
            throws IOException {

        //Create a copy so we don't encrypt the existing reference
        ConnectionCredentials copy = ConnectionCredentials.copyOf(connectionCredentials);

        ConnectionCredentialsEncrypter credentialsEncrypter = new ConnectionCredentialsEncrypter();
        credentialsEncrypter.encrypt(copy);

        jgen.writeStartObject();
        if (copy.getIdentity() != null) {
            jgen.writeStringField("identity",copy.getIdentity());
        }
        if (copy.getCredential() != null) {
            jgen.writeStringField("credential",copy.getCredential());
        }
        if (copy.getApiKey() != null) {
            jgen.writeStringField("apiKey",copy.getApiKey());
        }
        if (copy.getOauthToken() != null) {
            jgen.writeStringField("oauthToken",copy.getOauthToken());
        }
        if (copy.getOauthTokenSecret() != null) {
            jgen.writeStringField("oauthTokenSecret",copy.getOauthTokenSecret());
        }
        if (copy.getOauthVerifier() != null) {
            jgen.writeStringField("oauthVerifier",copy.getOauthVerifier());
        }
        jgen.writeEndObject();
    }
View Full Code Here

                TypeFactory.defaultInstance().constructCollectionType(List.class, ConnectionResponseDTO.class));

        assertEquals(25, allConnections.size()); // The 21 RSS feed connections, 1 AWS, 1 GitHub and 1 Jira

        cloud = createConnection(authnToken, "AWS Cloud Connection", "This is a test cloud connection to AWS.",
                new ConnectionCredentials(cloudProperties.getString("nodeable.aws.accessKeyId"),
                        cloudProperties.getString("nodeable.aws.secretKey")),
                ProviderIdConstants.AWS_PROVIDER_ID, null, ConnectionTypeConstants.CLOUD_TYPE, AuthType.USERNAME_PASSWORD);

        allConnections = jsonToObject(makeRequest(connectionsBaseUrl, "GET", null, authnToken),
                TypeFactory.defaultInstance().constructCollectionType(List.class, ConnectionResponseDTO.class));

        assertEquals(26, allConnections.size());

        jira = createConnection(authnToken, "Jira Connection", "This is a test project hosting connection to Jira.",
                new ConnectionCredentials(jiraProperties.getString("nodeable.jira.username"),
                        jiraProperties.getString("nodeable.jira.password")),
                ProviderIdConstants.JIRA_PROVIDER_ID, jiraProperties.getString("nodeable.jira.url"),
                ConnectionTypeConstants.PROJECT_HOSTING_TYPE, AuthType.USERNAME_PASSWORD);
        allConnections = jsonToObject(makeRequest(connectionsBaseUrl, "GET", null, authnToken),
                TypeFactory.defaultInstance()
                        .constructCollectionType(List.class, ConnectionResponseDTO.class));

        assertEquals(27, allConnections.size());

        gitHub = createConnection(authnToken, "GitHub Connection",
                "This is a test project hosting connection to GitHub.",
                new ConnectionCredentials(gitHubProperties.getString("nodeable.github.username"),
                        gitHubProperties.getString("nodeable.github.password")),
                ProviderIdConstants.GITHUB_PROVIDER_ID, null,
                ConnectionTypeConstants.PROJECT_HOSTING_TYPE, AuthType.USERNAME_PASSWORD);
        allConnections = jsonToObject(makeRequest(connectionsBaseUrl, "GET", null, authnToken),
                TypeFactory.defaultInstance()
View Full Code Here

    @Test
    @Ignore
    public void testUpdatingCredentials() throws Exception {
        gitHub = createConnection(authnToken, "GitHub Connection",
                "This is a test project hosting connection to GitHub.",
                new ConnectionCredentials(gitHubProperties.getString("nodeable.github.username"),
                        gitHubProperties.getString("nodeable.github.password")),
                ProviderIdConstants.GITHUB_PROVIDER_ID, null,
                ConnectionTypeConstants.PROJECT_HOSTING_TYPE, AuthType.USERNAME_PASSWORD);

        // To test that we can successfully change connection credentials via REST, we will change the credentials
View Full Code Here

    @Test
    @Ignore
    public void testCannotUpdateVisibilityToPublic() throws Exception {
        gitHub = createConnection(authnToken, "GitHub Connection",
                "This is a test project hosting connection to GitHub.",
                new ConnectionCredentials(gitHubProperties.getString("nodeable.github.username"),
                        gitHubProperties.getString("nodeable.github.password")),
                ProviderIdConstants.GITHUB_PROVIDER_ID, null,
                ConnectionTypeConstants.PROJECT_HOSTING_TYPE, AuthType.USERNAME_PASSWORD);

        JSONObject json = new JSONObject();
View Full Code Here

                .user(testUser)
                .url("http://someUrl" )
                .authType(AuthType.NONE)
                .outboundConfigurations(
                        new OutboundConfiguration.Builder()
                                .credentials(new ConnectionCredentials("accessKey", "secretKey" ))
                                .protocol("s3" )
                                .destination("my.bucket.name" )
                                .namespace("/key/prefix/here/" )
                                .dataTypes(OutboundDataType.PROCESSED)
                                .build()
View Full Code Here

        testUser = new User.Builder().account(new Account.Builder().name("ABC").build()).username("sampleUser").build();
        feedConnections = Arrays.asList(
                new Connection.Builder()
                        .provider(ConnectionProvidersForTests.RSS_PROVIDER)
                        .url("http://foo.url1.com/rss")
                        .credentials(new ConnectionCredentials("ident", "pass"))
                        .alias("connection1")
                        .user(testUser)
                        .authType(AuthType.NONE)
                        .build(),
                new Connection.Builder()
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.