Skip to content

Commit

Permalink
fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
grapigeau committed Oct 1, 2024
1 parent 7b43b82 commit 0a8df4e
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 150 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ public class ShesmuDetailedCase {
private final String assayVersion;
private final String caseIdentifier;
private final CaseStatus caseStatus;
private final boolean isStopped;
private final boolean isPaused;
private final boolean stopped;
private final boolean paused;
private final Optional<Instant> completedDate;
private final long requisitionId;
private final String requisitionName;
private final Set<ShesmuTest> sequencing;
private final Set<ShesmuSequencing> sequencing;

private ShesmuDetailedCase(Builder builder) {
this.assayName = requireNonNull(builder.assayName);
this.assayVersion = requireNonNull(builder.assayVersion);
this.caseIdentifier = requireNonNull(builder.caseIdentifier);
this.caseStatus = requireNonNull(builder.caseStatus);
this.completedDate = builder.completedDate;
this.isStopped = builder.isStopped;
this.isPaused = builder.isPaused;
this.stopped = builder.stopped;
this.paused = builder.paused;
this.requisitionId = requireNonNull(builder.requisitionId);
this.requisitionName = requireNonNull(builder.requisitionName);
this.sequencing = unmodifiableSet(requireNonNull(builder.sequencing));
Expand All @@ -56,12 +56,12 @@ public CaseStatus getCaseStatus() {
return caseStatus;
}

public boolean getIsStopped() {
return isStopped;
public boolean isStopped() {
return stopped;
}

public boolean getIsPaused() {
return isPaused;
public boolean isPaused() {
return paused;
}

public Optional<Instant> getCompletedDate() {
Expand All @@ -76,7 +76,7 @@ public String getRequisitionName() {
return requisitionName;
}

public Set<ShesmuTest> getSequencing() {
public Set<ShesmuSequencing> getSequencing() {
return sequencing;
}

Expand All @@ -87,12 +87,12 @@ public static class Builder {
private String assayVersion;
private String caseIdentifier;
private CaseStatus caseStatus;
private boolean isPaused;
private boolean isStopped;
private boolean paused;
private boolean stopped;
private Optional<Instant> completedDate;
private long requisitionId;
private String requisitionName;
private Set<ShesmuTest> sequencing;
private Set<ShesmuSequencing> sequencing;

public ShesmuDetailedCase build() {
return new ShesmuDetailedCase(this);
Expand All @@ -113,13 +113,13 @@ public Builder caseStatus(CaseStatus caseStatus) {
return this;
}

public Builder isPaused(boolean isPaused) {
this.isPaused = isPaused;
public Builder paused(boolean paused) {
this.paused = paused;
return this;
}

public Builder isStopped(boolean isStopped) {
this.isStopped = isStopped;
public Builder stopped(boolean stopped) {
this.stopped = stopped;
return this;
}

Expand Down Expand Up @@ -148,7 +148,7 @@ public Builder requisitionName(String requisitionName) {
return this;
}

public Builder sequencing(Set<ShesmuTest> sequencing){
public Builder sequencing(Set<ShesmuSequencing> sequencing){
this.sequencing = sequencing;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@
public class ShesmuSample {

private final String id;
private final Boolean isSupplemental;
private final boolean supplemental;


private ShesmuSample(Builder builder) {
this.id = requireNonNull(builder.id);
this.isSupplemental = requireNonNull(builder.isSupplemental);
this.supplemental = requireNonNull(builder.supplemental);
}


public String getId() {
return id;
}

public Boolean getIsSupplemental() {
return isSupplemental;
public Boolean isSupplemental() {
return supplemental;
}


Expand All @@ -38,7 +38,7 @@ public Boolean getIsSupplemental() {
public static class Builder {

private String id;
private Boolean isSupplemental;
private boolean supplemental;

public ShesmuSample build() {
return new ShesmuSample(this);
Expand All @@ -50,8 +50,8 @@ public Builder id(String id) {
return this;
}

public Builder isSupplemental(Boolean isSupplemental) {
this.isSupplemental = isSupplemental;
public Builder supplemental(boolean supplemental) {
this.supplemental = supplemental;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,37 @@
/**
* Immutable Test
*/
@JsonDeserialize(builder = ShesmuTest.Builder.class)
public class ShesmuTest {
@JsonDeserialize(builder = ShesmuSequencing.Builder.class)
public class ShesmuSequencing {

private final String name;
private final TestCategory test;
private final MetricCategory test;
private final Set<ShesmuSample> limsIds;
private final Boolean isComplete;
private final boolean complete;


private ShesmuTest(Builder builder) {
private ShesmuSequencing(Builder builder) {
this.name = requireNonNull(builder.name);
this.test = requireNonNull(builder.test);
this.limsIds = unmodifiableSet(requireNonNull(builder.limsIds));
this.isComplete = requireNonNull(builder.isComplete);
this.complete = requireNonNull(builder.complete);
}


public String getName() {
return name;
}

public TestCategory getTest() {
public MetricCategory getTest() {
return test;
}

public Set<ShesmuSample> getLimsIds() {
return limsIds;
}

public Boolean getIsComplete() {
return isComplete;
public Boolean isComplete() {
return complete;
}


Expand All @@ -51,14 +51,14 @@ public static class Builder {

private String name;
private Set<ShesmuSample> limsIds;
private TestCategory test;
private Boolean isComplete;
private MetricCategory test;
private boolean complete;




public ShesmuTest build() {
return new ShesmuTest(this);
public ShesmuSequencing build() {
return new ShesmuSequencing(this);
}


Expand All @@ -67,7 +67,7 @@ public Builder name(String name) {
return this;
}

public Builder test(TestCategory test) {
public Builder test(MetricCategory test) {
this.test = test;
return this;
}
Expand All @@ -77,8 +77,8 @@ public Builder limsIds(Set<ShesmuSample> limsIds) {
return this;
}

public Builder isComplete(Boolean isComplete) {
this.isComplete = isComplete;
public Builder complete(boolean complete) {
this.complete = complete;
return this;
}

Expand Down

This file was deleted.

55 changes: 15 additions & 40 deletions cardea-data/src/test/java/ca/on/oicr/gsi/cardea/JacksonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,11 @@
import java.util.Map;
import java.util.Set;
import java.util.function.BiConsumer;

import ca.on.oicr.gsi.cardea.data.*;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import com.fasterxml.jackson.databind.ObjectMapper;
import ca.on.oicr.gsi.cardea.data.AnalysisQcGroup;
import ca.on.oicr.gsi.cardea.data.Assay;
import ca.on.oicr.gsi.cardea.data.AssayTargets;
import ca.on.oicr.gsi.cardea.data.Case;
import ca.on.oicr.gsi.cardea.data.CaseDeliverable;
import ca.on.oicr.gsi.cardea.data.CaseDeliverableImpl;
import ca.on.oicr.gsi.cardea.data.CaseImpl;
import ca.on.oicr.gsi.cardea.data.CaseRelease;
import ca.on.oicr.gsi.cardea.data.CaseReleaseImpl;
import ca.on.oicr.gsi.cardea.data.CaseStatus;
import ca.on.oicr.gsi.cardea.data.DeliverableType;
import ca.on.oicr.gsi.cardea.data.Donor;
import ca.on.oicr.gsi.cardea.data.Lane;
import ca.on.oicr.gsi.cardea.data.Metric;
import ca.on.oicr.gsi.cardea.data.MetricCategory;
import ca.on.oicr.gsi.cardea.data.MetricSubcategory;
import ca.on.oicr.gsi.cardea.data.OmittedSample;
import ca.on.oicr.gsi.cardea.data.Project;
import ca.on.oicr.gsi.cardea.data.Requisition;
import ca.on.oicr.gsi.cardea.data.Run;
import ca.on.oicr.gsi.cardea.data.Sample;
import ca.on.oicr.gsi.cardea.data.ShesmuCase;
import ca.on.oicr.gsi.cardea.data.ShesmuDetailedCase;
import ca.on.oicr.gsi.cardea.data.ShesmuSample;
import ca.on.oicr.gsi.cardea.data.ShesmuTest;
import ca.on.oicr.gsi.cardea.data.Test;
import ca.on.oicr.gsi.cardea.data.TestCategory;
import ca.on.oicr.gsi.cardea.data.ThresholdType;
import ca.on.oicr.gsi.cardea.data.ShesmuSequencing;

public class JacksonTest {

Expand Down Expand Up @@ -519,8 +494,8 @@ private static void assertShesmuDetailedCaseEqual(ShesmuDetailedCase one, Shesmu
assertEquals(one.getAssayName(), two.getAssayName());
assertEquals(one.getAssayVersion(), two.getAssayVersion());
assertEquals(one.getCaseIdentifier(), two.getCaseIdentifier());
assertEquals(one.getIsPaused(), two.getIsPaused());
assertEquals(one.getIsStopped(), two.getIsStopped());
assertEquals(one.isPaused(), two.isPaused());
assertEquals(one.isStopped(), two.isStopped());
assertEquals(one.getCaseStatus(), two.getCaseStatus());
assertEquals(one.getCompletedDate(), two.getCompletedDate());
assertEquals(one.getSequencing().size(), two.getSequencing().size());
Expand All @@ -531,13 +506,13 @@ private static void assertShesmuDetailedCaseEqual(ShesmuDetailedCase one, Shesmu

private static void assertShesmuSampleEqual(ShesmuSample one, ShesmuSample two) {
assertEquals(one.getId(), two.getId());
assertEquals(one.getIsSupplemental(), two.getIsSupplemental());
assertEquals(one.isSupplemental(), two.isSupplemental());
}

private static void assertShesmuTestEqual(ShesmuTest one, ShesmuTest two) {
private static void assertShesmuTestEqual(ShesmuSequencing one, ShesmuSequencing two) {
assertEquals(one.getName(), two.getName());
assertEquals(one.getTest(), two.getTest());
assertEquals(one.getIsComplete(), two.getIsComplete());
assertEquals(one.isComplete(), two.isComplete());
assertEquals(one.getLimsIds().size(), two.getLimsIds().size());
assertShesmuSampleEqual(one.getLimsIds().iterator().next(), two.getLimsIds().iterator().next());

Expand Down Expand Up @@ -839,25 +814,25 @@ private static ShesmuCase makeShesmuCase() {
}

private static ShesmuDetailedCase makeShesmuDetailedCase() {
Set<ShesmuTest> sequencing = new HashSet<>();
Set<ShesmuSequencing> sequencing = new HashSet<>();
Set<ShesmuSample> limsIds = new HashSet<>();
limsIds.add(new ShesmuSample.Builder()
.id("ID1")
.isSupplemental(false)
.supplemental(false)
.build());
sequencing.add(new ShesmuTest.Builder()
sequencing.add(new ShesmuSequencing.Builder()
.name("Some Test")
.limsIds(limsIds)
.isComplete(true)
.test(TestCategory.LIBRARYQUALIFICATION)
.complete(true)
.test(MetricCategory.LIBRARY_QUALIFICATION)
.build());

return new ShesmuDetailedCase.Builder()
.assayName("Assay")
.assayVersion("2.0")
.caseIdentifier("CASE10")
.isStopped(false)
.isPaused(false)
.stopped(false)
.paused(false)
.caseStatus(CaseStatus.COMPLETED)
.completedDateLocal(LocalDate.of(2024, 1, 13))
.sequencing(sequencing)
Expand Down
Loading

0 comments on commit 0a8df4e

Please sign in to comment.