@Test public void testGetPrerequisitesOnlyAzureIsImplemented() { String expected = "someAppCreationCommandValue"; when(appCreationCommand.generate(anyString())).thenReturn(expected); CredentialPrerequisitesResponse result = underTest.getPrerequisites(TEST_CLOUD_CONTEXT, "2", DEPLOYMENT_ADDRESS, CredentialType.ENVIRONMENT); assertNull(result.getAws()); assertNull(result.getGcp()); assertNotNull(result.getAzure()); }
@Override public CredentialPrerequisitesResponse getPrerequisites(CloudContext cloudContext, String externalId, String deploymentAddress, CredentialType type) { String creationCommand = appCreationCommand.generate(deploymentAddress); String encodedCommand = Base64.encodeBase64String(creationCommand.getBytes()); String roleDefJson; switch (type) { case ENVIRONMENT: roleDefJson = azurePlatformParameters.getRoleDefJson(); break; case AUDIT: roleDefJson = azurePlatformParameters.getAuditRoleDefJson(); break; default: roleDefJson = null; break; } AzureCredentialPrerequisites azurePrerequisites = new AzureCredentialPrerequisites(encodedCommand, roleDefJson); return new CredentialPrerequisitesResponse(cloudContext.getPlatform().value(), azurePrerequisites); }
AzureCredentialConnector implements CredentialConnector { @Override public CredentialPrerequisitesResponse getPrerequisites(CloudContext cloudContext, String externalId, String deploymentAddress, CredentialType type) { String creationCommand = appCreationCommand.generate(deploymentAddress); String encodedCommand = Base64.encodeBase64String(creationCommand.getBytes()); String roleDefJson; switch (type) { case ENVIRONMENT: roleDefJson = azurePlatformParameters.getRoleDefJson(); break; case AUDIT: roleDefJson = azurePlatformParameters.getAuditRoleDefJson(); break; default: roleDefJson = null; break; } AzureCredentialPrerequisites azurePrerequisites = new AzureCredentialPrerequisites(encodedCommand, roleDefJson); return new CredentialPrerequisitesResponse(cloudContext.getPlatform().value(), azurePrerequisites); } }
AzureCredentialConnector implements CredentialConnector { @Override public CredentialPrerequisitesResponse getPrerequisites(CloudContext cloudContext, String externalId, String deploymentAddress, CredentialType type) { String creationCommand = appCreationCommand.generate(deploymentAddress); String encodedCommand = Base64.encodeBase64String(creationCommand.getBytes()); String roleDefJson; switch (type) { case ENVIRONMENT: roleDefJson = azurePlatformParameters.getRoleDefJson(); break; case AUDIT: roleDefJson = azurePlatformParameters.getAuditRoleDefJson(); break; default: roleDefJson = null; break; } AzureCredentialPrerequisites azurePrerequisites = new AzureCredentialPrerequisites(encodedCommand, roleDefJson); return new CredentialPrerequisitesResponse(cloudContext.getPlatform().value(), azurePrerequisites); }  }
AzureCredentialConnector implements CredentialConnector { @Override public CredentialPrerequisitesResponse getPrerequisites(CloudContext cloudContext, String externalId, String deploymentAddress, CredentialType type) { String creationCommand = appCreationCommand.generate(deploymentAddress); String encodedCommand = Base64.encodeBase64String(creationCommand.getBytes()); String roleDefJson; switch (type) { case ENVIRONMENT: roleDefJson = azurePlatformParameters.getRoleDefJson(); break; case AUDIT: roleDefJson = azurePlatformParameters.getAuditRoleDefJson(); break; default: roleDefJson = null; break; } AzureCredentialPrerequisites azurePrerequisites = new AzureCredentialPrerequisites(encodedCommand, roleDefJson); return new CredentialPrerequisitesResponse(cloudContext.getPlatform().value(), azurePrerequisites); }  @Override CloudCredentialStatus verify(AuthenticatedContext authenticatedContext, CredentialVerificationContext credentialVerificationContext); @Override CloudCredentialStatus create(AuthenticatedContext authenticatedContext); @Override Map<String, String> interactiveLogin(CloudContext cloudContext, ExtendedCloudCredential extendedCloudCredential,
            CredentialNotifier credentialNotifier); @Override CloudCredentialStatus delete(AuthenticatedContext authenticatedContext); @Override CredentialPrerequisitesResponse getPrerequisites(CloudContext cloudContext, String externalId, String deploymentAddress, CredentialType type); @Override Map<String, String> initCodeGrantFlow(CloudContext cloudContext, CloudCredential cloudCredential); }
AzureCredentialConnector implements CredentialConnector { @Override public CredentialPrerequisitesResponse getPrerequisites(CloudContext cloudContext, String externalId, String deploymentAddress, CredentialType type) { String creationCommand = appCreationCommand.generate(deploymentAddress); String encodedCommand = Base64.encodeBase64String(creationCommand.getBytes()); String roleDefJson; switch (type) { case ENVIRONMENT: roleDefJson = azurePlatformParameters.getRoleDefJson(); break; case AUDIT: roleDefJson = azurePlatformParameters.getAuditRoleDefJson(); break; default: roleDefJson = null; break; } AzureCredentialPrerequisites azurePrerequisites = new AzureCredentialPrerequisites(encodedCommand, roleDefJson); return new CredentialPrerequisitesResponse(cloudContext.getPlatform().value(), azurePrerequisites); }  @Override CloudCredentialStatus verify(AuthenticatedContext authenticatedContext, CredentialVerificationContext credentialVerificationContext); @Override CloudCredentialStatus create(AuthenticatedContext authenticatedContext); @Override Map<String, String> interactiveLogin(CloudContext cloudContext, ExtendedCloudCredential extendedCloudCredential,
            CredentialNotifier credentialNotifier); @Override CloudCredentialStatus delete(AuthenticatedContext authenticatedContext); @Override CredentialPrerequisitesResponse getPrerequisites(CloudContext cloudContext, String externalId, String deploymentAddress, CredentialType type); @Override Map<String, String> initCodeGrantFlow(CloudContext cloudContext, CloudCredential cloudCredential);  }