Search in sources :

Example 21 with Entity

use of org.molgenis.data.Entity in project molgenis by molgenis.

the class FairControllerTest method getCatalogTestUnknownCatalog.

@Test
public void getCatalogTestUnknownCatalog() throws Exception {
    reset(dataService);
    Entity answer = mock(Entity.class);
    this.mockMvc.perform(get(URI.create("http://molgenis01.gcc.rug.nl:8080/fdp/catalogID?blah=value")).contentType(MediaType.APPLICATION_FORM_URLENCODED)).andExpect(status().isBadRequest());
}
Also used : Entity(org.molgenis.data.Entity) Test(org.testng.annotations.Test)

Example 22 with Entity

use of org.molgenis.data.Entity in project molgenis by molgenis.

the class FairControllerTest method getCatalogTest.

@Test
public void getCatalogTest() throws Exception {
    reset(dataService);
    Entity answer = mock(Entity.class);
    when(dataService.findOneById("fdp_Catalog", "catalogID")).thenReturn(answer);
    this.mockMvc.perform(get(URI.create("http://molgenis01.gcc.rug.nl:8080/fdp/catalogID?blah=value")).contentType(MediaType.APPLICATION_FORM_URLENCODED)).andExpect(status().isOk());
    Mockito.verify(entityModelWriter).createRdfModel("http://molgenis01.gcc.rug.nl:8080/fdp/catalogID", answer);
}
Also used : Entity(org.molgenis.data.Entity) Test(org.testng.annotations.Test)

Example 23 with Entity

use of org.molgenis.data.Entity in project molgenis by molgenis.

the class QueryImplTest method setFetch.

@Test
public void setFetch() {
    Fetch fetch = new Fetch();
    QueryImpl<Entity> q = new QueryImpl<>();
    q.setFetch(fetch);
    assertEquals(fetch, q.getFetch());
}
Also used : Fetch(org.molgenis.data.Fetch) Entity(org.molgenis.data.Entity) Test(org.testng.annotations.Test)

Example 24 with Entity

use of org.molgenis.data.Entity in project molgenis by molgenis.

the class QueryImplTest method nest.

@Test
public void nest() {
    Query<Entity> q = new QueryImpl<>().nest().eq("field", "value").unnest();
    QueryRule expectedRule = new QueryRule(Arrays.asList(new QueryRule("field", Operator.EQUALS, "value")));
    assertEquals(q.getRules(), Arrays.asList(expectedRule));
}
Also used : Entity(org.molgenis.data.Entity) QueryRule(org.molgenis.data.QueryRule) Test(org.testng.annotations.Test)

Example 25 with Entity

use of org.molgenis.data.Entity in project molgenis by molgenis.

the class QueryImplTest method rng.

@Test
public void rng() {
    Query<Entity> q = new QueryImpl<>().rng("field", "min", "max");
    QueryRule expectedRule = new QueryRule("field", Operator.RANGE, Arrays.asList("min", "max"));
    assertEquals(q.getRules(), Arrays.asList(expectedRule));
}
Also used : Entity(org.molgenis.data.Entity) QueryRule(org.molgenis.data.QueryRule) Test(org.testng.annotations.Test)

Aggregations

Entity (org.molgenis.data.Entity)448 Test (org.testng.annotations.Test)295 DynamicEntity (org.molgenis.data.support.DynamicEntity)192 AbstractMolgenisSpringTest (org.molgenis.data.AbstractMolgenisSpringTest)120 Attribute (org.molgenis.data.meta.model.Attribute)111 EntityType (org.molgenis.data.meta.model.EntityType)110 AbstractMockitoTest (org.molgenis.test.AbstractMockitoTest)37 MolgenisDataException (org.molgenis.data.MolgenisDataException)20 QueryImpl (org.molgenis.data.support.QueryImpl)20 AttributeType (org.molgenis.data.meta.AttributeType)18 UnexpectedEnumException (org.molgenis.util.UnexpectedEnumException)18 Stream (java.util.stream.Stream)17 QueryRule (org.molgenis.data.QueryRule)16 MultiAllelicResultFilter (org.molgenis.data.annotation.core.filter.MultiAllelicResultFilter)16 RunAsSystem (org.molgenis.security.core.runas.RunAsSystem)16 Objects.requireNonNull (java.util.Objects.requireNonNull)15 DataService (org.molgenis.data.DataService)15 AttributeMapping (org.molgenis.semanticmapper.mapping.model.AttributeMapping)15 WithMockUser (org.springframework.security.test.context.support.WithMockUser)14 Instant (java.time.Instant)13