@Override public EndpointProfileSchemaDto getProfileSchema(String profileSchemaId) throws ControlServiceException { return profileService.findProfileSchemaById(profileSchemaId); }
@Test public void removeProfileSchemaByIdTest() { String schemaId = generateProfSchemaDto(null, null, 1).get(0).getId(); EndpointProfileSchemaDto schemaDto = profileService.findProfileSchemaById(schemaId); Assert.assertNotNull(schemaDto); profileService.removeProfileSchemaById(schemaId); schemaDto = profileService.findProfileSchemaById(schemaId); Assert.assertNull(schemaDto); }
@Test public void findProfileSchemaByIdTest() { String schemaId = generateProfSchemaDto(null, null, 1).get(0).getId(); EndpointProfileSchemaDto schemaDto = profileService.findProfileSchemaById(schemaId); Assert.assertNotNull(schemaDto); }
@Test public void saveProfileSchemaTest() { String schemaId = generateProfSchemaDto(null, null, 1).get(0).getId(); EndpointProfileSchemaDto schemaDto = profileService.findProfileSchemaById(schemaId); Assert.assertNotNull(schemaDto); int version = schemaDto.getVersion(); schemaDto.setId(null); EndpointProfileSchemaDto saved = profileService.saveProfileSchema(schemaDto); Assert.assertNotNull(saved); Assert.assertNotEquals(version, saved.getVersion()); Assert.assertNotEquals(schemaId, saved.getId()); }
schemaDto = generateProfSchemaDto(null, null, 1).get(0); } else { schemaDto = profileService.findProfileSchemaById(schemaId);
@Test public void updateExistingProfileSchemaTest() { ApplicationDto app = generateApplicationDto(null); String appId = app.getId(); List<EndpointProfileSchemaDto> schemas = generateProfSchemaDto(app.getTenantId(), appId, 1); EndpointProfileSchemaDto schema = profileService.findProfileSchemaById(schemas.get(0).getId()); Assert.assertNotNull(schema); EndpointProfileSchema endpointProfileSchema = new EndpointProfileSchema(schema); endpointProfileSchema.setName("Updated name"); endpointProfileSchema.setDescription("Updated description"); EndpointProfileSchemaDto saved = profileService.saveProfileSchema(endpointProfileSchema.toDto()); Assert.assertNotNull(saved); Assert.assertEquals(schema.getId(), saved.getId()); Assert.assertEquals(schema.getApplicationId(), saved.getApplicationId()); Assert.assertNotEquals(schema.getName(), saved.getName()); Assert.assertNotEquals(schema.getDescription(), saved.getDescription()); }