Commit 8cb5795d by Johannes Edmeier

Rename copying factory method to 'copyOf

parent c15b3bbc
......@@ -110,7 +110,7 @@ public class ApplicationDiscoveryListener {
protected String register(ServiceInstance instance) {
try {
Application application = converter.convert(instance);
application = Application.create(application).withSource(SOURCE).build();
application = Application.copyOf(application).withSource(SOURCE).build();
if (application != null) {
LOGGER.debug("Registering discovered application {}", application);
return registry.register(application).getId();
......
......@@ -72,7 +72,7 @@ public class Application implements Serializable {
return new Builder(name);
}
public static Builder create(Application application) {
public static Builder copyOf(Application application) {
return new Builder(application);
}
......
......@@ -72,7 +72,7 @@ public class ApplicationRegistry implements ApplicationEventPublisherAware {
StatusInfo existingStatusInfo = getExistingStatusInfo(applicationId);
Application registering = Application.create(application).withId(applicationId)
Application registering = Application.copyOf(application).withId(applicationId)
.withStatusInfo(existingStatusInfo).build();
Application replaced = store.save(registering);
......
......@@ -73,7 +73,7 @@ public class StatusUpdater implements ApplicationEventPublisherAware {
StatusInfo oldStatus = application.getStatusInfo();
StatusInfo newStatus = queryStatus(application);
Application newState = Application.create(application).withStatusInfo(newStatus).build();
Application newState = Application.copyOf(application).withStatusInfo(newStatus).build();
store.save(newState);
if (!newStatus.equals(oldStatus)) {
......
......@@ -56,7 +56,7 @@ public class RegistryController {
*/
@RequestMapping(method = RequestMethod.POST)
public ResponseEntity<Application> register(@RequestBody Application application) {
application = Application.create(application).withSource("http-api").build();
application = Application.copyOf(application).withSource("http-api").build();
LOGGER.debug("Register application {}", application.toString());
Application registeredApp = registry.register(application);
return ResponseEntity.status(HttpStatus.CREATED).body(registeredApp);
......
......@@ -110,7 +110,7 @@ public class ApplicationTest {
Application app = Application.create("App").withId("-id-").withHealthUrl("http://health")
.withManagementUrl("http://mgmgt").withServiceUrl("http://svc")
.withStatusInfo(StatusInfo.ofUp()).build();
Application copy = Application.create(app).build();
Application copy = Application.copyOf(app).build();
assertThat(app, is(copy));
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment