public Builder toBuilder() { final Builder builder = newBuilder(); if (id != null) { builder.setName(id.getName()).setVersion(id.getVersion()); } return builder .setImage(image) .setHostname(hostname) .setCommand(command) .setEnv(env) .setResources(resources) .setPorts(ports) .setRegistration(registration) .setGracePeriod(gracePeriod) .setVolumes(volumes) .setExpires(expires) .setRegistrationDomain(registrationDomain) .setCreatingUser(creatingUser) .setToken(token) .setHealthCheck(healthCheck) .setSecurityOpt(securityOpt) .setNetworkMode(networkMode); }
@Test public void deletesSome() throws Exception { final JobId jobId = new JobId(UUID.randomUUID()); repository.put(aJobHistoryItemWith(jobId)); repository.put(aJobHistoryItem()); repository.remove(format("jobId:\"%s\"", jobId.value().toString())); assertThat(repository.find("").right().size(), is(1)); }
@Override public int hashCode() { int result = id != null ? id.hashCode() : 0; result = 31 * result + (image != null ? image.hashCode() : 0); result = 31 * result + (hostname != null ? hostname.hashCode() : 0); result = 31 * result + (expires != null ? expires.hashCode() : 0); result = 31 * result + (command != null ? command.hashCode() : 0); result = 31 * result + (env != null ? env.hashCode() : 0); result = 31 * result + (resources != null ? resources.hashCode() : 0); result = 31 * result + (ports != null ? ports.hashCode() : 0); result = 31 * result + (registration != null ? registration.hashCode() : 0); result = 31 * result + (registrationDomain != null ? registrationDomain.hashCode() : 0); result = 31 * result + (gracePeriod != null ? gracePeriod.hashCode() : 0); result = 31 * result + (volumes != null ? volumes.hashCode() : 0); result = 31 * result + (creatingUser != null ? creatingUser.hashCode() : 0); result = 31 * result + token.hashCode(); result = 31 * result + (healthCheck != null ? healthCheck.hashCode() : 0); result = 31 * result + (securityOpt != null ? securityOpt.hashCode() : 0); result = 31 * result + (networkMode != null ? networkMode.hashCode() : 0); return result; }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final Job job = (Job) o; if (command != null ? !command.equals(job.command) : job.command != null) { return false; } if (env != null ? !env.equals(job.env) : job.env != null) { return false; } if (resources != null ? !resources.equals(job.resources) : job.resources != null) { return false; } if (expires != null ? !expires.equals(job.expires) : job.expires != null) { return false; } if (id != null ? !id.equals(job.id) : job.id != null) { return false; } if (image != null ? !image.equals(job.image) : job.image != null) { return false; } if (hostname != null ? !hostname.equals(job.hostname) : job.hostname != null) { return false; } if (ports != null ? !ports.equals(job.ports) : job.ports != null) { return false; } if (registration != null ? !registration.equals(job.registration) : job.registration != null) { return false; } if (registrationDomain != null ? !registrationDomain.equals(job.registrationDomain) : job.registrationDomain != null) { return false; } if (gracePeriod != null ? !gracePeriod.equals(job.gracePeriod) : job.gracePeriod != null) { return false; } if (volumes != null ? !volumes.equals(job.volumes) : job.volumes != null) { return false; } if (creatingUser != null ? !creatingUser.equals(job.creatingUser) : job.creatingUser != null) { return false; } if (!token.equals(job.token)) { return false; } if (healthCheck != null ? !healthCheck.equals(job.healthCheck) : job.healthCheck != null) { return false; } if (securityOpt != null ? !securityOpt.equals(job.securityOpt) : job.securityOpt != null) { return false; } if (networkMode != null ? !networkMode.equals(job.networkMode) : job.networkMode != null) { return false; } return true; }
@Override public int compareTo(@NotNull final Job o) { return id.compareTo(o.getId()); }