forked from datahub-project/datahub
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'datahub-project:master' into master
- Loading branch information
Showing
38 changed files
with
1,488 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
.../com/linkedin/datahub/graphql/types/mlmodel/mappers/MLModelGroupPropertiesMapperTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package com.linkedin.datahub.graphql.types.mlmodel.mappers; | ||
|
||
import static org.testng.Assert.assertEquals; | ||
import static org.testng.Assert.assertNotNull; | ||
import static org.testng.Assert.assertNull; | ||
|
||
import com.linkedin.common.urn.Urn; | ||
import com.linkedin.ml.metadata.MLModelGroupProperties; | ||
import java.net.URISyntaxException; | ||
import org.testng.annotations.Test; | ||
|
||
public class MLModelGroupPropertiesMapperTest { | ||
|
||
@Test | ||
public void testMapMLModelGroupProperties() throws URISyntaxException { | ||
// Create backend ML Model Group Properties | ||
MLModelGroupProperties input = new MLModelGroupProperties(); | ||
|
||
// Set description | ||
input.setDescription("a ml trust model group"); | ||
|
||
// Set Name | ||
input.setName("ML trust model group"); | ||
|
||
// Create URN | ||
Urn groupUrn = | ||
Urn.createFromString( | ||
"urn:li:mlModelGroup:(urn:li:dataPlatform:sagemaker,another-group,PROD)"); | ||
|
||
// Map the properties | ||
com.linkedin.datahub.graphql.generated.MLModelGroupProperties result = | ||
MLModelGroupPropertiesMapper.map(null, input, groupUrn); | ||
|
||
// Verify mapped properties | ||
assertNotNull(result); | ||
assertEquals(result.getDescription(), "a ml trust model group"); | ||
assertEquals(result.getName(), "ML trust model group"); | ||
|
||
// Verify lineage info is null as in the mock data | ||
assertNotNull(result.getMlModelLineageInfo()); | ||
assertNull(result.getMlModelLineageInfo().getTrainingJobs()); | ||
assertNull(result.getMlModelLineageInfo().getDownstreamJobs()); | ||
} | ||
|
||
@Test | ||
public void testMapWithMinimalProperties() throws URISyntaxException { | ||
// Create backend ML Model Group Properties with minimal information | ||
MLModelGroupProperties input = new MLModelGroupProperties(); | ||
|
||
// Create URN | ||
Urn groupUrn = | ||
Urn.createFromString( | ||
"urn:li:mlModelGroup:(urn:li:dataPlatform:sagemaker,another-group,PROD)"); | ||
|
||
// Map the properties | ||
com.linkedin.datahub.graphql.generated.MLModelGroupProperties result = | ||
MLModelGroupPropertiesMapper.map(null, input, groupUrn); | ||
|
||
// Verify basic mapping with minimal properties | ||
assertNotNull(result); | ||
assertNull(result.getDescription()); | ||
|
||
// Verify lineage info is null | ||
assertNotNull(result.getMlModelLineageInfo()); | ||
assertNull(result.getMlModelLineageInfo().getTrainingJobs()); | ||
assertNull(result.getMlModelLineageInfo().getDownstreamJobs()); | ||
} | ||
} |
Oops, something went wrong.