Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/issue-79' into develop-2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
timparsons committed Oct 6, 2023
2 parents 8d48ce0 + f83a2c7 commit 20b6436
Show file tree
Hide file tree
Showing 6 changed files with 862 additions and 629 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,28 @@
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(fluent=true)
@Accessors(fluent = true)
public class CrossQueryParams extends BrAPIQueryParams {

private String crossingProjectDbId;
private String crossDbId;
private String externalReferenceSource;
private String externalReferenceId;
@Deprecated
private String externalReferenceID;

public String getExternalReferenceId() {
private String commonCropName;
private String crossingProjectDbId;
private String crossingProjectName;
private String crossDbId;
private String crossName;
private String externalReferenceSource;
private String externalReferenceId;
@Deprecated
private String externalReferenceID;
private String programDbId;

public String getExternalReferenceId() {
return externalReferenceId;
}
public String externalReferenceId() {

public String externalReferenceId() {
return externalReferenceId;
}

public void setExternalReferenceId(String externalReferenceId) {
this.externalReferenceId = externalReferenceId;
}
Expand All @@ -55,10 +61,12 @@ public void setExternalReferenceId(String externalReferenceId) {
public String getExternalReferenceID() {
return externalReferenceID;
}

@Deprecated
public String externalReferenceID() {
return externalReferenceID;
}

@Deprecated
public void setExternalReferenceID(String externalReferenceID) {
this.externalReferenceID = externalReferenceID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,27 @@
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(fluent=true)
@Accessors(fluent = true)
public class CrossingProjectQueryParams extends BrAPIQueryParams {

private String crossingProjectDbId;
private String externalReferenceSource;
private String externalReferenceId;
@Deprecated
private String externalReferenceID;

public String getExternalReferenceId() {
private String commonCropName;
private String crossingProjectDbId;
private String crossingProjectName;
private String externalReferenceId;;
@Deprecated
private String externalReferenceID;
private String externalReferenceSource;
private Boolean includePotentialParents;
private String programDbId;

public String getExternalReferenceId() {
return externalReferenceId;
}
public String externalReferenceId() {

public String externalReferenceId() {
return externalReferenceId;
}

public void setExternalReferenceId(String externalReferenceId) {
this.externalReferenceId = externalReferenceId;
}
Expand All @@ -54,10 +60,12 @@ public void setExternalReferenceId(String externalReferenceId) {
public String getExternalReferenceID() {
return externalReferenceID;
}

@Deprecated
public String externalReferenceID() {
return externalReferenceID;
}

@Deprecated
public void setExternalReferenceID(String externalReferenceID) {
this.externalReferenceID = externalReferenceID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import java.util.Map;

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class CrossesApiTest extends BrAPIClientTest{
public class CrossesApiTest extends BrAPIClientTest{

private final CrossesApi api = new CrossesApi(this.apiClient);

Expand All @@ -48,17 +48,13 @@ public class CrossesApiTest extends BrAPIClientTest{
*/
@Test
public void crossesGetTest() throws ApiException {
String crossingProjectDbId = null;
String crossDbId = null;
String externalReferenceID = null;
String externalReferenceSource = null;
Integer page = null;
Integer pageSize = null;
String crossDbId = "cross1";

CrossQueryParams queryParams = new CrossQueryParams();
CrossQueryParams queryParams = new CrossQueryParams().crossDbId(crossDbId);
ApiResponse<BrAPICrossesListResponse> response = api.crossesGet(queryParams);

// TODO: test validations

assertEquals(1, response.getBody().getResult().getData().size());
assertEquals(crossDbId, response.getBody().getResult().getData().get(0).getCrossDbId());
}
/**
* Create new Cross entities on this server
Expand All @@ -70,13 +66,17 @@ public void crossesGetTest() throws ApiException {
*/
@Test
public void crossesPostTest() throws ApiException {
List<BrAPICross> body = null;
BrAPICross cross = new BrAPICross()
.crossingProjectDbId("crossing_project2")
.crossName("New Name");
List<BrAPICross> body = Arrays.asList(cross);

IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> {
ApiResponse<BrAPICrossesListResponse> response = api.crossesPost(body);
});

// TODO: test validations
assertEquals(1, response.getBody().getResult().getData().size());
assertNotNull(response.getBody().getResult().getData().get(0).getCrossDbId());
assertEquals(cross.getCrossName(), response.getBody().getResult().getData().get(0).getCrossName());
assertEquals(cross.getCrossingProjectDbId(), response.getBody().getResult().getData().get(0).getCrossingProjectDbId());
}
/**
* Update existing Cross entities on this server
Expand All @@ -88,13 +88,19 @@ public void crossesPostTest() throws ApiException {
*/
@Test
public void crossesPutTest() throws ApiException {
Map<String, BrAPICross> body = null;
BrAPICross cross = new BrAPICross()
.crossingProjectDbId("crossing_project2")
.crossName("New Name")
.crossDbId("cross1");
Map<String, BrAPICross> body = new HashMap<String, BrAPICross>();
body.put("cross1", cross);

IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> {
ApiResponse<BrAPICrossesListResponse> response = api.crossesPut(body);
});

// TODO: test validations
assertEquals(1, response.getBody().getResult().getData().size());
assertEquals(cross.getCrossDbId(), response.getBody().getResult().getData().get(0).getCrossDbId());
assertEquals(cross.getCrossName(), response.getBody().getResult().getData().get(0).getCrossName());
assertEquals(cross.getCrossingProjectDbId(), response.getBody().getResult().getData().get(0).getCrossingProjectDbId());
}
/**
* Get a filtered list of Planned Cross entities
Expand Down
Loading

0 comments on commit 20b6436

Please sign in to comment.