/** * Get version of endpoint profile schema. * @return version */ public Integer getEndpointProfileSchemaVersion() { Integer version = null; if (endpointProfileSchema != null) { version = endpointProfileSchema.getVersion(); } return version; }
@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()); }
@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()); }
@Override public ProfileFilterDto toDto() { ProfileFilterDto filterDto = super.toDto(); filterDto.setBody(body); if (endpointProfileSchema != null) { filterDto.setEndpointProfileSchemaId(endpointProfileSchema.getStringId()); filterDto.setEndpointProfileSchemaVersion(endpointProfileSchema.getVersion()); } if (serverProfileSchema != null) { filterDto.setServerProfileSchemaId(serverProfileSchema.getStringId()); filterDto.setServerProfileSchemaVersion(serverProfileSchema.getVersion()); } return filterDto; }
int version = -1; if (endpointProfileSchema != null) { version = endpointProfileSchema.getVersion();
@Test public void findByAppIdAndSchemaVersion() { Application app = generateApplication(null); EndpointProfileSchema schema = generateProfSchema(app, 1).get(0); ServerProfileSchemaDto srvSchema = generateServerProfileSchema(app.getStringId(), app.getTenant().getStringId(), 101); generateFilter(schema, new ServerProfileSchema(srvSchema), null, 2, UpdateStatus.ACTIVE); List<ProfileFilter> filters = generateFilterWithoutSchemaGeneration(schema, new ServerProfileSchema(srvSchema), null, 1, UpdateStatus.ACTIVE); filters.addAll(generateFilterWithoutSchemaGeneration(null, new ServerProfileSchema(srvSchema), null, 1, UpdateStatus.ACTIVE)); filters.addAll(generateFilterWithoutSchemaGeneration(schema, null, null, 1, UpdateStatus.ACTIVE)); List<ProfileFilter> found = profileFilterDao.findByAppIdAndSchemaVersionsCombination(app.getStringId(), schema.getVersion(), srvSchema.getVersion()); Assert.assertEquals(filters, found); }