use of se.inera.intyg.infra.integration.hsa.model.Vardenhet in project webcert by sklintyg.
the class UtkastApiControllerTest method buildVardenhet.
private SelectableVardenhet buildVardenhet() {
Vardenhet enhet = new Vardenhet();
enhet.setId("123");
enhet.setNamn("Enhetsnamn");
enhet.setEpost("test@test.com");
enhet.setTelefonnummer("12345");
enhet.setPostadress("Enhetsadress");
enhet.setPostnummer("12345");
enhet.setPostort("Enhetsort");
enhet.setArbetsplatskod("000000");
return enhet;
}
use of se.inera.intyg.infra.integration.hsa.model.Vardenhet in project webcert by sklintyg.
the class IntygIntegrationControllerTest method createUser.
private WebCertUser createUser(String roleName, Privilege p, Map<String, Feature> features, String origin) {
WebCertUser user = new WebCertUser();
HashMap<String, Privilege> pMap = new HashMap<>();
pMap.put(p.getName(), p);
user.setAuthorities(pMap);
user.setOrigin(origin);
user.setFeatures(features);
HashMap<String, Role> rMap = new HashMap<>();
Role role = new Role();
role.setName(roleName);
rMap.put(roleName, role);
user.setRoles(rMap);
Vardgivare vg = new Vardgivare();
vg.setId("vg1");
Vardenhet ve = new Vardenhet();
ve.setVardgivareHsaId("vg1");
ve.setId(ENHETSID);
vg.setVardenheter(Arrays.asList(ve));
user.setVardgivare(Arrays.asList(vg));
return user;
}
use of se.inera.intyg.infra.integration.hsa.model.Vardenhet in project webcert by sklintyg.
the class StatModuleApiControllerTest method setupDataAndExpectations.
@Before
public void setupDataAndExpectations() {
fragaSvarStatsMap = new HashMap<>();
fragaSvarStatsMap.put("VE1", 2L);
fragaSvarStatsMap.put("VE1M1", 3L);
fragaSvarStatsMap.put("VE1M2", 3L);
fragaSvarStatsMap.put("VE2", 2L);
fragaSvarStatsMap.put("VE3", 1L);
arendeStatsMap = new HashMap<>();
arendeStatsMap.put("VE1", 2L);
arendeStatsMap.put("VE1M1", 3L);
arendeStatsMap.put("VE1M2", 3L);
arendeStatsMap.put("VE2", 2L);
arendeStatsMap.put("VE3", 1L);
intygStatsMap = new HashMap<>();
intygStatsMap.put("VE1M1", 1L);
intygStatsMap.put("VE1M2", 2L);
intygStatsMap.put("VE2", 2L);
mockUser = new WebCertUser();
Role role = AUTHORITIES_RESOLVER.getRole(AuthoritiesConstants.ROLE_LAKARE);
mockUser.setRoles(AuthoritiesResolverUtil.toMap(role));
mockUser.setAuthorities(AuthoritiesResolverUtil.toMap(role.getPrivileges(), Privilege::getName));
ve1 = new Vardenhet("VE1", "Vardenhet1");
ve1.getMottagningar().add(new Mottagning("VE1M1", "Mottagning1"));
ve1.getMottagningar().add(new Mottagning("VE1M2", "Mottagning2"));
ve2 = new Vardenhet("VE2", "Vardenhet2");
ve2.getMottagningar().add(new Mottagning("VE2M1", "Mottagning3"));
ve3 = new Vardenhet("VE3", "Vardenhet3");
ve4 = new Vardenhet("VE4", "Vardenhet4");
Vardgivare vg = new Vardgivare("VG1", "Vardgivaren");
vg.setVardenheter(Arrays.asList(ve1, ve2, ve3, ve4));
mockUser.setVardgivare(Collections.singletonList(vg));
mockUser.setValdVardgivare(vg);
when(authoritiesHelper.getIntygstyperForPrivilege(any(UserDetails.class), anyString())).thenReturn(Stream.of("fk7263").collect(Collectors.toSet()));
when(webCertUserService.getUser()).thenReturn(mockUser);
}
use of se.inera.intyg.infra.integration.hsa.model.Vardenhet in project webcert by sklintyg.
the class WebCertUserServiceTest method createWebCertUser.
private WebCertUser createWebCertUser(boolean fromJS) {
WebCertUser user = buildUserPrincipal();
user.setNamn("A Name");
user.setHsaId("HSA-id");
user.setForskrivarkod("Forskrivarkod");
user.setAuthenticationScheme("AuthScheme");
user.setSpecialiseringar(Arrays.asList("Kirurgi", "Ortopedi"));
user.setBefattningar(Arrays.asList("Specialistläkare"));
List<Vardgivare> vardgivare = new ArrayList<>();
Vardgivare vg1 = new Vardgivare(VARDGIVARE_1, "Vardgivare 1");
Vardenhet vg1ve1 = new Vardenhet(VARDENHET_1, "Vardenhet 1");
vg1.getVardenheter().add(vg1ve1);
vg1.getVardenheter().add(new Vardenhet(VARDENHET_2, "Vardenhet 2"));
Vardgivare vg2 = new Vardgivare(VARDGIVARE_2, "Vardgivare 2");
vg2.getVardenheter().add(new Vardenhet(VARDENHET_3, "Vardenhet 3"));
vg2.getVardenheter().add(new Vardenhet(VARDENHET_4, "Vardenhet 4"));
vardgivare.add(vg1);
vardgivare.add(vg2);
user.setVardgivare(vardgivare);
user.setValdVardenhet(vg1ve1);
user.setValdVardgivare(vg1);
user.setMiuNamnPerEnhetsId(buildMiuMap());
if (fromJS) {
user.setOrigin(UserOriginType.DJUPINTEGRATION.name());
} else {
user.setOrigin(UserOriginType.NORMAL.name());
}
return user;
}
use of se.inera.intyg.infra.integration.hsa.model.Vardenhet in project webcert by sklintyg.
the class StatisticsGroupByUtilTest method buildUserOfRole.
private WebCertUser buildUserOfRole(Role role) {
WebCertUser user = new WebCertUser();
user.setRoles(AuthoritiesResolverUtil.toMap(role));
user.setAuthorities(AuthoritiesResolverUtil.toMap(role.getPrivileges(), Privilege::getName));
user.setOrigin(UserOriginType.DJUPINTEGRATION.name());
user.setHsaId("testuser");
user.setNamn("test userman");
Vardenhet vardenhet = new Vardenhet(HSA1, "enhet");
Vardgivare vardgivare = new Vardgivare("vardgivare", "Vardgivaren");
vardgivare.getVardenheter().add(vardenhet);
user.setVardgivare(Collections.singletonList(vardgivare));
user.setValdVardenhet(vardenhet);
return user;
}
Aggregations