fix error pages
This commit is contained in:
parent
f7bb4a2c74
commit
4009a5cf2b
@ -36,7 +36,7 @@
|
||||
<!-- Navigation -->
|
||||
<nav class="navbar navbar-expand-lg navbar-dark fixed-top navbar-shrink" id="mainNav">
|
||||
<div class="container">
|
||||
<a class="navbar-brand js-scroll-trigger" href="./">NG-Tracker</a>
|
||||
<a class="navbar-brand js-scroll-trigger" href="/">NG-Tracker</a>
|
||||
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse"
|
||||
data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false"
|
||||
aria-label="Toggle navigation">
|
||||
|
@ -6,8 +6,16 @@
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" layout:fragment="content">
|
||||
<h2>Доступ запрещён</h2>
|
||||
<a href="/"><h3>Вернуться на главную</h3></a>
|
||||
<section id="services">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-12 text-center">
|
||||
<h2 class="section-heading text-uppercase">Доступ запрещен</h2>
|
||||
<a href="/"><h3>Вернуться на главную</h3></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -6,8 +6,16 @@
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" layout:fragment="content">
|
||||
<h2>Страница не найдена</h2>
|
||||
<a href="/"><h3>Вернуться на главную</h3></a>
|
||||
<section id="services">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-12 text-center">
|
||||
<h2 class="section-heading text-uppercase">Страница не найдена</h2>
|
||||
<a href="/"><h3>Вернуться на главную</h3></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -6,8 +6,16 @@
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" layout:fragment="content">
|
||||
<h2>Ошибка сервера</h2>
|
||||
<a href="/"><h3>Вернуться на главную</h3></a>
|
||||
<section id="services">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-12 text-center">
|
||||
<h2 class="section-heading text-uppercase">Ошибка сервера</h2>
|
||||
<a href="/"><h3>Вернуться на главную</h3></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,88 +0,0 @@
|
||||
//import org.junit.jupiter.api.Test;
|
||||
//import ru.ulstu.platform.balance.boundary.BalanceEmployeeService;
|
||||
//import ru.ulstu.platform.balance.entity.dto.BalanceEmployeeDto;
|
||||
//import ru.ulstu.platform.balance.entity.dto.BalanceValueDto;
|
||||
//import ru.ulstu.platform.tools.entity.WorkType;
|
||||
//import ru.ulstu.platform.unit.entity.Unit;
|
||||
//
|
||||
//import java.util.Arrays;
|
||||
//import java.util.HashMap;
|
||||
//import java.util.List;
|
||||
//import java.util.Map;
|
||||
|
||||
//import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
|
||||
public class BalanceEmployeeTest {
|
||||
private final static Integer YEAR_2010 = 2010;
|
||||
private final static Integer YEAR_2011 = 2011;
|
||||
|
||||
// @Test
|
||||
// public void testGetFreeEmployeesNextUnits() {
|
||||
// WorkType workType = new WorkType();
|
||||
// workType.setId(1L);
|
||||
//
|
||||
// BalanceEmployeeService balanceEmployeeService = new BalanceEmployeeService();
|
||||
//
|
||||
// Map<Unit, List<BalanceEmployeeDto>> allUnitBalances = new HashMap<>();
|
||||
// Unit parent = new Unit(0L);
|
||||
// Unit currentUnit = new Unit(1L);
|
||||
// currentUnit.setParent(parent);
|
||||
// Unit nextUnit = new Unit(2L);
|
||||
// nextUnit.setParent(parent);
|
||||
// Unit anotherUnit = new Unit(3L);
|
||||
// anotherUnit.setParent(parent);
|
||||
//
|
||||
// parent.getChildren().addAll(Arrays.asList(currentUnit, nextUnit, anotherUnit));
|
||||
//
|
||||
// Double deficit = 10.0;
|
||||
// Double proficit = deficit;
|
||||
// Double fullUseProfict = 0.0;
|
||||
//
|
||||
// //move all employees (deficit == proficit)
|
||||
// BalanceValueDto balanceEmployeeValueDto = new BalanceValueDto(YEAR_2010, 1, workType, deficit * -1);
|
||||
// allUnitBalances.put(currentUnit, Arrays.asList(getBalanceDto(balanceEmployeeValueDto, deficit * -1)));
|
||||
// allUnitBalances.put(nextUnit, Arrays.asList(getBalanceDto(balanceEmployeeValueDto, proficit)));
|
||||
// Double result = balanceEmployeeService.getFreeEmployeesNextUnits(allUnitBalances, currentUnit, balanceEmployeeValueDto);
|
||||
// assertEquals(result, Double.valueOf(deficit));
|
||||
// assertEquals(Double.valueOf(fullUseProfict), Double.valueOf(allUnitBalances.get(nextUnit).get(0).getMaxValue(YEAR_2010)));
|
||||
// assertEquals(Double.valueOf(fullUseProfict), Double.valueOf(allUnitBalances.get(currentUnit).get(0).getMaxValue(YEAR_2010)));
|
||||
//
|
||||
// //move part employees (deficit < proficit)
|
||||
// Double proficitDeficitDiff = 5.0;
|
||||
// proficit = deficit + proficitDeficitDiff;
|
||||
// allUnitBalances.put(currentUnit, Arrays.asList(getBalanceDto(balanceEmployeeValueDto, deficit * -1)));
|
||||
// allUnitBalances.put(nextUnit, Arrays.asList(getBalanceDto(balanceEmployeeValueDto, proficit)));
|
||||
// result = balanceEmployeeService.getFreeEmployeesNextUnits(allUnitBalances, currentUnit, balanceEmployeeValueDto);
|
||||
// assertEquals(result, Double.valueOf(deficit));
|
||||
// assertEquals(Double.valueOf(proficitDeficitDiff), Double.valueOf(allUnitBalances.get(nextUnit).get(0).getMaxValue(YEAR_2010)));
|
||||
// assertEquals(Double.valueOf(fullUseProfict), Double.valueOf(allUnitBalances.get(currentUnit).get(0).getMaxValue(YEAR_2010)));
|
||||
//
|
||||
// //move all employees and deficit not compelte (deficit > proficit)
|
||||
// proficit = deficit - proficitDeficitDiff;
|
||||
// allUnitBalances.put(currentUnit, Arrays.asList(getBalanceDto(balanceEmployeeValueDto, deficit * -1)));
|
||||
// allUnitBalances.put(nextUnit, Arrays.asList(getBalanceDto(balanceEmployeeValueDto, proficit)));
|
||||
// result = balanceEmployeeService.getFreeEmployeesNextUnits(allUnitBalances, currentUnit, balanceEmployeeValueDto);
|
||||
// assertEquals(result, Double.valueOf(deficit - proficitDeficitDiff));
|
||||
// assertEquals(Double.valueOf(fullUseProfict), Double.valueOf(allUnitBalances.get(nextUnit).get(0).getMaxValue(YEAR_2010)));
|
||||
// assertEquals(Double.valueOf(proficitDeficitDiff * -1.0), Double.valueOf(allUnitBalances.get(currentUnit).get(0).getMaxValue(YEAR_2010)));
|
||||
//
|
||||
// //collect from several units
|
||||
// proficit = deficit - proficitDeficitDiff;
|
||||
// allUnitBalances.put(currentUnit, Arrays.asList(getBalanceDto(balanceEmployeeValueDto, deficit * -1)));
|
||||
// allUnitBalances.put(nextUnit, Arrays.asList(getBalanceDto(balanceEmployeeValueDto, proficit)));
|
||||
// allUnitBalances.put(anotherUnit, Arrays.asList(getBalanceDto(balanceEmployeeValueDto, proficit)));
|
||||
// result = balanceEmployeeService.getFreeEmployeesNextUnits(allUnitBalances, currentUnit, balanceEmployeeValueDto);
|
||||
// assertEquals(result, Double.valueOf(deficit));
|
||||
// assertEquals(Double.valueOf(fullUseProfict), Double.valueOf(allUnitBalances.get(nextUnit).get(0).getMaxValue(YEAR_2010)));
|
||||
// assertEquals(Double.valueOf(fullUseProfict), Double.valueOf(allUnitBalances.get(anotherUnit).get(0).getMaxValue(YEAR_2010)));
|
||||
// assertEquals(Double.valueOf(fullUseProfict), Double.valueOf(allUnitBalances.get(currentUnit).get(0).getMaxValue(YEAR_2010)));
|
||||
// }
|
||||
//
|
||||
// private BalanceEmployeeDto getBalanceDto(BalanceValueDto balanceEmployeeValueDto, double deficit) {
|
||||
// BalanceEmployeeDto dto = new BalanceEmployeeDto(BalanceEmployeeDto.BalanceEmployeeKey.DEFICIT);
|
||||
// dto.setValue(balanceEmployeeValueDto.getPeriod().getYear(), 1, balanceEmployeeValueDto.getWorkType(), deficit);
|
||||
// dto.setValue(YEAR_2011, 1, balanceEmployeeValueDto.getWorkType(), 100.0);
|
||||
// return dto;
|
||||
// }
|
||||
}
|
@ -1,126 +0,0 @@
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.assertj.core.util.Files;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import ru.ulstu.core.error.XlsParseException;
|
||||
import ru.ulstu.core.service.XlsDocumentBuilder;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
public class XlsDocumentBuilderTest {
|
||||
private final static String TEST_FILE_NAME = "testDoc.xlsx";
|
||||
private final static String TEST_XLS_FILE_NAME = "testDoc.xls";
|
||||
private final static String CELL_TEST_VALUE = "cell test value";
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
Files.delete(new File(TEST_FILE_NAME));
|
||||
Files.delete(new File(TEST_XLS_FILE_NAME));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void documentSaveTest() throws IOException, XlsParseException {
|
||||
File xlsFile = new File(TEST_FILE_NAME);
|
||||
XlsDocumentBuilder xlsDocumentBuilder = new XlsDocumentBuilder(xlsFile);
|
||||
xlsDocumentBuilder.save();
|
||||
File savedFile = new File(TEST_FILE_NAME);
|
||||
XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream(savedFile));
|
||||
Assert.assertEquals(workbook.getActiveSheetIndex(), 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void insertSheetTest() throws IOException, XlsParseException {
|
||||
File xlsFile = new File(TEST_FILE_NAME);
|
||||
XlsDocumentBuilder xlsDocumentBuilder = new XlsDocumentBuilder(xlsFile)
|
||||
.insertNewSheet("new sheet");
|
||||
Assert.assertEquals(xlsDocumentBuilder.getSheetCount(), 2);
|
||||
Assert.assertEquals(xlsDocumentBuilder.getActiveSheetIndex(), 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void openExistingFile() throws IOException, XlsParseException {
|
||||
File xlsFile = new File(TEST_FILE_NAME);
|
||||
new XlsDocumentBuilder(xlsFile)
|
||||
.insertNewSheet("new sheet")
|
||||
.save();
|
||||
|
||||
XlsDocumentBuilder xlsDocumentBuilder = new XlsDocumentBuilder(xlsFile);
|
||||
Assert.assertEquals(xlsDocumentBuilder.getSheetCount(), 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void openExistingXlsFile() throws IOException, XlsParseException {
|
||||
File xlsFile = new File(TEST_XLS_FILE_NAME);
|
||||
Workbook workbook = new HSSFWorkbook();
|
||||
workbook.createSheet("123");
|
||||
OutputStream out = new FileOutputStream(xlsFile);
|
||||
workbook.write(out);
|
||||
|
||||
XlsDocumentBuilder xlsDocumentBuilder = new XlsDocumentBuilder(xlsFile);
|
||||
Assert.assertEquals(xlsDocumentBuilder.getSheetCount(), 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void openWrongXlsFile() throws IOException, XlsParseException {
|
||||
File xlsFile = new File(TEST_XLS_FILE_NAME);
|
||||
OutputStream out = new FileOutputStream(xlsFile);
|
||||
out.write(1);
|
||||
out.close();
|
||||
|
||||
boolean wrongDocument = false;
|
||||
try {
|
||||
new XlsDocumentBuilder(xlsFile);
|
||||
} catch (XlsParseException ex) {
|
||||
wrongDocument = true;
|
||||
}
|
||||
Assert.assertTrue(wrongDocument);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setActiveSheetTest() throws IOException, XlsParseException {
|
||||
File xlsFile = new File(TEST_FILE_NAME);
|
||||
XlsDocumentBuilder xlsDocumentBuilder = new XlsDocumentBuilder(xlsFile)
|
||||
.insertNewSheet("new sheet")
|
||||
.setActiveSheet(0);
|
||||
Assert.assertEquals(xlsDocumentBuilder.getActiveSheetIndex(), 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getRowCountTest() throws IOException, XlsParseException {
|
||||
File xlsFile = new File(TEST_FILE_NAME);
|
||||
XlsDocumentBuilder xlsDocumentBuilder = new XlsDocumentBuilder(xlsFile)
|
||||
.insertNewSheet("new sheet");
|
||||
Assert.assertEquals(xlsDocumentBuilder.getRowCount(), 0);
|
||||
xlsDocumentBuilder.setCellValue(10, 10, CELL_TEST_VALUE);
|
||||
Assert.assertEquals(xlsDocumentBuilder.getRowCount(), 10);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getColumnCountTest() throws IOException, XlsParseException {
|
||||
File xlsFile = new File(TEST_FILE_NAME);
|
||||
XlsDocumentBuilder xlsDocumentBuilder = new XlsDocumentBuilder(xlsFile)
|
||||
.insertNewSheet("new sheet");
|
||||
Assert.assertEquals(xlsDocumentBuilder.getColumnCount(), 0);
|
||||
xlsDocumentBuilder.setCellValue(10, 10, CELL_TEST_VALUE);
|
||||
Assert.assertEquals(xlsDocumentBuilder.getColumnCount(), 10);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getCellAsStringTest() throws IOException, XlsParseException {
|
||||
File xlsFile = new File(TEST_FILE_NAME);
|
||||
XlsDocumentBuilder xlsDocumentBuilder = new XlsDocumentBuilder(xlsFile)
|
||||
.insertNewSheet("new sheet");
|
||||
xlsDocumentBuilder.setCellValue(10, 10, CELL_TEST_VALUE);
|
||||
Assert.assertEquals(xlsDocumentBuilder.getCellAsString(10, 10), CELL_TEST_VALUE);
|
||||
}
|
||||
|
||||
@After
|
||||
public void after() {
|
||||
Files.delete(new File(TEST_FILE_NAME));
|
||||
Files.delete(new File(TEST_XLS_FILE_NAME));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user