From 58e1e70aafe86e394cc5fa8ad46388c2a359f4bc Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Fri, 10 May 2019 11:56:15 -0400 Subject: [PATCH 1/3] test(Compare and Comply): Fix failing integration test --- .../v1/CompareComplyServiceIT.java | 49 +++++++++++++++++-- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyServiceIT.java b/compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyServiceIT.java index ce1873e6a57..e535a3e6b63 100644 --- a/compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyServiceIT.java +++ b/compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyServiceIT.java @@ -5,6 +5,7 @@ import com.ibm.watson.compare_comply.v1.model.AddFeedbackOptions; import com.ibm.watson.compare_comply.v1.model.BatchStatus; import com.ibm.watson.compare_comply.v1.model.Batches; +import com.ibm.watson.compare_comply.v1.model.Category; import com.ibm.watson.compare_comply.v1.model.ClassifyElementsOptions; import com.ibm.watson.compare_comply.v1.model.ClassifyReturn; import com.ibm.watson.compare_comply.v1.model.CompareDocumentsOptions; @@ -20,10 +21,12 @@ import com.ibm.watson.compare_comply.v1.model.GetFeedback; import com.ibm.watson.compare_comply.v1.model.GetFeedbackOptions; import com.ibm.watson.compare_comply.v1.model.HTMLReturn; +import com.ibm.watson.compare_comply.v1.model.Label; import com.ibm.watson.compare_comply.v1.model.Location; import com.ibm.watson.compare_comply.v1.model.OriginalLabelsIn; import com.ibm.watson.compare_comply.v1.model.ShortDoc; import com.ibm.watson.compare_comply.v1.model.TableReturn; +import com.ibm.watson.compare_comply.v1.model.TypeLabel; import com.ibm.watson.compare_comply.v1.model.UpdateBatchOptions; import com.ibm.watson.compare_comply.v1.model.UpdatedLabelsIn; import org.junit.Before; @@ -32,6 +35,8 @@ import java.io.File; import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import static org.junit.Assert.assertEquals; @@ -111,13 +116,47 @@ public void testCompareDocuments() throws FileNotFoundException { public void testFeedbackOperations() { String userId = "lp_java"; String comment = "could be better"; - String text = "This is some text from a contract about something."; + String text = "1. IBM will provide a Senior Managing Consultant / expert resource, for up to 80 hours, to assist " + + "Florida Power & Light (FPL) with the creation of an IT infrastructure unit cost model for existing " + + "infrastructure."; ShortDoc shortDoc = new ShortDoc(); + shortDoc.setTitle("doc title"); + shortDoc.setHash(""); Location location = new Location(); - location.setBegin(0L); - location.setEnd(1L); + location.setBegin(241); + location.setEnd(237); OriginalLabelsIn originalLabelsIn = new OriginalLabelsIn(); + Label label1 = new Label(); + label1.setNature("Obligation"); + label1.setParty("IBM"); + List ids1 = Arrays.asList("85f5981a-ba91-44f5-9efa-0bd22e64b7bc", "ce0480a1-5ef1-4c3e-9861-3743b5610795"); + TypeLabel typeLabel1 = new TypeLabel(); + typeLabel1.setLabel(label1); + typeLabel1.setProvenanceIds(ids1); + Label label2 = new Label(); + label2.setNature("End User"); + label2.setParty("Exclusion"); + List ids2 = Arrays.asList("85f5981a-ba91-44f5-9efa-0bd22e64b7bc", "ce0480a1-5ef1-4c3e-9861-3743b5610795"); + TypeLabel typeLabel2 = new TypeLabel(); + typeLabel2.setLabel(label2); + typeLabel2.setProvenanceIds(ids2); + List types = Arrays.asList(typeLabel1, typeLabel2); + originalLabelsIn.setTypes(types); + Category category1 = new Category(); + category1.setLabel(Category.Label.RESPONSIBILITIES); + category1.setProvenanceIds(new ArrayList()); + Category category2 = new Category(); + category2.setLabel(Category.Label.AMENDMENTS); + category2.setProvenanceIds(new ArrayList()); + originalLabelsIn.setCategories(Arrays.asList(category1, category2)); UpdatedLabelsIn updatedLabelsIn = new UpdatedLabelsIn(); + Label label3 = new Label(); + label3.setNature("Disclaimer"); + label3.setParty("buyer"); + TypeLabel typeLabel3 = new TypeLabel(); + typeLabel3.setLabel(label3); + updatedLabelsIn.setTypes(Arrays.asList(typeLabel1, typeLabel3)); + updatedLabelsIn.setCategories(Arrays.asList(category1, category2)); FeedbackDataInput feedbackDataInput = new FeedbackDataInput(); feedbackDataInput.setDocument(shortDoc); feedbackDataInput.setLocation(location); @@ -125,6 +164,8 @@ public void testFeedbackOperations() { feedbackDataInput.setOriginalLabels(originalLabelsIn); feedbackDataInput.setUpdatedLabels(updatedLabelsIn); feedbackDataInput.setFeedbackType("element_classification"); + feedbackDataInput.setModelId("contracts"); + feedbackDataInput.setModelVersion("11.00"); AddFeedbackOptions addFeedbackOptions = new AddFeedbackOptions.Builder() .userId(userId) @@ -141,7 +182,7 @@ public void testFeedbackOperations() { .getFeedback(getFeedbackOptions) .addHeader("x-watson-metadata", "customer_id=sdk-test-customer-id") .execute().getResult(); - assertEquals(comment, getFeedback.getComment()); + assertEquals(text, getFeedback.getFeedbackData().getText()); DeleteFeedbackOptions deleteFeedbackOptions = new DeleteFeedbackOptions.Builder() .feedbackId(feedbackId) From 99e05f7b2aa5d41e0ec820e6f5c6f216d86cbaaa Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Fri, 10 May 2019 11:59:08 -0400 Subject: [PATCH 2/3] build: Remove detect secrets files --- .gitignore | 4 +++- .pre-commit-config.yaml | 5 ----- .secrets.baseline | 25 ------------------------- 3 files changed, 3 insertions(+), 31 deletions(-) delete mode 100644 .pre-commit-config.yaml delete mode 100644 .secrets.baseline diff --git a/.gitignore b/.gitignore index 7ec6536d4f3..a262e0e1d1f 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,6 @@ package-lock.json *.mlmodel .openapi-generator-ignore .openapi-generator/ -package-lock.json \ No newline at end of file +package-lock.json +.pre-commit-config.yaml +.secrets.baseline \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index 9a742884733..00000000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,5 +0,0 @@ -- repo: git@github.ibm.com:Whitewater/whitewater-detect-secrets - rev: master - hooks: - - id: detect-secrets # pragma: whitelist secret - args: [--baseline, .secrets.baseline, --no-keyword-scan ] \ No newline at end of file diff --git a/.secrets.baseline b/.secrets.baseline deleted file mode 100644 index b107d9ca62d..00000000000 --- a/.secrets.baseline +++ /dev/null @@ -1,25 +0,0 @@ -{ - "exclude_regex": null, - "generated_at": "2019-01-16T16:41:59Z", - "plugins_used": [ - { - "base64_limit": 4.5, - "name": "Base64HighEntropyString" - }, - { - "name": "BasicAuthDetector" - }, - { - "hex_limit": 3, - "name": "HexHighEntropyString" - }, - { - "name": "PrivateKeyDetector" - }, - { - "name": "SlackDetector" - } - ], - "results": {}, - "version": "0.10.3" -} From f083f3c03868df30023bddba307930fc554b2ed6 Mon Sep 17 00:00:00 2001 From: Logan Patino Date: Fri, 10 May 2019 12:28:05 -0400 Subject: [PATCH 3/3] style(Compare and Comply): Address checkstyle issue --- .../watson/compare_comply/v1/CompareComplyServiceIT.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyServiceIT.java b/compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyServiceIT.java index e535a3e6b63..2a2b42710bb 100644 --- a/compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyServiceIT.java +++ b/compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyServiceIT.java @@ -116,9 +116,9 @@ public void testCompareDocuments() throws FileNotFoundException { public void testFeedbackOperations() { String userId = "lp_java"; String comment = "could be better"; - String text = "1. IBM will provide a Senior Managing Consultant / expert resource, for up to 80 hours, to assist " + - "Florida Power & Light (FPL) with the creation of an IT infrastructure unit cost model for existing " + - "infrastructure."; + String text = "1. IBM will provide a Senior Managing Consultant / expert resource, for up to 80 hours, to assist " + + "Florida Power & Light (FPL) with the creation of an IT infrastructure unit cost model for existing " + + "infrastructure."; ShortDoc shortDoc = new ShortDoc(); shortDoc.setTitle("doc title"); shortDoc.setHash("");