summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2012-01-04 19:25:57 +0100
committerJan Holesovsky <kendy@suse.cz>2012-01-04 20:25:37 +0100
commit953b7f9e1ba665b4763fac8f83113f43b6d49b39 (patch)
tree317fd0333bc2daedbebf2fe701cadd82fdc093da /extensions
parent27bcd172ca47874ff530eef12149e872f9e1448a (diff)
Online update: Introduce inst:gitid to check exactly if we are the same.
This allows to feed updates via a static .xml in a controlled environment.
Diffstat (limited to 'extensions')
-rw-r--r--extensions/qa/update/simple.xml6
-rw-r--r--extensions/qa/update/test_update.cxx27
-rw-r--r--extensions/source/update/check/updateprotocol.cxx14
-rw-r--r--extensions/source/update/check/updateprotocol.hxx1
4 files changed, 40 insertions, 8 deletions
diff --git a/extensions/qa/update/simple.xml b/extensions/qa/update/simple.xml
index 6a6af1280b87..79003972317b 100644
--- a/extensions/qa/update/simple.xml
+++ b/extensions/qa/update/simple.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<inst:description xmlns:inst="http://update.libreoffice.org/description">
- <inst:id>LibreOffice_3.4</inst:id>
- <inst:version>3.4.2</inst:version>
- <inst:buildid>102</inst:buildid>
+ <inst:id>LibreOffice 3.5.0 Beta2</inst:id>
+ <inst:version>3.5.0 Beta2</inst:version>
+ <inst:gitid>123456-abcdef-1a2b3c-4d5e6f</inst:gitid>
<inst:os>Linux</inst:os>
<inst:arch>x86</inst:arch>
diff --git a/extensions/qa/update/test_update.cxx b/extensions/qa/update/test_update.cxx
index bed67d374350..af93e66c7ec2 100644
--- a/extensions/qa/update/test_update.cxx
+++ b/extensions/qa/update/test_update.cxx
@@ -121,8 +121,8 @@ protected:
CPPUNIT_FAIL( "Wrong type of the entry." );
}
- // test the checkForUpdates() method
- void testCheckForUpdates()
+ // test the checkForUpdates() method - update is available
+ void testCheckUpdateAvailable()
{
UpdateInfo aInfo;
rtl::Reference< UpdateCheck > aController( UpdateCheck::get() );
@@ -131,6 +131,7 @@ protected:
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Linux" ) ),
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "x86" ) ),
m_aRepositoryList,
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "111111-222222-333333-444444" ) ),
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InstallSetID" ) ) ) )
{
CPPUNIT_ASSERT( aInfo.Sources.size() == 1 );
@@ -140,9 +141,29 @@ protected:
CPPUNIT_FAIL( "Calling checkForUpdates() failed." );
}
+ // test the checkForUpdates() method - we are up-to-date
+ void testCheckUpToDate()
+ {
+ UpdateInfo aInfo;
+ rtl::Reference< UpdateCheck > aController( UpdateCheck::get() );
+
+ if ( checkForUpdates( aInfo, m_xContext, aController->getInteractionHandler(), m_xProvider,
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Linux" ) ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "x86" ) ),
+ m_aRepositoryList,
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "123456-abcdef-1a2b3c-4d5e6f" ) ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InstallSetID" ) ) ) )
+ {
+ CPPUNIT_ASSERT( aInfo.Sources.size() == 0 );
+ }
+ else
+ CPPUNIT_FAIL( "Calling checkForUpdates() failed." );
+ }
+
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(testGetUpdateInformationEnumeration);
- CPPUNIT_TEST(testCheckForUpdates);
+ CPPUNIT_TEST(testCheckUpdateAvailable);
+ CPPUNIT_TEST(testCheckUpToDate);
CPPUNIT_TEST_SUITE_END();
private:
diff --git a/extensions/source/update/check/updateprotocol.cxx b/extensions/source/update/check/updateprotocol.cxx
index b0a20ab168f0..2e9ec20fa0c1 100644
--- a/extensions/source/update/check/updateprotocol.cxx
+++ b/extensions/source/update/check/updateprotocol.cxx
@@ -59,8 +59,14 @@ namespace xml = css::xml ;
static bool
getBootstrapData(
uno::Sequence< ::rtl::OUString > & rRepositoryList,
+ ::rtl::OUString & rGitID,
::rtl::OUString & rInstallSetID)
{
+ rGitID = UNISTRING( "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("version") ":buildid}" );
+ rtl::Bootstrap::expandMacros( rGitID );
+ if ( rGitID.isEmpty() )
+ return false;
+
rInstallSetID = UNISTRING( "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("version") ":UpdateID}" );
rtl::Bootstrap::expandMacros( rInstallSetID );
if ( ! rInstallSetID.getLength() )
@@ -97,14 +103,15 @@ checkForUpdates(
rtl::Bootstrap::get(UNISTRING("_ARCH"), myArch);
uno::Sequence< ::rtl::OUString > aRepositoryList;
+ ::rtl::OUString aGitID;
::rtl::OUString aInstallSetID;
- if( ! ( getBootstrapData(aRepositoryList, aInstallSetID) && (aRepositoryList.getLength() > 0) ) )
+ if( ! ( getBootstrapData(aRepositoryList, aGitID, aInstallSetID) && (aRepositoryList.getLength() > 0) ) )
return false;
return checkForUpdates( o_rUpdateInfo, rxContext, rxInteractionHandler, rUpdateInfoProvider,
myOS, myArch,
- aRepositoryList, aInstallSetID );
+ aRepositoryList, aGitID, aInstallSetID );
}
bool
@@ -116,6 +123,7 @@ checkForUpdates(
const rtl::OUString &rOS,
const rtl::OUString &rArch,
const uno::Sequence< rtl::OUString > &rRepositoryList,
+ const rtl::OUString &rGitID,
const rtl::OUString &rInstallSetID )
{
if( !rxContext.is() )
@@ -147,6 +155,8 @@ checkForUpdates(
aBuffer.append( rOS );
aBuffer.appendAscii("\' and inst:arch=\'");
aBuffer.append( rArch );
+ aBuffer.appendAscii("\' and inst:gitid!=\'");
+ aBuffer.append( rGitID );
aBuffer.appendAscii("\']");
rtl::OUString aXPathExpression = aBuffer.makeStringAndClear();
diff --git a/extensions/source/update/check/updateprotocol.hxx b/extensions/source/update/check/updateprotocol.hxx
index e15583703b87..510f8f968fd6 100644
--- a/extensions/source/update/check/updateprotocol.hxx
+++ b/extensions/source/update/check/updateprotocol.hxx
@@ -51,6 +51,7 @@ checkForUpdates(
const rtl::OUString &rOS,
const rtl::OUString &rArch,
const ::com::sun::star::uno::Sequence< rtl::OUString > &rRepositoryList,
+ const rtl::OUString &rGitID,
const rtl::OUString &rInstallID
);