Search in sources :

Example 6 with GenomeBrowserAttributes

use of org.molgenis.genomebrowser.meta.GenomeBrowserAttributes in project molgenis by molgenis.

the class GenomeBrowserTrackTest method testToTrack.

@Test
public void testToTrack() throws Exception {
    EntityType entity = mock(EntityType.class);
    GenomeBrowserAttributes genomeBrowserAttributes = GenomeBrowserServiceTest.getGenomeBrowserAttributes("postion", "chrom", "normal", "mutant");
    GenomeBrowserTrack reference = GenomeBrowserTrack.create("ref_id", "label", "ref_label", entity, VARIANT, null, GenomeBrowserSettings.MolgenisReferenceMode.NONE, genomeBrowserAttributes, null, null, null, null);
    EntityType molgenisEntityType = when(mock(EntityType.class).getId()).thenReturn("molgenisEntityType").getMock();
    GenomeBrowserTrack track = GenomeBrowserTrack.create("id", "label", "entityLabel", molgenisEntityType, VARIANT, Collections.singletonList(reference), GenomeBrowserSettings.MolgenisReferenceMode.NONE, genomeBrowserAttributes, "alert(\"test\")", "attr 1:attr1,reference attribute:REF,position on genome:POS", null, null);
    String expected = "{\"genome_attrs\":{\"ref\":\"normal\",\"pos\":\"postion\",\"alt\":\"mutant\",\"chr\":\"chrom\"},\"name\":\"label\",\"label_attr\":\"entityLabel\",\"tier_type\":\"molgenis\",\"uri\":\"/api/v2/molgenisEntityType\",\"actions\":\"alert(\\\"test\\\")\",\"track_type\":\"VARIANT\",\"entity\":\"molgenisEntityType\",\"attrs\":[\"attr 1:attr1\",\"reference attribute:REF\",\"position on genome:POS\"]}";
    assertEquals(track.toTrackJson().toString(), expected);
}
Also used : EntityType(org.molgenis.data.meta.model.EntityType) GenomeBrowserAttributes(org.molgenis.genomebrowser.meta.GenomeBrowserAttributes) GenomeBrowserServiceTest(org.molgenis.genomebrowser.service.GenomeBrowserServiceTest) Test(org.testng.annotations.Test)

Aggregations

GenomeBrowserAttributes (org.molgenis.genomebrowser.meta.GenomeBrowserAttributes)6 EntityType (org.molgenis.data.meta.model.EntityType)4 GenomeBrowserTrack (org.molgenis.genomebrowser.GenomeBrowserTrack)4 Test (org.testng.annotations.Test)4 HashMap (java.util.HashMap)1 Entity (org.molgenis.data.Entity)1 MetaDataService (org.molgenis.data.meta.MetaDataService)1 Attribute (org.molgenis.data.meta.model.Attribute)1 QueryImpl (org.molgenis.data.support.QueryImpl)1 GenomeBrowserSettings (org.molgenis.genomebrowser.meta.GenomeBrowserSettings)1 GenomeBrowserServiceTest (org.molgenis.genomebrowser.service.GenomeBrowserServiceTest)1