TSK-742 remove log level DEBUG

This commit is contained in:
BerndBreier 2018-11-09 09:03:17 +01:00 committed by Holger Hagen
parent 5c66f14d54
commit e77e54e0b2
11 changed files with 25 additions and 50 deletions

View File

@ -4,8 +4,6 @@ import java.sql.SQLException;
import java.sql.SQLIntegrityConstraintViolationException;
import java.time.Duration;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -295,47 +293,23 @@ public class ClassificationServiceImpl implements ClassificationService {
}
}
private void validateServiceLevel(String serviceLevel) throws InvalidArgumentException {
Duration duration;
private static void validateServiceLevel(String serviceLevel) throws InvalidArgumentException {
try {
duration = Duration.parse(serviceLevel);
Duration.parse(serviceLevel);
} catch (Exception e) {
throw new InvalidArgumentException("Invalid service level " + serviceLevel
+ ". The formats accepted are based on the ISO-8601 duration format PnDTnHnMn.nS with days considered to be exactly 24 hours. "
+ "For example: \"P2D\" represents a period of \"two days.\" ",
+ ". The formats accepted are based on the ISO-8601 duration format PnDTnHnMn.nS with days considered to be exactly 24 hours. "
+ "For example: \"P2D\" represents a period of \"two days.\" ",
e.getCause());
}
// check that the duration contains only whole days and no remaining hours, minutes or seconds
LocalDateTime ref = LocalDateTime.now(); // reference timestamp
LocalDateTime end = ref.plus(duration);
// find the years part
LocalDateTime ldt = ref;
long years = ChronoUnit.YEARS.between(ldt, end);
// check that the duration is based on format PnD, i.e. it must start with a P, end with a D
String serviceLevelLower = serviceLevel.toLowerCase();
if (!('p' == serviceLevelLower.charAt(0))
|| !('d' == serviceLevelLower.charAt(serviceLevel.length() - 1))) {
// find the months part
ldt = ldt.plus(years, ChronoUnit.YEARS);
long months = ChronoUnit.MONTHS.between(ldt, end);
// find the days part
ldt = ldt.plus(months, ChronoUnit.MONTHS);
long days = ChronoUnit.DAYS.between(ldt, end);
// find the hours part
ldt = ldt.plus(days, ChronoUnit.DAYS);
long hours = ChronoUnit.HOURS.between(ldt, end);
// find the minutes part
ldt = ldt.plus(hours, ChronoUnit.HOURS);
long minutes = ChronoUnit.MINUTES.between(ldt, end);
// find the seconds part
ldt = ldt.plus(minutes, ChronoUnit.MINUTES);
long seconds = ChronoUnit.SECONDS.between(ldt, end);
if (hours != 0 || minutes != 0 || seconds != 0) {
throw new InvalidArgumentException("Invalid service level " + serviceLevel + ". Taskana only supports service levels that"
+ " contain a number of whole days without additional hours, minutes or seconds.");
+ " contain a number of whole days specified according to the format 'PnD' where n is the number of days");
}
}

View File

@ -306,7 +306,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
List<ClassificationSummary> results = classificationService.createClassificationQuery()
.serviceLevelLike("PT%")
.list();
assertEquals(2, results.size());
assertEquals(0, results.size());
}
@Test
@ -523,7 +523,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
List<ClassificationSummary> results = classificationService.createClassificationQuery()
.orderByServiceLevel(desc)
.list();
assertEquals("PT24H", results.get(0).getServiceLevel());
assertEquals("P8D", results.get(0).getServiceLevel());
}
@Test

View File

@ -74,7 +74,7 @@ public class UpdateClassificationAccTest extends AbstractAccTest {
classification.setParentId("CLI:100000000000000000000000000000000004");
classification.setParentKey("L11010");
classification.setPriority(1000);
classification.setServiceLevel("P2DT24H");
classification.setServiceLevel("P3D");
classificationService.updateClassification(classification);

View File

@ -328,7 +328,7 @@ public class ClassificationServiceImplIntAutoCommitTest {
classificationService.createClassification(classification);
all++;
Classification classification1 = this.createDummyClassificationWithUniqueKey("", "TASK");
classification1.setServiceLevel("P1DT24H");
classification1.setServiceLevel("P2D");
classification1.setName("name1");
classification1.setDescription("desc");
classificationService.createClassification(classification1);
@ -349,7 +349,7 @@ public class ClassificationServiceImplIntAutoCommitTest {
Assert.assertEquals(1, list.size());
list = classificationService.createClassificationQuery().serviceLevelIn("P1D").descriptionLike("desc").list();
Assert.assertEquals(2, list.size());
list = classificationService.createClassificationQuery().serviceLevelIn("P1DT24H").nameIn("name").list();
list = classificationService.createClassificationQuery().serviceLevelIn("P2D").nameIn("name").list();
Assert.assertEquals(0, list.size());
list = classificationService.createClassificationQuery().descriptionLike("desc%").list();
Assert.assertEquals(all, list.size());

View File

@ -366,7 +366,7 @@ public class ClassificationServiceImplIntExplicitTest {
classificationService.createClassification(classification);
all++;
Classification classification1 = this.createNewClassificationWithUniqueKey("", "TASK");
classification1.setServiceLevel("P1DT24H");
classification1.setServiceLevel("P2D");
classification1.setName("name1");
classification1.setDescription("desc");
classificationService.createClassification(classification1);
@ -387,7 +387,7 @@ public class ClassificationServiceImplIntExplicitTest {
Assert.assertEquals(1, list.size());
list = classificationService.createClassificationQuery().serviceLevelIn("P1D").descriptionLike("desc").list();
Assert.assertEquals(2, list.size());
list = classificationService.createClassificationQuery().serviceLevelIn("P1DT24H").nameIn("name").list();
list = classificationService.createClassificationQuery().serviceLevelIn("P2D").nameIn("name").list();
Assert.assertEquals(0, list.size());
list = classificationService.createClassificationQuery().descriptionLike("desc%").list();
Assert.assertEquals(all, list.size());

View File

@ -1,6 +1,6 @@
-- ID, KEY, PARENT_ID, PARENT_KEY, CATEGORY, TYPE, DOMAIN, VALID_IN_DOMAIN, CREATED, MODIFIED, NAME, DESCRIPTION, PRIORITY, SERVICE_LEVEL, APPLICATION_ENTRY_POINT, CUSTOM_1 - 8
-- MASTER CLASSIFICATIONS
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000001', 'L10000', '', '', 'EXTERNAL', 'TASK', '', FALSE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'OLD-Leistungsfall', 'OLD-Leistungsfall', 999, 'PT24H', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000001', 'L10000', '', '', 'EXTERNAL', 'TASK', '', FALSE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'OLD-Leistungsfall', 'OLD-Leistungsfall', 999, 'P1D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000002', 'L10303', '', '', 'EXTERNAL', 'TASK', '', FALSE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Beratungsprotokoll', 'Beratungsprotokoll', 1, 'P2D', '', 'VNR,RVNR,KOLVNR, ANR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000003', 'L1050', '', '', 'EXTERNAL', 'TASK', '', FALSE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Widerruf', 'Widerruf', 1, 'P3D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000004', 'L11010', '', '', 'EXTERNAL', 'TASK', '', FALSE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Dynamikänderung', 'Dynamikänderung', 7, 'P4D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
@ -21,7 +21,7 @@ INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000023', 'T
INSERT INTO CLASSIFICATION VALUES('CLI:300000000000000000000000000000000017', 'L3060', '', '', 'EXTERNAL', 'TASK', '', FALSE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Widerruf neu', 'Widerruf neu', 1, 'P1D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
-- DOMAIN_A CLASSIFICATIONS
INSERT INTO CLASSIFICATION VALUES('CLI:100000000000000000000000000000000002', 'L10303', '', '', 'EXTERNAL', 'TASK', 'DOMAIN_A', TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Beratungsprotokoll', 'Beratungsprotokoll', 101, 'PT24H', '', 'VNR,RVNR,KOLVNR, ANR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:100000000000000000000000000000000002', 'L10303', '', '', 'EXTERNAL', 'TASK', 'DOMAIN_A', TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Beratungsprotokoll', 'Beratungsprotokoll', 101, 'P1D', '', 'VNR,RVNR,KOLVNR, ANR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:100000000000000000000000000000000003', 'L1050', '', '', 'EXTERNAL', 'TASK', 'DOMAIN_A', TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Widerruf', 'Widerruf', 1, 'P13D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:100000000000000000000000000000000004', 'L11010', '', '', 'EXTERNAL', 'TASK', 'DOMAIN_A', TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Dynamikänderung', 'Dynamikänderung', 1, 'P14D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:100000000000000000000000000000000005', 'L110102', 'CLI:100000000000000000000000000000000004', 'L11010', 'EXTERNAL', 'TASK', 'DOMAIN_A', TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Dynamik-Ablehnung', 'Dynamik-Ablehnung', 5, 'P15D', '', 'VNR,RVNR,KOLVNR', 'TEXT_1', '', '', '', '', '', '');

View File

@ -1 +1 @@
logging.level.pro.taskana=DEBUG
logging.level.pro.taskana=INFO

View File

@ -10,6 +10,7 @@ import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.internal.verification.VerificationModeFactory.atLeastOnce;
import java.sql.Connection;
import java.sql.SQLException;
@ -246,7 +247,7 @@ public class TaskanaTransactionIntTest {
WorkbasketCleanupJob job = new WorkbasketCleanupJob(taskanaEngine, springTransactionProvider, null);
job.run();
verify(mockAppender, times(7)).doAppend(captorLoggingEvent.capture());
verify(mockAppender, atLeastOnce()).doAppend(captorLoggingEvent.capture());
List<LoggingEvent> allValues = captorLoggingEvent.getAllValues();
Optional<LoggingEvent> result = allValues.stream().filter(event -> event.getLevel().equals(

View File

@ -1,4 +1,4 @@
logging.level.pro.taskana=DEBUG
logging.level.pro.taskana=INFO
### logging.level.org.springframework=DEBUG
######## Taskana DB #######
######## h2 configuration ########

View File

@ -1,6 +1,6 @@
-- ID, KEY, PARENT_ID, PARENT_KEY, CATEGORY, TYPE, DOMAIN, VALID_IN_DOMAIN, CREATED, MODIFIED, NAME, DESCRIPTION, PRIORITY, SERVICE_LEVEL, APPLICATION_ENTRY_POINT, CUSTOM_1 - 8
-- MASTER CLASSIFICATIONS
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000001', 'L10000', '', '', 'EXTERNAL', 'TASK', '', FALSE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'OLD-Leistungsfall', 'OLD-Leistungsfall', 999, 'PT24H', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000001', 'L10000', '', '', 'EXTERNAL', 'TASK', '', FALSE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'OLD-Leistungsfall', 'OLD-Leistungsfall', 999, 'P1D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000002', 'L10303', '', '', 'EXTERNAL', 'TASK', '', FALSE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Beratungsprotokoll', 'Beratungsprotokoll', 1, 'P2D', '', 'VNR,RVNR,KOLVNR, ANR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000003', 'L1050', '', '', 'EXTERNAL', 'TASK', '', FALSE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Widerruf', 'Widerruf', 1, 'P3D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000004', 'L11010', '', '', 'EXTERNAL', 'TASK', '', FALSE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Dynamikänderung', 'Dynamikänderung', 7, 'P4D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
@ -21,7 +21,7 @@ INSERT INTO CLASSIFICATION VALUES('CLI:000000000000000000000000000000000023', 'T
INSERT INTO CLASSIFICATION VALUES('CLI:300000000000000000000000000000000017', 'L3060', '', '', 'EXTERNAL', 'TASK', '', FALSE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Widerruf neu', 'Widerruf neu', 1, 'P1D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
-- DOMAIN_A CLASSIFICATIONS
INSERT INTO CLASSIFICATION VALUES('CLI:100000000000000000000000000000000002', 'L10303', '', '', 'EXTERNAL', 'TASK', 'DOMAIN_A', TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Beratungsprotokoll', 'Beratungsprotokoll', 101, 'PT24H', '', 'VNR,RVNR,KOLVNR, ANR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:100000000000000000000000000000000002', 'L10303', '', '', 'EXTERNAL', 'TASK', 'DOMAIN_A', TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Beratungsprotokoll', 'Beratungsprotokoll', 101, 'P1D', '', 'VNR,RVNR,KOLVNR, ANR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:100000000000000000000000000000000003', 'L1050', '', '', 'EXTERNAL', 'TASK', 'DOMAIN_A', TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Widerruf', 'Widerruf', 1, 'P13D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:100000000000000000000000000000000004', 'L11010', '', '', 'EXTERNAL', 'TASK', 'DOMAIN_A', TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Dynamikänderung', 'Dynamikänderung', 1, 'P14D', '', 'VNR,RVNR,KOLVNR', '', '', '', '', '', '', '');
INSERT INTO CLASSIFICATION VALUES('CLI:100000000000000000000000000000000005', 'L110102', 'CLI:100000000000000000000000000000000004', 'L11010', 'EXTERNAL', 'TASK', 'DOMAIN_A', TRUE, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Dynamik-Ablehnung', 'Dynamik-Ablehnung', 5, 'P15D', '', 'VNR,RVNR,KOLVNR', 'TEXT_1', '', '', '', '', '', '');

View File

@ -1,4 +1,4 @@
logging.level.pro.taskana=DEBUG
logging.level.pro.taskana=INFO
### logging.level.org.springframework=DEBUG
######## Taskana DB #######
datasource.url=jdbc:h2:mem:taskana;IGNORECASE=TRUE;LOCK_MODE=0