Search in sources :

Example 16 with FetchPlan

use of io.jmix.core.FetchPlan in project jmix by jmix-framework.

the class ViewBuilderTest method testMerging.

@Test
public void testMerging() {
    FetchPlan view1 = ViewBuilder.of(Pet.class).add("owner", FetchPlan.LOCAL).build();
    FetchPlan view2 = ViewBuilder.of(Pet.class).addView(view1).add("name").build();
    FetchPlanProperty ownerProp = view2.getProperty("owner");
    assertTrue(ownerProp != null && ownerProp.getFetchPlan() != null);
    assertTrue(ownerProp.getFetchPlan().containsProperty("name"));
}
Also used : FetchPlanProperty(io.jmix.core.FetchPlanProperty) FetchPlan(io.jmix.core.FetchPlan) Pet(com.haulmont.cuba.core.model.Pet) Test(org.junit.jupiter.api.Test) CoreTest(com.haulmont.cuba.core.testsupport.CoreTest)

Example 17 with FetchPlan

use of io.jmix.core.FetchPlan in project jmix by jmix-framework.

the class ViewBuilderTest method testProperties.

@Test
public void testProperties() {
    FetchPlan view = ViewBuilder.of(Pet.class).addAll("name", "nick").build();
    assertFalse(containsSystemProperties(view));
    assertTrue(view.containsProperty("name"));
}
Also used : FetchPlan(io.jmix.core.FetchPlan) Test(org.junit.jupiter.api.Test) CoreTest(com.haulmont.cuba.core.testsupport.CoreTest)

Example 18 with FetchPlan

use of io.jmix.core.FetchPlan in project jmix by jmix-framework.

the class ViewBuilderTest method testInlineRefProperty.

@Test
public void testInlineRefProperty() {
    FetchPlan view = ViewBuilder.of(Pet.class).add("owner.name").build();
    assertFalse(containsSystemProperties(view));
    assertNotNull(view.getProperty("owner"));
    FetchPlan ownerView = view.getProperty("owner").getFetchPlan();
    assertNotNull(ownerView);
    assertFalse(containsSystemProperties(ownerView));
    assertTrue(ownerView.containsProperty("name"));
}
Also used : FetchPlan(io.jmix.core.FetchPlan) Test(org.junit.jupiter.api.Test) CoreTest(com.haulmont.cuba.core.testsupport.CoreTest)

Example 19 with FetchPlan

use of io.jmix.core.FetchPlan in project jmix by jmix-framework.

the class ViewBuilderTest method testSystem.

@Test
public void testSystem() {
    FetchPlan view = ViewBuilder.of(Pet.class).addSystem().addAll("name").build();
    assertTrue(containsSystemProperties(view));
    assertTrue(view.containsProperty("name"));
    view = ViewBuilder.of(Pet.class).addSystem().addView(FetchPlan.LOCAL).build();
    assertTrue(containsSystemProperties(view));
    assertTrue(view.containsProperty("name"));
}
Also used : FetchPlan(io.jmix.core.FetchPlan) Pet(com.haulmont.cuba.core.model.Pet) Test(org.junit.jupiter.api.Test) CoreTest(com.haulmont.cuba.core.testsupport.CoreTest)

Example 20 with FetchPlan

use of io.jmix.core.FetchPlan in project jmix by jmix-framework.

the class ViewBuilderTest method testRefProperty.

@Test
public void testRefProperty() {
    FetchPlan view = ViewBuilder.of(Pet.class).add("owner").build();
    assertFalse(containsSystemProperties(view));
    assertNotNull(view.getProperty("owner"));
    FetchPlan ownerView = view.getProperty("owner").getFetchPlan();
    assertNotNull(ownerView);
    assertFalse(containsSystemProperties(ownerView));
    assertFalse(ownerView.containsProperty("name"));
}
Also used : FetchPlan(io.jmix.core.FetchPlan) Test(org.junit.jupiter.api.Test) CoreTest(com.haulmont.cuba.core.testsupport.CoreTest)

Aggregations

FetchPlan (io.jmix.core.FetchPlan)61 Test (org.junit.jupiter.api.Test)48 CoreTest (com.haulmont.cuba.core.testsupport.CoreTest)45 View (com.haulmont.cuba.core.global.View)35 JpaEntityManager (org.eclipse.persistence.jpa.JpaEntityManager)10 Pet (com.haulmont.cuba.core.model.Pet)5 SoftDeleteOneToOneA (com.haulmont.cuba.core.model.SoftDeleteOneToOneA)5 Group (com.haulmont.cuba.core.model.common.Group)5 User (com.haulmont.cuba.core.model.common.User)4 Autowired (org.springframework.beans.factory.annotation.Autowired)4 DataManager (com.haulmont.cuba.core.global.DataManager)3 LoadContext (com.haulmont.cuba.core.global.LoadContext)3 FetchPlanProperty (io.jmix.core.FetchPlanProperty)3 Metadata (io.jmix.core.Metadata)3 MetadataTools (io.jmix.core.MetadataTools)3 MetaClass (io.jmix.core.metamodel.model.MetaClass)3 SoftDeleteOneToOneB (com.haulmont.cuba.core.model.SoftDeleteOneToOneB)2 Permission (com.haulmont.cuba.core.model.common.Permission)2 QueryImpl (com.haulmont.cuba.core.sys.QueryImpl)2 Entity (io.jmix.core.Entity)2