File tree Expand file tree Collapse file tree 5 files changed +20
-0
lines changed Expand file tree Collapse file tree 5 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 1
1
package org .keepassxc ;
2
2
3
+ import org .apache .commons .lang3 .SystemUtils ;
3
4
import org .slf4j .Logger ;
4
5
import org .slf4j .LoggerFactory ;
5
6
6
7
import java .util .Optional ;
7
8
9
+ /**
10
+ * Utility class to determine the kind of the KeePassXC installation on Linux
11
+ */
8
12
public class KindOfKeePassXC {
9
13
private static final Logger LOG = LoggerFactory .getLogger (KindOfKeePassXC .class );
10
14
11
15
public static Optional <KeePassXCType > determineType () {
16
+ if (!SystemUtils .IS_OS_LINUX ) {
17
+ return Optional .empty ();
18
+ }
19
+
12
20
///home/<user>/Downloads/KeePassXC-2.7.4-x86_64.AppImage
13
21
var processHandle = ProcessHandle .allProcesses ()
14
22
.filter (ph -> ph .info ().command ().isPresent () && ph .info ().command ().get ().contains ("KeePassXC" )
Original file line number Diff line number Diff line change 3
3
import org .junit .jupiter .api .DisplayName ;
4
4
import org .junit .jupiter .api .Order ;
5
5
import org .junit .jupiter .api .Test ;
6
+ import org .junit .jupiter .api .condition .EnabledOnOs ;
7
+ import org .junit .jupiter .api .condition .OS ;
6
8
import org .keepassxc .KeePassXCType ;
7
9
import org .keepassxc .KindOfKeePassXC ;
8
10
@@ -15,6 +17,7 @@ public class AppImageTest {
15
17
@ Test
16
18
@ Order (7 )
17
19
@ DisplayName ("Testing KeePassXC installation type" )
20
+ @ EnabledOnOs (OS .LINUX )
18
21
public void shouldHaveNoErrors () {
19
22
var type = KindOfKeePassXC .determineType ();
20
23
assertTrue (type .isPresent () && type .get ().equals (KeePassXCType .AppImage ));
Original file line number Diff line number Diff line change 3
3
import org .junit .jupiter .api .DisplayName ;
4
4
import org .junit .jupiter .api .Order ;
5
5
import org .junit .jupiter .api .Test ;
6
+ import org .junit .jupiter .api .condition .EnabledOnOs ;
7
+ import org .junit .jupiter .api .condition .OS ;
6
8
import org .keepassxc .KeePassXCType ;
7
9
import org .keepassxc .KindOfKeePassXC ;
8
10
@@ -15,6 +17,7 @@ public class FlatpakTest {
15
17
@ Test
16
18
@ Order (4 )
17
19
@ DisplayName ("Testing KeePassXC installation type" )
20
+ @ EnabledOnOs (OS .LINUX )
18
21
public void shouldHaveNoErrors () {
19
22
var type = KindOfKeePassXC .determineType ();
20
23
assertTrue (type .isPresent () && type .get ().equals (KeePassXCType .Flatpak ));
Original file line number Diff line number Diff line change 3
3
import org .junit .jupiter .api .DisplayName ;
4
4
import org .junit .jupiter .api .Order ;
5
5
import org .junit .jupiter .api .Test ;
6
+ import org .junit .jupiter .api .condition .EnabledOnOs ;
7
+ import org .junit .jupiter .api .condition .OS ;
6
8
import org .keepassxc .KeePassXCType ;
7
9
import org .keepassxc .KindOfKeePassXC ;
8
10
@@ -15,6 +17,7 @@ public class RepoTest {
15
17
@ Test
16
18
@ Order (6 )
17
19
@ DisplayName ("Testing KeePassXC installation type" )
20
+ @ EnabledOnOs (OS .LINUX )
18
21
public void shouldHaveNoErrors () {
19
22
var type = KindOfKeePassXC .determineType ();
20
23
assertTrue (type .isPresent () && type .get ().equals (KeePassXCType .Repo ));
Original file line number Diff line number Diff line change 3
3
import org .junit .jupiter .api .DisplayName ;
4
4
import org .junit .jupiter .api .Order ;
5
5
import org .junit .jupiter .api .Test ;
6
+ import org .junit .jupiter .api .condition .EnabledOnOs ;
7
+ import org .junit .jupiter .api .condition .OS ;
6
8
import org .keepassxc .KeePassXCType ;
7
9
import org .keepassxc .KindOfKeePassXC ;
8
10
@@ -15,6 +17,7 @@ public class SnapTest {
15
17
@ Test
16
18
@ Order (5 )
17
19
@ DisplayName ("Testing KeePassXC installation type" )
20
+ @ EnabledOnOs (OS .LINUX )
18
21
public void shouldHaveNoErrors () {
19
22
var type = KindOfKeePassXC .determineType ();
20
23
assertTrue (type .isPresent () && type .get ().equals (KeePassXCType .Snap ));
You can’t perform that action at this time.
0 commit comments