Fix testMetadataCachingLocalRepo
As content.xml.xz is now used, and then XZedSimpleMetadataRepository,
the cached file path differs and test needs to be updated.
Change-Id: I0b56179e371acf95aefbc34fb1256cb46d74227e
Reviewed-on: https://git.eclipse.org/r/c/equinox/rt.equinox.p2/+/188554
Tested-by: Equinox Bot <equinox-bot@eclipse.org>
Reviewed-by: Mickael Istria <mistria@redhat.com>
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java
index 22f8f91..6ac0391 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java
@@ -387,17 +387,14 @@
IAgentLocation agentLocation = ServiceHelper.getService(TestActivator.getContext(), IAgentLocation.class);
URI dataArea = agentLocation.getDataArea("org.eclipse.equinox.p2.repository/cache/");
File dataAreaFile = URIUtil.toFile(dataArea);
- File cacheFileXML = new File(dataAreaFile, "content" + repoLocation.hashCode() + ".xml");
- File cacheFileJAR = new File(dataAreaFile, "content" + repoLocation.hashCode() + ".jar");
- File cacheFile;
+ File cacheFile = new File(dataAreaFile,
+ Integer.toString(URIUtil.append(repoLocation, "content.xml.xz").hashCode())); // as implemented in
+ // XZedSimpleMetadataRepository
+ // and CacheManager
// load a remote repository and check that a local cache was created
manager.loadRepository(repoLocation, null);
- assertTrue("Cache file was not created.", cacheFileXML.exists() || cacheFileJAR.exists());
- if (cacheFileXML.exists())
- cacheFile = cacheFileXML;
- else
- cacheFile = cacheFileJAR;
+ assertTrue("Cache file was not created.", cacheFile.exists());
// modify the last modified date to be older than the remote file
cacheFile.setLastModified(0);