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 11package org .keepassxc ;
22
3+ import org .apache .commons .lang3 .SystemUtils ;
34import org .slf4j .Logger ;
45import org .slf4j .LoggerFactory ;
56
67import java .util .Optional ;
78
9+ /**
10+ * Utility class to determine the kind of the KeePassXC installation on Linux
11+ */
812public class KindOfKeePassXC {
913 private static final Logger LOG = LoggerFactory .getLogger (KindOfKeePassXC .class );
1014
1115 public static Optional <KeePassXCType > determineType () {
16+ if (!SystemUtils .IS_OS_LINUX ) {
17+ return Optional .empty ();
18+ }
19+
1220 ///home/<user>/Downloads/KeePassXC-2.7.4-x86_64.AppImage
1321 var processHandle = ProcessHandle .allProcesses ()
1422 .filter (ph -> ph .info ().command ().isPresent () && ph .info ().command ().get ().contains ("KeePassXC" )
Original file line number Diff line number Diff line change 33import org .junit .jupiter .api .DisplayName ;
44import org .junit .jupiter .api .Order ;
55import org .junit .jupiter .api .Test ;
6+ import org .junit .jupiter .api .condition .EnabledOnOs ;
7+ import org .junit .jupiter .api .condition .OS ;
68import org .keepassxc .KeePassXCType ;
79import org .keepassxc .KindOfKeePassXC ;
810
@@ -15,6 +17,7 @@ public class AppImageTest {
1517 @ Test
1618 @ Order (7 )
1719 @ DisplayName ("Testing KeePassXC installation type" )
20+ @ EnabledOnOs (OS .LINUX )
1821 public void shouldHaveNoErrors () {
1922 var type = KindOfKeePassXC .determineType ();
2023 assertTrue (type .isPresent () && type .get ().equals (KeePassXCType .AppImage ));
Original file line number Diff line number Diff line change 33import org .junit .jupiter .api .DisplayName ;
44import org .junit .jupiter .api .Order ;
55import org .junit .jupiter .api .Test ;
6+ import org .junit .jupiter .api .condition .EnabledOnOs ;
7+ import org .junit .jupiter .api .condition .OS ;
68import org .keepassxc .KeePassXCType ;
79import org .keepassxc .KindOfKeePassXC ;
810
@@ -15,6 +17,7 @@ public class FlatpakTest {
1517 @ Test
1618 @ Order (4 )
1719 @ DisplayName ("Testing KeePassXC installation type" )
20+ @ EnabledOnOs (OS .LINUX )
1821 public void shouldHaveNoErrors () {
1922 var type = KindOfKeePassXC .determineType ();
2023 assertTrue (type .isPresent () && type .get ().equals (KeePassXCType .Flatpak ));
Original file line number Diff line number Diff line change 33import org .junit .jupiter .api .DisplayName ;
44import org .junit .jupiter .api .Order ;
55import org .junit .jupiter .api .Test ;
6+ import org .junit .jupiter .api .condition .EnabledOnOs ;
7+ import org .junit .jupiter .api .condition .OS ;
68import org .keepassxc .KeePassXCType ;
79import org .keepassxc .KindOfKeePassXC ;
810
@@ -15,6 +17,7 @@ public class RepoTest {
1517 @ Test
1618 @ Order (6 )
1719 @ DisplayName ("Testing KeePassXC installation type" )
20+ @ EnabledOnOs (OS .LINUX )
1821 public void shouldHaveNoErrors () {
1922 var type = KindOfKeePassXC .determineType ();
2023 assertTrue (type .isPresent () && type .get ().equals (KeePassXCType .Repo ));
Original file line number Diff line number Diff line change 33import org .junit .jupiter .api .DisplayName ;
44import org .junit .jupiter .api .Order ;
55import org .junit .jupiter .api .Test ;
6+ import org .junit .jupiter .api .condition .EnabledOnOs ;
7+ import org .junit .jupiter .api .condition .OS ;
68import org .keepassxc .KeePassXCType ;
79import org .keepassxc .KindOfKeePassXC ;
810
@@ -15,6 +17,7 @@ public class SnapTest {
1517 @ Test
1618 @ Order (5 )
1719 @ DisplayName ("Testing KeePassXC installation type" )
20+ @ EnabledOnOs (OS .LINUX )
1821 public void shouldHaveNoErrors () {
1922 var type = KindOfKeePassXC .determineType ();
2023 assertTrue (type .isPresent () && type .get ().equals (KeePassXCType .Snap ));
You can’t perform that action at this time.
0 commit comments