@Override public EventClassFamilyDto findEventClassFamilyByEcfvId(String id) { validateSqlId(id, "Event class family version id is incorrect. Can't find event class family " + "by ECF version id " + id); return getDto(eventClassFamilyDao.findByEcfvId(id)); }
@Test public void findByEcfvIdTest() { List<EventClassFamily> eventClassFamilies = generateEventClassFamily(null, 1); EventClassFamily ecf = eventClassFamilies.get(0); List<EventClassFamilyVersion> ecfvList = generateEventClassFamilyVersion(ecf, 1, 1); ecf.setSchemas(ecfvList); ecf = eventClassFamilyDao.save(ecf); EventClassFamilyVersion ecfv = ecfvList.get(0); EventClassFamily ecfByEcfv = eventClassFamilyDao.findByEcfvId(ecfv.getStringId()); Assert.assertNotNull(ecfByEcfv); Assert.assertEquals(ecf, ecfByEcfv); Assert.assertEquals(ecfByEcfv.getSchemas().size(), 1); if (ecfByEcfv.getSchemas().size() == 1) { Assert.assertEquals(ecfByEcfv.getSchemas().get(0).getRecords().size(), 1); } else { throw new AssertionError("There should be 1 ecfv in fetched ecf, but got: " + ecfByEcfv.getSchemas().size()); } } }