當前位置: 首頁>>代碼示例>>Java>>正文


Java ServiceBindingResource類代碼示例

本文整理匯總了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)
            );

}
 
開發者ID:orange-cloudfoundry,項目名稱:sec-group-broker-filter,代碼行數:24,代碼來源:CreateSecurityGroupTest.java

示例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());
}
 
開發者ID:cf-platform-eng,項目名稱:mongodb-broker,代碼行數:9,代碼來源:MongoServiceInstanceBindingServiceTest.java

示例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());
}
 
開發者ID:orange-cloudfoundry,項目名稱:sec-group-broker-filter,代碼行數:37,代碼來源:CreateSecurityGroupTest.java

示例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());
}
 
開發者ID:orange-cloudfoundry,項目名稱:sec-group-broker-filter,代碼行數:35,代碼來源:CreateSecurityGroupTest.java

示例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());
}
 
開發者ID:orange-cloudfoundry,項目名稱:sec-group-broker-filter,代碼行數:44,代碼來源:CreateSecurityGroupTest.java


注:本文中的org.springframework.cloud.servicebroker.model.ServiceBindingResource類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。