@Override public List<EndpointUserConfigurationDto> findUserConfigurationByUserId(String userId) { return convertDtoList(endpointUserConfigurationDao.findByUserId(userId)); }
@Test public void removeByUserIdAndAppTokenAndSchemaVersionTest() throws IOException { EndpointUserDto userDto = generateEndpointUserDto(null); ApplicationDto appDto = generateApplicationDto(); ConfigurationSchemaDto configurationSchemaDto = generateConfSchemaDto(null, appDto.getId(), 1).get(0); generateEndpointUserConfigurationDto(userDto, appDto, configurationSchemaDto, readSchemaFileAsString(OVERRIDE_USER_DATA_JSON)); generateEndpointUserConfigurationDto(userDto, appDto, null, readSchemaFileAsString(OVERRIDE_USER_DATA_JSON)); generateEndpointUserConfigurationDto(userDto, appDto, null, readSchemaFileAsString(OVERRIDE_USER_DATA_JSON)); endpointUserConfigurationDao.removeByUserIdAndAppTokenAndSchemaVersion(userDto.getId(), appDto.getApplicationToken(), configurationSchemaDto.getVersion()); MongoEndpointUserConfiguration removed = endpointUserConfigurationDao.findByUserIdAndAppTokenAndSchemaVersion(userDto.getId(), appDto.getApplicationToken(), configurationSchemaDto.getVersion()); Assert.assertNull(removed); List<MongoEndpointUserConfiguration> foundList = endpointUserConfigurationDao.findByUserId(userDto.getId()); Assert.assertEquals(2, foundList.size()); }
@Test @Ignore("invalid") public void findByUserIdTest() throws IOException { EndpointUserDto userDto = generateEndpointUserDto(null); ApplicationDto appDto = generateApplicationDto(); EndpointUserConfigurationDto firstUserConfigurationDto = generateEndpointUserConfigurationDto(userDto, appDto, null, readSchemaFileAsString(OVERRIDE_USER_DATA_JSON)); EndpointUserConfigurationDto secondUserConfigurationDto = generateEndpointUserConfigurationDto(userDto, appDto, null, readSchemaFileAsString(OVERRIDE_USER_DATA_JSON)); List<MongoEndpointUserConfiguration> expectedList = new ArrayList<>(); expectedList.add(new MongoEndpointUserConfiguration(firstUserConfigurationDto)); expectedList.add(new MongoEndpointUserConfiguration(secondUserConfigurationDto)); generateEndpointUserConfigurationDto(null, null, null); List<MongoEndpointUserConfiguration> foundList = endpointUserConfigurationDao.findByUserId(userDto.getId()); Assert.assertEquals(expectedList.size(), foundList.size()); Assert.assertEquals(expectedList, foundList); } }