@Test void shouldReturnStartedStatusInCaseOfExistingResourceGroup() { when(client.getResourceGroup(RESOURCE_GROUP_NAME)).thenReturn(resourceGroup); when(azureResourceGroupMetadataProvider.getResourceGroupName(cloudContext, databaseStack)).thenReturn(RESOURCE_GROUP_NAME); ExternalDatabaseStatus actual = victim.getDatabaseServerStatus(ac, databaseStack); assertEquals(ExternalDatabaseStatus.STARTED, actual); }
public ExternalDatabaseStatus getDatabaseServerStatus(AuthenticatedContext ac, DatabaseStack stack) { CloudContext cloudContext = ac.getCloudContext(); AzureClient client = ac.getParameter(AzureClient.class); String resourceGroupName = azureResourceGroupMetadataProvider.getResourceGroupName(cloudContext, stack); try { ResourceGroup resourceGroup = client.getResourceGroup(resourceGroupName); if (resourceGroup == null) { return ExternalDatabaseStatus.DELETED; } return ExternalDatabaseStatus.STARTED; } catch (Exception e) { LOGGER.error(e.getMessage()); throw new CloudConnectorException(e); } }
AzureDatabaseResourceService { public ExternalDatabaseStatus getDatabaseServerStatus(AuthenticatedContext ac, DatabaseStack stack) { CloudContext cloudContext = ac.getCloudContext(); AzureClient client = ac.getParameter(AzureClient.class); String resourceGroupName = azureResourceGroupMetadataProvider.getResourceGroupName(cloudContext, stack); try { ResourceGroup resourceGroup = client.getResourceGroup(resourceGroupName); if (resourceGroup == null) { return ExternalDatabaseStatus.DELETED; } return ExternalDatabaseStatus.STARTED; } catch (Exception e) { LOGGER.error(e.getMessage()); throw new CloudConnectorException(e); } } }
AzureDatabaseResourceService { public ExternalDatabaseStatus getDatabaseServerStatus(AuthenticatedContext ac, DatabaseStack stack) { CloudContext cloudContext = ac.getCloudContext(); AzureClient client = ac.getParameter(AzureClient.class); String resourceGroupName = azureResourceGroupMetadataProvider.getResourceGroupName(cloudContext, stack); try { ResourceGroup resourceGroup = client.getResourceGroup(resourceGroupName); if (resourceGroup == null) { return ExternalDatabaseStatus.DELETED; } return ExternalDatabaseStatus.STARTED; } catch (Exception e) { LOGGER.error(e.getMessage()); throw new CloudConnectorException(e); } }  }
AzureDatabaseResourceService { public ExternalDatabaseStatus getDatabaseServerStatus(AuthenticatedContext ac, DatabaseStack stack) { CloudContext cloudContext = ac.getCloudContext(); AzureClient client = ac.getParameter(AzureClient.class); String resourceGroupName = azureResourceGroupMetadataProvider.getResourceGroupName(cloudContext, stack); try { ResourceGroup resourceGroup = client.getResourceGroup(resourceGroupName); if (resourceGroup == null) { return ExternalDatabaseStatus.DELETED; } return ExternalDatabaseStatus.STARTED; } catch (Exception e) { LOGGER.error(e.getMessage()); throw new CloudConnectorException(e); } }  List<CloudResourceStatus> buildDatabaseResourcesForLaunch(AuthenticatedContext ac, DatabaseStack stack, PersistenceNotifier persistenceNotifier); List<CloudResourceStatus> terminateDatabaseServer(AuthenticatedContext ac, DatabaseStack stack,
            List<CloudResource> resources, boolean force, PersistenceNotifier persistenceNotifier); ExternalDatabaseStatus getDatabaseServerStatus(AuthenticatedContext ac, DatabaseStack stack); }
AzureDatabaseResourceService { public ExternalDatabaseStatus getDatabaseServerStatus(AuthenticatedContext ac, DatabaseStack stack) { CloudContext cloudContext = ac.getCloudContext(); AzureClient client = ac.getParameter(AzureClient.class); String resourceGroupName = azureResourceGroupMetadataProvider.getResourceGroupName(cloudContext, stack); try { ResourceGroup resourceGroup = client.getResourceGroup(resourceGroupName); if (resourceGroup == null) { return ExternalDatabaseStatus.DELETED; } return ExternalDatabaseStatus.STARTED; } catch (Exception e) { LOGGER.error(e.getMessage()); throw new CloudConnectorException(e); } }  List<CloudResourceStatus> buildDatabaseResourcesForLaunch(AuthenticatedContext ac, DatabaseStack stack, PersistenceNotifier persistenceNotifier); List<CloudResourceStatus> terminateDatabaseServer(AuthenticatedContext ac, DatabaseStack stack,
            List<CloudResource> resources, boolean force, PersistenceNotifier persistenceNotifier); ExternalDatabaseStatus getDatabaseServerStatus(AuthenticatedContext ac, DatabaseStack stack);  }