use of se.inera.intyg.infra.integration.hsa.model.Vardgivare in project webcert by sklintyg.
the class PageControllerTest method createMockVardgivare.
private Vardgivare createMockVardgivare() {
Vardgivare vg = new Vardgivare("vg-1", "Vårdgivare 1");
Vardenhet ve = new Vardenhet("ve-1", "Vårdenhet 1");
vg.setVardenheter(Collections.singletonList(ve));
return vg;
}
use of se.inera.intyg.infra.integration.hsa.model.Vardgivare in project webcert by sklintyg.
the class UtkastApiControllerTest method buildVardgivare.
private SelectableVardenhet buildVardgivare() {
Vardgivare vardgivare = new Vardgivare();
vardgivare.setId("456");
vardgivare.setNamn("vardgivarnamn");
return vardgivare;
}
use of se.inera.intyg.infra.integration.hsa.model.Vardgivare 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.Vardgivare 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.Vardgivare 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;
}
Aggregations