@Test public void findByApplicationId() { List<EndpointProfileSchema> schemas = generateProfSchema(null, 3); Assert.assertEquals(3, schemas.size()); EndpointProfileSchema schema = schemas.get(0); Application app = schema.getApplication(); List<EndpointProfileSchema> found = profileSchemaDao.findByApplicationId(app.getId().toString()); Assert.assertEquals(3, found.size()); Assert.assertEquals(schemas, found); }
@Test public void findLatestByAppId() { List<EndpointProfileSchema> schemas = generateProfSchema(null, 4); Assert.assertEquals(4, schemas.size()); EndpointProfileSchema schema = schemas.get(0); Application app = schema.getApplication(); EndpointProfileSchema found = profileSchemaDao.findLatestByAppId(app.getId().toString()); Assert.assertNotNull(found); Assert.assertEquals(4, found.getVersion()); }
@Test public void findByAppIdAndVersion() { List<EndpointProfileSchema> schemas = generateProfSchema(null, 4); Assert.assertEquals(4, schemas.size()); EndpointProfileSchema schema = schemas.get(2); Application app = schema.getApplication(); EndpointProfileSchema found = profileSchemaDao.findByAppIdAndVersion(app.getId().toString(), schema.getVersion()); Assert.assertNotNull(found); Assert.assertEquals(3, found.getVersion()); }
protected List<ProfileFilter> generateFilterWithoutSchemaGeneration(EndpointProfileSchema schema, ServerProfileSchema srvSchema, EndpointGroup group, int count, UpdateStatus status) { Application app = null; if (schema != null) { app = schema.getApplication(); } else if (srvSchema != null) { app = srvSchema.getApplication(); } if (group == null) { group = generateEndpointGroup(app, null); } List<ProfileFilter> filters = new ArrayList<>(); for (int i = 0; i < count; i++) { ProfileFilter dto = new ProfileFilter(); dto.setId(null); dto.setStatus(status != null ? status : UpdateStatus.INACTIVE); dto.setEndpointGroup(group); dto.setEndpointProfileSchema(schema); dto.setServerProfileSchema(srvSchema); dto.setSequenceNumber(i); dto.setApplication(app); ProfileFilter saved = profileFilterDao.save(dto); Assert.assertNotNull(saved); filters.add(saved); } return filters; }