use of com.haulmont.cuba.testmodel.severalfetchgroups.SeveralFetchGroups_TariffVersion in project cuba by cuba-platform.
the class SeveralFetchGroupsTest method setUp.
@Before
public void setUp() {
metadata = cont.metadata();
persistence = cont.persistence();
dataManager = AppBeans.get(DataManager.class);
try (Transaction tx = persistence.createTransaction()) {
EntityManager em = persistence.getEntityManager();
SeveralFetchGroups_Tariff tariff1 = metadata.create(SeveralFetchGroups_Tariff.class);
tariffId1 = tariff1.getId();
tariff1.setName("tariff1");
em.persist(tariff1);
SeveralFetchGroups_Tariff tariff2_1 = metadata.create(SeveralFetchGroups_Tariff.class);
tariffId2_1 = tariff2_1.getId();
tariff2_1.setName("tariff2_1");
tariff2_1.setParent(tariff1);
em.persist(tariff2_1);
SeveralFetchGroups_Tariff tariff3_1 = metadata.create(SeveralFetchGroups_Tariff.class);
tariffId3_1 = tariff3_1.getId();
tariff3_1.setName("tariff3_1");
tariff3_1.setParent(tariff1);
em.persist(tariff3_1);
SeveralFetchGroups_Tariff tariff4_2 = metadata.create(SeveralFetchGroups_Tariff.class);
tariffId4_2 = tariff4_2.getId();
tariff4_2.setName("tariff4");
tariff4_2.setParent(tariff2_1);
em.persist(tariff4_2);
SeveralFetchGroups_TariffVersion tariffVersion1 = metadata.create(SeveralFetchGroups_TariffVersion.class);
tariffVersionId1 = tariffVersion1.getId();
tariffVersion1.setName("1");
tariffVersion1.setDescription("tariffVersionDescription1");
tariffVersion1.setParent(tariff1);
tariff1.setActiveVersion(tariffVersion1);
em.persist(tariffVersion1);
SeveralFetchGroups_TariffVersion tariffVersion2 = metadata.create(SeveralFetchGroups_TariffVersion.class);
tariffVersionId2 = tariffVersion2.getId();
tariffVersion2.setName("2");
tariffVersion2.setDescription("tariffVersionDescription2");
tariffVersion2.setParent(tariff4_2);
tariff4_2.setActiveVersion(tariffVersion2);
em.persist(tariffVersion2);
SeveralFetchGroups_TariffVersion tariffVersion3 = metadata.create(SeveralFetchGroups_TariffVersion.class);
tariffVersionId3 = tariffVersion3.getId();
tariffVersion3.setName("3");
tariffVersion3.setDescription("tariffVersionDescription3");
tariffVersion3.setParent(tariff2_1);
tariff2_1.setActiveVersion(tariffVersion3);
em.persist(tariffVersion3);
tx.commit();
}
}
use of com.haulmont.cuba.testmodel.severalfetchgroups.SeveralFetchGroups_TariffVersion in project cuba by cuba-platform.
the class SeveralFetchGroupsTest method testLoadTariffVersions.
@Test
public void testLoadTariffVersions() {
LoadContext<SeveralFetchGroups_TariffVersion> loadContext = new LoadContext<>(SeveralFetchGroups_TariffVersion.class);
loadContext.setQueryString("select e from test$SeveralFetchGroups_TariffVersion e order by e.name asc");
loadContext.setView("tariffVersion.withParent");
List<SeveralFetchGroups_TariffVersion> result = dataManager.loadList(loadContext);
for (SeveralFetchGroups_TariffVersion version : result) {
Assert.assertNotNull(version.getParent());
}
}
Aggregations