|
|
@ -15,8 +15,10 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.boot.test.context.SpringBootTest; |
|
|
import org.springframework.boot.test.context.SpringBootTest; |
|
|
import org.springframework.boot.test.mock.mockito.MockBean; |
|
|
import org.springframework.boot.test.mock.mockito.MockBean; |
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
|
|
import org.springframework.jdbc.core.JdbcTemplate; |
|
|
import org.springframework.test.context.ActiveProfiles; |
|
|
import org.springframework.test.context.ActiveProfiles; |
|
|
import org.springframework.test.context.TestPropertySource; |
|
|
import org.springframework.test.context.TestPropertySource; |
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.hibernate.boot.model.relational.Namespace; |
|
|
import org.hibernate.boot.model.relational.Namespace; |
|
|
import org.hibernate.boot.model.relational.Sequence; |
|
|
import org.hibernate.boot.model.relational.Sequence; |
|
|
import org.hibernate.mapping.Table; |
|
|
import org.hibernate.mapping.Table; |
|
|
@ -61,6 +63,9 @@ class SkillTaxonomyRepositoryTest { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private OccupationSkillRepository occupationSkillRepository; |
|
|
private OccupationSkillRepository occupationSkillRepository; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private JdbcTemplate jdbcTemplate; |
|
|
|
|
|
|
|
|
@MockBean |
|
|
@MockBean |
|
|
private RedisTemplate<String, Object> redisTemplate; |
|
|
private RedisTemplate<String, Object> redisTemplate; |
|
|
|
|
|
|
|
|
@ -115,6 +120,37 @@ class SkillTaxonomyRepositoryTest { |
|
|
.isEmpty(); |
|
|
.isEmpty(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
@Transactional |
|
|
|
|
|
void projectionQueriesRejectCrossOccupationCategoryMismatch() { |
|
|
|
|
|
jdbcTemplate.update(""" |
|
|
|
|
|
INSERT INTO occupation_skills ( |
|
|
|
|
|
occupation_id, skill_id, category_id, importance, |
|
|
|
|
|
importance_source_code, importance_element_id, |
|
|
|
|
|
importance_is_proxy, relationship_type, source_version_id |
|
|
|
|
|
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) |
|
|
|
|
|
""", |
|
|
|
|
|
1L, 1L, 201L, new BigDecimal("4.61"), |
|
|
|
|
|
"15-1252.00", "4.A.3.b.1", 1, "ESSENTIAL", 2L); |
|
|
|
|
|
|
|
|
|
|
|
List<SkillCloudSkillProjection> occupationOneSkills = |
|
|
|
|
|
occupationSkillRepository.findSkillProjectionsByOccupationId(1L); |
|
|
|
|
|
|
|
|
|
|
|
assertThat(occupationOneSkills) |
|
|
|
|
|
.extracting(SkillCloudSkillProjection::skillId) |
|
|
|
|
|
.contains(3L) |
|
|
|
|
|
.doesNotContain(1L); |
|
|
|
|
|
|
|
|
|
|
|
assertThat(occupationSkillRepository |
|
|
|
|
|
.findSkillProjectionsByOccupationIdAndCategoryId(1L, 201L)) |
|
|
|
|
|
.isEmpty(); |
|
|
|
|
|
|
|
|
|
|
|
assertThat(occupationSkillRepository |
|
|
|
|
|
.findSkillProjectionsByOccupationIdAndCategoryId(2L, 201L)) |
|
|
|
|
|
.extracting(SkillCloudSkillProjection::skillId) |
|
|
|
|
|
.contains(1L); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Test |
|
|
@Test |
|
|
void projectionCarriesOnetProvenanceNullImportanceAndSortOrders() { |
|
|
void projectionCarriesOnetProvenanceNullImportanceAndSortOrders() { |
|
|
SkillCloudSkillProjection react = occupationSkillRepository |
|
|
SkillCloudSkillProjection react = occupationSkillRepository |
|
|
|