@Test public void test_cloud_foundry_instance_id() { Registration registration = Registration.create("foo", "http: .metadata("applicationId", "549e64cf-a478-423d-9d6d-02d803a028a8") .metadata("instanceId", "0") .build(); assertThat(instance.generateId(registration)).isEqualTo( InstanceId.of("549e64cf-a478-423d-9d6d-02d803a028a8:0")); }
@Override public InstanceId generateId(Registration registration) { String applicationId = registration.getMetadata().get("applicationId"); String instanceId = registration.getMetadata().get("instanceId"); if (StringUtils.hasText(applicationId) && StringUtils.hasText(instanceId)) { return InstanceId.of(String.format("%s:%s", applicationId, instanceId)); } return fallbackIdGenerator.generateId(registration); }
CloudFoundryInstanceIdGenerator implements InstanceIdGenerator { @Override public InstanceId generateId(Registration registration) { String applicationId = registration.getMetadata().get("applicationId"); String instanceId = registration.getMetadata().get("instanceId"); if (StringUtils.hasText(applicationId) && StringUtils.hasText(instanceId)) { return InstanceId.of(String.format("%s:%s", applicationId, instanceId)); } return fallbackIdGenerator.generateId(registration); } }
CloudFoundryInstanceIdGenerator implements InstanceIdGenerator { @Override public InstanceId generateId(Registration registration) { String applicationId = registration.getMetadata().get("applicationId"); String instanceId = registration.getMetadata().get("instanceId"); if (StringUtils.hasText(applicationId) && StringUtils.hasText(instanceId)) { return InstanceId.of(String.format("%s:%s", applicationId, instanceId)); } return fallbackIdGenerator.generateId(registration); } CloudFoundryInstanceIdGenerator(InstanceIdGenerator fallbackIdGenerator); }
CloudFoundryInstanceIdGenerator implements InstanceIdGenerator { @Override public InstanceId generateId(Registration registration) { String applicationId = registration.getMetadata().get("applicationId"); String instanceId = registration.getMetadata().get("instanceId"); if (StringUtils.hasText(applicationId) && StringUtils.hasText(instanceId)) { return InstanceId.of(String.format("%s:%s", applicationId, instanceId)); } return fallbackIdGenerator.generateId(registration); } CloudFoundryInstanceIdGenerator(InstanceIdGenerator fallbackIdGenerator); @Override InstanceId generateId(Registration registration); }
CloudFoundryInstanceIdGenerator implements InstanceIdGenerator { @Override public InstanceId generateId(Registration registration) { String applicationId = registration.getMetadata().get("applicationId"); String instanceId = registration.getMetadata().get("instanceId"); if (StringUtils.hasText(applicationId) && StringUtils.hasText(instanceId)) { return InstanceId.of(String.format("%s:%s", applicationId, instanceId)); } return fallbackIdGenerator.generateId(registration); } CloudFoundryInstanceIdGenerator(InstanceIdGenerator fallbackIdGenerator); @Override InstanceId generateId(Registration registration);  }