20020205_11
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/ConfigurationPolicyModel.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/ConfigurationPolicyModel.java
index 834d423..7295329 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/ConfigurationPolicyModel.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/ConfigurationPolicyModel.java
@@ -65,7 +65,7 @@
* @since 2.0
*/
public FeatureReferenceModel[] getConfiguredFeaturesModel() {
- if (configuredFeatureReferences==null)
+ if (configuredFeatureReferences==null || configuredFeatureReferences.isEmpty())
return new FeatureReferenceModel[0];
return (FeatureReferenceModel[]) configuredFeatureReferences.toArray(arrayTypeFor(configuredFeatureReferences));
}
@@ -74,7 +74,7 @@
* @since 2.0
*/
public FeatureReferenceModel[] getUnconfiguredFeaturesModel() {
- if (configuredFeatureReferences==null)
+ if (unconfiguredFeatureReferences==null || unconfiguredFeatureReferences.isEmpty())
return new FeatureReferenceModel[0];
return (FeatureReferenceModel[]) unconfiguredFeatureReferences.toArray(arrayTypeFor(unconfiguredFeatureReferences));
}
@@ -167,7 +167,7 @@
assertIsWriteable();
if (unconfiguredFeatureReferences == null)
this.unconfiguredFeatureReferences = new ArrayList();
- if (unconfiguredFeatureReferences.contains(feature))
+ if (!unconfiguredFeatureReferences.contains(feature))
this.add(feature, unconfiguredFeatureReferences);
// an unconfigured feature is always from a configured one no ?
@@ -178,4 +178,25 @@
}
+
+ /**
+ * Sets the configuredFeatureReferences.
+ * @param configuredFeatureReferences The configuredFeatureReferences to set
+ */
+ protected void setConfiguredFeatureReferences(IFeatureReference[] featureReferences) {
+ configuredFeatureReferences = new ArrayList();
+ configuredFeatureReferences.addAll(Arrays.asList(featureReferences));
+
+ }
+
+
+ /**
+ * Sets the unconfiguredFeatureReferences.
+ * @param unconfiguredFeatureReferences The unconfiguredFeatureReferences to set
+ */
+ protected void setUnconfiguredFeatureReferences(IFeatureReference[] featureReferences) {
+ unconfiguredFeatureReferences = new ArrayList();
+ unconfiguredFeatureReferences.addAll(Arrays.asList(featureReferences));
+ }
+
}
\ No newline at end of file
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/ConfigurationSiteModel.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/ConfigurationSiteModel.java
index a324611..4ad1bd8 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/ConfigurationSiteModel.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/ConfigurationSiteModel.java
@@ -31,15 +31,6 @@
}
/**
- * Copy Constructor
- */
- public ConfigurationSiteModel(ConfigurationSiteModel configSite) {
- this.site = configSite.getSiteModel();
- this.policy = new ConfigurationPolicyModel(configSite.getConfigurationPolicyModel());
- this.installable = configSite.isInstallSite();
- }
-
- /**
* returns the site
* @return The ISite
* @since 2.0
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/InstallConfigurationModel.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/InstallConfigurationModel.java
index 9b1e61c..1909331 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/InstallConfigurationModel.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/InstallConfigurationModel.java
@@ -60,29 +60,7 @@
*/
public InstallConfigurationModel(){
}
- /*
- * copy constructor
- */
- public InstallConfigurationModel(InstallConfigurationModel config, String newLocation, String label) {
- setLocationURLString(newLocation);
- setLabel(label);
- // do not copy list of listeners nor activities
- // ake a copy of the siteConfiguration object
- if (config != null) {
- configurationSites = new ArrayList();
- ConfigurationSiteModel[] sites = config.getConfigurationSitesModel();
- if (sites != null) {
- for (int i = 0; i < sites.length; i++) {
- addConfigurationSiteModel(new ConfigurationSiteModel(sites[i]));
- }
- }
- }
- // set dummy date as caller can call set date if the
- // date on the URL string has to be the same
- date = new Date();
- this.isCurrent = false;
- }
-
+
/**
* @since 2.0
*/
@@ -106,6 +84,15 @@
if (!configurationSites.contains(site))
configurationSites.add(site);
}
+
+
+ public void setConfigurationSiteModel(ConfigurationSiteModel[] sites) {
+ configurationSites=null;
+ for (int i = 0; i < sites.length; i++) {
+ addConfigurationSiteModel(sites[i]);
+ }
+ }
+
/**
* @since 2.0
*/
@@ -218,7 +205,7 @@
public void resolve(URL base, ResourceBundle bundle)
throws MalformedURLException {
// local
- resolveURL(base,bundle,locationURLString);
+ locationURL = resolveURL(base,bundle,locationURLString);
// delagate
resolveListReference(getActivityModel(),base,bundle);
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/InstallConfigurationParser.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/InstallConfigurationParser.java
index 86fb626..7c476be 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/InstallConfigurationParser.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/InstallConfigurationParser.java
@@ -22,6 +22,7 @@
import org.eclipse.update.core.ISite;
import org.eclipse.update.core.SiteManager;
import org.eclipse.update.internal.core.Assert;
+import org.eclipse.update.internal.core.BaseSiteLocalFactory;
import org.eclipse.update.internal.core.FeatureReference;
import org.eclipse.update.internal.core.UpdateManagerPlugin;
import org.eclipse.update.internal.core.UpdateManagerUtils;
@@ -207,7 +208,7 @@
int action = Integer.parseInt(actionString);
// create
- ConfigurationActivityModel activity = new ConfigurationActivityModel();
+ ConfigurationActivityModel activity = new BaseSiteLocalFactory().createConfigurationAcivityModel();
activity.setAction(action);
// label
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/SiteLocalModel.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/SiteLocalModel.java
index 669201f..68ae53f 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/SiteLocalModel.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/SiteLocalModel.java
@@ -186,7 +186,7 @@
*/
public void resolve(URL base, ResourceBundle bundle) throws MalformedURLException {
// local
- resolveURL(base,bundle,getLocationURLString());
+ location = resolveURL(base,bundle,getLocationURLString());
// delegate
resolveListReference(getConfigurationHistoryModel(),base,bundle);
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/SiteLocalParser.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/SiteLocalParser.java
index 8f6e057..23e49f5 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/model/SiteLocalParser.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/model/SiteLocalParser.java
@@ -17,6 +17,9 @@
import org.eclipse.update.core.IFeatureReference;
import org.eclipse.update.core.ILocalSite;
import org.eclipse.update.internal.core.Assert;
+import org.eclipse.update.internal.core.BaseSiteLocalFactory;
+import org.eclipse.update.internal.core.InstallConfiguration;
+import org.eclipse.update.internal.core.SiteLocal;
import org.eclipse.update.internal.core.UpdateManagerPlugin;
import org.eclipse.update.internal.core.UpdateManagerUtils;
import org.xml.sax.Attributes;
@@ -153,29 +156,25 @@
* process the Config info
*/
private void processConfig(Attributes attributes) throws MalformedURLException, IOException, CoreException {
-
// url
URL url = UpdateManagerUtils.getURL(site.getLocationURL(), attributes.getValue("url"), null);
String label = attributes.getValue("label");
label = UpdateManagerUtils.getResourceString(label, bundle);
- InstallConfigurationModel config = new InstallConfigurationModel();
+ InstallConfigurationModel config = new BaseSiteLocalFactory().createInstallConfigurationModel();
config.setLocationURLString(url.toExternalForm());
config.setLabel(label);
config.resolve(url,getResourceBundle());
config.initialize();
-
// add the config
if (preserved) {
site.addPreservedInstallConfigurationModel(config);
} else {
site.addConfigurationModel(config);
}
-
// DEBUG:
if (UpdateManagerPlugin.DEBUG && UpdateManagerPlugin.DEBUG_SHOW_PARSING) {
UpdateManagerPlugin.getPlugin().debug("End Processing Config Tag: url:" + url.toExternalForm());
}
-
}
/*
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/BaseSiteLocalFactory.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/BaseSiteLocalFactory.java
new file mode 100644
index 0000000..2b66025
--- /dev/null
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/BaseSiteLocalFactory.java
@@ -0,0 +1,29 @@
+package org.eclipse.update.internal.core;
+/*
+ * (c) Copyright IBM Corp. 2000, 2002.
+ * All Rights Reserved.
+ */
+import org.eclipse.update.core.model.ConfigurationActivityModel;
+import org.eclipse.update.core.model.InstallConfigurationModel;
+
+/**
+ *
+ */
+
+public class BaseSiteLocalFactory {
+
+
+ /*
+ * @see SiteModelFactory#createSiteMapModel()
+ */
+ public InstallConfigurationModel createInstallConfigurationModel() {
+ return new InstallConfiguration();
+ }
+ /*
+ * @see SiteModelFactory#createFeatureReferenceModel()
+ */
+ public ConfigurationActivityModel createConfigurationAcivityModel() {
+ return new ConfigurationActivity();
+ }
+
+}
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/ConfigurationActivity.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/ConfigurationActivity.java
index 8b4a267..79fc4be 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/ConfigurationActivity.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/ConfigurationActivity.java
@@ -13,6 +13,9 @@
public class ConfigurationActivity extends ConfigurationActivityModel implements IActivity, IWritable {
+ public ConfigurationActivity(){
+ }
+
/**
* Constructor for ConfigurationActivityModel.
*/
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/ConfigurationPolicy.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/ConfigurationPolicy.java
index eae5e8b..869ada3 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/ConfigurationPolicy.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/ConfigurationPolicy.java
@@ -21,6 +21,7 @@
public class ConfigurationPolicy extends ConfigurationPolicyModel implements IConfigurationPolicy {
+
/**
* Constructor for ConfigurationPolicyModel.
*/
@@ -30,6 +31,17 @@
}
/**
+ * Copy Constructor for ConfigurationPolicyModel.
+ */
+ public ConfigurationPolicy(IConfigurationPolicy configPolicy) {
+ super();
+ setPolicy(configPolicy.getPolicy());
+ setConfiguredFeatureReferences(configPolicy.getConfiguredFeatures());
+ setUnconfiguredFeatureReferences(configPolicy.getUnconfiguredFeatures());
+ }
+
+
+ /**
* @since 2.0
*/
public boolean isConfigured(IFeatureReference feature) {
@@ -173,14 +185,18 @@
* @since 2.0
*/
public IFeatureReference[] getConfiguredFeatures() {
- return (IFeatureReference[])getConfiguredFeatures();
+ if (getConfiguredFeaturesModel().length==0)
+ return new IFeatureReference[0];
+ return (IFeatureReference[])getConfiguredFeaturesModel();
}
/**
* @since 2.0
*/
public IFeatureReference[] getUnconfiguredFeatures() {
- return (IFeatureReference[])getUnconfiguredFeatures();
+ if (getUnconfiguredFeaturesModel().length==0)
+ return new IFeatureReference[0];
+ return (IFeatureReference[])getUnconfiguredFeaturesModel();
}
}
\ No newline at end of file
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/ConfigurationSite.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/ConfigurationSite.java
index 72bf00a..431e58f 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/ConfigurationSite.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/ConfigurationSite.java
@@ -37,7 +37,8 @@
* Copy Constructor
*/
public ConfigurationSite(IConfigurationSite configSite) {
- this(configSite.getSite(),configSite.getConfigurationPolicy());
+ setSiteModel((SiteMapModel)configSite.getSite());
+ setConfigurationPolicyModel(new ConfigurationPolicy(configSite.getConfigurationPolicy()));
setInstallSite(configSite.isInstallSite());
}
@@ -200,9 +201,7 @@
* @see IConfigurationSite#getConfiguredFeatures()
*/
public IFeatureReference[] getConfiguredFeatures() {
- FeatureReferenceModel[] ref = getConfigurationPolicyModel().getConfiguredFeaturesModel();
- if (ref.length==0) return new IFeatureReference[0];
- return (IFeatureReference[])ref;
+ return ((ConfigurationPolicy) getConfigurationPolicyModel()).getConfiguredFeatures();
}
/**
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/InstallConfiguration.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/InstallConfiguration.java
index 680a47f..0aa25ff 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/InstallConfiguration.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/InstallConfiguration.java
@@ -11,11 +11,13 @@
import org.eclipse.core.boot.BootLoader;
import org.eclipse.core.boot.IPlatformConfiguration;
import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.model.ConfigurationPropertyModel;
import org.eclipse.update.core.*;
import org.eclipse.update.core.model.ConfigurationActivityModel;
import org.eclipse.update.core.model.ConfigurationSiteModel;
import org.eclipse.update.core.model.InstallConfigurationModel;
import org.eclipse.update.core.model.InstallConfigurationParser;
+import org.eclipse.update.core.model.SiteMapModel;
import org.xml.sax.SAXException;
/**
@@ -28,6 +30,9 @@
private ListenersList listeners = new ListenersList();
+ public InstallConfiguration(){
+ }
+
/**
* default constructor. Create
*/
@@ -38,21 +43,41 @@
resolve(newLocation,null);
}
- /**
+
+ /*
* copy constructor
*/
public InstallConfiguration(IInstallConfiguration config, URL newLocation, String label) throws MalformedURLException {
- super((InstallConfigurationModel)config,newLocation.toExternalForm(),label);
+ setLocationURLString(newLocation.toExternalForm());
+ setLabel(label);
+ // do not copy list of listeners nor activities
+ // ake a copy of the siteConfiguration object
+ if (config != null) {
+ IConfigurationSite[] sites = config.getConfigurationSites();
+ if (sites != null) {
+ for (int i = 0; i < sites.length; i++) {
+ ConfigurationSite configSite = new ConfigurationSite(sites[i]);
+ addConfigurationSiteModel(configSite);
+ }
+ }
+ }
+ // set dummy date as caller can call set date if the
+ // date on the URL string has to be the same
+ setCreationDate(new Date());
+ setCurrent(false);
resolve(newLocation,null);
}
+
/**
*
*/
public IConfigurationSite[] getConfigurationSites() {
- if (getConfigurationSitesModel().length==0)
+ ConfigurationSiteModel[] result = getConfigurationSitesModel();
+ if (result.length == 0)
return new IConfigurationSite[0];
- return (IConfigurationSite[])getConfigurationSitesModel();
+ else
+ return (IConfigurationSite[]) result;
}
@@ -217,7 +242,11 @@
*
*/
public void revertTo(IInstallConfiguration configuration, IProgressMonitor monitor, IProblemHandler handler) throws CoreException, InterruptedException {
+
+
IConfigurationSite[] oldConfigSites = configuration.getConfigurationSites();
+ IConfigurationSite[] nowConfigSites = this.getConfigurationSites();
+
// create a hashtable of the *old* sites
Map oldSitesMap = new Hashtable(0);
for (int i = 0; i < oldConfigSites.length; i++) {
@@ -225,26 +254,26 @@
oldSitesMap.put(element.getSite().getURL().toExternalForm(), element);
}
// create list of all the sites that map the *old* sites
- // we want the intersection between teh old sites and teh current sites
- if (getConfigurationSitesModel() != null) {
+ // we want the intersection between the old sites and the current sites
+ if (nowConfigSites != null) {
// for each current site, ask the old site
// to calculate the delta
- ConfigurationSiteModel[] currentSites = getConfigurationSitesModel();
String key = null;
- for (int i = 0; i < currentSites.length; i++) {
- IConfigurationSite element = (IConfigurationSite) currentSites[i];
- key = element.getSite().getURL().toExternalForm();
+ for (int i = 0; i < nowConfigSites.length; i++) {
+ key = nowConfigSites[i].getSite().getURL().toExternalForm();
IConfigurationSite oldSite = (IConfigurationSite) oldSitesMap.get(key);
if (oldSite != null) {
- ((ConfigurationSite) oldSite).deltaWith(element, monitor, handler);
+ ((ConfigurationSite) oldSite).deltaWith(nowConfigSites[i], monitor, handler);
}
}
// the new configuration has the exact same sites as the old configuration
+ // the old configuration in the Map are either as-is because they don't exist
+ // in the current one, or they are the delta from the current one to the old one
Collection sites = oldSitesMap.values();
- Iterator iter = sites.iterator();
- while (iter.hasNext()) {
- ConfigurationSiteModel element = (ConfigurationSiteModel) iter.next();
- addConfigurationSiteModel(element);
+ if (sites!=null && !sites.isEmpty()){
+ ConfigurationSiteModel[] sitesModel = new ConfigurationSiteModel[sites.size()];
+ sites.toArray(sitesModel);
+ setConfigurationSiteModel(sitesModel);
}
}
}
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteLocal.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteLocal.java
index 8681498..992ef93 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteLocal.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/SiteLocal.java
@@ -1,7 +1,7 @@
package org.eclipse.update.internal.core;
/*
* (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
+ * All Rights Reserved.
*/
import java.io.*;
import java.net.MalformedURLException;
@@ -34,18 +34,18 @@
* is shared between the workspaces.
*/
public static ILocalSite getLocalSite() throws CoreException {
- URL configXml = null;
+ URL configXML = null;
SiteLocal site = null;
try {
site = new SiteLocal();
IPlatformConfiguration platformConfig = BootLoader.getCurrentPlatformConfiguration();
URL location = Platform.resolve(platformConfig.getConfigurationLocation());
- site.setLocationURLString(location.toExternalForm());
- site.resolve(location, null);
- configXml = UpdateManagerUtils.getURL(location, SITE_LOCAL_FILE, null);
+ configXML = UpdateManagerUtils.getURL(location, SITE_LOCAL_FILE, null);
+ site.setLocationURLString(configXML.toExternalForm());
+ site.resolve(configXML, null);
//if the file exists, parse it
- new SiteLocalParser(configXml.openStream(), site);
+ new SiteLocalParser(configXML.openStream(), site);
} catch (FileNotFoundException exception) {
// file doesn't exist, ok, log it and continue
// log no config
@@ -65,7 +65,7 @@
throw new CoreException(status);
} catch (IOException exception) {
String id = UpdateManagerPlugin.getPlugin().getDescriptor().getUniqueIdentifier();
- IStatus status = new Status(IStatus.ERROR, id, IStatus.OK, "Cannot read xml file: " + configXml, exception);
+ IStatus status = new Status(IStatus.ERROR, id, IStatus.OK, "Cannot read xml file: " + configXML, exception);
throw new CoreException(status);
}
@@ -86,7 +86,7 @@
//FIXME: the plugin site may not be read-write
//the default is USER_EXCLUDE
ConfigurationSite configSite = (ConfigurationSite) SiteManager.createConfigurationSite(site, IPlatformConfiguration.ISitePolicy.USER_EXCLUDE);
- configSite.setInstallSite(true);
+ configSite.setInstallSite(siteEntries[siteIndex].isUpdateable());
localSite.getCurrentConfiguration().addConfigurationSite(configSite);
}
@@ -271,7 +271,7 @@
// pass the date onto teh name
if (name == null)
name = currentDate.toString();
- result = new InstallConfiguration((IInstallConfiguration) getCurrentConfigurationModel(), newFile, name);
+ result = new InstallConfiguration(getCurrentConfiguration(), newFile, name);
// set teh same date in the installConfig
result.setCreationDate(currentDate);
} catch (MalformedURLException e) {
@@ -429,9 +429,12 @@
* @see ILocalSite#getCurrentConfiguration()
*/
public IInstallConfiguration getCurrentConfiguration() {
- if (getCurrentConfigurationModel() == null)
- return null;
- return (IInstallConfiguration) getCurrentConfiguration();
+ if (getCurrentConfigurationModel() == null){
+ int index = 0;
+ if ((index = getConfigurationHistoryModel().length)==0) return null;
+ setCurrentConfigurationModel(getConfigurationHistoryModel()[index-1]);
+ }
+ return (IInstallConfiguration) getCurrentConfigurationModel();
}
/*
diff --git a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/api/TestSiteManagerAPI.java b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/api/TestSiteManagerAPI.java
index b08eb6f..5e7cc56 100644
--- a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/api/TestSiteManagerAPI.java
+++ b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/api/TestSiteManagerAPI.java
@@ -56,8 +56,9 @@
UpdateManagerUtils.removeFromFileSystem(file);
file = new File(instSites[0].getSite().getURL().getFile()+File.separator+Site.DEFAULT_PLUGIN_PATH+"org.eclipse.update.plugin1_1.1.1");
UpdateManagerUtils.removeFromFileSystem(file);
- File localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),SiteLocal.SITE_LOCAL_FILE).getFile());
- UpdateManagerUtils.removeFromFileSystem(localFile);
+ File localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocationURL(),SiteLocal.SITE_LOCAL_FILE).getFile());
+ UpdateManagerUtils.removeFromFileSystem(localFile);
+ UpdateManagerUtils.removeFromFileSystem(new File(site.getCurrentConfiguration().getURL().getFile()));
}
diff --git a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/configurations/TestRevert.java b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/configurations/TestRevert.java
index a64ec6e..2bad8b5 100644
--- a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/configurations/TestRevert.java
+++ b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/configurations/TestRevert.java
@@ -27,8 +27,10 @@
public void testSimpleRevertInstall() throws Exception {
// cleanup
- File localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),SiteLocal.SITE_LOCAL_FILE).getFile());
+ SiteLocal siteLocal = ((SiteLocal)SiteManager.getLocalSite());
+ File localFile = new File(new URL(siteLocal.getLocationURL(),SiteLocal.SITE_LOCAL_FILE).getFile());
UpdateManagerUtils.removeFromFileSystem(localFile);
+ UpdateManagerUtils.removeFromFileSystem(new File(siteLocal.getCurrentConfiguration().getURL().getFile()));
InternalSiteManager.localSite=null;
ILocalSite site = SiteManager.getLocalSite();
@@ -60,7 +62,7 @@
// check
// there are 4 configuration
String time = ""+site.getCurrentConfiguration().getCreationDate().getTime();
- File file = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),"Config"+time+".xml").getFile());
+ File file = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocationURL(),"Config"+time+".xml").getFile());
assertTrue("new configuration does not exist", file.exists());
@@ -75,16 +77,16 @@
assertTrue("wrong number of unconfigured features",site.getCurrentConfiguration().getConfigurationSites()[0].getConfigurationPolicy().getUnconfiguredFeatures().length==2);
// cleanup
- localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),SiteLocal.SITE_LOCAL_FILE).getFile());
+ localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocationURL(),SiteLocal.SITE_LOCAL_FILE).getFile());
UpdateManagerUtils.removeFromFileSystem(localFile);
- localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),SiteLocal.DEFAULT_CONFIG_FILE).getFile());
+ localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocationURL(),SiteLocal.DEFAULT_CONFIG_FILE).getFile());
UpdateManagerUtils.removeFromFileSystem(localFile);
UpdateManagerUtils.removeFromFileSystem(file);
time = ""+newConfig.getCreationDate().getTime();
- file = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),"DefaultConfig"+time+".xml").getFile());
+ file = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocationURL(),"DefaultConfig"+time+".xml").getFile());
UpdateManagerUtils.removeFromFileSystem(file);
time = ""+newConfig2.getCreationDate().getTime();
- file = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),"DefaultConfig"+time+".xml").getFile());
+ file = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocationURL(),"DefaultConfig"+time+".xml").getFile());
UpdateManagerUtils.removeFromFileSystem(file);
}
diff --git a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestInstall.java b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestInstall.java
index caadd8f..644eb4a 100644
--- a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestInstall.java
+++ b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestInstall.java
@@ -115,7 +115,7 @@
boolean found = false;
for (int i = 0; i < localFeatures.length; i++) {
- if (features[i].getURL().toExternalForm().endsWith("features2.jar")) {
+ if (localFeatures[i].getURL().toExternalForm().endsWith("features2.jar")) {
found= true;
break;
}
@@ -146,7 +146,7 @@
public void testInstall() throws Exception {
// cleanup local files...
- File localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),SiteLocal.SITE_LOCAL_FILE).getFile());
+ File localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocationURL(),SiteLocal.SITE_LOCAL_FILE).getFile());
UpdateManagerUtils.removeFromFileSystem(localFile);
@@ -196,7 +196,8 @@
File file = new File(site.getSite().getURL().getFile()+File.separator+Site.INSTALL_FEATURE_PATH+remoteFeature.getVersionIdentifier());
UpdateManagerUtils.removeFromFileSystem(file);
UpdateManagerUtils.removeFromFileSystem(pluginFile);
- UpdateManagerUtils.removeFromFileSystem(localFile);
+ UpdateManagerUtils.removeFromFileSystem(localFile);
+ UpdateManagerUtils.removeFromFileSystem(new File(localSite.getCurrentConfiguration().getURL().getFile()));
site.getSite().removeSiteChangedListener(listener);
assertTrue("Listener hasn't received notification",listener.isNotified());
@@ -221,7 +222,7 @@
UpdateManagerUtils.removeFromFileSystem(file);
file = new File(localSite.getSite().getURL().getFile()+File.separator+Site.DEFAULT_PLUGIN_PATH+"org.eclipse.update.core.tests.feature1.plugin2_5.0.0");
UpdateManagerUtils.removeFromFileSystem(file);
- File localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),SiteLocal.SITE_LOCAL_FILE).getFile());
+ File localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocationURL(),SiteLocal.SITE_LOCAL_FILE).getFile());
UpdateManagerUtils.removeFromFileSystem(localFile);
try {
diff --git a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestInstallURLSIteXML.java b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestInstallURLSIteXML.java
index d9d7af9..c0bcc81 100644
--- a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestInstallURLSIteXML.java
+++ b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestInstallURLSIteXML.java
@@ -148,7 +148,7 @@
public void testInstall() throws Exception {
// cleanup local files...
- File localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),SiteLocal.SITE_LOCAL_FILE).getFile());
+ File localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocationURL(),SiteLocal.SITE_LOCAL_FILE).getFile());
UpdateManagerUtils.removeFromFileSystem(localFile);
@@ -198,7 +198,8 @@
File file = new File(site.getSite().getURL().getFile()+File.separator+Site.INSTALL_FEATURE_PATH+remoteFeature.getVersionIdentifier());
UpdateManagerUtils.removeFromFileSystem(file);
UpdateManagerUtils.removeFromFileSystem(pluginFile);
- UpdateManagerUtils.removeFromFileSystem(localFile);
+ UpdateManagerUtils.removeFromFileSystem(localFile);
+ UpdateManagerUtils.removeFromFileSystem(new File(localSite.getCurrentConfiguration().getURL().getFile()));
site.getSite().removeSiteChangedListener(listener);
assertTrue("Listener hasn't received notification",listener.isNotified());
@@ -223,7 +224,7 @@
UpdateManagerUtils.removeFromFileSystem(file);
file = new File(localSite.getSite().getURL().getFile()+File.separator+Site.DEFAULT_PLUGIN_PATH+"org.eclipse.update.core.tests.feature1.plugin2_5.0.0");
UpdateManagerUtils.removeFromFileSystem(file);
- File localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),SiteLocal.SITE_LOCAL_FILE).getFile());
+ File localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocationURL(),SiteLocal.SITE_LOCAL_FILE).getFile());
UpdateManagerUtils.removeFromFileSystem(localFile);
try {
diff --git a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestLocalSite.java b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestLocalSite.java
index 917e36d..472cdc0 100644
--- a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestLocalSite.java
+++ b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularInstall/TestLocalSite.java
@@ -23,17 +23,19 @@
public void testCreationConfigFile() throws Exception {
//clean up
- URL newURL = new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),SiteLocal.SITE_LOCAL_FILE);
+ SiteLocal siteLocal = (SiteLocal)SiteManager.getLocalSite();
+ URL newURL = new URL(siteLocal.getLocationURL(),SiteLocal.SITE_LOCAL_FILE);
File localFile = UpdateManagerUtils.decodeFile(newURL);
- UpdateManagerUtils.removeFromFileSystem(localFile);
+ UpdateManagerUtils.removeFromFileSystem(localFile);
+ UpdateManagerUtils.removeFromFileSystem(new File(siteLocal.getCurrentConfiguration().getURL().getFile()));
InternalSiteManager.localSite=null;
ILocalSite site = SiteManager.getLocalSite();
// FIXME should check for any name
- //assertTrue("the local site already contains a config state, test cannot be executed",site.getCurrentConfiguration().getLabel().equals(SiteLocal.DEFAULT_CONFIG_LABEL));
+ //assertTrue("the local site already contains a config state, test cannot be executed",site.getCurrentConfiguration().getLabel().equals(SiteLocalModel.DEFAULT_CONFIG_LABEL));
site.save();
- URL location = ((SiteLocal)site).getLocation();
+ URL location = ((SiteLocal)site).getLocationURL();
String fileName = UpdateManagerUtils.getLocalRandomIdentifier(SiteLocal.DEFAULT_CONFIG_FILE, site.getCurrentConfiguration().getCreationDate());
String filePath = UpdateManagerUtils.decode(new URL(location,fileName));
File file = new File(filePath);
@@ -50,13 +52,16 @@
public void testDefaultConfigFile() throws Exception {
//clean up
- File localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),SiteLocal.SITE_LOCAL_FILE).getFile());
- UpdateManagerUtils.removeFromFileSystem(localFile);
+ SiteLocal siteLocal = (SiteLocal)SiteManager.getLocalSite();
+ URL newURL = new URL(siteLocal.getLocationURL(),SiteLocal.SITE_LOCAL_FILE);
+ File localFile = UpdateManagerUtils.decodeFile(newURL);
+ UpdateManagerUtils.removeFromFileSystem(localFile);
+ UpdateManagerUtils.removeFromFileSystem(new File(siteLocal.getCurrentConfiguration().getURL().getFile()));
InternalSiteManager.localSite=null;
ILocalSite site = SiteManager.getLocalSite();
// FIXME shoudl check for any name
- //assertTrue("the local site already contains a config state, test cannot be executed",site.getCurrentConfiguration().getLabel().equals(SiteLocal.DEFAULT_CONFIG_LABEL));
+ //assertTrue("the local site already contains a config state, test cannot be executed",site.getCurrentConfiguration().getLabel().equals(SiteLocalModel.DEFAULT_CONFIG_LABEL));
assertTrue("The local site does not contain an history of install configuration",site.getConfigurationHistory().length!=0);
assertTrue("The local site does not contain an current install configuration",site.getCurrentConfiguration()!=null);
assertTrue("The local site does not contain a default configuration site for the current install config",site.getCurrentConfiguration().getConfigurationSites().length!=0);
@@ -64,7 +69,7 @@
System.out.println("Default Config Site is :"+site.getCurrentConfiguration().getConfigurationSites()[0].getSite().getURL().toExternalForm());
// cleanup
- URL location = ((SiteLocal)site).getLocation();
+ URL location = ((SiteLocal)site).getLocationURL();
String filePath = new URL(location,SiteLocal.DEFAULT_CONFIG_FILE).getFile();
File file = new File(filePath);
UpdateManagerUtils.removeFromFileSystem(file);
@@ -75,9 +80,12 @@
public void testInstallFeatureSaveConfig() throws Exception {
- // cleanup
- File localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),SiteLocal.SITE_LOCAL_FILE).getFile());
- UpdateManagerUtils.removeFromFileSystem(localFile);
+ //clean up
+ SiteLocal siteLocal = (SiteLocal)SiteManager.getLocalSite();
+ URL newURL = new URL(siteLocal.getLocationURL(),SiteLocal.SITE_LOCAL_FILE);
+ File localFile = UpdateManagerUtils.decodeFile(newURL);
+ UpdateManagerUtils.removeFromFileSystem(localFile);
+ UpdateManagerUtils.removeFromFileSystem(new File(siteLocal.getCurrentConfiguration().getURL().getFile()));
InternalSiteManager.localSite=null;
ILocalSite site = SiteManager.getLocalSite();
@@ -126,29 +134,32 @@
// check
// there are 2 configuration
String time = ""+site.getCurrentConfiguration().getCreationDate().getTime();
- File file = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),"Config"+time+".xml").getFile());
+ URL location = ((SiteLocal)site).getLocationURL();
+ File file = new File(new URL(location,"Config"+time+".xml").getFile());
assertTrue("new configuration does not exist", file.exists());
// cleanup
- localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),SiteLocal.SITE_LOCAL_FILE).getFile());
+ localFile = new File(new URL(location,SiteLocal.SITE_LOCAL_FILE).getFile());
UpdateManagerUtils.removeFromFileSystem(localFile);
- localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),SiteLocal.DEFAULT_CONFIG_FILE).getFile());
+ localFile = new File(new URL(location,SiteLocal.DEFAULT_CONFIG_FILE).getFile());
UpdateManagerUtils.removeFromFileSystem(localFile);
- localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),Site.DEFAULT_FEATURE_PATH+File.separator+feature.getVersionIdentifier().toString()).getFile());
+ localFile = new File(new URL(location,Site.DEFAULT_FEATURE_PATH+File.separator+feature.getVersionIdentifier().toString()).getFile());
UpdateManagerUtils.removeFromFileSystem(localFile);
- localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),Site.DEFAULT_FEATURE_PATH+File.separator+feature2.getVersionIdentifier().toString()).getFile());
+ localFile = new File(new URL(location,Site.DEFAULT_FEATURE_PATH+File.separator+feature2.getVersionIdentifier().toString()).getFile());
UpdateManagerUtils.removeFromFileSystem(localFile);
UpdateManagerUtils.removeFromFileSystem(file);
localFile = new File(feature2.getURL().getFile());
UpdateManagerUtils.removeFromFileSystem(localFile);
-
}
public void testRetriveConfig() throws Exception {
- // cleanup
- File localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),SiteLocal.SITE_LOCAL_FILE).getFile());
- UpdateManagerUtils.removeFromFileSystem(localFile);
+ //clean up
+ SiteLocal siteLocal = (SiteLocal)SiteManager.getLocalSite();
+ URL newURL = new URL(siteLocal.getLocationURL(),SiteLocal.SITE_LOCAL_FILE);
+ File localFile = UpdateManagerUtils.decodeFile(newURL);
+ UpdateManagerUtils.removeFromFileSystem(localFile);
+ UpdateManagerUtils.removeFromFileSystem(new File(siteLocal.getCurrentConfiguration().getURL().getFile()));
InternalSiteManager.localSite=null;
ILocalSite site = SiteManager.getLocalSite();
@@ -173,7 +184,8 @@
// check
// there are 2 configuration
String time = ""+site.getCurrentConfiguration().getCreationDate().getTime();
- File file = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),"Config"+time+".xml").getFile());
+ URL location = ((SiteLocal)site).getLocationURL();
+ File file = new File(new URL(location,"Config"+time+".xml").getFile());
assertTrue("new configuration does not exist", file.exists());
// teh current one points to a real fature
@@ -199,21 +211,24 @@
// cleanup
- localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),SiteLocal.SITE_LOCAL_FILE).getFile());
+ localFile = new File(new URL(location,SiteLocal.SITE_LOCAL_FILE).getFile());
UpdateManagerUtils.removeFromFileSystem(localFile);
- localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),SiteLocal.DEFAULT_CONFIG_FILE).getFile());
+ localFile = new File(new URL(location,SiteLocal.DEFAULT_CONFIG_FILE).getFile());
UpdateManagerUtils.removeFromFileSystem(localFile);
- localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),Site.DEFAULT_FEATURE_PATH+File.separator+feature.getVersionIdentifier().toString()).getFile());
+ localFile = new File(new URL(location,Site.DEFAULT_FEATURE_PATH+File.separator+feature.getVersionIdentifier().toString()).getFile());
UpdateManagerUtils.removeFromFileSystem(localFile);
-
+ UpdateManagerUtils.removeFromFileSystem(new File(site.getCurrentConfiguration().getURL().getFile()));
UpdateManagerUtils.removeFromFileSystem(file);
}
public void testRetriveConfigHTTPInstall() throws Exception {
- // cleanup
- File localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),SiteLocal.SITE_LOCAL_FILE).getFile());
- UpdateManagerUtils.removeFromFileSystem(localFile);
+ //clean up
+ SiteLocal siteLocal = (SiteLocal)SiteManager.getLocalSite();
+ URL newURL = new URL(siteLocal.getLocationURL(),SiteLocal.SITE_LOCAL_FILE);
+ File localFile = UpdateManagerUtils.decodeFile(newURL);
+ UpdateManagerUtils.removeFromFileSystem(localFile);
+ UpdateManagerUtils.removeFromFileSystem(new File(siteLocal.getCurrentConfiguration().getURL().getFile()));
InternalSiteManager.localSite=null;
ILocalSite site = SiteManager.getLocalSite();
@@ -237,7 +252,8 @@
// check
// there are 2 configuration
String time = ""+site.getCurrentConfiguration().getCreationDate().getTime();
- File file = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),"Config"+time+".xml").getFile());
+ URL location = ((SiteLocal)site).getLocationURL();
+ File file = new File(new URL(location,"Config"+time+".xml").getFile());
assertTrue("new configuration does not exist", file.exists());
// teh current one points to a real fature
@@ -263,13 +279,13 @@
// cleanup
- localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),SiteLocal.SITE_LOCAL_FILE).getFile());
+ localFile = new File(new URL(location,SiteLocal.SITE_LOCAL_FILE).getFile());
UpdateManagerUtils.removeFromFileSystem(localFile);
- localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),SiteLocal.DEFAULT_CONFIG_FILE).getFile());
+ localFile = new File(new URL(location,SiteLocal.DEFAULT_CONFIG_FILE).getFile());
UpdateManagerUtils.removeFromFileSystem(localFile);
- localFile = new File(new URL(((SiteLocal)SiteManager.getLocalSite()).getLocation(),Site.DEFAULT_FEATURE_PATH+File.separator+feature.getVersionIdentifier().toString()).getFile());
+ localFile = new File(new URL(location,Site.DEFAULT_FEATURE_PATH+File.separator+feature.getVersionIdentifier().toString()).getFile());
UpdateManagerUtils.removeFromFileSystem(localFile);
-
+ UpdateManagerUtils.removeFromFileSystem(new File(site.getCurrentConfiguration().getURL().getFile()));
UpdateManagerUtils.removeFromFileSystem(file);
localFile = new File(feature2.getURL().getFile());
UpdateManagerUtils.removeFromFileSystem(localFile);
diff --git a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularRemove/TestRemove.java b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularRemove/TestRemove.java
index b830d58..6fa2b62 100644
--- a/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularRemove/TestRemove.java
+++ b/update/org.eclipse.update.tests.core/src/org/eclipse/update/tests/regularRemove/TestRemove.java
@@ -86,7 +86,6 @@
File featureFile = new File(site, Site.INSTALL_FEATURE_PATH +featureRef);
assertTrue("feature info installed locally:"+featureFile, !featureFile.exists());
-
}