• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CloudInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getInfo

import org.cloudfoundry.client.lib.domain.CloudInfo; //导入依赖的package包/类
@Override
public CloudInfo getInfo() {
    String infoV2Json = getRestTemplate().getForObject(getUrl("/v2/info"), String.class);
    Map<String, Object> infoV2Map = JsonUtil.convertJsonToMap(infoV2Json);

    Map<String, Object> userMap = getUserInfo((String) infoV2Map.get("user"));

    String name = CloudUtil.parse(String.class, infoV2Map.get("name"));
    String support = CloudUtil.parse(String.class, infoV2Map.get("support"));
    String authorizationEndpoint = CloudUtil.parse(String.class, infoV2Map.get("authorization_endpoint"));
    String build = CloudUtil.parse(String.class, infoV2Map.get("build"));
    String version = "" + CloudUtil.parse(Number.class, infoV2Map.get("version"));
    String description = CloudUtil.parse(String.class, infoV2Map.get("description"));

    CloudInfo.Limits limits = null;
    CloudInfo.Usage usage = null;
    boolean debug = false;

    String loggregatorEndpoint = CloudUtil.parse(String.class, infoV2Map.get("logging_endpoint"));

    return new CloudInfo(name, support, authorizationEndpoint, build, version, (String) userMap.get("user_name"), description, limits,
        usage, debug, loggregatorEndpoint);
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:24,代码来源:CloudControllerClientImpl.java


示例2: saveToken

import org.cloudfoundry.client.lib.domain.CloudInfo; //导入依赖的package包/类
public void saveToken(URI target, OAuth2AccessToken token, CloudInfo cloudInfo, CloudSpace space) {
    TargetInfos targetInfos = getTokensFromFile();

    if (targetInfos == null) {
        targetInfos = new TargetInfos();
    }

    HashMap<String, String> targetInfo = targetInfos.get(target);

    if (targetInfo == null) {
        targetInfo = new LinkedHashMap<String, String>();
    }

    targetInfos.putToken(targetInfo, token);
    targetInfos.putRefreshToken(targetInfo, token.getRefreshToken());
    targetInfos.putVersion(targetInfo, cloudInfo.getVersion());
    targetInfos.putSpace(targetInfo, space.getMeta().getGuid().toString());
    targetInfos.putOrganization(targetInfo, space.getOrganization().getMeta().getGuid().toString());

    targetInfos.put(target, targetInfo);

    saveTokensToFile(targetInfos);
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:24,代码来源:TokensFile.java


示例3: infoForUserAvailable

import org.cloudfoundry.client.lib.domain.CloudInfo; //导入依赖的package包/类
@Test
public void infoForUserAvailable() throws Exception {
    CloudInfo info = connectedClient.getCloudInfo();

    assertNotNull(info.getName());
    assertNotNull(info.getSupport());
    assertNotNull(info.getBuild());
    assertNotNull(info.getSupport());
    assertNotNull(info.getSupport());

    assertEquals(CCNG_USER_EMAIL, info.getUser());
    assertNotNull(info.getLimits());
    // Just ensure that we got back some sensible values
    assertTrue(info.getLimits().getMaxApps() > 0 && info.getLimits().getMaxApps() < 1000);
    assertTrue(info.getLimits().getMaxServices() > 0 && info.getLimits().getMaxServices() < 1000);
    assertTrue(info.getLimits().getMaxTotalMemory() > 0 && info.getLimits().getMaxTotalMemory() < 100000);
    assertTrue(info.getLimits().getMaxUrisPerApp() > 0 && info.getLimits().getMaxUrisPerApp() < 100);
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:19,代码来源:CloudFoundryClientTest.java


示例4: prepareClient

import org.cloudfoundry.client.lib.domain.CloudInfo; //导入依赖的package包/类
private void prepareClient() throws Exception {
    CloudDomain domain = mock(CloudDomain.class);
    CloudInfo info;
    if (input.portBasedRouting) {
        info = mock(CloudInfoExtended.class);
        when(((CloudInfoExtended) info).isPortBasedRouting()).thenReturn(true);
    } else {
        info = mock(CloudInfo.class);
    }

    if (info instanceof CloudInfoExtended)
        when(((CloudInfoExtended) info).getDeployServiceUrl()).thenReturn(input.deployServiceUrl);

    when(clientProvider.getPortAllocator(any(), anyString())).thenReturn(portAllocator);

    when(info.getAuthorizationEndpoint()).thenReturn(input.authorizationEndpoint);
    when(domain.getName()).thenReturn(input.defaultDomain);
    when(domain.getMeta()).thenReturn(new Meta(CLOUD_DOMAIN_GUID, null, null));

    when(client.getDefaultDomain()).thenReturn(domain);
    when(client.getCloudInfo()).thenReturn(info);
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:23,代码来源:CollectSystemParametersStepTest.java


示例5: testConnectToSecureUrl

import org.cloudfoundry.client.lib.domain.CloudInfo; //导入依赖的package包/类
public void testConnectToSecureUrl() throws Exception {
	HarnessProperties props = getTestFixture().getHarnessProperties();

	String url = props.getApiUrl();

	URL ur = new URL(url);
	String host = ur.getHost();
	String httpUrl = "https://" + host;

	CloudFoundryOperations client = StsTestUtil.createStandaloneClient(props.getUsername(), props.getPassword(),
			props.getOrg(), props.getSpace(), httpUrl, props.skipSslValidation());

	new CloudFoundryLoginHandler(client, null).login(new NullProgressMonitor());

	CloudInfo cloudInfo = client.getCloudInfo();
	Assert.assertNotNull(cloudInfo);
}
 
开发者ID:eclipse,项目名称:cft,代码行数:18,代码来源:CloudFoundryClientConnectionTest.java


示例6: streamLogs

import org.cloudfoundry.client.lib.domain.CloudInfo; //导入依赖的package包/类
public StreamingLogToken streamLogs(String appName, ApplicationLogListener listener) throws CloudFoundryException {	        
	UUID appId = getAppId(appName);
	CloudInfo cloudInfo = getCloudInfo();
	log.info("Streamlogs :"+cloudInfo.getLoggregatorEndpoint()+" "+appId);
	//	        String mode = recent ? "dump" : "tail";
	//	        URI loggregatorUri = loggregatorUriTemplate.expand(cloudInfo.getLoggregatorEndpoint(), mode, appId);
	//	        try {
	//	            WebSocketContainer container = ContainerProvider.getWebSocketContainer();
	//	            ClientEndpointConfig config = ClientEndpointConfig.Builder.create().configurator(configurator).build();
	//	            Session session = container.connectToServer(new LoggregatorEndpoint(listener), config, loggregatorUri);
	//	            return new StreamingLogTokenImpl(session);
	//	        } 
	//	        catch (DeploymentException e) {
	//	            throw new CloudOperationException(e);
	//	        } 
	//	        catch (IOException e) {
	//	            throw new CloudOperationException(e);
	//	        }
	return null;
}
 
开发者ID:stephen-kruger,项目名称:cloudfoundry-liteclient-lib,代码行数:21,代码来源:CloudFoundryClient.java


示例7: infoForUserAvailable

import org.cloudfoundry.client.lib.domain.CloudInfo; //导入依赖的package包/类
@Test
public void infoForUserAvailable() throws Exception {
	CloudInfo info = connectedClient.getCloudInfo();

	assertNotNull(info.getName());
	assertNotNull(info.getSupport());
	assertNotNull(info.getBuild());
	assertNotNull(info.getSupport());
	assertNotNull(info.getSupport());

	assertEquals(CCNG_USER_EMAIL, info.getUser());
	assertNotNull(info.getLimits());
	// Just ensure that we got back some sensible values
	assertTrue(info.getLimits().getMaxApps() > 0 && info.getLimits().getMaxApps() < 1000);
	assertTrue(info.getLimits().getMaxServices() > 0 && info.getLimits().getMaxServices() < 1000);
	assertTrue(info.getLimits().getMaxTotalMemory() > 0 && info.getLimits().getMaxTotalMemory() < 100000);
	assertTrue(info.getLimits().getMaxUrisPerApp() > 0 && info.getLimits().getMaxUrisPerApp() < 100);
}
 
开发者ID:stephen-kruger,项目名称:cloudfoundry-liteclient-lib,代码行数:19,代码来源:CloudFoundryClientTest.java


示例8: testCloudInfo

import org.cloudfoundry.client.lib.domain.CloudInfo; //导入依赖的package包/类
public void testCloudInfo() {
	CloudInfoListener cil = new CloudInfoListener() {

		@Override
		public void cloudInfo(CloudInfo ci) {
			cloudInfo = ci;				
		}

		@Override
		public void cloudFoundryException(CloudFoundryException e) {
			log.severe(e.getMessage());				
		}

	};
	cfc.addCloudInfoListener(cil);
	cfc.login();
	cfc.cloudInfo();
	int maxWait = 10;
	while ((cloudInfo==null)&&(maxWait-- > 0)) {
		log.info("Waiting for cloudInfo "+maxWait);
		sleepyMe(2000);
	}
	assertNotNull("get CloudInfo failed",cloudInfo);		
}
 
开发者ID:stephen-kruger,项目名称:cloudfoundry-liteclient-lib,代码行数:25,代码来源:EventTest.java


示例9: getCloudInfo

import org.cloudfoundry.client.lib.domain.CloudInfo; //导入依赖的package包/类
@Override
public CloudInfo getCloudInfo() {
    if (info == null) {
        info = cc.getInfo();
    }
    return info;
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:8,代码来源:CloudFoundryClient.java


示例10: infoAvailable

import org.cloudfoundry.client.lib.domain.CloudInfo; //导入依赖的package包/类
@Test
public void infoAvailable() throws Exception {
    CloudInfo info = connectedClient.getCloudInfo();
    assertNotNull(info.getName());
    assertNotNull(info.getSupport());
    assertNotNull(info.getBuild());
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:8,代码来源:CloudFoundryClientTest.java


示例11: infoAvailableWithoutLoggingIn

import org.cloudfoundry.client.lib.domain.CloudInfo; //导入依赖的package包/类
@Test
public void infoAvailableWithoutLoggingIn() throws Exception {
    CloudFoundryClient infoClient = new CloudFoundryClient(new URL(CCNG_API_URL), httpProxyConfiguration, CCNG_API_SSL);
    CloudInfo info = infoClient.getCloudInfo();
    assertNotNull(info.getName());
    assertNotNull(info.getSupport());
    assertNotNull(info.getBuild());
    assertTrue(info.getUser() == null);
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:10,代码来源:CloudFoundryClientTest.java


示例12: isPortBasedRouting

import org.cloudfoundry.client.lib.domain.CloudInfo; //导入依赖的package包/类
private boolean isPortBasedRouting(CloudFoundryOperations client) {
    CloudInfo info = client.getCloudInfo();
    if (info instanceof CloudInfoExtended) {
        return ((CloudInfoExtended) info).isPortBasedRouting();
    }
    return false;
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:8,代码来源:CollectSystemParametersStep.java


示例13: getDeployServiceUrl

import org.cloudfoundry.client.lib.domain.CloudInfo; //导入依赖的package包/类
private String getDeployServiceUrl(CloudFoundryOperations client) {
    CloudInfo info = client.getCloudInfo();
    if (info instanceof CloudInfoExtended) {
        return ((CloudInfoExtended) info).getDeployServiceUrl();
    }
    return configuration.getDeployServiceUrl();
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:8,代码来源:CollectSystemParametersStep.java


示例14: controllerSupportsTasks

import org.cloudfoundry.client.lib.domain.CloudInfo; //导入依赖的package包/类
private boolean controllerSupportsTasks(CloudFoundryOperations client) {
    CloudInfo cloudInfo = client.getCloudInfo();
    if (!(cloudInfo instanceof CloudInfoExtended)) {
        return false;
    }
    CloudInfoExtended extendedCloudInfo = (CloudInfoExtended) cloudInfo;
    return extendedCloudInfo.hasTasksSupport();
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:9,代码来源:OneOffTasksSupportChecker.java


示例15: getLoginResponse

import org.cloudfoundry.client.lib.domain.CloudInfo; //导入依赖的package包/类
public static OAuth2AccessToken getLoginResponse(String targetUrl, CloudInfo info, CloudCredentials credentials) throws CloudFoundryException {
	log.info("Requesting authentication token from "+info.getAuthorizationEndpoint()+"/oauth/token");	
	Map<String,String> headers = new HashMap<String,String>();
	headers.put("Authorization", "Basic Y2Y6");
	try {
		StringEntity body = new StringEntity("grant_type=password&username="+Utils.safeEncode(credentials.getEmail())+"&password="+Utils.safeEncode(credentials.getPassword()));
		JSONObject ro = ResponseObject.postResponsObject(new URL(info.getAuthorizationEndpoint()+"/oauth/token").toURI(),headers,body);
		return new OAuth2AccessToken(ro, targetUrl);
	}
	catch (Throwable t) {
		t.printStackTrace();
		throw new CloudFoundryException(HttpStatus.SC_BAD_REQUEST,t.getMessage());
	}
}
 
开发者ID:stephen-kruger,项目名称:cloudfoundry-liteclient-lib,代码行数:15,代码来源:OAuth2AccessToken.java


示例16: infoAvailable

import org.cloudfoundry.client.lib.domain.CloudInfo; //导入依赖的package包/类
@Test
public void infoAvailable() throws Exception {
	CloudInfo info = connectedClient.getCloudInfo();
	assertNotNull(info.getName());
	assertNotNull(info.getSupport());
	assertNotNull(info.getBuild());
}
 
开发者ID:stephen-kruger,项目名称:cloudfoundry-liteclient-lib,代码行数:8,代码来源:CloudFoundryClientTest.java


示例17: testCloudInfo

import org.cloudfoundry.client.lib.domain.CloudInfo; //导入依赖的package包/类
public void testCloudInfo() throws JSONException, IllegalStateException, IOException, URISyntaxException, CloudFoundryException {
	log.info("==========================");
	CloudInfo cloudInfo = cfc.getCloudInfo();
	Limits limits = cloudInfo.getLimits();
	log.info("MaxTotalMemory:"+limits.getMaxTotalMemory());
	log.info("MaxApps:"+limits.getMaxApps());
	log.info("MaxServices:"+limits.getMaxServices());
	log.info("MaxUrisPerApp:"+limits.getMaxUrisPerApp());

}
 
开发者ID:stephen-kruger,项目名称:cloudfoundry-liteclient-lib,代码行数:11,代码来源:ClientTest.java


示例18: isPortBasedRouting

import org.cloudfoundry.client.lib.domain.CloudInfo; //导入依赖的package包/类
private boolean isPortBasedRouting(CloudFoundryOperations client) {
    CloudInfo info = client.getCloudInfo();
    return (info instanceof CloudInfoExtended) ? ((CloudInfoExtended) info).isPortBasedRouting() : false;
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:5,代码来源:UndeployAppStep.java


示例19: mockControllerTasksSupport

import org.cloudfoundry.client.lib.domain.CloudInfo; //导入依赖的package包/类
private void mockControllerTasksSupport(CloudFoundryOperations client) {
    CloudInfo info = getInfoSayingTheControllerSupportsTasks();
    when(client.getCloudInfo()).thenReturn(info);
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:5,代码来源:PrepareToExecuteTasksStepTest.java


示例20: getInfoSayingTheControllerSupportsTasks

import org.cloudfoundry.client.lib.domain.CloudInfo; //导入依赖的package包/类
private CloudInfo getInfoSayingTheControllerSupportsTasks() {
    CloudInfoExtended info = Mockito.mock(CloudInfoExtended.class);
    when(info.hasTasksSupport()).thenReturn(true);
    return info;
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:6,代码来源:PrepareToExecuteTasksStepTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TheatreDetailLiteVo类代码示例发布时间:2022-05-15
下一篇:
Java ASTVarNode类代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap