本文整理匯總了Java中org.springframework.cloud.servicebroker.model.ServiceBindingResource類的典型用法代碼示例。如果您正苦於以下問題:Java ServiceBindingResource類的具體用法?Java ServiceBindingResource怎麽用?Java ServiceBindingResource使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ServiceBindingResource類屬於org.springframework.cloud.servicebroker.model包,在下文中一共展示了ServiceBindingResource類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: givenBoundedAppExists
import org.springframework.cloud.servicebroker.model.ServiceBindingResource; //導入依賴的package包/類
@Test(expected = ClientV2Exception.class)
public void fail_to_create_create_security_group_should_raise_exception_so_that_CC_requests_unbinding_action_to_clean_up_target_broker_related_resources() throws Exception {
givenBoundedAppExists(this.cloudFoundryClient, "app_guid");
givenServicePlan(this.cloudFoundryClient, "plan-id", "service-id");
givenService(this.cloudFoundryClient, "service-id", "service-broker-id");
givenServiceBroker(this.cloudFoundryClient, "service-broker-id", "service-broker-name");
givenServiceInstance(this.cloudFoundryClient, "service-instance-id", "service-instance-name", "plan-id");
givenCreateSecurityGroupsFails(this.cloudFoundryClient, "test-securitygroup-name");
Map<String, Object> credentials = new HashMap<>();
credentials.put("uri", TEST_URI);
Map<String, Object> bindResources = new HashMap<>();
bindResources.put(ServiceBindingResource.BIND_RESOURCE_KEY_APP.toString(), "app_guid");
createSecurityGroup
.run(
new CreateServiceInstanceBindingRequest("service-id", "plan-id", null, bindResources, null)
.withBindingId("test-securitygroup-name")
.withServiceInstanceId("service-instance-id"),
new CreateServiceInstanceAppBindingResponse().withCredentials(credentials)
);
}
示例2: buildCreateRequest
import org.springframework.cloud.servicebroker.model.ServiceBindingResource; //導入依賴的package包/類
private CreateServiceInstanceBindingRequest buildCreateRequest() {
Map<String, Object> bindResource =
Collections.singletonMap(ServiceBindingResource.BIND_RESOURCE_KEY_APP.toString(), (Object) "app_guid");
return new CreateServiceInstanceBindingRequest(instance.getServiceDefinitionId(), instance.getPlanId(),
"app_guid", bindResource)
.withServiceInstanceId(instance.getServiceInstanceId())
.withBindingId(instanceBinding.getId());
}
示例3: should_create_security_group
import org.springframework.cloud.servicebroker.model.ServiceBindingResource; //導入依賴的package包/類
@Test
public void should_create_security_group() throws Exception {
givenBoundedAppExists(this.cloudFoundryClient, "app_guid");
givenServicePlan(this.cloudFoundryClient, "plan-id", "service-id");
givenService(this.cloudFoundryClient, "service-id", "service-broker-id");
givenServiceBroker(this.cloudFoundryClient, "service-broker-id", "service-broker-name");
givenServiceInstance(this.cloudFoundryClient, "service-instance-id", "service-instance-name", "plan-id");
givenCreateSecurityGroupsSucceeds(this.cloudFoundryClient, "test-securitygroup-name");
Map<String, Object> credentials = new HashMap<>();
credentials.put("uri", TEST_URI);
Map<String, Object> bindResources = new HashMap<>();
bindResources.put(ServiceBindingResource.BIND_RESOURCE_KEY_APP.toString(), "app_guid");
createSecurityGroup
.run(
new CreateServiceInstanceBindingRequest("service-id", "plan-id", null, bindResources, null)
.withBindingId("test-securitygroup-name")
.withServiceInstanceId("service-instance-id"),
new CreateServiceInstanceAppBindingResponse().withCredentials(credentials)
);
Mockito.verify(cloudFoundryClient.securityGroups())
.create(CreateSecurityGroupRequest.builder()
.name("test-securitygroup-name")
.spaceId("space_id")
.rule(RuleEntity.builder()
.description(RULE_DESCRIPTION)
.protocol(Protocol.TCP)
.ports("3306")
.destination("127.0.0.1")
.build())
.build());
}
示例4: should_block_until_create_security_group_returns
import org.springframework.cloud.servicebroker.model.ServiceBindingResource; //導入依賴的package包/類
@Test(expected = ClientV2Exception.class)
public void should_block_until_create_security_group_returns() throws Exception {
givenBoundedAppExists(this.cloudFoundryClient, "app_guid");
givenServicePlan(this.cloudFoundryClient, "plan-id", "service-id");
givenService(this.cloudFoundryClient, "service-id", "service-broker-id");
givenServiceBroker(this.cloudFoundryClient, "service-broker-id", "service-broker-name");
givenServiceInstance(this.cloudFoundryClient, "service-instance-id", "service-instance-name", "plan-id");
givenCreateSecurityGroupsFailsWithDelay(this.cloudFoundryClient, "test-securitygroup-name");
Map<String, Object> credentials = new HashMap<>();
credentials.put("uri", TEST_URI);
Map<String, Object> bindResources = new HashMap<>();
bindResources.put(ServiceBindingResource.BIND_RESOURCE_KEY_APP.toString(), "app_guid");
createSecurityGroup
.run(
new CreateServiceInstanceBindingRequest("service-id", "plan-id", null, bindResources, null)
.withBindingId("test-securitygroup-name")
.withServiceInstanceId("service-instance-id"),
new CreateServiceInstanceAppBindingResponse().withCredentials(credentials)
);
Mockito.verify(cloudFoundryClient.securityGroups())
.create(CreateSecurityGroupRequest.builder()
.name("test-securitygroup-name")
.spaceId("space_id")
.rule(RuleEntity.builder()
.description(RULE_DESCRIPTION)
.protocol(Protocol.TCP)
.ports("3306")
.destination("127.0.0.1")
.build())
.build());
}
示例5: should_reject_security_group_with_destination_out_of_range
import org.springframework.cloud.servicebroker.model.ServiceBindingResource; //導入依賴的package包/類
@Test(expected = CreateSecurityGroup.NotAllowedDestination.class)
public void should_reject_security_group_with_destination_out_of_range() throws Exception {
givenBoundedAppExists(this.cloudFoundryClient, "app_guid");
givenService(this.cloudFoundryClient, "service-id", "service-broker-id");
givenServiceBroker(this.cloudFoundryClient, "service-broker-id", "service-broker-name");
givenServiceInstance(this.cloudFoundryClient, "service-instance-id", "service-instance-name", "plan-id");
givenCreateSecurityGroupsSucceeds(this.cloudFoundryClient, "test-securitygroup-name");
Map<String, Object> credentials = new HashMap<>();
credentials.put("uri", TEST_URI);
Map<String, Object> bindResources = new HashMap<>();
bindResources.put(ServiceBindingResource.BIND_RESOURCE_KEY_APP.toString(), "app_guid");
final TrustedDestinationSpecification trustedDestinationSpecification = new TrustedDestinationSpecification(
ImmutableTrustedDestination.builder()
.hosts(ImmutableCIDR.of("192.168.0.1/29"))
.ports(ImmutablePorts.builder()
.addValue(ImmutablePort.of(3306))
.build())
.build());
CreateSecurityGroup createSecurityGroupWithRestrictiveDestinationRange = new CreateSecurityGroup(cloudFoundryClient, trustedDestinationSpecification);
createSecurityGroupWithRestrictiveDestinationRange
.run(
new CreateServiceInstanceBindingRequest("service-id", "plan-id", null, bindResources, null)
.withBindingId("test-securitygroup-name")
.withServiceInstanceId("service-instance-id"),
new CreateServiceInstanceAppBindingResponse().withCredentials(credentials)
);
Mockito.verify(cloudFoundryClient.securityGroups())
.create(CreateSecurityGroupRequest.builder()
.name("test-securitygroup-name")
.spaceId("space_id")
.rule(RuleEntity.builder()
.description(RULE_DESCRIPTION)
.protocol(Protocol.TCP)
.ports("3306")
.destination("127.0.0.1")
.build())
.build());
}