本文整理汇总了Java中com.cloudera.director.spi.v1.model.exception.TransientProviderException类的典型用法代码示例。如果您正苦于以下问题:Java TransientProviderException类的具体用法?Java TransientProviderException怎么用?Java TransientProviderException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TransientProviderException类属于com.cloudera.director.spi.v1.model.exception包,在下文中一共展示了TransientProviderException类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkTier
import com.cloudera.director.spi.v1.model.exception.TransientProviderException; //导入依赖的package包/类
/**
* Validates the configured tier type.
*
* @param configuration the configuration to be validated
* @param accumulator the exception condition accumulator
* @param localizationContext the localization context
*/
void checkTier(Configured configuration, PluginExceptionConditionAccumulator accumulator,
LocalizationContext localizationContext) {
String tierName = configuration.getConfigurationValue(TIER, localizationContext);
LOG.info(">> Querying tier'{}'", tierName);
GoogleCredentials credentials = provider.getCredentials();
SQLAdmin sqlAdmin = credentials.getSQLAdmin();
String projectId = credentials.getProjectId();
try {
List<Tier> tierList = sqlAdmin.tiers().list(projectId).execute().getItems();
if (tierList != null) {
for (Tier tier : tierList) {
if (tier.getTier().equals(tierName)) {
return;
}
}
}
addError(accumulator, TIER, localizationContext, null, INVALID_TIER_MSG, tierName);
} catch (IOException e) {
throw new TransientProviderException(e);
}
}
开发者ID:cloudera,项目名称:director-google-plugin,代码行数:33,代码来源:GoogleCloudSQLInstanceTemplateConfigurationValidator.java
示例2: checkRegion
import com.cloudera.director.spi.v1.model.exception.TransientProviderException; //导入依赖的package包/类
/**
* Validates the configured region.
*
* @param configuration the configuration to be validated
* @param accumulator the exception condition accumulator
* @param localizationContext the localization context
*/
void checkRegion(Configured configuration,
PluginExceptionConditionAccumulator accumulator,
LocalizationContext localizationContext) {
String regionName = configuration.getConfigurationValue(REGION, localizationContext);
LOG.info(">> Querying region '{}'", regionName);
SQLAdmin sqlAdmin = credentials.getSQLAdmin();
String projectId = credentials.getProjectId();
try {
List<Tier> tierList = sqlAdmin.tiers().list(projectId).execute().getItems();
if (tierList != null) {
for (Tier tier : tierList) {
if (tier.getRegion().contains(regionName)) {
return;
}
}
}
addError(accumulator, REGION, localizationContext, null, REGION_NOT_FOUND_MSG, regionName, projectId);
} catch (IOException e) {
throw new TransientProviderException(e);
}
}
开发者ID:cloudera,项目名称:director-google-plugin,代码行数:33,代码来源:GoogleCloudSQLProviderConfigurationValidator.java
示例3: propagate
import com.cloudera.director.spi.v1.model.exception.TransientProviderException; //导入依赖的package包/类
/**
* Returns an appropriate SPI exception in response to the specified AWS exception.
*
* @param e the AWS exception
* @return the corresponding SPI exception
*/
public static RuntimeException propagate(AmazonClientException e) {
propagateIfUnrecoverable(e);
// otherwise assume this is a transient error
throw new TransientProviderException(e.getMessage(), e);
}
示例4: createVmWithImplicitMsiAndAddToInvalidAadGroupExpectNoResourcesLeaked
import com.cloudera.director.spi.v1.model.exception.TransientProviderException; //导入依赖的package包/类
@Test
public void createVmWithImplicitMsiAndAddToInvalidAadGroupExpectNoResourcesLeaked()
throws Exception {
Assume.assumeTrue(TestHelper.runImplicitMsiLiveTests());
LOG.info("createVmWithImplicitMsiAndAddToInvalidAadGroupExpectNoResourcesLeaked");
// 0. set up
LOG.info("0. set up");
Launcher launcher = new AzureLauncher();
launcher.initialize(new File("non_existent_file"), null);
CloudProvider cloudProvider = launcher.createCloudProvider(AzureCloudProvider.ID,
TestHelper.buildValidDirectorLiveTestConfig(), Locale.getDefault());
AzureComputeProvider provider = (AzureComputeProvider) cloudProvider.createResourceProvider(
AzureComputeProvider.METADATA.getId(), TestHelper.buildValidDirectorLiveTestConfig());
// enable implicit MSI config and set a random AAD name that shouldn't exist
Map<String, String> map = TestHelper.buildValidDirectorLiveTestMap();
map.put(AzureComputeInstanceTemplateConfigurationProperty.USE_IMPLICIT_MSI.unwrap()
.getConfigKey(), "Yes");
map.put(AzureComputeInstanceTemplateConfigurationProperty.IMPLICIT_MSI_AAD_GROUP_NAME
.unwrap().getConfigKey(),
"test-" + UUID.randomUUID().toString());
AzureComputeInstanceTemplate template = new AzureComputeInstanceTemplate(TEMPLATE_NAME,
new SimpleConfiguration(map), TAGS, DEFAULT_LOCALIZATION_CONTEXT);
// the repeated instanceId to use for this test
String instanceId = UUID.randomUUID().toString();
Collection<String> instanceIds = new ArrayList<>();
instanceIds.add(instanceId);
// 1. allocate the VMs, allow success even if none come up
LOG.info("1. allocate");
try {
provider.allocate(template, instanceIds, 1);
} catch (TransientProviderException e) {
LOG.info("Caught expected TransientProviderException:", e);
}
// 2. verify that no instance is created
LOG.info("2. find");
ArrayList<AzureComputeInstance> foundInstances =
(ArrayList<AzureComputeInstance>) provider.find(template, instanceIds);
Assert.assertEquals(foundInstances.size(), 0);
// 3. verify cleanup - no resources should be orphaned
LOG.info("3. verify cleanup");
Assert.assertTrue(checkVmResourceLeak(template, provider, instanceIds));
}
示例5: testTransientProviderException
import com.cloudera.director.spi.v1.model.exception.TransientProviderException; //导入依赖的package包/类
@Test(expected = TransientProviderException.class)
public void testTransientProviderException() {
AmazonServiceException e =
new AmazonServiceException("Test TransientProviderException");
AWSExceptions.propagate(e);
}