Package com.sequenceiq.cloudbreak.controller.json

Examples of com.sequenceiq.cloudbreak.controller.json.CredentialJson


    @Autowired
    private GccCredentialInitializer gccCredentialInitializer;

    @Override
    public CredentialJson convert(GccCredential entity) {
        CredentialJson credentialJson = new CredentialJson();
        credentialJson.setId(entity.getId());
        credentialJson.setCloudPlatform(CloudPlatform.GCC);
        credentialJson.setName(entity.getName());
        Map<String, Object> params = new HashMap<>();
        params.put(GccCredentialParam.SERVICE_ACCOUNT_ID.getName(), entity.getServiceAccountId());
        params.put(GccCredentialParam.SERVICE_ACCOUNT_PRIVATE_KEY.getName(), entity.getServiceAccountPrivateKey());
        params.put(GccCredentialParam.PROJECTID.getName(), entity.getProjectId());
        credentialJson.setParameters(params);
        credentialJson.setDescription(entity.getDescription() == null ? "" : entity.getDescription());
        return credentialJson;
    }
View Full Code Here


    @Autowired
    private AzureCredentialInitializer azureCredentialInitializer;

    @Override
    public CredentialJson convert(AzureCredential entity) {
        CredentialJson credentialJson = new CredentialJson();
        credentialJson.setId(entity.getId());
        credentialJson.setCloudPlatform(CloudPlatform.AZURE);
        credentialJson.setName(entity.getName());
        credentialJson.setDescription(entity.getDescription());
        credentialJson.setPublicKey(entity.getPublicKey());
        Map<String, Object> params = new HashMap<>();
        params.put(RequiredAzureCredentialParam.JKS_PASSWORD.getName(), entity.getJks());
        params.put(RequiredAzureCredentialParam.SUBSCRIPTION_ID.getName(), entity.getSubscriptionId());
        credentialJson.setParameters(params);
        return credentialJson;
    }
View Full Code Here

    @Autowired
    private AwsCredentialInitializer awsCredentialInitializer;

    @Override
    public CredentialJson convert(AwsCredential entity) {
        CredentialJson credentialJson = new CredentialJson();
        credentialJson.setId(entity.getId());
        credentialJson.setCloudPlatform(CloudPlatform.AWS);
        credentialJson.setName(entity.getName());
        Map<String, Object> params = new HashMap<>();
        params.put(AWSCredentialParam.ROLE_ARN.getName(), entity.getRoleArn());
        params.put(AWSCredentialParam.SNS_TOPICS.getName(), snsTopicConverter.convertAllEntityToJson(entity.getSnsTopics()));
        credentialJson.setParameters(params);
        credentialJson.setDescription(entity.getDescription() == null ? "" : entity.getDescription());
        credentialJson.setPublicKey(entity.getPublicKey());
        return credentialJson;
    }
View Full Code Here

        }
        return ret;
    }

    private CredentialJson convert(Credential credential) {
        CredentialJson ret = null;
        switch (credential.getCloudPlatform()) {
            case AWS:
                ret = awsCredentialConverter.convert((AwsCredential) credential);
                break;
            case AZURE:
View Full Code Here

    public void testConvertAwsCredentialEntityToJson() {
        // GIVEN
        given(snsTopicConverter.convertAllEntityToJson(anySetOf(SnsTopic.class)))
                .willReturn(new HashSet<SnsTopicJson>());
        // WHEN
        CredentialJson result = underTest.convert(awsCredential);
        // THEN
        assertEquals(result.getCloudPlatform(), CloudPlatform.AWS);
        assertEquals(result.getDescription(), awsCredential.getDescription());
        assertEquals(result.getName(), awsCredential.getName());
    }
View Full Code Here

        // GIVEN
        awsCredential.setDescription(null);
        given(snsTopicConverter.convertAllEntityToJson(anySetOf(SnsTopic.class)))
                .willReturn(new HashSet<SnsTopicJson>());
        // WHEN
        CredentialJson result = underTest.convert(awsCredential);
        // THEN
        assertEquals(result.getDescription(), "");
    }
View Full Code Here

        awsCredential.setPublicInAccount(true);
        return awsCredential;
    }

    private CredentialJson createCredentialJson() {
        CredentialJson credentialJson = new CredentialJson();
        credentialJson.setCloudPlatform(CloudPlatform.AWS);
        credentialJson.setDescription(DUMMY_DESCRIPTION);
        credentialJson.setId(1L);
        credentialJson.setName(DUMMY_NAME);
        Map<String, Object> params = new HashMap<>();
        params.put(AWSCredentialParam.ROLE_ARN.getName(), DUMMY_ROLE_ARN);
        params.put(AWSCredentialParam.SNS_TOPICS.getName(), new HashSet<SnsTopic>());
        credentialJson.setParameters(params);
        return credentialJson;
    }
View Full Code Here

    @Test
    public void testConvertAzureCredentialEntityToJson() {
        // GIVEN
        // WHEN
        CredentialJson result = underTest.convert(azureCredential);
        // THEN
        assertEquals(result.getCloudPlatform(), azureCredential.getCloudPlatform());
        assertEquals(result.getName(), azureCredential.getName());
        assertEquals(result.getDescription(), azureCredential.getDescription());
        assertEquals(result.getParameters().get(RequiredAzureCredentialParam.JKS_PASSWORD.getName()),
                azureCredential.getJks());
    }
View Full Code Here

                credentialJson.getParameters().get(RequiredAzureCredentialParam.JKS_PASSWORD.getName()));
        assertEquals(result.getName(), credentialJson.getName());
    }

    private CredentialJson createCredentialJson() {
        CredentialJson credentialJson = new CredentialJson();
        Map<String, Object> params = new HashMap<>();
        params.put(RequiredAzureCredentialParam.JKS_PASSWORD.getName(), DUMMY_JKS);
        params.put(RequiredAzureCredentialParam.SUBSCRIPTION_ID.getName(), DUMMY_SUBSCRIPTION_ID);
        credentialJson.setParameters(params);
        credentialJson.setCloudPlatform(CloudPlatform.AZURE);
        credentialJson.setId(1L);
        credentialJson.setName(DUMMY_NAME);
        credentialJson.setDescription(DUMMY_DESCRIPTION);
        return credentialJson;
    }
View Full Code Here

TOP

Related Classes of com.sequenceiq.cloudbreak.controller.json.CredentialJson

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.