fix for test

This commit is contained in:
gulnaz 2024-10-24 10:12:39 +03:00 committed by Zaripov Emil
parent 7161cb4bbb
commit d855cc6934
5 changed files with 89 additions and 24 deletions

View file

@ -1,5 +0,0 @@
import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer;
import org.springframework.web.WebApplicationInitializer;
public class SecurityInit extends AbstractSecurityWebApplicationInitializer implements WebApplicationInitializer {
}

View file

@ -1,5 +1,7 @@
package ru.micord.ervu.service.grid.impl;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
@ -59,17 +61,17 @@ public class JournalInMemoryStaticGridLoadService implements
.toList();
List<JournalDto> ervuJournalList;
try {
String responseJsonString = replyingKafkaService.sendMessageAndGetReply(requestTopic,
replyTopic, objectMapper.writeValueAsString(journalFileDataRequest));
JournalFileDataResponse journalFileDataResponse = objectMapper.readValue(responseJsonString,
JournalFileDataResponse.class);
try (InputStream in = getClass().getClassLoader().getResourceAsStream("test.json")) {
JournalFileDataResponse journalFileDataResponse = objectMapper.readValue(in, JournalFileDataResponse.class);
ervuJournalList = journalFileDataResponse.getFilesInfo().stream()
.map(JournalDtoMapper::mapToJournalDto)
.toList();
}
catch (JsonProcessingException e) {
throw new RuntimeException("Failed to parse JournalFileDataResponse.", e);
throw new RuntimeException("Failed to parse JournalFileDataResponse", e);
}
catch (IOException e) {
throw new RuntimeException("Failed to read file", e);
}
return Stream.concat(dbJournalList.stream(), ervuJournalList.stream())
@ -78,16 +80,16 @@ public class JournalInMemoryStaticGridLoadService implements
}
private JournalFileDataRequest initJournalFileDataRequest() {
String authToken = Optional.ofNullable(request.getCookies())
.map(cookies -> Arrays.stream(cookies)
.filter(cookie -> cookie.getName().equals("auth_token"))
.findFirst()
.map(Cookie::getValue)
.orElseThrow(() -> new RuntimeException("Failed to get auth data. User unauthorized.")))
.orElseThrow(() -> new RuntimeException("Failed to get auth data. User unauthorized."));
String[] ids = jwtTokenService.getToken(authToken).getUserAccountId().split(":");
String userId = ids[0];
String ervuId = ids[1];
// String authToken = Optional.ofNullable(request.getCookies())
// .map(cookies -> Arrays.stream(cookies)
// .filter(cookie -> cookie.getName().equals("auth_token"))
// .findFirst()
// .map(Cookie::getValue)
// .orElseThrow(() -> new RuntimeException("Failed to get auth data. User unauthorized.")))
// .orElseThrow(() -> new RuntimeException("Failed to get auth data. User unauthorized."));
// String[] ids = jwtTokenService.getToken(authToken).getUserAccountId().split(":");
String userId = "";
String ervuId = "";
return new JournalFileDataRequest()
.setPrnOid(userId)
.setOrgIdErvu(ervuId);

View file

@ -0,0 +1,68 @@
{
"orgId_ERVU": "9b301728-9ab2-4650-a701-1e774f5e0851",
"filesInfo": [
{
"fileId": "1649bb01-787e-436b-9e17-af833fcb83cf",
"fileName": "2_успешный.csv",
"filePatternCode": "12",
"filePatternName": "Изменений сведений сотрудников, необходимы для ведения воинского учета",
"departureDateTime": "03.10.2024 13:06:02",
"timeZone": "+03:00",
"fileStatus": {
"code": "07",
"status": "Принято ЕРВУ",
"description": "Все записи успешно прошли проверку ФЛК"
},
"senderInfo": {
"prnOid": "1002386763",
"lastName": "Хайруллин",
"firstName": "Булат",
"middleName": "Икрамович"
},
"rowsCount": 10,
"rowsSuccess": 10
},
{
"fileId": "b4c3d70a-4a95-42a0-9055-7cf50d0f9883",
"fileName": "9_успешный.csv",
"filePatternCode": "9",
"filePatternName": "Сведения о приеме на работу (увольнении), зачислении в образовательную организацию (отчислении)",
"departureDateTime": "04.10.2024 09:26:30",
"timeZone": "+03:00",
"fileStatus": {
"code": "07",
"status": "Принято ЕРВУ",
"description": "Все записи успешно прошли проверку ФЛК"
},
"senderInfo": {
"prnOid": "1002386763",
"lastName": "Мишустин",
"firstName": "Михаил",
"middleName": "Владимирович"
},
"rowsCount": 10,
"rowsSuccess": 10
},
{
"fileId": "4914d465-2614-43bb-8323-e674e3882e23",
"fileName": "10_файл_один_Липецк.csv",
"filePatternCode": "10",
"filePatternName": "Сведения о приеме на работу (увольнении), зачислении в образовательную организацию (отчислении)",
"departureDateTime": "16.10.2024 09:47:46",
"timeZone": "+03:00",
"fileStatus": {
"code": "07",
"status": "Принято ЕРВУ",
"description": "Все записи успешно прошли проверку ФЛК"
},
"senderInfo": {
"prnOid": "1000352722",
"lastName": "Паутова",
"firstName": "Евгения",
"middleName": "Владимировна"
},
"rowsCount": 2,
"rowsSuccess": 2
}
]
}

View file

@ -13,12 +13,12 @@ const appRoutes: Routes = [
{
path: 'mydata',
loadChildren: 'generated-sources/page-mydata.module#PagemydataModule',
canActivate: [AuthGuard],
// canActivate: [AuthGuard],
},
{
path: 'filesentlog',
loadChildren: 'generated-sources/page-filesentlog.module#PagefilesentlogModule',
canActivate: [AuthGuard],
// canActivate: [AuthGuard],
}

View file

@ -6,7 +6,7 @@ const webbpmRoutes: Routes = [
{
path: '',
loadChildren: 'generated-sources/page-lkul.module#PagelkulModule',
canActivate: [AuthGuard],
// canActivate: [AuthGuard],
pathMatch: 'full',
},
{