-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2448 from opencb/TASK-6231
TASK-6231 - Port Patch 1.10.4.1 -> 1.10.5
- Loading branch information
Showing
14 changed files
with
233 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,7 @@ | |
import org.opencb.opencga.core.models.sample.*; | ||
import org.opencb.opencga.core.models.study.*; | ||
import org.opencb.opencga.core.models.user.Account; | ||
import org.opencb.opencga.core.models.user.AuthenticationResponse; | ||
import org.opencb.opencga.core.models.user.User; | ||
import org.opencb.opencga.core.response.OpenCGAResult; | ||
import org.opencb.opencga.core.testclassification.duration.MediumTests; | ||
|
@@ -276,6 +277,16 @@ private String getAdminToken() throws CatalogException, IOException { | |
return catalogManager.getUserManager().loginAsAdmin("admin").getToken(); | ||
} | ||
|
||
@Test | ||
public void createUserUsingMailAsId() throws CatalogException { | ||
catalogManager.getUserManager().create(new User().setId("[email protected]").setName("Hello") | ||
.setAccount(new Account().setType(Account.AccountType.GUEST)), TestParamConstants.PASSWORD, opencgaToken); | ||
AuthenticationResponse login = catalogManager.getUserManager().login("[email protected]", TestParamConstants.PASSWORD); | ||
assertNotNull(login); | ||
User user = catalogManager.getUserManager().get("[email protected]", new QueryOptions(), login.getToken()).first(); | ||
assertEquals("[email protected]", user.getId()); | ||
} | ||
|
||
@Test | ||
public void getGroupsTest() throws CatalogException { | ||
Group group = new Group("groupId", Arrays.asList("user2", "user3")).setSyncedFrom(new Group.Sync("ldap", "bio")); | ||
|
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
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
46 changes: 46 additions & 0 deletions
46
...b/opencga/storage/core/variant/annotation/converters/VariantAnnotationModelUtilsTest.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,46 @@ | ||
package org.opencb.opencga.storage.core.variant.annotation.converters; | ||
|
||
import junit.framework.TestCase; | ||
import org.junit.experimental.categories.Category; | ||
import org.opencb.biodata.models.variant.avro.ConsequenceType; | ||
import org.opencb.biodata.models.variant.avro.VariantAnnotation; | ||
import org.opencb.biodata.models.variant.avro.Xref; | ||
import org.opencb.opencga.core.testclassification.duration.ShortTests; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.Set; | ||
|
||
@Category(ShortTests.class) | ||
public class VariantAnnotationModelUtilsTest extends TestCase { | ||
|
||
public void testXrefsHgvs() throws Exception { | ||
VariantAnnotation variantAnnotation = new VariantAnnotation(); | ||
variantAnnotation.setId("id"); | ||
variantAnnotation.setXrefs(Collections.singletonList(new Xref("xref1", "source"))); | ||
variantAnnotation.setHgvs(Arrays.asList( | ||
"ENST00000680783.1(ENSG00000135744):c.776T>C", | ||
"ENSP00000451720.1:p.Asn134Lys" | ||
)); | ||
ConsequenceType ct = new ConsequenceType(); | ||
ct.setGeneName("GENE"); | ||
ct.setHgvs(variantAnnotation.getHgvs()); | ||
ct.setGeneId(null); | ||
variantAnnotation.setConsequenceTypes(Arrays.asList(ct, new ConsequenceType())); | ||
Set<String> xrefs = new VariantAnnotationModelUtils().extractXRefs(variantAnnotation); | ||
|
||
assertEquals(7, xrefs.size()); | ||
// Default fields | ||
assertTrue(xrefs.contains("id")); | ||
assertTrue(xrefs.contains("xref1")); | ||
assertTrue(xrefs.contains("GENE")); | ||
|
||
// Untouched hgvs, not starting with ENST or NM_ | ||
assertTrue(xrefs.contains("ENSP00000451720.1:p.Asn134Lys")); | ||
|
||
assertTrue(xrefs.contains("ENST00000680783.1(ENSG00000135744):c.776T>C")); | ||
assertTrue(xrefs.contains("ENST00000680783.1:c.776T>C")); | ||
assertTrue(xrefs.contains("GENE:c.776T>C")); | ||
|
||
} | ||
} |
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
Oops, something went wrong.