Skip to content

Commit 7a8f0b6

Browse files
committed
version information is self declared by modules.
Due to cyclical dependency reasons, it is not possible for VersionUtil in logback-core to querty properties files located in logback-classic. It follows that, logback-classic deplicated some code found in VersionUtil in ClassicVersionUtil. Signed-off-by: ceki <ceki@qos.ch>
1 parent 00d272f commit 7a8f0b6

File tree

12 files changed

+604
-364
lines changed

12 files changed

+604
-364
lines changed

logback-classic-blackbox/src/test/java/ch/qos/logback/classic/blackbox/VersionCheckTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@
1414

1515
package ch.qos.logback.classic.blackbox;
1616

17+
import ch.qos.logback.classic.ClassicConstants;
1718
import ch.qos.logback.classic.LoggerContext;
1819
import ch.qos.logback.core.CoreConstants;
1920
import ch.qos.logback.core.util.VersionUtil;
2021
import org.junit.jupiter.api.Test;
2122

2223
import static org.junit.jupiter.api.Assertions.assertEquals;
24+
import static org.junit.jupiter.api.Assertions.assertNotNull;
25+
import static org.junit.jupiter.api.Assertions.assertTrue;
2326
import static org.junit.jupiter.api.Assertions.fail;
2427

2528
/**
@@ -44,6 +47,8 @@
4447
public class VersionCheckTest {
4548

4649

50+
// WARNING: do not add other tests to this file
51+
4752
LoggerContext loggerContext = new LoggerContext();
4853

4954
/**
@@ -66,4 +71,6 @@ public void versionTest() {
6671
}
6772
}
6873

74+
// WARNING: do not add other tests to this file
75+
6976
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Logback: the reliable, generic, fast and flexible logging framework.
3+
* Copyright (C) 1999-2026, QOS.ch. All rights reserved.
4+
*
5+
* This program and the accompanying materials are dual-licensed under
6+
* either the terms of the Eclipse Public License v1.0 as published by
7+
* the Eclipse Foundation
8+
*
9+
* or (per the licensee's choosing)
10+
*
11+
* under the terms of the GNU Lesser General Public License version 2.1
12+
* as published by the Free Software Foundation.
13+
*/
14+
15+
package ch.qos.logback.classic.blackbox.util;
16+
17+
import ch.qos.logback.classic.util.ClassicVersionUtil;
18+
import org.junit.jupiter.api.Test;
19+
20+
import static org.junit.jupiter.api.Assertions.assertNotNull;
21+
import static org.junit.jupiter.api.Assertions.assertTrue;
22+
23+
public class ClassicVersionUtilTest {
24+
25+
@Test
26+
public void bySelfDeclaredProperties() {
27+
String version = ClassicVersionUtil.getVersionBySelfDeclaredProperties();
28+
assertNotNull(version);
29+
assertTrue(version.startsWith("1.5"));
30+
}
31+
32+
}

logback-classic-blackbox/src/test/java/module-info.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@
2525

2626
// resources in named modules are accessible only if opened
2727
opens asResource;
28+
exports ch.qos.logback.classic.blackbox.util;
2829
}

0 commit comments

Comments
 (0)