@Override public List<EndpointProfileSchemaDto> getProfileSchemasByApplicationId( String applicationId) throws ControlServiceException { return profileService.findProfileSchemasByAppId(applicationId); }
@Test public void findProfileSchemaByAppIdTest() { ApplicationDto application = generateApplicationDto(null); List<EndpointProfileSchemaDto> schemas = profileService.findProfileSchemasByAppId(application.getId()); Assert.assertNotNull(schemas); Assert.assertFalse(schemas.isEmpty()); }
@Test public void removeProfileSchemasByAppIdTest() { int profSchemaCount = 2; ApplicationDto application = generateApplicationDto(null); generateProfSchemaDto(application.getTenantId(), application.getId(), profSchemaCount); List<EndpointProfileSchemaDto> schemas = profileService.findProfileSchemasByAppId(application.getId()); Assert.assertNotNull(schemas); Assert.assertFalse(schemas.isEmpty()); profileService.removeProfileSchemasByAppId(application.getId()); schemas = profileService.findProfileSchemasByAppId(application.getId()); Assert.assertNotNull(schemas); Assert.assertTrue(schemas.isEmpty()); }
@Test public void findProfileSchemasByAppIdTest() { int profSchemaCount = 2; int profSchemaWithDefaultCount = profSchemaCount + 1; ApplicationDto application = generateApplicationDto(null); generateProfSchemaDto(application.getTenantId(), application.getId(), profSchemaCount); List<EndpointProfileSchemaDto> schemas = profileService.findProfileSchemasByAppId(application.getId()); Assert.assertNotNull(schemas); Assert.assertEquals(profSchemaWithDefaultCount, schemas.size()); }
@Test public void testRemoveAppsByTenantId() { TenantDto tenant = generateTenantDto(); ApplicationDto application = generateApplicationDto(tenant.getId()); applicationService.removeAppsByTenantId(tenant.getId()); List<ApplicationDto> foundApplications = applicationService.findAppsByTenantId(tenant.getId()); Assert.assertTrue(foundApplications.isEmpty()); Assert.assertEquals(0, foundApplications.size()); TenantDto foundTenant = userService.findTenantById(tenant.getId()); Assert.assertNotNull(foundTenant); List<EndpointProfileSchemaDto> foundProfileSchemas = profileService.findProfileSchemasByAppId(application.getId()); Assert.assertEquals(0, foundProfileSchemas.size()); List<ConfigurationSchemaDto> foundConfigSchemas = configurationService.findConfSchemasByAppId(application.getId()); Assert.assertEquals(0, foundConfigSchemas.size()); }