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

View file

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