Skip to content

Commit

Permalink
Merge pull request #140 from bcgov/feature/3.6.0
Browse files Browse the repository at this point in the history
Feature/3.6.0
  • Loading branch information
mhostett authored Dec 13, 2024
2 parents f0c9dde + 3591643 commit e89472a
Show file tree
Hide file tree
Showing 16 changed files with 473 additions and 25 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/openshift-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@ jobs:
LOG_LEVEL: ${{ vars.LOG_LEVEL }}
CONNECTION_TIMEOUT: ${{ vars.CONNECTION_TIMEOUT }}

WEBADE_CHECK_TOKEN_URL: ${{ vars.WEBADE_CHECK_TOKEN_URL }}
WEBADE_GET_TOKEN_URL: ${{ vars.WEBADE_GET_TOKEN_URL }}
WEBADE_CHECK_CLIENT_TOKEN_URL: ${{ vars.WEBADE_CHECK_CLIENT_TOKEN_URL }}
WEBADE_CHECK_API_TOKEN_URL: ${{ vars.WEBADE_CHECK_API_TOKEN_URL }}
WEBADE_GET_API_TOKEN_URL: ${{ vars.WEBADE_GET_API_TOKEN_URL }}
WEBADE_GET_CLIENT_TOKEN_URL: ${{ vars.WEBADE_GET_CLIENT_TOKEN_URL }}
POSTGRES_USERNAME: ${{ vars.POSTGRES_USERNAME}}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public class ProductRsrc extends BaseResource implements Product {
private Double productionGuarantee;
private Double probableYield;
private String insuredByMeasType;
private Double insurableValueHundredPercent;
private Double coverageDollars;

private Date dataSyncTransDate;
private String transactionType;
Expand Down Expand Up @@ -109,4 +111,20 @@ public String getTransactionType() {
public void setTransactionType(String transactionType) {
this.transactionType = transactionType;
}

public Double getInsurableValueHundredPercent() {
return insurableValueHundredPercent;
}

public void setInsurableValueHundredPercent(Double insurableValueHundredPercent) {
this.insurableValueHundredPercent = insurableValueHundredPercent;
}

public Double getCoverageDollars() {
return coverageDollars;
}

public void setCoverageDollars(Double coverageDollars) {
this.coverageDollars = coverageDollars;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ public void updateProduct(ProductDto dto, Product model) {
dto.setProductId(model.getProductId());
dto.setProductionGuarantee(model.getProductionGuarantee());
dto.setProductStatusCode(model.getProductStatusCode());
dto.setInsurableValueHundredPercent(model.getInsurableValueHundredPercent());
dto.setCoverageDollars(model.getCoverageDollars());
dto.setDataSyncTransDate(model.getDataSyncTransDate());
}

Expand All @@ -213,8 +215,10 @@ public Product getProduct(ProductDto dto) {
resource.setProductId(dto.getProductId());
resource.setProductionGuarantee(dto.getProductionGuarantee());
resource.setProductStatusCode(dto.getProductStatusCode());
resource.setInsurableValueHundredPercent(dto.getInsurableValueHundredPercent());
resource.setCoverageDollars(dto.getCoverageDollars());
resource.setDataSyncTransDate(dto.getDataSyncTransDate());

return resource;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,21 @@ public void updateDto(

}

@Override
public void updateDto(VerifiedYieldAmendmentDto dto, VerifiedYieldAmendment model) {
dto.setAcres(model.getAcres());
dto.setCropCommodityId(model.getCropCommodityId());
dto.setCropCommodityName(model.getCropCommodityName());
dto.setFieldId(model.getFieldId());
dto.setFieldLabel(model.getFieldLabel());
dto.setIsPedigreeInd(model.getIsPedigreeInd());
dto.setRationale(model.getRationale());
dto.setVerifiedYieldAmendmentCode(model.getVerifiedYieldAmendmentCode());
dto.setVerifiedYieldAmendmentGuid(model.getVerifiedYieldAmendmentGuid());
dto.setVerifiedYieldContractGuid(model.getVerifiedYieldContractGuid());
dto.setYieldPerAcre(model.getYieldPerAcre());
}

private Double notNull(Double value, Double defaultValue) {
return (value == null) ? defaultValue : value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ public void testCreateUpdateDeleteProduct() throws CirrasUnderwritingServiceExce
resource.setProductId(productId);
resource.setProductionGuarantee(56.78);
resource.setProductStatusCode("OFFER");
resource.setInsurableValueHundredPercent(150.5);
resource.setCoverageDollars(1155.7);


resource.setDataSyncTransDate(createTransactionDate);
resource.setTransactionType(PoliciesSyncEventTypes.ProductCreated);
Expand All @@ -183,7 +186,9 @@ public void testCreateUpdateDeleteProduct() throws CirrasUnderwritingServiceExce
Assert.assertEquals(resource.getProductId(), fetchedResource.getProductId());
Assert.assertEquals(resource.getProductionGuarantee(), fetchedResource.getProductionGuarantee());
Assert.assertEquals(resource.getProductStatusCode(), fetchedResource.getProductStatusCode());

Assert.assertEquals(resource.getInsurableValueHundredPercent(), fetchedResource.getInsurableValueHundredPercent());
Assert.assertEquals(resource.getCoverageDollars(), fetchedResource.getCoverageDollars());

Assert.assertTrue(resource.getDataSyncTransDate().compareTo(fetchedResource.getDataSyncTransDate()) == 0);


Expand All @@ -196,6 +201,9 @@ public void testCreateUpdateDeleteProduct() throws CirrasUnderwritingServiceExce
fetchedResource.setProbableYield(11.22);
fetchedResource.setProductionGuarantee(33.44);
fetchedResource.setProductStatusCode("FINAL");
fetchedResource.setInsurableValueHundredPercent(234.5);
fetchedResource.setCoverageDollars(2233.5);


fetchedResource.setDataSyncTransDate(addSeconds(transactionDate, +1));
fetchedResource.setTransactionType(PoliciesSyncEventTypes.ProductUpdated);
Expand All @@ -213,7 +221,9 @@ public void testCreateUpdateDeleteProduct() throws CirrasUnderwritingServiceExce
Assert.assertEquals(fetchedResource.getProductId(), updatedResource.getProductId());
Assert.assertEquals(fetchedResource.getProductionGuarantee(), updatedResource.getProductionGuarantee());
Assert.assertEquals(fetchedResource.getProductStatusCode(), updatedResource.getProductStatusCode());

Assert.assertEquals(fetchedResource.getInsurableValueHundredPercent(), updatedResource.getInsurableValueHundredPercent());
Assert.assertEquals(fetchedResource.getCoverageDollars(), updatedResource.getCoverageDollars());

Assert.assertTrue(fetchedResource.getDataSyncTransDate().compareTo(updatedResource.getDataSyncTransDate()) == 0);

//DELETE PRODUCT
Expand All @@ -237,6 +247,8 @@ public void testCreateUpdateDeleteProduct() throws CirrasUnderwritingServiceExce
resource2.setProductId(productId);
resource2.setProductionGuarantee(56.78);
resource2.setProductStatusCode("OFFER");
resource2.setInsurableValueHundredPercent(188.3);
resource2.setCoverageDollars(8945.4);

resource2.setDataSyncTransDate(createTransactionDate);
resource2.setTransactionType(PoliciesSyncEventTypes.ProductCreated);
Expand Down Expand Up @@ -290,6 +302,9 @@ public void testUpdateProductWithoutRecordNoUpdate() throws CirrasUnderwritingSe
resource.setProductId(productId);
resource.setProductionGuarantee(56.78);
resource.setProductStatusCode("OFFER");
resource.setInsurableValueHundredPercent(150.5);
resource.setCoverageDollars(1155.7);


resource.setDataSyncTransDate(createTransactionDate);

Expand All @@ -314,7 +329,9 @@ public void testUpdateProductWithoutRecordNoUpdate() throws CirrasUnderwritingSe
Assert.assertEquals(resource.getProductId(), fetchedResource.getProductId());
Assert.assertEquals(resource.getProductionGuarantee(), fetchedResource.getProductionGuarantee());
Assert.assertEquals(resource.getProductStatusCode(), fetchedResource.getProductStatusCode());

Assert.assertEquals(resource.getInsurableValueHundredPercent(), fetchedResource.getInsurableValueHundredPercent());
Assert.assertEquals(resource.getCoverageDollars(), fetchedResource.getCoverageDollars());

Assert.assertTrue(resource.getDataSyncTransDate().compareTo(fetchedResource.getDataSyncTransDate()) == 0);

//NO UPDATE EXPECTED BECAUSE TRANSACTION DATE IS EARLIER THAN STORED ONE
Expand All @@ -336,7 +353,9 @@ public void testUpdateProductWithoutRecordNoUpdate() throws CirrasUnderwritingSe
notUpdatedResource.setProbableYield(11.22);
notUpdatedResource.setProductionGuarantee(33.44);
notUpdatedResource.setProductStatusCode("FINAL");

notUpdatedResource.setInsurableValueHundredPercent(222.5);
notUpdatedResource.setCoverageDollars(1235.7);


//UPDATE EXPECTED BECAUSE RECORD EXISTS IT WILL UPDATE IT
notUpdatedResource.setTransactionType(PoliciesSyncEventTypes.ProductCreated);
Expand All @@ -354,7 +373,9 @@ public void testUpdateProductWithoutRecordNoUpdate() throws CirrasUnderwritingSe
Assert.assertEquals(notUpdatedResource.getProductId(), updatedResource.getProductId());
Assert.assertEquals(notUpdatedResource.getProductionGuarantee(), updatedResource.getProductionGuarantee());
Assert.assertEquals(notUpdatedResource.getProductStatusCode(), updatedResource.getProductStatusCode());

Assert.assertEquals(notUpdatedResource.getInsurableValueHundredPercent(), updatedResource.getInsurableValueHundredPercent());
Assert.assertEquals(notUpdatedResource.getCoverageDollars(), updatedResource.getCoverageDollars());

Assert.assertTrue(notUpdatedResource.getDataSyncTransDate().compareTo(updatedResource.getDataSyncTransDate()) == 0);

logger.debug(">testUpdateProductWithoutRecordNoUpdate");
Expand Down
Loading

0 comments on commit e89472a

Please sign in to comment.