From b17e7e78533bba7b81497518b9033b30f4e30ed6 Mon Sep 17 00:00:00 2001 From: Shawn Fang <45607042+mssfang@users.noreply.github.com> Date: Mon, 5 Jun 2023 15:17:27 -0700 Subject: [PATCH] [TA] Fix live tests (#35296) --- .../azure-ai-textanalytics/assets.json | 2 +- .../com/azure/ai/textanalytics/TestUtils.java | 53 ++++++------------- .../TextAnalyticsAsyncClientTest.java | 2 - 3 files changed, 17 insertions(+), 40 deletions(-) diff --git a/sdk/textanalytics/azure-ai-textanalytics/assets.json b/sdk/textanalytics/azure-ai-textanalytics/assets.json index 7cb579e0f0cd0..377b159809425 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/assets.json +++ b/sdk/textanalytics/azure-ai-textanalytics/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "java", "TagPrefix": "java/textanalytics/azure-ai-textanalytics", - "Tag": "java/textanalytics/azure-ai-textanalytics_3369166513" + "Tag": "java/textanalytics/azure-ai-textanalytics_71462656f7" } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TestUtils.java b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TestUtils.java index e4d4391a47901..d220654068370 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TestUtils.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TestUtils.java @@ -834,67 +834,46 @@ static AnalyzeHealthcareEntitiesResult getRecognizeHealthcareEntitiesResult1(Str HealthcareEntityPropertiesHelper.setDataSources(healthcareEntity2, IterableStream.of(null)); final HealthcareEntity healthcareEntity3 = new HealthcareEntity(); - HealthcareEntityPropertiesHelper.setText(healthcareEntity3, "progressive"); - HealthcareEntityPropertiesHelper.setCategory(healthcareEntity3, HealthcareEntityCategory.fromString("Course")); + HealthcareEntityPropertiesHelper.setText(healthcareEntity3, "progressive angina"); + HealthcareEntityPropertiesHelper.setNormalizedText(healthcareEntity3, "Progressive Angina"); + HealthcareEntityPropertiesHelper.setCategory(healthcareEntity3, HealthcareEntityCategory.DIAGNOSIS); HealthcareEntityPropertiesHelper.setConfidenceScore(healthcareEntity3, 0.91); HealthcareEntityPropertiesHelper.setOffset(healthcareEntity3, 57); - HealthcareEntityPropertiesHelper.setLength(healthcareEntity3, 11); + HealthcareEntityPropertiesHelper.setLength(healthcareEntity3, 18); HealthcareEntityPropertiesHelper.setDataSources(healthcareEntity3, IterableStream.of(null)); final HealthcareEntity healthcareEntity4 = new HealthcareEntity(); - HealthcareEntityPropertiesHelper.setText(healthcareEntity4, "angina"); - HealthcareEntityPropertiesHelper.setNormalizedText(healthcareEntity4, "Angina Pectoris"); - HealthcareEntityPropertiesHelper.setCategory(healthcareEntity4, HealthcareEntityCategory.SYMPTOM_OR_SIGN); - HealthcareEntityPropertiesHelper.setConfidenceScore(healthcareEntity4, 0.81); - HealthcareEntityPropertiesHelper.setOffset(healthcareEntity4, 69); - HealthcareEntityPropertiesHelper.setLength(healthcareEntity4, 6); + HealthcareEntityPropertiesHelper.setText(healthcareEntity4, "past several months"); + HealthcareEntityPropertiesHelper.setCategory(healthcareEntity4, HealthcareEntityCategory.TIME); + HealthcareEntityPropertiesHelper.setConfidenceScore(healthcareEntity4, 1.0); + HealthcareEntityPropertiesHelper.setOffset(healthcareEntity4, 85); + HealthcareEntityPropertiesHelper.setLength(healthcareEntity4, 19); HealthcareEntityPropertiesHelper.setDataSources(healthcareEntity4, IterableStream.of(null)); - // there are too many healthcare entity data sources, we can just assert it is not null. - HealthcareEntityPropertiesHelper.setDataSources(healthcareEntity4, - IterableStream.of(null)); - final HealthcareEntity healthcareEntity5 = new HealthcareEntity(); - HealthcareEntityPropertiesHelper.setText(healthcareEntity5, "past several months"); - HealthcareEntityPropertiesHelper.setCategory(healthcareEntity5, HealthcareEntityCategory.TIME); - HealthcareEntityPropertiesHelper.setConfidenceScore(healthcareEntity5, 1.0); - HealthcareEntityPropertiesHelper.setOffset(healthcareEntity5, 85); - HealthcareEntityPropertiesHelper.setLength(healthcareEntity5, 19); - HealthcareEntityPropertiesHelper.setDataSources(healthcareEntity5, - IterableStream.of(null)); // RecognizeHealthcareEntitiesResult final AnalyzeHealthcareEntitiesResult healthcareEntitiesResult1 = new AnalyzeHealthcareEntitiesResult(documentId, textDocumentStatistics1, null); AnalyzeHealthcareEntitiesResultPropertiesHelper.setEntities(healthcareEntitiesResult1, - new IterableStream<>(asList(healthcareEntity1, healthcareEntity2, healthcareEntity3, healthcareEntity4, - healthcareEntity5))); + new IterableStream<>(asList(healthcareEntity1, healthcareEntity2, healthcareEntity3, healthcareEntity4))); // HealthcareEntityRelations - final HealthcareEntityRelation healthcareEntityRelation1 = new HealthcareEntityRelation(); final HealthcareEntityRelationRole role1 = new HealthcareEntityRelationRole(); - HealthcareEntityRelationRolePropertiesHelper.setName(role1, "Course"); + HealthcareEntityRelationRolePropertiesHelper.setName(role1, "Condition"); HealthcareEntityRelationRolePropertiesHelper.setEntity(role1, healthcareEntity3); - final HealthcareEntityRelationRole role2 = new HealthcareEntityRelationRole(); - HealthcareEntityRelationRolePropertiesHelper.setName(role2, "Condition"); - HealthcareEntityRelationRolePropertiesHelper.setEntity(role2, healthcareEntity4); - HealthcareEntityRelationPropertiesHelper.setRelationType(healthcareEntityRelation1, - HealthcareEntityRelationType.fromString("CourseOfCondition")); - HealthcareEntityRelationPropertiesHelper.setRoles(healthcareEntityRelation1, - IterableStream.of(asList(role1, role2))); - HealthcareEntityRelationPropertiesHelper.setConfidenceScore(healthcareEntityRelation1, 1.0); final HealthcareEntityRelation healthcareEntityRelation2 = new HealthcareEntityRelation(); - final HealthcareEntityRelationRole role3 = new HealthcareEntityRelationRole(); - HealthcareEntityRelationRolePropertiesHelper.setName(role3, "Time"); - HealthcareEntityRelationRolePropertiesHelper.setEntity(role3, healthcareEntity5); + final HealthcareEntityRelationRole role2 = new HealthcareEntityRelationRole(); + HealthcareEntityRelationRolePropertiesHelper.setName(role2, "Time"); + HealthcareEntityRelationRolePropertiesHelper.setEntity(role2, healthcareEntity4); HealthcareEntityRelationPropertiesHelper.setRelationType(healthcareEntityRelation2, HealthcareEntityRelationType.TIME_OF_CONDITION); HealthcareEntityRelationPropertiesHelper.setRoles(healthcareEntityRelation2, - IterableStream.of(asList(role2, role3))); + IterableStream.of(asList(role1, role2))); HealthcareEntityRelationPropertiesHelper.setConfidenceScore(healthcareEntityRelation2, 1.0); AnalyzeHealthcareEntitiesResultPropertiesHelper.setEntityRelations(healthcareEntitiesResult1, - IterableStream.of(asList(healthcareEntityRelation1, healthcareEntityRelation2))); + IterableStream.of(asList(healthcareEntityRelation2))); return healthcareEntitiesResult1; } diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientTest.java b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientTest.java index a57d92aac1807..1094efb7b0dcf 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientTest.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientTest.java @@ -1850,7 +1850,6 @@ public void healthcareStringInputWithOptions(HttpClient httpClient, TextAnalytic analyzeHealthcareEntitiesPagedFlux.toStream().collect(Collectors.toList())); }); } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void healthcareMaxOverload(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { @@ -1875,7 +1874,6 @@ public void healthcareMaxOverload(HttpClient httpClient, TextAnalyticsServiceVer analyzeHealthcareEntitiesPagedFlux.toStream().collect(Collectors.toList())); }); } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") public void healthcareLroPagination(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {