Package com.streamreduce.core.model

Examples of com.streamreduce.core.model.Connection


                .protocol("s3")
                .namespace("com.streamreduce.bucket")
                .dataTypes(OutboundDataType.PROCESSED)
                .build();

        Connection feedConnection = new Connection.Builder()
                .alias("EC2 Test Connection")
                .description("Reports the status of Amazon Elastic Compute Cloud (N. California).")
                .visibility(SobaObject.Visibility.ACCOUNT)
                .provider(connectionProviderFactory.connectionProviderFromId(ProviderIdConstants.FEED_PROVIDER_ID))
                .user(testUser)
                .authType(AuthType.NONE)
                .url("status.aws.amazon.com/rss/ec2-us-west-1.rss?junkParam")
                .outboundConfigurations(outboundConfiguration)
                .build();

        Connection createdFeedConnection = connectionService.createConnection(feedConnection);
        ObjectId objectId = createdFeedConnection.getId();

        Connection retrievedConnection = connectionService.getConnection(objectId);
        Set<OutboundConfiguration> retrievedConnectionOutboundConfigurations = retrievedConnection.getOutboundConfigurations();
        Set<OutboundConfiguration> feedConnectionOutboundConfigurations = feedConnection.getOutboundConfigurations();
        OutboundConfiguration[] retrivedConfigurations = retrievedConnectionOutboundConfigurations.toArray(new OutboundConfiguration[retrievedConnectionOutboundConfigurations.size()]);
        OutboundConfiguration[] feedConfigurations = feedConnectionOutboundConfigurations.toArray(new OutboundConfiguration[feedConnectionOutboundConfigurations.size()]);
        Assert.assertEquals(retrivedConfigurations[0], feedConfigurations[0]);
        Assert.assertEquals(retrievedConnection.getId(), feedConnection.getId());
    }
View Full Code Here


        Assert.assertEquals(retrievedConnection.getId(), feedConnection.getId());
    }

    @Test(expected = Exception.class)
    public void testCreateJiraConnectionWithInvalidURLFails() throws Exception {
        Connection tmpConnection = new Connection.Builder()
                .alias("Nodeable Jira")
                .description("Nodeable's Jira instance.")
                .credentials(new ConnectionCredentials(jiraProperties.getString("nodeable.jira.username"),
                        jiraProperties.getString("nodeable.jira.password")))
                .provider(connectionProviderFactory.connectionProviderFromId(ProviderIdConstants.JIRA_PROVIDER_ID))
View Full Code Here

        connectionService.createConnection(tmpConnection);
    }

    @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"))
View Full Code Here

            if (metricName.startsWith("INVENTORY_ITEM_COUNT.")) {
                return null;
            }

            // get the connection where applicable
            Connection connection = null;
            try {
                ObjectId connectionId = null;
                // ugh
                if (objectType.contains("Connection")) {
                    connectionId = event.getTargetId();
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    public Connection getConnection(ObjectId id) throws ConnectionNotFoundException {
        Connection connection = connectionDAO.get(id);

        if (connection == null) {
            // TODO: Event handling
            throw new ConnectionNotFoundException(id == null ? "null" : id.toString());
        }
View Full Code Here

                extraMetadata.put("targetFuid", tAccount.getFuid());
                extraMetadata.put("targetName", tAccount.getName());

            } else if (target instanceof InventoryItem) {
                InventoryItem inventoryItem = (InventoryItem)target;
                Connection connection = inventoryItem.getConnection();
                ConnectionProvider tConnectionProvider = connectionProviderFactory.connectionProviderFromId(
                        connection.getProviderId());

                extraMetadata.put("targetExternalId", inventoryItem.getExternalId());
                extraMetadata.put("targetExternalType", inventoryItem.getType());

                extraMetadata.put("targetConnectionId", connection.getId());
                extraMetadata.put("targetConnectionAlias", connection.getAlias());
                extraMetadata.put("targetConnectionHashtags", connection.getHashtags());
                extraMetadata.put("targetConnectionVersion", connection.getVersion());

                extraMetadata.put("targetProviderId", tConnectionProvider.getId());
                extraMetadata.put("targetProviderDisplayName", tConnectionProvider.getDisplayName());
                extraMetadata.put("targetProviderType", tConnectionProvider.getType());

                // Fill in the extra metadata stored in the nodeMetadata
                extraMetadata.putAll(getMetadataFromInventoryItem(inventoryItem));
            } else if (target instanceof Connection) {
                Connection tConnection = (Connection) target;
                ConnectionProvider tConnectionProvider = connectionProviderFactory.connectionProviderFromId(
                        tConnection.getProviderId());

                extraMetadata.put("targetProviderId", tConnectionProvider.getId());
                extraMetadata.put("targetProviderDisplayName", tConnectionProvider.getDisplayName());
                extraMetadata.put("targetProviderType", tConnectionProvider.getType());
View Full Code Here

        NodeableAuthenticationToken token = (GatewayAuthenticaionToken) authcToken;

        logger.debug("Attempting to get gateway api authentication info for" + ((GatewayAuthenticaionToken) authcToken).getToken());

        Connection connection = securityService.getByApiKey(token.getToken(), GatewayProvider.TYPE);

        if (connection == null) {
            throw new AuthenticationException(ErrorMessages.INVALID_CREDENTIAL);
        }

        logger.debug("ConnectionId is set to " + connection.getId());

        // all is well so far...
        return new SimpleAuthenticationInfo(connection.getCredentials().getIdentity(), "", getName());
    }
View Full Code Here

    @POST
    @Consumes(MediaType.APPLICATION_JSON)
    @Path("custom")
    public Response createCustomConnectionMessage(JSONObject json) {

        Connection connection = securityService.getCurrentGatewayConnection();

        // Make sure this account has IMG support enabled
        if (connection.getAccount().getConfigValue(Account.ConfigKey.DISABLE_INBOUND_API)) {
            return error("This account is not provisioned for inbound payloads, please contact support@nodeable.com.",
                    Response.status(Response.Status.FORBIDDEN));
        }

        JSONArray entries = new JSONArray();
View Full Code Here

        new OutboundConfigurationWithPayloadDTO(mock(OutboundConfiguration.class),"[what]",OutboundDataType.INSIGHT);
    }

    @Test
    public void testValidInstantiation() {
        Connection c = TestUtils.createTestFeedConnection(OutboundDataType.PROCESSED);
        ObjectId testObjectId = new ObjectId();
        c.setId(testObjectId);
        OutboundConfiguration outboundConfiguration = Lists.newArrayList(c.getOutboundConfigurations()).get(0);
        OutboundConfigurationWithPayloadDTO dto = new OutboundConfigurationWithPayloadDTO(
                outboundConfiguration,"{\"foo\":\"bar\"}", OutboundDataType.PROCESSED);

        Assert.assertEquals(OutboundDataType.PROCESSED,dto.getDataType());
        Assert.assertEquals(new OutboundConfigurationServiceDTO(outboundConfiguration),dto.getOutboundConfiguration());
View Full Code Here

        Assert.assertEquals("{\"foo\":\"bar\"}",dto.getPayload());
    }

    @Test
    public void testSerializeDeserialize() throws Exception{
        Connection c = TestUtils.createTestFeedConnection(OutboundDataType.PROCESSED);
        ObjectId testObjectId = new ObjectId();
        c.setId(testObjectId);
        OutboundConfiguration outboundConfiguration = Lists.newArrayList(c.getOutboundConfigurations()).get(0);
        OutboundConfigurationWithPayloadDTO expected = new OutboundConfigurationWithPayloadDTO(
                outboundConfiguration,"{\"foo\":\"bar\"}", OutboundDataType.PROCESSED);

        ObjectMapper om = new ObjectMapper();
        String s = om.writeValueAsString(expected);
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.