summaryrefslogtreecommitdiffstats
path: root/tests/auto/installer/commandlineinstall
diff options
context:
space:
mode:
authorKatja Marttila <katja.marttila@qt.io>2022-06-02 10:46:14 +0300
committerKatja Marttila <katja.marttila@qt.io>2022-06-06 14:12:13 +0300
commitfdfd2e381bd16a99822ef8c9dfdffb75ab29d142 (patch)
treec97aa34d0e11907c8f65978a7aecc7c088e9d341 /tests/auto/installer/commandlineinstall
parentb6e6ad4876ab6c2c2a20f6cce191e27411441921 (diff)
Convert possible test cases to data-driven tests
Also rename the test to better correspond the test cases. Change-Id: Ic3f624fc8cf42724ff4df550cc85a52343ac6452 Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
Diffstat (limited to 'tests/auto/installer/commandlineinstall')
-rw-r--r--tests/auto/installer/commandlineinstall/commandlineinstall.pro9
-rw-r--r--tests/auto/installer/commandlineinstall/data/components.xml24
-rw-r--r--tests/auto/installer/commandlineinstall/data/componentsFromInstallPackagesRepository.xml160
-rw-r--r--tests/auto/installer/commandlineinstall/data/config.xml8
-rw-r--r--tests/auto/installer/commandlineinstall/data/filequeryrepository/A/1.0.2-1meta.7zbin0 -> 945 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/filequeryrepository/Updates.xml13
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/Updates.xml72
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentA/2.0.0content.7zbin0 -> 259 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentB/1.0.0content.7zbin0 -> 241 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentC/1.0.0content.7zbin0 -> 241 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentD/1.0.0content.7zbin0 -> 241 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentF/1.0.0content.7zbin0 -> 241 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentH/1.0.0content.7zbin0 -> 209 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/Updates.xml173
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentA/1.0.0content.7zbin0 -> 259 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentB/1.0.0content.7zbin0 -> 241 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentC/1.0.0content.7zbin0 -> 241 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentD/1.0.0content.7zbin0 -> 241 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentE/1.0.0content.7zbin0 -> 241 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent1.subsubcomponent1/1.0.0content.7zbin0 -> 249 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent1.subsubcomponent2/1.0.0content.7zbin0 -> 249 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent1/1.0.0content.7zbin0 -> 241 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent2.subsubcomponent1/1.0.0content.7zbin0 -> 249 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent2.subsubcomponent2/1.0.0content.7zbin0 -> 249 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent2/1.0.0content.7zbin0 -> 241 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF/1.0.0content.7zbin0 -> 241 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentG/1.0.0content.7zbin0 -> 241 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentG/1.0.0meta.7zbin0 -> 970 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentH/1.0.0content.7zbin0 -> 209 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentI/1.0.0content.7zbin0 -> 209 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/repository/Updates.xml69
-rw-r--r--tests/auto/installer/commandlineinstall/data/uninstallableComponentsRepository/Updates.xml50
-rw-r--r--tests/auto/installer/commandlineinstall/settings.qrc35
-rw-r--r--tests/auto/installer/commandlineinstall/tst_commandlineinstall.cpp764
34 files changed, 1377 insertions, 0 deletions
diff --git a/tests/auto/installer/commandlineinstall/commandlineinstall.pro b/tests/auto/installer/commandlineinstall/commandlineinstall.pro
new file mode 100644
index 000000000..891830a97
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/commandlineinstall.pro
@@ -0,0 +1,9 @@
+include(../../qttest.pri)
+
+QT += qml
+
+SOURCES += tst_commandlineinstall.cpp
+
+RESOURCES += \
+ settings.qrc \
+ ../shared/config.qrc
diff --git a/tests/auto/installer/commandlineinstall/data/components.xml b/tests/auto/installer/commandlineinstall/data/components.xml
new file mode 100644
index 000000000..d5102787f
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/components.xml
@@ -0,0 +1,24 @@
+<Packages>
+ <ApplicationName>Online Installer Example</ApplicationName>
+ <ApplicationVersion>1.0.0</ApplicationVersion>
+ <Package>
+ <Name>A</Name>
+ <Title>A Title</Title>
+ <Description>Example component A</Description>
+ <Version>1.0.2-1</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2020-02-13</InstallDate>
+ <Size>74</Size>
+ <Checkable>true</Checkable>
+ </Package>
+ <Package>
+ <Name>B</Name>
+ <Title>B Title</Title>
+ <Description>Example component B</Description>
+ <Version>1.0.0-1</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2020-02-13</InstallDate>
+ <Size>74</Size>
+ <Checkable>true</Checkable>
+ </Package>
+</Packages> \ No newline at end of file
diff --git a/tests/auto/installer/commandlineinstall/data/componentsFromInstallPackagesRepository.xml b/tests/auto/installer/commandlineinstall/data/componentsFromInstallPackagesRepository.xml
new file mode 100644
index 000000000..18d6f11c3
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/componentsFromInstallPackagesRepository.xml
@@ -0,0 +1,160 @@
+<Packages>
+ <ApplicationName>Dependency Solving Example</ApplicationName>
+ <ApplicationVersion>1.0.0</ApplicationVersion>
+ <Package>
+ <Name>componentA</Name>
+ <Title>Component A</Title>
+ <Description>This component does not depend on any other component.</Description>
+ <Version>1.0.0</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2020-03-23</InstallDate>
+ <Size>158</Size>
+ <Checkable>true</Checkable>
+ </Package>
+ <Package>
+ <Name>componentB</Name>
+ <Title>Component B</Title>
+ <Description>This component does not depend on any other component.</Description>
+ <Version>1.0.0</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2020-03-23</InstallDate>
+ <Size>99</Size>
+ <Checkable>true</Checkable>
+ </Package>
+ <Package>
+ <Name>componentC</Name>
+ <Title>Component C (depends on A and B)</Title>
+ <Description>This component depends on Component A and Component B. Selecting this component for installation also marks Component A and Component B for installation, which in turn marks Component D, because it has an automatic dependency on Component A and Component B.</Description>
+ <Version>1.0.0</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2020-03-23</InstallDate>
+ <Size>99</Size>
+ <Dependencies>componentA,componentB</Dependencies>
+ <Checkable>true</Checkable>
+ </Package>
+ <Package>
+ <Name>componentD</Name>
+ <Title>Component D (auto depends on A and B)</Title>
+ <Description>This component has an automatic dependency on Component A and Component B. If both A and B are marked for installation, this component is also installed.</Description>
+ <Version>1.0.0</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2020-03-23</InstallDate>
+ <Size>99</Size>
+ <AutoDependOn>componentA,componentB</AutoDependOn>
+ <Checkable>true</Checkable>
+ </Package>
+ <Package>
+ <Name>componentE</Name>
+ <Title>Component E (forced)</Title>
+ <Description>This is a forced component that is always installed.</Description>
+ <Version>1.0.0</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2020-03-23</InstallDate>
+ <Size>99</Size>
+ <ForcedInstallation>true</ForcedInstallation>
+ </Package>
+ <Package>
+ <Name>componentF</Name>
+ <Title>Component F</Title>
+ <Description>This component contains 2 subcomponents.</Description>
+ <Version>1.0.0</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2020-03-23</InstallDate>
+ <Size>99</Size>
+ <Checkable>true</Checkable>
+ </Package>
+ <Package>
+ <Name>componentF.subcomponent1</Name>
+ <Title>Subcomponent 1</Title>
+ <Description>This component contains 2 leaf components.</Description>
+ <Version>1.0.0</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2020-03-23</InstallDate>
+ <Size>99</Size>
+ <Checkable>true</Checkable>
+ </Package>
+ <Package>
+ <Name>componentF.subcomponent1.subsubcomponent1</Name>
+ <Title>Subsubcomponent 1</Title>
+ <Description>This component does not depend on any other component.</Description>
+ <Version>1.0.0</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2020-03-23</InstallDate>
+ <Size>99</Size>
+ <Checkable>true</Checkable>
+ </Package>
+ <Package>
+ <Name>componentF.subcomponent1.subsubcomponent2</Name>
+ <Title>Subsubcomponent 2</Title>
+ <Description>This component does not depend on any other component.</Description>
+ <Version>1.0.0</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2020-03-23</InstallDate>
+ <Size>99</Size>
+ <Checkable>true</Checkable>
+ </Package>
+ <Package>
+ <Name>componentF.subcomponent2</Name>
+ <Title>Subcomponent 2</Title>
+ <Description>This component contains 2 leaf components.</Description>
+ <Version>1.0.0</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2020-03-23</InstallDate>
+ <Size>99</Size>
+ <Checkable>true</Checkable>
+ </Package>
+ <Package>
+ <Name>componentF.subcomponent2.subsubcomponent1</Name>
+ <Title>Subsubcomponent 1</Title>
+ <Description>This component does not depend on any other component.</Description>
+ <Version>1.0.0</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2020-03-23</InstallDate>
+ <Size>99</Size>
+ <Checkable>true</Checkable>
+ </Package>
+ <Package>
+ <Name>componentF.subcomponent2.subsubcomponent2</Name>
+ <Title>Subsubcomponent 2</Title>
+ <Description>This component does not depend on any other component.</Description>
+ <Version>1.0.0</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2020-03-23</InstallDate>
+ <Size>99</Size>
+ <Checkable>true</Checkable>
+ </Package>
+ <Package>
+ <Name>componentG</Name>
+ <Title>Component G (default, depends on A, dependency added dynamically)</Title>
+ <Description>By default, this component is selected for installation. It depends on component A. Dependency is added from inside component script.</Description>
+ <Version>1.0.0</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2020-03-23</InstallDate>
+ <Size>99</Size>
+ <Dependencies>componentA</Dependencies>
+ <Checkable>true</Checkable>
+ </Package>
+ <Package>
+ <Name>componentH</Name>
+ <Title>Component H</Title>
+ <Description>This component does not depend on any other component.</Description>
+ <Version>1.0.0</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2020-03-23</InstallDate>
+ <Size>99</Size>
+ <Virtual>true</Virtual>
+ <Checkable>true</Checkable>
+ </Package>
+ <Package>
+ <Name>componentI</Name>
+ <Title>Component I</Title>
+ <Description>This component has an automatic dependency on Component C. If C is marked for installation, this component is also installed.</Description>
+ <Version>1.0.0</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2020-03-23</InstallDate>
+ <Size>99</Size>
+ <AutoDependOn>componentC</AutoDependOn>
+ <Virtual>true</Virtual>
+ <Checkable>true</Checkable>
+ </Package>
+</Packages>
diff --git a/tests/auto/installer/commandlineinstall/data/config.xml b/tests/auto/installer/commandlineinstall/data/config.xml
new file mode 100644
index 000000000..041ce5062
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/config.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Installer>
+ <Name>Your application</Name>
+ <Version>1.2.3</Version>
+ <MaintenanceToolName></MaintenanceToolName>
+ <MaintenanceToolIniFile></MaintenanceToolIniFile>
+ <TargetConfigurationFile></TargetConfigurationFile>
+</Installer>
diff --git a/tests/auto/installer/commandlineinstall/data/filequeryrepository/A/1.0.2-1meta.7z b/tests/auto/installer/commandlineinstall/data/filequeryrepository/A/1.0.2-1meta.7z
new file mode 100644
index 000000000..0b0b6ade6
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/filequeryrepository/A/1.0.2-1meta.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineinstall/data/filequeryrepository/Updates.xml b/tests/auto/installer/commandlineinstall/data/filequeryrepository/Updates.xml
new file mode 100644
index 000000000..72b7938d9
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/filequeryrepository/Updates.xml
@@ -0,0 +1,13 @@
+<Updates>
+ <ApplicationName>{AnyApplication}</ApplicationName>
+ <ApplicationVersion>1.0.0</ApplicationVersion>
+ <PackageUpdate>
+ <Name>A</Name>
+ <DisplayName>A</DisplayName>
+ <Description>A component</Description>
+ <Version>1.0.2-1</Version>
+ <ReleaseDate>2015-01-01</ReleaseDate>
+ <Default>true</Default>
+ <Script>script.qs</Script>
+ </PackageUpdate>
+</Updates>
diff --git a/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/Updates.xml b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/Updates.xml
new file mode 100644
index 000000000..72931954a
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/Updates.xml
@@ -0,0 +1,72 @@
+<Updates>
+ <ApplicationName>{AnyApplication}</ApplicationName>
+ <ApplicationVersion>1.0.0</ApplicationVersion>
+ <Checksum>false</Checksum>
+ <PackageUpdate>
+ <Name>componentA</Name>
+ <DisplayName>Component A</DisplayName>
+ <Description>New dependency added</Description>
+ <Version>2.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>100</SortingPriority>
+ <UpdateFile OS="Any" CompressedSize="299" UncompressedSize="158"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>92b02a74d0886bc1569ff8b3a7edd1f9d828e56c</SHA1>
+ <Dependencies>componentF</Dependencies>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentB</Name>
+ <DisplayName>Component B</DisplayName>
+ <Description>This component does not depend on any other component.</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>90</SortingPriority>
+ <UpdateFile OS="Any" CompressedSize="281" UncompressedSize="99"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>aedfaef53cdc0f52353a8680009be405fa767811</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentC</Name>
+ <DisplayName>Component C. Dependencies removed</DisplayName>
+ <Description>This component dependencies on Component A and Component B are removed in update.</Description>
+ <Dependencies></Dependencies>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>80</SortingPriority>
+ <UpdateFile OS="Any" CompressedSize="281" UncompressedSize="99"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>20b9463a5e06f373182b3c7c4cf879806d429409</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentD</Name>
+ <DisplayName>Component D (auto depends on A and B)</DisplayName>
+ <Description>This component has an automatic dependency on Component A and Component B. If both A and B are marked for installation, this component is also installed.</Description>
+ <AutoDependOn>componentA, componentB</AutoDependOn>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>70</SortingPriority>
+ <UpdateFile OS="Any" CompressedSize="281" UncompressedSize="99"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>99cf24c71559c75dfae9933826ed16051fca6ea1</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentF</Name>
+ <DisplayName>Component F</DisplayName>
+ <Description>This component contains 2 subcomponents.</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>40</SortingPriority>
+ <UpdateFile OS="Any" CompressedSize="281" UncompressedSize="99"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>e6443a8b5a5651f63c0604cae6d32431ca617f1a</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentH</Name>
+ <Description>This component does not depend on any other component.</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>50</SortingPriority>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <Virtual>false</Virtual>
+ </PackageUpdate>
+</Updates>
diff --git a/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentA/2.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentA/2.0.0content.7z
new file mode 100644
index 000000000..4ddbe565b
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentA/2.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentB/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentB/1.0.0content.7z
new file mode 100644
index 000000000..f84ffcdc5
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentB/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentC/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentC/1.0.0content.7z
new file mode 100644
index 000000000..9ad11e06f
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentC/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentD/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentD/1.0.0content.7z
new file mode 100644
index 000000000..0c8c52e31
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentD/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentF/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentF/1.0.0content.7z
new file mode 100644
index 000000000..4a04b1394
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentF/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentH/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentH/1.0.0content.7z
new file mode 100644
index 000000000..e1449ad29
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentH/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineinstall/data/installPackagesRepository/Updates.xml b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/Updates.xml
new file mode 100644
index 000000000..81831ed5b
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/Updates.xml
@@ -0,0 +1,173 @@
+<Updates>
+ <ApplicationName>{AnyApplication}</ApplicationName>
+ <ApplicationVersion>1.0.0</ApplicationVersion>
+ <Checksum>false</Checksum>
+ <PackageUpdate>
+ <Name>componentA</Name>
+ <DisplayName>Component A</DisplayName>
+ <Description>This component does not depend on any other component.</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>100</SortingPriority>
+ <UpdateFile OS="Any" CompressedSize="299" UncompressedSize="158"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>92b02a74d0886bc1569ff8b3a7edd1f9d828e56c</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentB</Name>
+ <DisplayName>Component B</DisplayName>
+ <Description>This component does not depend on any other component.</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>90</SortingPriority>
+ <UpdateFile OS="Any" CompressedSize="281" UncompressedSize="99"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>aedfaef53cdc0f52353a8680009be405fa767811</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentC</Name>
+ <DisplayName>Component C (depends on A and B)</DisplayName>
+ <Description>This component depends on Component A and Component B. Selecting this component for installation also marks Component A and Component B for installation, which in turn marks Component D, because it has an automatic dependency on Component A and Component B.</Description>
+ <Dependencies>componentA, componentB</Dependencies>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>80</SortingPriority>
+ <UpdateFile OS="Any" CompressedSize="281" UncompressedSize="99"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>20b9463a5e06f373182b3c7c4cf879806d429409</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentD</Name>
+ <DisplayName>Component D (auto depends on A and B)</DisplayName>
+ <Description>This component has an automatic dependency on Component A and Component B. If both A and B are marked for installation, this component is also installed.</Description>
+ <AutoDependOn>componentA, componentB</AutoDependOn>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>70</SortingPriority>
+ <UpdateFile OS="Any" CompressedSize="281" UncompressedSize="99"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>99cf24c71559c75dfae9933826ed16051fca6ea1</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentE</Name>
+ <DisplayName>Component E (forced)</DisplayName>
+ <Description>This is a forced component that is always installed.</Description>
+ <ForcedInstallation>true</ForcedInstallation>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>60</SortingPriority>
+ <UpdateFile OS="Any" CompressedSize="281" UncompressedSize="99"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>926bf503ccdff93351744843a95e5e2172cad5ec</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentF</Name>
+ <DisplayName>Component F</DisplayName>
+ <Description>This component contains 2 subcomponents.</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>40</SortingPriority>
+ <UpdateFile OS="Any" CompressedSize="281" UncompressedSize="99"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>e6443a8b5a5651f63c0604cae6d32431ca617f1a</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentF.subcomponent1</Name>
+ <DisplayName>Subcomponent 1</DisplayName>
+ <Description>This component contains 2 leaf components.</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>100</SortingPriority>
+ <UpdateFile OS="Any" CompressedSize="281" UncompressedSize="99"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>a3bc5dce1c93add30c22e46436396c66b0b51001</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentF.subcomponent1.subsubcomponent1</Name>
+ <DisplayName>Subsubcomponent 1</DisplayName>
+ <Description>This component does not depend on any other component.</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>100</SortingPriority>
+ <UpdateFile OS="Any" CompressedSize="289" UncompressedSize="99"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>ebe4d69414a1675a7f46887e15d9bffc275b7cc4</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentF.subcomponent1.subsubcomponent2</Name>
+ <DisplayName>Subsubcomponent 2</DisplayName>
+ <Description>This component does not depend on any other component.</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>50</SortingPriority>
+ <UpdateFile OS="Any" CompressedSize="289" UncompressedSize="99"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>e4379d20320d4c173b2d8e228f5722e3f36e3114</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentF.subcomponent2</Name>
+ <DisplayName>Subcomponent 2</DisplayName>
+ <Description>This component contains 2 leaf components.</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>50</SortingPriority>
+ <UpdateFile OS="Any" CompressedSize="281" UncompressedSize="99"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>6462be25912c490569a7c4f3931d978e78c69dc4</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentF.subcomponent2.subsubcomponent1</Name>
+ <DisplayName>Subsubcomponent 1</DisplayName>
+ <Description>This component does not depend on any other component.</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>100</SortingPriority>
+ <UpdateFile OS="Any" CompressedSize="289" UncompressedSize="99"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>72b224bc8f3431210834ce6db373fc8d638a3546</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentF.subcomponent2.subsubcomponent2</Name>
+ <DisplayName>Subsubcomponent 2</DisplayName>
+ <Description>This component does not depend on any other component.</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>50</SortingPriority>
+ <UpdateFile OS="Any" CompressedSize="289" UncompressedSize="99"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>3e2744edaef06af75b3248d5935523a6e2e61551</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentG</Name>
+ <DisplayName>Component G (default, depends on A, dependency added dynamically)</DisplayName>
+ <Description>By default, this component is selected for installation. It depends on component A. Dependency is added from inside component script.</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <Script>installscript.js</Script>
+ <SortingPriority>30</SortingPriority>
+ <UpdateFile OS="Any" CompressedSize="281" UncompressedSize="99"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>8cba36dd589492c28e0d04942b4f8aa0a09f59cc</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentH</Name>
+ <DisplayName>component H</DisplayName>
+ <Description>This component does not depend on any other component.</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>50</SortingPriority>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <Virtual>true</Virtual>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>componentI</Name>
+ <DisplayName>component I</DisplayName>
+ <Description>This component has an automatic dependency on Component C. If C is marked for installation, this component is also installed.</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <SortingPriority>50</SortingPriority>
+ <AutoDependOn>componentC</AutoDependOn>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <Virtual>true</Virtual>
+ </PackageUpdate>
+</Updates>
diff --git a/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentA/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentA/1.0.0content.7z
new file mode 100644
index 000000000..4ddbe565b
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentA/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentB/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentB/1.0.0content.7z
new file mode 100644
index 000000000..f84ffcdc5
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentB/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentC/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentC/1.0.0content.7z
new file mode 100644
index 000000000..9ad11e06f
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentC/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentD/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentD/1.0.0content.7z
new file mode 100644
index 000000000..0c8c52e31
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentD/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentE/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentE/1.0.0content.7z
new file mode 100644
index 000000000..f5abacf81
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentE/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent1.subsubcomponent1/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent1.subsubcomponent1/1.0.0content.7z
new file mode 100644
index 000000000..3aced680f
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent1.subsubcomponent1/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent1.subsubcomponent2/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent1.subsubcomponent2/1.0.0content.7z
new file mode 100644
index 000000000..e5385a163
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent1.subsubcomponent2/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent1/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent1/1.0.0content.7z
new file mode 100644
index 000000000..5bc549863
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent1/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent2.subsubcomponent1/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent2.subsubcomponent1/1.0.0content.7z
new file mode 100644
index 000000000..da9e9f340
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent2.subsubcomponent1/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent2.subsubcomponent2/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent2.subsubcomponent2/1.0.0content.7z
new file mode 100644
index 000000000..d0b013706
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent2.subsubcomponent2/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent2/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent2/1.0.0content.7z
new file mode 100644
index 000000000..74ab44033
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent2/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF/1.0.0content.7z
new file mode 100644
index 000000000..4a04b1394
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentG/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentG/1.0.0content.7z
new file mode 100644
index 000000000..81fc02052
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentG/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentG/1.0.0meta.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentG/1.0.0meta.7z
new file mode 100644
index 000000000..90bfe33a2
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentG/1.0.0meta.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentH/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentH/1.0.0content.7z
new file mode 100644
index 000000000..e1449ad29
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentH/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentI/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentI/1.0.0content.7z
new file mode 100644
index 000000000..651a29f94
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentI/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineinstall/data/repository/Updates.xml b/tests/auto/installer/commandlineinstall/data/repository/Updates.xml
new file mode 100644
index 000000000..52707d09d
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/repository/Updates.xml
@@ -0,0 +1,69 @@
+<Updates>
+ <ApplicationName>{AnyApplication}</ApplicationName>
+ <ApplicationVersion>1.0.0</ApplicationVersion>
+ <Checksum>true</Checksum>
+ <PackageUpdate>
+ <Name>A</Name>
+ <DisplayName>A</DisplayName>
+ <Description>Example component A</Description>
+ <Version>1.0.2-1</Version>
+ <ReleaseDate>2015-01-01</ReleaseDate>
+ <Default>true</Default>
+ <UpdateFile CompressedSize="222" OS="Any" UncompressedSize="72"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>9d54e3a5adf3563913feee8ba23a99fb80d46590</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>B</Name>
+ <DisplayName>B</DisplayName>
+ <Description>Example component B</Description>
+ <Version>1.0.0-1</Version>
+ <ReleaseDate>2015-01-01</ReleaseDate>
+ <Default>false</Default>
+ <UpdateFile CompressedSize="222" OS="Any" UncompressedSize="72"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>9170d55a6af81c1a6a63d708a4ab6ed359775cd9</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>C</Name>
+ <DisplayName>C</DisplayName>
+ <Description>Example component C</Description>
+ <Version>1.0.0-1</Version>
+ <ReleaseDate>2015-01-01</ReleaseDate>
+ <Default>true</Default>
+ <UpdateFile CompressedSize="222" OS="Any" UncompressedSize="72"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>5b3939da1af492382c68388fc796837e4c36b876</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>C.virt</Name>
+ <DisplayName>Virtual subcomponent of C</DisplayName>
+ <Description>Example virtual component</Description>
+ <Version>1.0.0-1</Version>
+ <ReleaseDate>2015-01-01</ReleaseDate>
+ <Virtual>true</Virtual>
+ <UpdateFile CompressedSize="222" OS="Any" UncompressedSize="72"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>5b3939da1af492382c68388fc796837e4c36b876</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>C.virt.subcomponent</Name>
+ <DisplayName>Subcomponent of virtual component</DisplayName>
+ <Description>Example subcomponent of virtual component</Description>
+ <Version>1.0.0-1</Version>
+ <ReleaseDate>2015-01-01</ReleaseDate>
+ <UpdateFile CompressedSize="222" OS="Any" UncompressedSize="72"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>5b3939da1af492382c68388fc796837e4c36b876</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>AB</Name>
+ <DisplayName>AB</DisplayName>
+ <Description>Example component AB</Description>
+ <Version>1.0.2-1</Version>
+ <ReleaseDate>2015-01-01</ReleaseDate>
+ <Default>true</Default>
+ <UpdateFile UncompressedSize="0" OS="Any" CompressedSize="0"/>
+ <SHA1>f75e65b1a0f68abb77fc41da08fc26dda5409a18</SHA1>
+ </PackageUpdate>
+</Updates>
diff --git a/tests/auto/installer/commandlineinstall/data/uninstallableComponentsRepository/Updates.xml b/tests/auto/installer/commandlineinstall/data/uninstallableComponentsRepository/Updates.xml
new file mode 100644
index 000000000..f0c724db8
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/data/uninstallableComponentsRepository/Updates.xml
@@ -0,0 +1,50 @@
+<Updates>
+ <ApplicationName>{AnyApplication}</ApplicationName>
+ <ApplicationVersion>1.0.0</ApplicationVersion>
+ <Checksum>true</Checksum>
+ <PackageUpdate>
+ <Name>A</Name>
+ <DisplayName>A</DisplayName>
+ <Description>Example component A</Description>
+ <Version>2.0.0</Version>
+ <ReleaseDate>2015-01-01</ReleaseDate>
+ <Default>true</Default>
+ <UpdateFile CompressedSize="224" OS="Any" UncompressedSize="74"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>c1f340c9a7ad1edbef4cb6288c83c646211e5ccd</SHA1>
+ <AutoDependOn>autoDep</AutoDependOn>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>AB</Name>
+ <DisplayName>AB</DisplayName>
+ <Description>Example component AB</Description>
+ <Version>1.0.2-1</Version>
+ <ReleaseDate>2015-01-01</ReleaseDate>
+ <Default>true</Default>
+ <UpdateFile CompressedSize="0" OS="Any" UncompressedSize="0"/>
+ <SHA1>3c1470896a9db84092e00806b1303f3b5fa4f7ad</SHA1>
+ <Checkable>false</Checkable>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>B</Name>
+ <DisplayName>B</DisplayName>
+ <Description>Example component B</Description>
+ <Version>2.0.0</Version>
+ <ReleaseDate>2015-01-01</ReleaseDate>
+ <Default>true</Default>
+ <UpdateFile CompressedSize="224" OS="Any" UncompressedSize="74"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>cfa136fa1d7a4196896c90af72d510727ba799ae</SHA1>
+ <Virtual>true</Virtual>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>B.subcomponent</Name>
+ <DisplayName>Subcomponent of B</DisplayName>
+ <Description>Example non-virtual subcomponent of B</Description>
+ <Version>2.0.0</Version>
+ <ReleaseDate>2015-01-01</ReleaseDate>
+ <UpdateFile CompressedSize="224" OS="Any" UncompressedSize="74"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>cfa136fa1d7a4196896c90af72d510727ba799ae</SHA1>
+ </PackageUpdate>
+</Updates>
diff --git a/tests/auto/installer/commandlineinstall/settings.qrc b/tests/auto/installer/commandlineinstall/settings.qrc
new file mode 100644
index 000000000..824517e1e
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/settings.qrc
@@ -0,0 +1,35 @@
+<RCC>
+ <qresource prefix="/">
+ <file>data/config.xml</file>
+ <file>data/repository/Updates.xml</file>
+ <file>data/uninstallableComponentsRepository/Updates.xml</file>
+ <file>data/components.xml</file>
+ <file>data/installPackagesRepository/Updates.xml</file>
+ <file>data/installPackagesRepository/componentA/1.0.0content.7z</file>
+ <file>data/installPackagesRepository/componentB/1.0.0content.7z</file>
+ <file>data/installPackagesRepository/componentC/1.0.0content.7z</file>
+ <file>data/installPackagesRepository/componentD/1.0.0content.7z</file>
+ <file>data/installPackagesRepository/componentE/1.0.0content.7z</file>
+ <file>data/installPackagesRepository/componentF/1.0.0content.7z</file>
+ <file>data/installPackagesRepository/componentG/1.0.0content.7z</file>
+ <file>data/installPackagesRepository/componentH/1.0.0content.7z</file>
+ <file>data/installPackagesRepository/componentI/1.0.0content.7z</file>
+ <file>data/installPackagesRepository/componentG/1.0.0meta.7z</file>
+ <file>data/installPackagesRepository/componentF.subcomponent1/1.0.0content.7z</file>
+ <file>data/installPackagesRepository/componentF.subcomponent2/1.0.0content.7z</file>
+ <file>data/installPackagesRepository/componentF.subcomponent1.subsubcomponent1/1.0.0content.7z</file>
+ <file>data/installPackagesRepository/componentF.subcomponent1.subsubcomponent2/1.0.0content.7z</file>
+ <file>data/installPackagesRepository/componentF.subcomponent2.subsubcomponent1/1.0.0content.7z</file>
+ <file>data/installPackagesRepository/componentF.subcomponent2.subsubcomponent2/1.0.0content.7z</file>
+ <file>data/installPackagesDependencyChanged/Updates.xml</file>
+ <file>data/installPackagesDependencyChanged/componentA/2.0.0content.7z</file>
+ <file>data/installPackagesDependencyChanged/componentB/1.0.0content.7z</file>
+ <file>data/installPackagesDependencyChanged/componentC/1.0.0content.7z</file>
+ <file>data/installPackagesDependencyChanged/componentD/1.0.0content.7z</file>
+ <file>data/installPackagesDependencyChanged/componentF/1.0.0content.7z</file>
+ <file>data/installPackagesDependencyChanged/componentH/1.0.0content.7z</file>
+ <file>data/filequeryrepository/Updates.xml</file>
+ <file>data/filequeryrepository/A/1.0.2-1meta.7z</file>
+ <file>data/componentsFromInstallPackagesRepository.xml</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/installer/commandlineinstall/tst_commandlineinstall.cpp b/tests/auto/installer/commandlineinstall/tst_commandlineinstall.cpp
new file mode 100644
index 000000000..89f6153ed
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/tst_commandlineinstall.cpp
@@ -0,0 +1,764 @@
+/**************************************************************************
+**
+** Copyright (C) 2022 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Installer Framework.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+**************************************************************************/
+#include "../shared/packagemanager.h"
+#include "../shared/verifyinstaller.h"
+
+#include <component.h>
+#include <packagemanagercore.h>
+
+#include <QLoggingCategory>
+#include <QTest>
+#include <QRegularExpression>
+
+#include <iostream>
+#include <sstream>
+
+using namespace QInstaller;
+
+typedef QList<QPair<QString, QString> > ComponentResourceHash;
+typedef QPair<QString, QString> ComponentResource;
+
+class tst_CommandLineInstall : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void testListAvailablePackages()
+ {
+ QString loggingRules = (QLatin1String("ifw.* = false\n"));
+
+ QTest::ignoreMessage(QtDebugMsg, "Operations sanity check succeeded.");
+
+ QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManager
+ (m_installDir, ":///data/repository"));
+
+ QLoggingCategory::setFilterRules(loggingRules);
+ auto func = &PackageManagerCore::listAvailablePackages;
+
+ verifyListPackagesMessage(core.get(), QLatin1String("<?xml version=\"1.0\"?>\n"
+ "<availablepackages>\n"
+ " <package name=\"AB\" displayname=\"AB\" version=\"1.0.2-1\"/>\n"
+ " <package name=\"A\" displayname=\"A\" version=\"1.0.2-1\"/>\n"
+ " <package name=\"B\" displayname=\"B\" version=\"1.0.0-1\"/>\n"
+ " <package name=\"C\" displayname=\"C\" version=\"1.0.0-1\"/>\n"
+ "</availablepackages>\n"), func, QLatin1String("."), QHash<QString, QString>());
+
+ verifyListPackagesMessage(core.get(), QLatin1String("<?xml version=\"1.0\"?>\n"
+ "<availablepackages>\n"
+ " <package name=\"AB\" displayname=\"AB\" version=\"1.0.2-1\"/>\n"
+ " <package name=\"A\" displayname=\"A\" version=\"1.0.2-1\"/>\n"
+ "</availablepackages>\n"), func, QLatin1String("A"), QHash<QString, QString>());
+
+ verifyListPackagesMessage(core.get(), QLatin1String("<?xml version=\"1.0\"?>\n"
+ "<availablepackages>\n"
+ " <package name=\"AB\" displayname=\"AB\" version=\"1.0.2-1\"/>\n"
+ " <package name=\"A\" displayname=\"A\" version=\"1.0.2-1\"/>\n"
+ "</availablepackages>\n"), func, QLatin1String("A.*"), QHash<QString, QString>());
+
+ verifyListPackagesMessage(core.get(), QLatin1String("<?xml version=\"1.0\"?>\n"
+ "<availablepackages>\n"
+ " <package name=\"B\" displayname=\"B\" version=\"1.0.0-1\"/>\n"
+ "</availablepackages>\n"), func, QLatin1String("^B"), QHash<QString, QString>());
+
+ verifyListPackagesMessage(core.get(), QLatin1String("<?xml version=\"1.0\"?>\n"
+ "<availablepackages>\n"
+ " <package name=\"B\" displayname=\"B\" version=\"1.0.0-1\"/>\n"
+ "</availablepackages>\n"), func, QLatin1String("^B.*"), QHash<QString, QString>());
+
+ verifyListPackagesMessage(core.get(), QLatin1String("<?xml version=\"1.0\"?>\n"
+ "<availablepackages>\n"
+ " <package name=\"C\" displayname=\"C\" version=\"1.0.0-1\"/>\n"
+ "</availablepackages>\n"), func, QLatin1String("^C"), QHash<QString, QString>());
+
+ // Test with filters
+ QHash<QString, QString> searchHash {
+ { "Version", "1.0.2" },
+ { "DisplayName", "A" }
+ };
+ verifyListPackagesMessage(core.get(), QLatin1String("<?xml version=\"1.0\"?>\n"
+ "<availablepackages>\n"
+ " <package name=\"AB\" displayname=\"AB\" version=\"1.0.2-1\"/>\n"
+ " <package name=\"A\" displayname=\"A\" version=\"1.0.2-1\"/>\n"
+ "</availablepackages>\n"), func, QString(), searchHash);
+
+ searchHash.clear();
+ searchHash.insert("Default", "false");
+ verifyListPackagesMessage(core.get(), QLatin1String("<?xml version=\"1.0\"?>\n"
+ "<availablepackages>\n"
+ " <package name=\"B\" displayname=\"B\" version=\"1.0.0-1\"/>\n"
+ "</availablepackages>\n"), func, QString(), searchHash);
+
+ // Need to change rules here to catch messages
+ QLoggingCategory::setFilterRules("ifw.* = true\n");
+
+ QTest::ignoreMessage(QtDebugMsg, "No matching packages found.");
+ core->listAvailablePackages(QLatin1String("C.virt"));
+
+ QTest::ignoreMessage(QtDebugMsg, "No matching packages found.");
+ core->listAvailablePackages(QLatin1String("C.virt.subcomponent"));
+ }
+
+ void testInstallPackageFails()
+ {
+ QString loggingRules = (QLatin1String("ifw.* = false\n"
+ "ifw.installer.installlog = true\n"));
+
+ QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManager
+ (m_installDir, ":///data/uninstallableComponentsRepository"));
+
+ QLoggingCategory::setFilterRules(loggingRules);
+
+ QTest::ignoreMessage(QtDebugMsg, "Preparing meta information download...");
+ QTest::ignoreMessage(QtDebugMsg, QRegularExpression("Cannot install component A. Component "
+ "is installed only as automatic dependency to autoDep.\n"));
+ QCOMPARE(PackageManagerCore::Canceled, core->installSelectedComponentsSilently(QStringList()
+ << QLatin1String("A")));
+
+ QTest::ignoreMessage(QtDebugMsg, "Preparing meta information download...");
+ QTest::ignoreMessage(QtDebugMsg, QRegularExpression("Cannot install component AB. Component "
+ "is not checkable, meaning you have to select one of the subcomponents.\n"));
+ QCOMPARE(PackageManagerCore::Canceled, core->installSelectedComponentsSilently(QStringList()
+ << QLatin1String("AB")));
+
+ QTest::ignoreMessage(QtDebugMsg, "Preparing meta information download...");
+ QTest::ignoreMessage(QtDebugMsg, QRegularExpression("Cannot install B. Component is virtual.\n"));
+ QCOMPARE(PackageManagerCore::Canceled, core->installSelectedComponentsSilently(QStringList()
+ << QLatin1String("B")));
+
+ QTest::ignoreMessage(QtDebugMsg, "Preparing meta information download...");
+ QTest::ignoreMessage(QtDebugMsg, QRegularExpression("Cannot install B.subcomponent. Component "
+ "is a descendant of a virtual component B.\n"));
+ QCOMPARE(PackageManagerCore::Canceled, core->installSelectedComponentsSilently(QStringList()
+ << QLatin1String("B.subcomponent")));
+
+ QTest::ignoreMessage(QtDebugMsg, "Preparing meta information download...");
+ QTest::ignoreMessage(QtDebugMsg, QRegularExpression("Cannot install MissingComponent. "
+ "Component not found.\n"));
+ QCOMPARE(PackageManagerCore::Canceled, core->installSelectedComponentsSilently(QStringList()
+ << QLatin1String("MissingComponent")));
+ QCOMPARE(PackageManagerCore::Canceled, core->status());
+ }
+
+ void testUninstallPackageFails()
+ {
+ QString loggingRules = (QLatin1String("ifw.installer.installog = true\n"));
+ PackageManagerCore core;
+ core.setPackageManager();
+ QString appFilePath = QCoreApplication::applicationFilePath();
+ core.setAllowedRunningProcesses(QStringList() << appFilePath);
+ QLoggingCategory::setFilterRules(loggingRules);
+
+ QVERIFY(QFile::copy(":/data/componentsFromInstallPackagesRepository.xml", m_installDir + "/components.xml"));
+
+ core.setValue(scTargetDir, m_installDir);
+ QTest::ignoreMessage(QtWarningMsg, "Cannot uninstall ForcedInstallation component componentE");
+ QCOMPARE(PackageManagerCore::Success, core.uninstallComponentsSilently(QStringList()
+ << "componentE"));
+
+ QTest::ignoreMessage(QtWarningMsg, "Cannot uninstall component componentD because it is added as auto dependency to componentA,componentB");
+ QCOMPARE(PackageManagerCore::Success, core.uninstallComponentsSilently(QStringList()
+ << "componentD"));
+
+ QTest::ignoreMessage(QtWarningMsg, "Cannot uninstall component MissingComponent. Component not found in install tree.");
+ QCOMPARE(PackageManagerCore::Success, core.uninstallComponentsSilently(QStringList()
+ << "MissingComponent"));
+
+ QTest::ignoreMessage(QtWarningMsg, "Cannot uninstall virtual component componentH");
+ QCOMPARE(PackageManagerCore::Success, core.uninstallComponentsSilently(QStringList()
+ << "componentH"));
+
+ QCOMPARE(PackageManagerCore::Success, core.status());
+ }
+
+ void testListInstalledPackages()
+ {
+ QString loggingRules = (QLatin1String("ifw.* = false\n"));
+ PackageManagerCore core;
+ core.setPackageManager();
+ QLoggingCategory::setFilterRules(loggingRules);
+ auto func = &PackageManagerCore::listInstalledPackages;
+
+ const QString testDirectory = QInstaller::generateTemporaryFileName();
+ QVERIFY(QDir().mkpath(testDirectory));
+ QVERIFY(QFile::copy(":/data/components.xml", testDirectory + "/components.xml"));
+
+ core.setValue(scTargetDir, testDirectory);
+
+ verifyListPackagesMessage(&core, QLatin1String("<?xml version=\"1.0\"?>\n"
+ "<localpackages>\n"
+ " <package name=\"A\" displayname=\"A Title\" version=\"1.0.2-1\"/>\n"
+ " <package name=\"B\" displayname=\"B Title\" version=\"1.0.0-1\"/>\n"
+ "</localpackages>\n"), func, QString());
+
+ verifyListPackagesMessage(&core, QLatin1String("<?xml version=\"1.0\"?>\n"
+ "<localpackages>\n"
+ " <package name=\"A\" displayname=\"A Title\" version=\"1.0.2-1\"/>\n"
+ "</localpackages>\n"), func, QLatin1String("A"));
+
+ QDir dir(testDirectory);
+ QVERIFY(dir.removeRecursively());
+ }
+
+ void testInstall_data()
+ {
+ QTest::addColumn<QString>("repository");
+ QTest::addColumn<QStringList>("installComponents");
+ QTest::addColumn<PackageManagerCore::Status>("status");
+ QTest::addColumn<ComponentResourceHash>("componentResources");
+ QTest::addColumn<QStringList >("installedFiles");
+
+ /*********** Forced installation **********/
+ ComponentResourceHash componentResources;
+ componentResources.append(ComponentResource("componentA", "1.0.0content.txt"));
+ componentResources.append(ComponentResource("componentE", "1.0.0content.txt")); //ForcedInstall
+ componentResources.append(ComponentResource("componentG", "1.0.0content.txt")); //Depends on componentA
+
+ QTest::newRow("Forced installation")
+ << ":///data/installPackagesRepository"
+ << (QStringList() << "componentE")
+ << PackageManagerCore::Success
+ << componentResources
+ << (QStringList() << "components.xml" << "installcontent.txt"
+ << "installcontentA.txt" << "installcontentE.txt" << "installcontentG.txt");
+
+ /*********** Simple installation **********/
+ componentResources.clear();
+ componentResources.append(ComponentResource("componentA", "1.0.0content.txt"));
+ componentResources.append(ComponentResource("componentE", "1.0.0content.txt")); //ForcedInstall
+ componentResources.append(ComponentResource("componentG", "1.0.0content.txt")); //Depends on componentA
+
+ QTest::newRow("Simple installation")
+ << ":///data/installPackagesRepository"
+ << (QStringList() << "componentA")
+ << PackageManagerCore::Success
+ << componentResources
+ << (QStringList() << "components.xml" << "installcontent.txt"
+ << "installcontentA.txt" << "installcontentE.txt" << "installcontentG.txt");
+
+ /*********** Install with dependency **********/
+ componentResources.clear();
+ componentResources.append(ComponentResource("componentA", "1.0.0content.txt")); //Dependency for componentC
+ componentResources.append(ComponentResource("componentB", "1.0.0content.txt")); //Dependency for componentC
+ componentResources.append(ComponentResource("componentE", "1.0.0content.txt")); //ForcedInstall
+ componentResources.append(ComponentResource("componentG", "1.0.0content.txt")); //Depends on componentA
+ componentResources.append(ComponentResource("componentI", "1.0.0content.txt")); //Virtual, depends on componentC
+ componentResources.append(ComponentResource("componentD", "1.0.0content.txt")); //Autodepend on componentA and componentB
+
+ QTest::newRow("Install with dependency")
+ << ":///data/installPackagesRepository"
+ << (QStringList() << "componentC")
+ << PackageManagerCore::Success
+ << componentResources
+ << (QStringList() << "components.xml" << "installcontentC.txt"
+ << "installcontent.txt" << "installcontentA.txt" << "installcontentB.txt"
+ << "installcontentD.txt"<< "installcontentE.txt" << "installcontentG.txt"
+ << "installcontentI.txt");
+
+ /*********** Install with subcomponents **********/
+ componentResources.clear();
+ componentResources.append(ComponentResource("componentF.subcomponent2.subsubcomponent2", "1.0.0content.txt"));
+ componentResources.append(ComponentResource("componentF.subcomponent2", "1.0.0content.txt"));
+ componentResources.append(ComponentResource("componentF", "1.0.0content.txt"));
+ componentResources.append(ComponentResource("componentA", "1.0.0content.txt")); //Dependency for componentG
+ componentResources.append(ComponentResource("componentE", "1.0.0content.txt")); //ForcedInstall
+ componentResources.append(ComponentResource("componentG", "1.0.0content.txt")); //Default install
+
+ QTest::newRow("Install with subcomponents")
+ << ":///data/installPackagesRepository"
+ << (QStringList() << "componentF.subcomponent2.subsubcomponent2")
+ << PackageManagerCore::Success
+ << componentResources
+ << (QStringList() << "components.xml" << "installcontentF.txt"
+ << "installcontentF_2.txt" << "installcontentF_2_2.txt"
+ << "installcontent.txt" << "installcontentA.txt"
+ << "installcontentE.txt" << "installcontentG.txt");
+ }
+
+ void testInstall()
+ {
+ QFETCH(QString, repository);
+ QFETCH(QStringList, installComponents);
+ QFETCH(PackageManagerCore::Status, status);
+ QFETCH(ComponentResourceHash, componentResources);
+ QFETCH(QStringList, installedFiles);
+
+ QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
+ (m_installDir, repository));
+
+ QCOMPARE(status, core->installSelectedComponentsSilently(QStringList() << installComponents));
+ for (const ComponentResource &resource : componentResources)
+ VerifyInstaller::verifyInstallerResources(m_installDir, resource.first, resource.second);
+ VerifyInstaller::verifyFileExistence(m_installDir, installedFiles);
+ }
+
+ void testUninstall_data()
+ {
+ QTest::addColumn<QString>("repository");
+ QTest::addColumn<QStringList>("installComponents");
+ QTest::addColumn<PackageManagerCore::Status>("status");
+ QTest::addColumn<ComponentResourceHash>("componentResources");
+ QTest::addColumn<QStringList >("installedFiles");
+ QTest::addColumn<QStringList>("uninstallComponents");
+ QTest::addColumn<PackageManagerCore::Status>("uninstallStatus");
+ QTest::addColumn<ComponentResourceHash>("componentResourcesAfterUninstall");
+ QTest::addColumn<QStringList >("installedFilesAfterUninstall");
+ QTest::addColumn<ComponentResourceHash >("deletedComponentResources");
+ QTest::addColumn<bool >("virtualSetVisible");
+
+ /*********** Uninstallation **********/
+ ComponentResourceHash componentResourcesAfterUninstall;
+ componentResourcesAfterUninstall.append(ComponentResource("componentE", "1.0.0content.txt")); //ForcedInstall
+
+ ComponentResourceHash deletedComponentResources;
+ deletedComponentResources.append(ComponentResource("componentA", "1.0.0content.txt"));
+ deletedComponentResources.append(ComponentResource("componentG", "1.0.0content.txt"));
+
+ ComponentResourceHash componentResourceAfterInstall;
+ componentResourceAfterInstall << deletedComponentResources << componentResourcesAfterUninstall;
+
+ QStringList filesAfterUninstall;
+ filesAfterUninstall << "components.xml" << "installcontentE.txt";
+
+ QStringList filesAfterInstall;
+ filesAfterInstall << filesAfterUninstall << "installcontent.txt"
+ << "installcontentA.txt" << "installcontentG.txt";
+
+ QTest::newRow("Test uninstall")
+ << ":///data/installPackagesRepository"
+ << (QStringList() << "componentA")
+ << PackageManagerCore::Success
+ << componentResourceAfterInstall
+ << filesAfterInstall
+ << (QStringList() << "componentA")
+ << PackageManagerCore::Success
+ << componentResourcesAfterUninstall
+ << filesAfterUninstall
+ << deletedComponentResources;
+
+ /*********** Uninstall with dependency **********/
+ componentResourcesAfterUninstall.clear();
+ componentResourcesAfterUninstall.append(ComponentResource("componentA", "1.0.0content.txt"));
+ componentResourcesAfterUninstall.append(ComponentResource("componentB", "1.0.0content.txt"));
+ componentResourcesAfterUninstall.append(ComponentResource("componentE", "1.0.0content.txt"));
+ componentResourcesAfterUninstall.append(ComponentResource("componentG", "1.0.0content.txt"));
+ componentResourcesAfterUninstall.append(ComponentResource("componentD", "1.0.0content.txt"));
+
+ deletedComponentResources.clear();
+ deletedComponentResources.append(ComponentResource("componentC", "1.0.0content.txt")); //Unselected
+ deletedComponentResources.append(ComponentResource("componentI", "1.0.0content.txt")); //Autodepends on componentC
+
+ componentResourceAfterInstall.clear();
+ componentResourceAfterInstall << deletedComponentResources << componentResourcesAfterUninstall;
+
+ filesAfterUninstall.clear();
+ filesAfterUninstall << "components.xml"
+ << "installcontent.txt" << "installcontentA.txt" << "installcontentB.txt"
+ << "installcontentD.txt"<< "installcontentE.txt" << "installcontentG.txt";
+
+ filesAfterInstall.clear();
+ filesAfterInstall << filesAfterUninstall << "installcontentC.txt"
+ << "installcontentI.txt";
+
+
+ QTest::newRow("Uninstall with dependency")
+ << ":///data/installPackagesRepository"
+ << (QStringList() << "componentC")
+ << PackageManagerCore::Success
+ << componentResourceAfterInstall
+ << filesAfterInstall
+ << (QStringList() << "componentC")
+ << PackageManagerCore::Success
+ << componentResourcesAfterUninstall
+ << filesAfterUninstall
+ << deletedComponentResources;
+
+ /*********** Uninstall with subcomponents **********/
+ componentResourcesAfterUninstall.clear();
+ componentResourcesAfterUninstall.append(ComponentResource("componentA", "1.0.0content.txt"));
+ componentResourcesAfterUninstall.append(ComponentResource("componentE", "1.0.0content.txt"));
+ componentResourcesAfterUninstall.append(ComponentResource("componentG", "1.0.0content.txt"));
+
+ deletedComponentResources.clear();
+ deletedComponentResources.append(ComponentResource("componentF.subcomponent2.subsubcomponent2", "1.0.0content.txt"));
+ deletedComponentResources.append(ComponentResource("componentF.subcomponent2", "1.0.0content.txt"));
+ deletedComponentResources.append(ComponentResource("componentF", "1.0.0content.txt"));
+
+ componentResourceAfterInstall.clear();
+ componentResourceAfterInstall << deletedComponentResources << componentResourcesAfterUninstall;
+
+ filesAfterInstall.clear();
+ filesAfterInstall << "components.xml" << "installcontentF.txt"
+ << "installcontentF_2.txt" << "installcontentF_2_2.txt"
+ << "installcontent.txt" << "installcontentA.txt"
+ << "installcontentE.txt" << "installcontentG.txt";
+
+ filesAfterUninstall.clear();
+ filesAfterUninstall << "components.xml"
+ << "installcontent.txt" << "installcontentA.txt"
+ << "installcontentE.txt" << "installcontentG.txt";
+
+ QTest::newRow("Uninstall with subcomponents")
+ << ":///data/installPackagesRepository"
+ << (QStringList() << "componentF.subcomponent2.subsubcomponent2")
+ << PackageManagerCore::Success
+ << componentResourceAfterInstall
+ << filesAfterInstall
+ << (QStringList() << "componentF.subcomponent2")
+ << PackageManagerCore::Success
+ << componentResourcesAfterUninstall
+ << filesAfterUninstall
+ << deletedComponentResources;
+
+ /*********** Uninstall forced packages **********/
+ componentResourceAfterInstall.clear();
+ componentResourceAfterInstall.append(ComponentResource("componentA", "1.0.0content.txt")); //ComponentG depends
+ componentResourceAfterInstall.append(ComponentResource("componentE", "1.0.0content.txt")); //ForcedInstall
+ componentResourceAfterInstall.append(ComponentResource("componentG", "1.0.0content.txt")); //Default
+
+ componentResourcesAfterUninstall.clear();
+ componentResourcesAfterUninstall = componentResourceAfterInstall; //forced packages cannot be uninstalled
+
+ deletedComponentResources.clear();
+
+ filesAfterInstall.clear();
+ filesAfterInstall << "components.xml" << "installcontent.txt"
+ << "installcontentA.txt" << "installcontentE.txt" << "installcontentG.txt";
+
+ filesAfterUninstall.clear();
+ filesAfterUninstall = filesAfterInstall;
+
+ QTest::newRow("Uninstall forced packages")
+ << ":///data/installPackagesRepository"
+ << (QStringList() << "componentG")
+ << PackageManagerCore::Success
+ << componentResourceAfterInstall
+ << filesAfterInstall
+ << (QStringList() << "componentE")
+ << PackageManagerCore::Success
+ << componentResourceAfterInstall
+ << filesAfterUninstall
+ << deletedComponentResources;
+
+ /*********** Uninstall autodependency packages **********/
+ componentResourceAfterInstall.clear();
+ componentResourceAfterInstall.append(ComponentResource("componentA", "1.0.0content.txt")); //ComponentG depends
+ componentResourceAfterInstall.append(ComponentResource("componentB", "1.0.0content.txt")); //Dependency for componentC
+ componentResourceAfterInstall.append(ComponentResource("componentD", "1.0.0content.txt")); //Autodepend on componentA and componentB
+ componentResourceAfterInstall.append(ComponentResource("componentE", "1.0.0content.txt")); //ForcedInstall
+ componentResourceAfterInstall.append(ComponentResource("componentG", "1.0.0content.txt")); //Default
+
+ componentResourcesAfterUninstall.clear();
+ componentResourcesAfterUninstall = componentResourceAfterInstall; //autodependency packages cannot be uninstalled
+
+ deletedComponentResources.clear();
+
+ filesAfterInstall.clear();
+ filesAfterInstall << "components.xml" << "installcontent.txt"
+ << "installcontentA.txt" << "installcontentE.txt" << "installcontentG.txt"
+ << "installcontentB.txt" << "installcontentD.txt";
+ filesAfterUninstall.clear();
+ filesAfterUninstall = filesAfterInstall;
+
+ QTest::newRow("Uninstall autodependency packages")
+ << ":///data/installPackagesRepository"
+ << (QStringList() << "componentA" << "componentB")
+ << PackageManagerCore::Success
+ << componentResourceAfterInstall
+ << filesAfterInstall
+ << (QStringList() << "componentD")
+ << PackageManagerCore::Success
+ << componentResourceAfterInstall
+ << filesAfterUninstall
+ << deletedComponentResources;
+ }
+
+ void testUninstall()
+ {
+ QFETCH(QString, repository);
+ QFETCH(QStringList, installComponents);
+ QFETCH(PackageManagerCore::Status, status);
+ QFETCH(ComponentResourceHash, componentResources);
+ QFETCH(QStringList, installedFiles);
+ QFETCH(QStringList, uninstallComponents);
+ QFETCH(PackageManagerCore::Status, uninstallStatus);
+ QFETCH(ComponentResourceHash, componentResourcesAfterUninstall);
+ QFETCH(QStringList, installedFilesAfterUninstall);
+ QFETCH(ComponentResourceHash, deletedComponentResources);
+
+ QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
+ (m_installDir, repository));
+
+ QCOMPARE(status, core->installSelectedComponentsSilently(QStringList() << installComponents));
+ for (const ComponentResource &resource : componentResources)
+ VerifyInstaller::verifyInstallerResources(m_installDir, resource.first, resource.second);
+ VerifyInstaller::verifyFileExistence(m_installDir, installedFiles);
+ core->commitSessionOperations();
+ core->setPackageManager();
+
+ QCOMPARE(uninstallStatus, core->uninstallComponentsSilently(QStringList()
+ << uninstallComponents));
+ QCOMPARE(uninstallStatus, core->status());
+ for (const ComponentResource &resource : componentResourcesAfterUninstall)
+ VerifyInstaller::verifyInstallerResources(m_installDir, resource.first, resource.second);
+ for (const ComponentResource &resource : deletedComponentResources)
+ VerifyInstaller::verifyInstallerResourceFileDeletion(m_installDir, resource.first, resource.second);
+ VerifyInstaller::verifyFileExistence(m_installDir, installedFilesAfterUninstall);
+ }
+
+ void addToExistingInstall_data()
+ {
+ QTest::addColumn<QString>("repository");
+ QTest::addColumn<QStringList>("installComponents");
+ QTest::addColumn<PackageManagerCore::Status>("status");
+ QTest::addColumn<ComponentResourceHash>("componentResources");
+ QTest::addColumn<QStringList >("installedFiles");
+ QTest::addColumn<QString>("newRepository");
+ QTest::addColumn<QStringList>("installNewComponents");
+ QTest::addColumn<PackageManagerCore::Status>("reinstallStatus");
+ QTest::addColumn<ComponentResourceHash>("componentResourcesAfterReinstall");
+ QTest::addColumn<QStringList >("installedFilesAfterReinstall");
+ QTest::addColumn<ComponentResourceHash >("deletedComponentResources");
+
+ /*********** New dependency in repository **********/
+ ComponentResourceHash componentResourceAfterInstall;
+ componentResourceAfterInstall.append(ComponentResource("componentA", "1.0.0content.txt")); //ComponentC depends on
+ componentResourceAfterInstall.append(ComponentResource("componentB", "1.0.0content.txt")); //ComponentC depends on
+ componentResourceAfterInstall.append(ComponentResource("componentC", "1.0.0content.txt")); //Selected
+ componentResourceAfterInstall.append(ComponentResource("componentD", "1.0.0content.txt")); //Autodepend on componentA,componentB
+ componentResourceAfterInstall.append(ComponentResource("componentE", "1.0.0content.txt")); //Forced
+ componentResourceAfterInstall.append(ComponentResource("componentG", "1.0.0content.txt")); //Default
+ componentResourceAfterInstall.append(ComponentResource("componentI", "1.0.0content.txt")); //Autodepend componentC
+
+ ComponentResourceHash componentResourcesAfterReinstall;
+ componentResourcesAfterReinstall = componentResourceAfterInstall;
+ componentResourcesAfterReinstall.append(ComponentResource("componentH", "1.0.0content.txt"));
+
+ ComponentResourceHash deletedComponentResources;
+ // New dependency is added in repository from componentA to componentF, check that it is not installed
+ deletedComponentResources.append(ComponentResource("componentF", "1.0.0content.txt"));
+
+ QStringList filesAfterInstall;
+ filesAfterInstall << "components.xml"
+ << "installcontent.txt" << "installcontentA.txt" << "installcontentB.txt"
+ << "installcontentC.txt" << "installcontentD.txt" << "installcontentE.txt"
+ << "installcontentG.txt" << "installcontentI.txt";
+
+ QStringList filesAfterReinstall;
+ filesAfterReinstall = filesAfterInstall;
+ filesAfterReinstall << "installcontentH.txt";
+
+ QTest::newRow("New dependency in repository")
+ << ":///data/installPackagesRepository"
+ << (QStringList() << "componentC")
+ << PackageManagerCore::Success
+ << componentResourceAfterInstall
+ << filesAfterInstall
+ << ":///data/installPackagesDependencyChanged"
+ << (QStringList() << "componentH")
+ << PackageManagerCore::Success
+ << componentResourcesAfterReinstall
+ << filesAfterReinstall
+ << deletedComponentResources;
+ }
+
+ void addToExistingInstall()
+ {
+ QFETCH(QString, repository);
+ QFETCH(QStringList, installComponents);
+ QFETCH(PackageManagerCore::Status, status);
+ QFETCH(ComponentResourceHash, componentResources);
+ QFETCH(QStringList, installedFiles);
+ QFETCH(QString, newRepository);
+ QFETCH(QStringList, installNewComponents);
+ QFETCH(PackageManagerCore::Status, reinstallStatus);
+ QFETCH(ComponentResourceHash, componentResourcesAfterReinstall);
+ QFETCH(QStringList, installedFilesAfterReinstall);
+ QFETCH(ComponentResourceHash, deletedComponentResources);
+
+ QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
+ (m_installDir, repository));
+ QCOMPARE(status, core->installSelectedComponentsSilently(installComponents));
+ QCOMPARE(status, core->status());
+
+ for (const ComponentResource &resource : componentResources)
+ VerifyInstaller::verifyInstallerResources(m_installDir, resource.first, resource.second);
+ VerifyInstaller::verifyFileExistence(m_installDir, installedFiles);
+
+ core->reset();
+ core->cancelMetaInfoJob(); //Call cancel to reset metadata so that update repositories are fetched
+
+ QSet<Repository> repoList;
+ Repository repo = Repository::fromUserInput(newRepository);
+ repoList.insert(repo);
+ core->settings().setDefaultRepositories(repoList);
+
+ QCOMPARE(reinstallStatus, core->installSelectedComponentsSilently(installNewComponents));
+
+ for (const ComponentResource &resource : deletedComponentResources)
+ VerifyInstaller::verifyInstallerResourceFileDeletion(m_installDir, resource.first, resource.second);
+ for (const ComponentResource &resource : componentResourcesAfterReinstall)
+ VerifyInstaller::verifyInstallerResources(m_installDir, resource.first, resource.second);
+ VerifyInstaller::verifyFileExistence(m_installDir, installedFilesAfterReinstall);
+ }
+
+ void testInstallDefaultPackagesSilently()
+ {
+ QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
+ (m_installDir, ":///data/installPackagesRepository"));
+ QCOMPARE(PackageManagerCore::Success, core->installDefaultComponentsSilently());
+ QCOMPARE(PackageManagerCore::Success, core->status());
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "1.0.0content.txt"); //Dependency for componentG
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentE", "1.0.0content.txt"); //ForcedInstall
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentG", "1.0.0content.txt"); //Default
+ VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontent.txt"
+ << "installcontentA.txt" << "installcontentE.txt" << "installcontentG.txt");
+ }
+
+
+ void testNoDefaultInstallations()
+ {
+ QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
+ (m_installDir, ":///data/installPackagesRepository"));
+ core->setNoDefaultInstallation(true);
+ QCOMPARE(PackageManagerCore::Success, core->installDefaultComponentsSilently());
+ QCOMPARE(PackageManagerCore::Success, core->status());
+ VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml"
+ << "installcontentE.txt");
+ core->setNoDefaultInstallation(false);
+ }
+
+ void testRemoveAllSilently()
+ {
+ QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
+ (m_installDir, ":///data/installPackagesRepository"));
+ QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList()
+ << QLatin1String("componentA")));
+ VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontentE.txt"
+ << "installcontentA.txt" << "installcontent.txt" << "installcontentG.txt");
+
+ core->commitSessionOperations();
+ core->setUninstaller();
+ QCOMPARE(PackageManagerCore::Success, core->removeInstallationSilently());
+ QCOMPARE(PackageManagerCore::Success, core->status());
+ VerifyInstaller::verifyInstallerResourcesDeletion(m_installDir, "componentA");
+ VerifyInstaller::verifyInstallerResourcesDeletion(m_installDir, "componentE");
+ VerifyInstaller::verifyInstallerResourcesDeletion(m_installDir, "componentG");
+
+ // On Windows we have to settle for the resources check above as maintenance
+ // tool (if it would exists) and target directory are only removed later via
+ // started VBScript process. On Unix platforms the target directory should
+ // be removed in PackageManagerCorePrivate::runUninstaller().
+#if defined(Q_OS_UNIX)
+ QVERIFY(!QDir(m_installDir).exists());
+#endif
+ }
+
+ void testUninstallVirtualSetVisibleSilently()
+ {
+ QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
+ (m_installDir, ":///data/installPackagesRepository"));
+ core->setVirtualComponentsVisible(true);
+ QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList()
+ <<"componentH"));
+ QCOMPARE(PackageManagerCore::Success, core->status());
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentH", "1.0.0content.txt");
+
+ core->commitSessionOperations();
+ core->setPackageManager();
+ QCOMPARE(PackageManagerCore::Success, core->uninstallComponentsSilently(QStringList()
+ << "componentH"));
+ QCOMPARE(PackageManagerCore::Success, core->status());
+ VerifyInstaller::verifyInstallerResourcesDeletion(m_installDir, "componentH");
+ }
+
+ void testFileQuery()
+ {
+ QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit(m_installDir,
+ ":///data/filequeryrepository"));
+ core->setCommandLineInstance(true);
+ core->setFileDialogAutomaticAnswer("ValidDirectory", m_installDir);
+
+ QString testFile = qApp->applicationDirPath() + QDir::toNativeSeparators("/test");
+ QFile file(testFile);
+ QVERIFY(file.open(QIODevice::WriteOnly));
+ core->setFileDialogAutomaticAnswer("ValidFile", testFile);
+
+ //File dialog launched without ID
+ core->setFileDialogAutomaticAnswer("GetExistingDirectory", m_installDir);
+ core->setFileDialogAutomaticAnswer("GetExistingFile", testFile);
+
+ QCOMPARE(PackageManagerCore::Success, core->installDefaultComponentsSilently());
+ QCOMPARE(PackageManagerCore::Success, core->status());
+
+ QVERIFY(core->containsFileDialogAutomaticAnswer("ValidFile"));
+ core->removeFileDialogAutomaticAnswer("ValidFile");
+ QVERIFY(!core->containsFileDialogAutomaticAnswer("ValidFile"));
+
+ QVERIFY(file.remove());
+ }
+
+ void init()
+ {
+ m_installDir = QInstaller::generateTemporaryFileName();
+ QVERIFY(QDir().mkpath(m_installDir));
+ }
+
+ void initTestCase()
+ {
+ qSetGlobalQHashSeed(0); //Ensures the dom document deterministic behavior
+ }
+
+ void cleanup()
+ {
+ QDir dir(m_installDir);
+ QVERIFY(dir.removeRecursively());
+ }
+
+private:
+ template <typename Func, typename... Args>
+ void verifyListPackagesMessage(PackageManagerCore *core, const QString &message,
+ Func func, Args... args)
+ {
+ std::ostringstream stream;
+ std::streambuf *buf = std::cout.rdbuf();
+ std::cout.rdbuf(stream.rdbuf());
+
+ (core->*func)(std::forward<Args>(args)...);
+
+ std::cout.rdbuf(buf);
+ QVERIFY(stream && stream.str() == message.toStdString());
+ }
+
+private:
+ QString m_installDir;
+};
+
+
+QTEST_MAIN(tst_CommandLineInstall)
+
+#include "tst_commandlineinstall.moc"