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


Java ActualLRPResponse类代码示例

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


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

示例1: getServicesData

import org.cloudfoundry.receptor.commands.ActualLRPResponse; //导入依赖的package包/类
@Override
protected List<Process> getServicesData() {
	Map<String, Process> processes = new HashMap<>();
	List<DesiredLRPResponse> desiredLRPs = receptorClient.getDesiredLRPs();

	for (DesiredLRPResponse desired : desiredLRPs) {
		processes.put(desired.getProcessGuid(), new Process(desired));
	}

	List<ActualLRPResponse> actualLRPs = receptorClient.getActualLRPs();
	for (ActualLRPResponse actual : actualLRPs) {
		Process process = processes.get(actual.getProcessGuid());
		if (process != null) {
			process.add(actual);
		}
	}

	return new ArrayList<>(processes.values());
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-lattice,代码行数:20,代码来源:LatticeConnector.java

示例2: status

import org.cloudfoundry.receptor.commands.ActualLRPResponse; //导入依赖的package包/类
@Override
public ModuleStatus status(ModuleDeploymentId id) {
	ModuleStatus.Builder builder = ModuleStatus.of(id);

	// todo: if the actual LRP is not found, search for the desired LRP to verify
	// that the LRP is known to Lattice
	for (ActualLRPResponse lrp : receptorClient.getActualLRPsByProcessGuid(guid(id))) {
		Map<String, String> attributes = new HashMap<>();
		attributes.put("address", lrp.getAddress());
		attributes.put("cellId", lrp.getCellId());
		attributes.put("domain", lrp.getDomain());
		attributes.put("processGuid", lrp.getProcessGuid());
		attributes.put("index", Integer.toString(lrp.getIndex()));
		attributes.put("ports", StringUtils.arrayToCommaDelimitedString(lrp.getPorts()));
		attributes.put("since", Long.toString(lrp.getSince()));
		builder.with(new ReceptorModuleInstanceStatus(lrp.getInstanceGuid(), receptorProcessStatusMapper.map(lrp), attributes));
	}
	return builder.build();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dataflow-admin-lattice,代码行数:20,代码来源:LrpModuleDeployer.java

示例3: createServiceInfo

import org.cloudfoundry.receptor.commands.ActualLRPResponse; //导入依赖的package包/类
@Override
public RedisServiceInfo createServiceInfo(Process process) {
	ActualLRPResponse actual = process.getFirstActual();
	String address = actual.getAddress();
	int port = actual.getPorts()[0].getHostPort();
	String password = null;
	return new RedisServiceInfo(actual.getInstanceGuid(), address, port, password);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-lattice,代码行数:9,代码来源:RedisServiceInfoCreator.java

示例4: createServiceInfo

import org.cloudfoundry.receptor.commands.ActualLRPResponse; //导入依赖的package包/类
@Override
public AmqpServiceInfo createServiceInfo(Process process) {
	ActualLRPResponse actual = process.getFirstActual();
	String address = actual.getAddress();
	int port = actual.getPorts()[0].getHostPort();
	String username = "guest";
	String password = "guest";
	String virtualHost = null;
	return new LatticeAmqpServiceInfo(actual.getInstanceGuid(), address, port, username, password, virtualHost);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-lattice,代码行数:11,代码来源:AmqpServiceInfoCreator.java

示例5: createServiceInfo

import org.cloudfoundry.receptor.commands.ActualLRPResponse; //导入依赖的package包/类
@Override
public MysqlServiceInfo createServiceInfo(Process process) {
	ActualLRPResponse actual = process.getFirstActual();
	String scheme = "jdbc:"+ MysqlServiceInfo.MYSQL_SCHEME;
	String address = actual.getAddress();
	int port = actual.getPorts()[0].getHostPort();
	String username = "root";
	String password = findRequiredEnvVar(process, "MYSQL_ROOT_PASSWORD");
	String path = findEnvVar(process, "MYSQL_DATABASE_NAME", "test");

	return new MysqlServiceInfo(actual.getInstanceGuid(), constructJdbcUrl(scheme, address, port, username, password, path));
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-lattice,代码行数:13,代码来源:MysqlServiceInfoCreator.java

示例6: createConnector

import org.cloudfoundry.receptor.commands.ActualLRPResponse; //导入依赖的package包/类
protected LatticeConnector createConnector() {
	LatticeConnector connector = new LatticeConnector();
	connector.setEnvironmentAccessor(env);
	connector.setReceptorOperations(receptor);

	String alrpJson = readTestDataFile("/lattice-test/alrp.json");
	String dlrpJson = readTestDataFile("/lattice-test/dlrp.json");

	List<DesiredLRPResponse> dlrpResponses = read(DesiredLRPResponse.class, dlrpJson);
	List<ActualLRPResponse> alrpResponses = read(ActualLRPResponse.class, alrpJson);

	when(receptor.getActualLRPs()).thenReturn(alrpResponses);
	when(receptor.getDesiredLRPs()).thenReturn(dlrpResponses);
	return connector;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-lattice,代码行数:16,代码来源:AbstractServiceInfoCreatorTests.java

示例7: getServers

import org.cloudfoundry.receptor.commands.ActualLRPResponse; //导入依赖的package包/类
@SneakyThrows
private List<LatticeServer> getServers() {
	List<LatticeServer> servers = receptorService.getActualLRPsByProcessGuid(
			serviceId, new Converter<ActualLRPResponse, LatticeServer>() {
				@Override
				public LatticeServer convert(ActualLRPResponse response) {
					return new LatticeServer(response.getProcessGuid(), response
							.getInstanceGuid(), response.getAddress(), String
							.valueOf(response.getPorts()[0].getHostPort()));
				}
			});

	return servers;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-lattice,代码行数:15,代码来源:LatticeServerList.java

示例8: getActualLRPsByProcessGuid

import org.cloudfoundry.receptor.commands.ActualLRPResponse; //导入依赖的package包/类
public <T> List<T> getActualLRPsByProcessGuid(String processGuid,
		Converter<ActualLRPResponse, T> converter) {
	List<ActualLRPResponse> responses = getResponses(processGuid);
	List<T> lrps = new ArrayList<>();
	for (ActualLRPResponse response : responses) {
		T converted = converter.convert(response);
		lrps.add(converted);
	}
	return lrps;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-lattice,代码行数:11,代码来源:ReceptorService.java

示例9: getInstances

import org.cloudfoundry.receptor.commands.ActualLRPResponse; //导入依赖的package包/类
@Override
public List<ServiceInstance> getInstances(final String serviceId) {
	List<ServiceInstance> instances = receptorService.getActualLRPsByProcessGuid(
			serviceId, new Converter<ActualLRPResponse, ServiceInstance>() {
				@Override
				public ServiceInstance convert(ActualLRPResponse response) {
					return new DefaultServiceInstance(serviceId, response
							.getAddress(), response.getPorts()[0].getHostPort(),
							false);
				}
			});

	return instances;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-lattice,代码行数:15,代码来源:LatticeDiscoveryClient.java

示例10: getServices

import org.cloudfoundry.receptor.commands.ActualLRPResponse; //导入依赖的package包/类
@Override
public List<String> getServices() {
	LinkedHashSet<String> services = new LinkedHashSet<>();
	List<ActualLRPResponse> responses = receptorClient.getActualLRPs();

	for (ActualLRPResponse response : responses) {
		services.add(response.getProcessGuid());
	}
	return new ArrayList<>(services);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-lattice,代码行数:11,代码来源:LatticeDiscoveryClient.java

示例11: map

import org.cloudfoundry.receptor.commands.ActualLRPResponse; //导入依赖的package包/类
public ModuleStatus.State map(ActualLRPResponse actualLRPResponse) {
	ModuleStatus.State state;

	switch (actualLRPResponse.getState()) {
		case "RUNNING":
			state = ModuleStatus.State.deployed;
			break;
		case "UNCLAIMED":
			// see description of UNCLAIMED here: https://github.com/cloudfoundry-incubator/receptor/blob/master/doc/lrps.md
			if (StringUtils.hasText(actualLRPResponse.getPlacementError())) {
				state = ModuleStatus.State.failed;
			}
			else {
				state = ModuleStatus.State.deploying;
			}
			break;
		case "CLAIMED":
			state = ModuleStatus.State.deploying;
			break;
		case "CRASHED":
			state = ModuleStatus.State.failed;
			break;
		default:
			state = ModuleStatus.State.unknown;
	}

	return state;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dataflow-admin-lattice,代码行数:29,代码来源:LrpModuleDeployer.java

示例12: testGetActualLRPs

import org.cloudfoundry.receptor.commands.ActualLRPResponse; //导入依赖的package包/类
@Test
public void testGetActualLRPs() {
	ResponseEntity<List<ActualLRPResponse>> entity = new ResponseEntity(Collections.singletonList(getActualLRPResponse()), HttpStatus.OK);
	when(restTemplate.exchange("{baseUrl}/actual_lrps", HttpMethod.GET, null, ReceptorClient.ACTUAL_LRP_RESPONSE_LIST_TYPE, BASE_URL)).thenReturn(entity);

	List<ActualLRPResponse> responses = receptorClient.getActualLRPs();

	assertEquals(1, responses.size());

	ActualLRPResponse response = responses.get(0);
	assertActuaLRPResponse(response);
}
 
开发者ID:cloudfoundry-attic,项目名称:receptor-client,代码行数:13,代码来源:ReceptorClientTests.java

示例13: testGetActualLRPsByDomain

import org.cloudfoundry.receptor.commands.ActualLRPResponse; //导入依赖的package包/类
@Test
public void testGetActualLRPsByDomain() {
	ResponseEntity<List<ActualLRPResponse>> entity = new ResponseEntity(Collections.singletonList(getActualLRPResponse()), HttpStatus.OK);
	when(restTemplate.exchange("{baseUrl}/actual_lrps?domain={domain}", HttpMethod.GET, null, ReceptorClient.ACTUAL_LRP_RESPONSE_LIST_TYPE, BASE_URL, "foo")).thenReturn(entity);

	List<ActualLRPResponse> responses = receptorClient.getActualLRPsByDomain("foo");

	assertEquals(1, responses.size());

	ActualLRPResponse response = responses.get(0);
	assertActuaLRPResponse(response);
}
 
开发者ID:cloudfoundry-attic,项目名称:receptor-client,代码行数:13,代码来源:ReceptorClientTests.java

示例14: testGetActualLRPsByProcessGuid

import org.cloudfoundry.receptor.commands.ActualLRPResponse; //导入依赖的package包/类
@Test
public void testGetActualLRPsByProcessGuid() {
	ResponseEntity<List<ActualLRPResponse>> entity = new ResponseEntity(Collections.singletonList(getActualLRPResponse()), HttpStatus.OK);
	String guid = UUID.randomUUID().toString();
	when(restTemplate.exchange("{baseUrl}/actual_lrps/{processGuid}", HttpMethod.GET, null, ReceptorClient.ACTUAL_LRP_RESPONSE_LIST_TYPE, BASE_URL, guid)).thenReturn(entity);

	List<ActualLRPResponse> responses = receptorClient.getActualLRPsByProcessGuid(guid);

	assertEquals(1, responses.size());

	ActualLRPResponse response = responses.get(0);
	assertActuaLRPResponse(response);
}
 
开发者ID:cloudfoundry-attic,项目名称:receptor-client,代码行数:14,代码来源:ReceptorClientTests.java

示例15: testGetActualLRPByProcessGuidAndIndex

import org.cloudfoundry.receptor.commands.ActualLRPResponse; //导入依赖的package包/类
@Test
public void testGetActualLRPByProcessGuidAndIndex() {
	ResponseEntity<ActualLRPResponse> entity = new ResponseEntity(getActualLRPResponse(), HttpStatus.OK);
	String guid = UUID.randomUUID().toString();
	when(restTemplate.exchange("{baseUrl}/actual_lrps/{processGuid}/index/{index}", HttpMethod.GET, null, ActualLRPResponse.class, BASE_URL, guid, 5)).thenReturn(entity);

	ActualLRPResponse response = receptorClient.getActualLRPByProcessGuidAndIndex(guid, 5);

	assertActuaLRPResponse(response);
}
 
开发者ID:cloudfoundry-attic,项目名称:receptor-client,代码行数:11,代码来源:ReceptorClientTests.java


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