本文整理汇总了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());
}
示例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();
}
示例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);
}
示例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);
}
示例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));
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}