当前位置: 首页>>代码示例>>Java>>正文


Java ServiceDefinition类代码示例

本文整理汇总了Java中org.springframework.cloud.servicebroker.model.ServiceDefinition的典型用法代码示例。如果您正苦于以下问题:Java ServiceDefinition类的具体用法?Java ServiceDefinition怎么用?Java ServiceDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ServiceDefinition类属于org.springframework.cloud.servicebroker.model包,在下文中一共展示了ServiceDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: catalog

import org.springframework.cloud.servicebroker.model.ServiceDefinition; //导入依赖的package包/类
@Bean
public Catalog catalog() {
	return new Catalog(Collections.singletonList(
			new ServiceDefinition(
					"mongodb-service-broker",
					"MongoDB",
					"MongoDB service broker implementation for Community Edition",
					true,
					true,
					Collections.singletonList(
							new Plan("mongo-plan",
									"Default Mongo Plan",
									"This is a default mongo plan.  All services are created equally.",
									getPlanMetadata())),
					Arrays.asList("mongodb", "document"),
					getServiceDefinitionMetadata(),
					null,
					null)));
}
 
开发者ID:cf-platform-eng,项目名称:mongodb-broker,代码行数:20,代码来源:CatalogConfig.java

示例2: getSD

import org.springframework.cloud.servicebroker.model.ServiceDefinition; //导入依赖的package包/类
private ServiceDefinition getSD(JsonElement json) {
    JsonObject jo = json.getAsJsonObject();

    String id = jo.get("catalogItemId").getAsString();
    String name = jo.get("name").getAsString();
    String description = jo.get("description").getAsString();

    List<Plan> plans = new ArrayList<Plan>();
    plans.add(gson.fromJson(jo, Plan.class));

    Map<String, Object> sdMetadata = new HashMap<String, Object>();
    sdMetadata.put("displayName", name);
    sdMetadata.put("longDescription", description);
    sdMetadata.put("providerDisplayName", "vRealize");

    List<String> tags = new ArrayList<String>();
    tags.add(name);
    tags.add("vRealize");

    return new ServiceDefinition(id, name, description,
            true, false, plans, tags, sdMetadata, null, null);
}
 
开发者ID:cf-platform-eng,项目名称:vrealize-service-broker,代码行数:23,代码来源:ServiceDefinitionTranslator.java

示例3: map_service_metadata

import org.springframework.cloud.servicebroker.model.ServiceDefinition; //导入依赖的package包/类
@Test
public void map_service_metadata() {
    //GIVEN
    ServiceMetadataProperties serviceMetadataProperties = new ServiceMetadataProperties();
    serviceMetadataProperties.setDisplayName("aDisplayName");
    serviceMetadataProperties.setLongDescription("a long description");
    serviceMetadataProperties.setProviderDisplayName("a provider");
    serviceMetadataProperties.setDocumentationUrl("http://localhost/doc");
    serviceMetadataProperties.setImageUrl("http://localhost/image.png");
    serviceMetadataProperties.setSupportUrl("http://localhost/support");

    ServiceProperties serviceProperties = new ServiceProperties(SERVICE_ID);
    serviceProperties.setMetadata(serviceMetadataProperties);

    //WHEN
    final ServiceDefinition res = ServiceMapper.toServiceDefinition(serviceProperties);
    //THEN
    assertThat(res.getMetadata()).as("toServiceDefinition serviceProperties metadata").hasSize(6).includes(
            entry("displayName", "aDisplayName"),
            entry("longDescription", "a long description"),
            entry("providerDisplayName", "a provider"),
            entry("documentationUrl", "http://localhost/doc"),
            entry("imageUrl", "http://localhost/image.png"),
            entry("supportUrl", "http://localhost/support"));
}
 
开发者ID:orange-cloudfoundry,项目名称:static-creds-broker,代码行数:26,代码来源:ServicePropertiesMapperTest.java

示例4: testEcsBucketPlans

import org.springframework.cloud.servicebroker.model.ServiceDefinition; //导入依赖的package包/类
@Test
public void testEcsBucketPlans() {
    // Service Definition Plans
    ServiceDefinition service = catalog.getServiceDefinitions().get(1);
    List<Plan> ecsBucketPlans = service.getPlans();
    Plan plan0 = ecsBucketPlans.get(0);

    testPlan(plan0, "8e777d49-0a78-4cf4-810a-b5f5173b019d", "5gb",
            "Free Trial", 0.0, "MONTHLY",
            Arrays.asList("Shared object storage", "5 GB Storage",
                    "S3 protocol access"));

    Plan plan1 = ecsBucketPlans.get(1);
    testPlan(plan1, "89d20694-9ab0-4a98-bc6a-868d6d4ecf31", "unlimited",
            "Pay per GB for Month", 0.03, "PER GB PER MONTH",
            Arrays.asList("Shared object storage", "Unlimited Storage",
                    "S3 protocol access"));
}
 
开发者ID:codedellemc,项目名称:ecs-cf-service-broker,代码行数:19,代码来源:CatalogConfigTest.java

示例5: catalogWithRequiresIsRetrievedCorrectly

import org.springframework.cloud.servicebroker.model.ServiceDefinition; //导入依赖的package包/类
@Test
public void catalogWithRequiresIsRetrievedCorrectly() throws Exception {
	when(catalogService.getCatalog()).thenReturn(getCatalogWithRequires());

	ServiceDefinition service = ServiceFixture.getServiceWithRequires();

	this.mockMvc.perform(get("/v2/catalog")
			.accept(MediaType.APPLICATION_JSON))
			.andDo(print())
			.andExpect(status().isOk())
			.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
			.andExpect(jsonPath("$.services", hasSize(1)))
			.andExpect(jsonPath("$.services[*].id", contains(service.getId())))
			.andExpect(jsonPath("$.services[*].name", contains(service.getName())))
			.andExpect(jsonPath("$.services[*].description", contains(service.getDescription())))
			.andExpect(jsonPath("$.services[*].bindable", contains(service.isBindable())))
			.andExpect(jsonPath("$.services[*].plan_updateable", contains(service.isPlanUpdateable())))
			.andExpect(jsonPath("$.services[*].requires[*]", containsInAnyOrder(
					SERVICE_REQUIRES_SYSLOG_DRAIN.toString(),
					SERVICE_REQUIRES_ROUTE_FORWARDING.toString())
			));
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-cloudfoundry-service-broker,代码行数:23,代码来源:CatalogControllerIntegrationTest.java

示例6: catalogIsRetrievedCorrectlyWithCfInstanceId

import org.springframework.cloud.servicebroker.model.ServiceDefinition; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void catalogIsRetrievedCorrectlyWithCfInstanceId() throws Exception {
	when(catalogService.getCatalog()).thenReturn(getCatalog());

	ServiceDefinition service = ServiceFixture.getSimpleService();
	Plan[] plans = PlanFixture.getAllPlans();

	this.mockMvc.perform(get("/123/v2/catalog")
			.accept(MediaType.APPLICATION_JSON))
			.andDo(print())
			.andExpect(status().isOk())
			.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
			.andExpect(jsonPath("$.services", hasSize(1)))
			.andExpect(jsonPath("$.services[*].id", contains(service.getId())))
			.andExpect(jsonPath("$.services[*].name", contains(service.getName())))
			.andExpect(jsonPath("$.services[*].description", contains(service.getDescription())))
			.andExpect(jsonPath("$.services[*].bindable", contains(service.isBindable())))
			.andExpect(jsonPath("$.services[*].plan_updateable", contains(service.isPlanUpdateable())))
			.andExpect(jsonPath("$.services[*].requires[*]", empty()))
			.andExpect(jsonPath("$.services[*].plans[*].id", containsInAnyOrder(plans[0].getId(), plans[1].getId())))
			.andExpect(jsonPath("$.services[*].plans[*].name", containsInAnyOrder(plans[0].getName(), plans[1].getName())))
			.andExpect(jsonPath("$.services[*].plans[*].description", containsInAnyOrder(plans[0].getDescription(), plans[1].getDescription())))
			.andExpect(jsonPath("$.services[*].plans[1].metadata", contains(plans[1].getMetadata())))
			.andExpect(jsonPath("$.services[*].plans[*].free", containsInAnyOrder(plans[0].isFree(), plans[1].isFree())));
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-cloudfoundry-service-broker,代码行数:27,代码来源:CatalogControllerIntegrationTest.java

示例7: createServiceInstance

import org.springframework.cloud.servicebroker.model.ServiceDefinition; //导入依赖的package包/类
@PutMapping(value = {
		"/{cfInstanceId}/v2/service_instances/{instanceId}",
		"/v2/service_instances/{instanceId}"
})
public ResponseEntity<?> createServiceInstance(@PathVariable Map<String, String> pathVariables,
											   @PathVariable("instanceId") String serviceInstanceId,
											   @RequestParam(value = ASYNC_REQUEST_PARAMETER, required = false) boolean acceptsIncomplete,
											   @RequestHeader(value = API_INFO_LOCATION_HEADER, required = false) String apiInfoLocation,
											   @RequestHeader(value = ORIGINATING_IDENTITY_HEADER, required = false) String originatingIdentityString,
											   @Valid @RequestBody CreateServiceInstanceRequest request) {
	ServiceDefinition serviceDefinition = getRequiredServiceDefinition(request.getServiceDefinitionId());

	request.setServiceInstanceId(serviceInstanceId);
	request.setServiceDefinition(serviceDefinition);
	setCommonRequestFields(request, pathVariables.get("cfInstanceId"), apiInfoLocation,
			originatingIdentityString, acceptsIncomplete);

	log.debug("Creating a service instance: request={}", request);

	CreateServiceInstanceResponse response = service.createServiceInstance(request);

	log.debug("Creating a service instance succeeded: serviceInstanceId={}, response={}",
			serviceInstanceId, response);

	return new ResponseEntity<>(response, getCreateResponseCode(response));
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-cloudfoundry-service-broker,代码行数:27,代码来源:ServiceInstanceController.java

示例8: updateServiceInstance

import org.springframework.cloud.servicebroker.model.ServiceDefinition; //导入依赖的package包/类
@PatchMapping(value = {
		"/{cfInstanceId}/v2/service_instances/{instanceId}",
		"/v2/service_instances/{instanceId}"
})
public ResponseEntity<?> updateServiceInstance(@PathVariable Map<String, String> pathVariables,
											   @PathVariable("instanceId") String serviceInstanceId,
											   @RequestParam(value = ASYNC_REQUEST_PARAMETER, required = false) boolean acceptsIncomplete,
											   @RequestHeader(value = API_INFO_LOCATION_HEADER, required = false) String apiInfoLocation,
											   @RequestHeader(value = ORIGINATING_IDENTITY_HEADER, required = false) String originatingIdentityString,
											   @Valid @RequestBody UpdateServiceInstanceRequest request) {
	ServiceDefinition serviceDefinition = getServiceDefinition(request.getServiceDefinitionId());

	request.setServiceInstanceId(serviceInstanceId);
	request.setServiceDefinition(serviceDefinition);
	setCommonRequestFields(request, pathVariables.get("cfInstanceId"), apiInfoLocation,
			originatingIdentityString, acceptsIncomplete);

	log.debug("Updating a service instance: request={}", request);

	UpdateServiceInstanceResponse response = service.updateServiceInstance(request);

	log.debug("Updating a service instance succeeded: serviceInstanceId={}, response={}",
			serviceInstanceId, response);

	return new ResponseEntity<>(response, response.isAsync() ? HttpStatus.ACCEPTED : HttpStatus.OK);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-cloudfoundry-service-broker,代码行数:27,代码来源:ServiceInstanceController.java

示例9: createBlueprint

import org.springframework.cloud.servicebroker.model.ServiceDefinition; //导入依赖的package包/类
@VisibleForTesting
  public String createBlueprint(ServiceDefinition serviceDefinition, CreateServiceInstanceRequest request) {
      String location = "localhost"; // default
      Plan selectedPlan = null;
      for(Plan p : serviceDefinition.getPlans()){
          if(p.getId().equals(request.getPlanId())){
              selectedPlan = p;
          }
      }

      Map<String, Object> metadata = serviceDefinition.getMetadata();
      String brooklynCatalogId = (String) metadata.get("brooklynCatalogId");
String blueprint = ((BlueprintPlan)selectedPlan).toBlueprint(brooklynCatalogId, location, request);
      LOG.info("launching from blueprint: [blueprint={}]", blueprint);
return blueprint;
  }
 
开发者ID:cloudfoundry-incubator,项目名称:apache-brooklyn-service-broker,代码行数:17,代码来源:BrooklynServiceInstanceService.java

示例10: getServiceDefinition

import org.springframework.cloud.servicebroker.model.ServiceDefinition; //导入依赖的package包/类
@Override
public ServiceDefinition getServiceDefinition(String serviceId) {
       try {
           cacheLock.lock();
           if (catalogCache == null) catalogCache = getCatalog();
           for (ServiceDefinition def : catalogCache.getServiceDefinitions()) {
               if (def.getId().equals(serviceId)) {
                   return def;
               }
           }
       } finally {
           cacheLock.unlock();
       }

	return null;
}
 
开发者ID:cloudfoundry-incubator,项目名称:apache-brooklyn-service-broker,代码行数:17,代码来源:BrooklynCatalogService.java

示例11: testMetadataFromBlueprint

import org.springframework.cloud.servicebroker.model.ServiceDefinition; //导入依赖的package包/类
@Test
public void testMetadataFromBlueprint() {
    when(admin.getCatalogApplications(Mockito.anyBoolean())).thenReturn(new AsyncResult<>(Arrays.asList(TEST_SUMMARY_WITH_METADATA)));
    when(brooklynConfig.includesAllCatalogVersions()).thenReturn(false);
    List<ServiceDefinition> serviceDefinitions = catalogPlanStrategy.makeServiceDefinitions();
    String expectedKey = "test";
    String expectedValue = "test value";
    Map<String, Object> metadata = serviceDefinitions.get(1).getMetadata();
    assertTrue(metadata.containsKey(expectedKey));
    assertEquals(expectedValue, metadata.get(expectedKey));

    expectedKey = "brooklynCatalogId";
    expectedValue = TEST_SUMMARY_WITH_METADATA.getId();
    assertTrue(metadata.containsKey(expectedKey));
    assertEquals(expectedValue, metadata.get(expectedKey));
}
 
开发者ID:cloudfoundry-incubator,项目名称:apache-brooklyn-service-broker,代码行数:17,代码来源:AbstractCatalogPlanStrategyTest.java

示例12: catalog

import org.springframework.cloud.servicebroker.model.ServiceDefinition; //导入依赖的package包/类
@Bean
public Catalog catalog() {
	return new Catalog(Collections.singletonList(
			new ServiceDefinition(
					"mongodb-service-broker",
					"mongodb",
					"A simple MongoDB service broker implementation",
					true,
					false,
					Collections.singletonList(
							new Plan("mongo-plan",
									"default",
									"This is a default mongo plan.  All services are created equally.",
									getPlanMetadata())),
					Arrays.asList("mongodb", "document"),
					getServiceDefinitionMetadata(),
					null,
					null)));
}
 
开发者ID:spring-cloud-samples,项目名称:cloudfoundry-service-broker,代码行数:20,代码来源:CatalogConfig.java

示例13: unproxy

import org.springframework.cloud.servicebroker.model.ServiceDefinition; //导入依赖的package包/类
public ServiceDefinition unproxy() {
    List<Plan> realPlans = null;
    if (plans != null)
        realPlans = plans.stream().map(p -> p.unproxy())
                .collect(Collectors.toList());

    DashboardClient realDashboardClient = null;
    if (dashboardClient != null)
        realDashboardClient = dashboardClient.unproxy();

    return new ServiceDefinition(id, name, description, bindable,
            planUpdatable, realPlans, tags, metadata, requires,
            realDashboardClient);
}
 
开发者ID:ipolyzos,项目名称:cloudkarafka-broker,代码行数:15,代码来源:ServiceDefinitionProxy.java

示例14: toSuffixedServiceDefinition

import org.springframework.cloud.servicebroker.model.ServiceDefinition; //导入依赖的package包/类
private ServiceDefinition toSuffixedServiceDefinition(ServiceDefinition serviceDefinition) {
    return new ServiceDefinition(withSuffix(serviceDefinition.getId(), serviceOfferingSuffix),
            withSuffix(serviceDefinition.getName(), serviceOfferingSuffix),
            serviceDefinition.getDescription(),
            serviceDefinition.isBindable(),
            serviceDefinition.isPlanUpdateable(),
            serviceDefinition.getPlans()
                    .stream()
                    .map(this::toPlan)
                    .collect(Collectors.toList()),
            serviceDefinition.getTags(),
            serviceDefinition.getMetadata(),
            serviceDefinition.getRequires(),
            serviceDefinition.getDashboardClient());
}
 
开发者ID:orange-cloudfoundry,项目名称:sec-group-broker-filter,代码行数:16,代码来源:SuffixedCatalogMapper.java

示例15: expectedCatalog

import org.springframework.cloud.servicebroker.model.ServiceDefinition; //导入依赖的package包/类
private Catalog expectedCatalog() {
    ArrayList plans = new ArrayList();
    HashMap metadata = new HashMap();
    metadata.put("key1", "value1");
    metadata.put("key2", "value2");
    plans.add(new Plan("plan-one-id-suffix", "Plan One-suffix", "Description for Plan One"));
    plans.add(new Plan("plan-two-id-suffix", "Plan Two-suffix", "Description for Plan Two", metadata));
    List services = Collections.singletonList(new ServiceDefinition("service-one-id-suffix", "Service One-suffix", "Description for Service One", true, plans));
    return new Catalog(services);
}
 
开发者ID:orange-cloudfoundry,项目名称:sec-group-broker-filter,代码行数:11,代码来源:SuffixedCatalogMapperTest.java


注:本文中的org.springframework.cloud.servicebroker.model.ServiceDefinition类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。