@Override public TopicListEntryDto toDto() { List<TopicDto> topicDtos = ModelUtils.getTopicDtos(topicIds); return new TopicListEntryDto(simpleHash, hash, topicDtos); } }
@Override public TopicListEntryDto toDto() { List<TopicDto> topicDtos = ModelUtils.getTopicDtos(topicIds); return new TopicListEntryDto(simpleHash, getBytes(hash), topicDtos); } }
@Override @CachePut(value = "topicListEntries", key = "#key") public TopicListCacheEntry putTopicList(EndpointObjectHash key, TopicListCacheEntry entry) { if (entry != null) { TopicListEntryDto entryDto = new TopicListEntryDto( entry.getSimpleHash(), entry.getHash().getData(), entry.getTopics()); endpointService.saveTopicListEntry(entryDto); } return entry; }
@Test public void findEndpointUserConfigurationDtoTest() throws IOException { List<TopicDto> topics = new ArrayList<>(); topics.add(generateTopicDto(null, TopicTypeDto.OPTIONAL)); byte[] hash = "hash".getBytes(); int simpleHash = 123; TopicListEntryDto topicListEntryDto = new TopicListEntryDto(123, hash, topics); topicListEntryDao.save(topicListEntryDto); MongoTopicListEntry topicListEntry = topicListEntryDao.findByHash(hash); Assert.assertEquals(simpleHash, topicListEntry.getSimpleHash()); } }
@Test public void testFindByHash() throws Exception { List<TopicDto> topics = new ArrayList<>(); TopicDto topicDto = new TopicDto(); topicDto.setId("6123"); topics.add(topicDto); byte[] hash = "hash".getBytes(); int simpleHash = 123; TopicListEntryDto topicListEntryDto = new TopicListEntryDto(123, hash, topics); topicListEntryDao.save(topicListEntryDto); CassandraTopicListEntry topicListEntry = topicListEntryDao.findByHash(hash); Assert.assertEquals(simpleHash, topicListEntry.getSimpleHash()); } }
@Test public void findTopicListEntryByHashTest() { ApplicationDto applicationDto = generateApplicationDto(); TopicDto topicDto = generateTopicDto(applicationDto.getId(), TopicTypeDto.MANDATORY); List<TopicDto> topics = Arrays.asList(topicDto); byte[] hash = "123".getBytes(); TopicListEntryDto topicListEntryDto = new TopicListEntryDto(1, hash, topics); endpointService.saveTopicListEntry(topicListEntryDto); TopicListEntryDto foundTopicListEntry = endpointService.findTopicListEntryByHash(hash); Assert.assertEquals(topicListEntryDto, foundTopicListEntry); }