Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSusan Franklin2009-01-31 18:18:02 +0000
committerSusan Franklin2009-01-31 18:18:02 +0000
commitca6ae3c36109dcc4c60a66f9d9e201dffc84caa9 (patch)
treee6fa07c06fe7ca5bb54ae496846bd9fd058c4977 /bundles/org.eclipse.equinox.p2.ui.admin
parent9afee478cc4c32442b36c173cb0930ac7af5d288 (diff)
downloadrt.equinox.p2-ca6ae3c36109dcc4c60a66f9d9e201dffc84caa9.tar.gz
rt.equinox.p2-ca6ae3c36109dcc4c60a66f9d9e201dffc84caa9.tar.xz
rt.equinox.p2-ca6ae3c36109dcc4c60a66f9d9e201dffc84caa9.zip
Bug 204470 - [prov] [ui] Test cases
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.ui.admin')
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/AddArtifactRepositoryOperation.java39
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/AddMetadataRepositoryOperation.java39
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RefreshArtifactRepositoriesOperation.java50
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RefreshMetadataRepositoriesOperation.java52
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RemoveArtifactRepositoryOperation.java39
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RemoveMetadataRepositoryOperation.java39
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/AddArtifactRepositoryDialog.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/AddMetadataRepositoryDialog.java3
8 files changed, 262 insertions, 1 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/AddArtifactRepositoryOperation.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/AddArtifactRepositoryOperation.java
new file mode 100644
index 000000000..cc0b4a4eb
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/AddArtifactRepositoryOperation.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui.admin;
+
+import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
+import org.eclipse.equinox.internal.provisional.p2.ui.operations.RepositoryOperation;
+
+import java.net.URI;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
+
+/**
+ * Operation which adds an artifact repository given its URL.
+ *
+ * @since 3.4
+ */
+public class AddArtifactRepositoryOperation extends RepositoryOperation {
+
+ public AddArtifactRepositoryOperation(String label, URI location) {
+ super(label, new URI[] {location});
+ }
+
+ protected IStatus doBatchedExecute(IProgressMonitor monitor) throws ProvisionException {
+ SubMonitor mon = SubMonitor.convert(monitor, locations.length);
+ for (int i = 0; i < locations.length; i++) {
+ ProvisioningUtil.addArtifactRepository(locations[i], notify);
+ mon.worked(1);
+ }
+ return okStatus();
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/AddMetadataRepositoryOperation.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/AddMetadataRepositoryOperation.java
new file mode 100644
index 000000000..5e1f34008
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/AddMetadataRepositoryOperation.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui.admin;
+
+import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
+import org.eclipse.equinox.internal.provisional.p2.ui.operations.RepositoryOperation;
+
+import java.net.URI;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
+
+/**
+ * Operation that adds a metadata repository given its URL.
+ *
+ * @since 3.4
+ */
+public class AddMetadataRepositoryOperation extends RepositoryOperation {
+
+ public AddMetadataRepositoryOperation(String label, URI location) {
+ super(label, new URI[] {location});
+ }
+
+ protected IStatus doBatchedExecute(IProgressMonitor monitor) throws ProvisionException {
+ SubMonitor mon = SubMonitor.convert(monitor, locations.length);
+ for (int i = 0; i < locations.length; i++) {
+ ProvisioningUtil.addMetadataRepository(locations[i], notify);
+ mon.worked(1);
+ }
+ return okStatus();
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RefreshArtifactRepositoriesOperation.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RefreshArtifactRepositoriesOperation.java
new file mode 100644
index 000000000..cb0f86a34
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RefreshArtifactRepositoriesOperation.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.equinox.internal.p2.ui.admin;
+
+import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
+import org.eclipse.equinox.internal.provisional.p2.ui.operations.RepositoryOperation;
+
+import java.net.URI;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
+import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
+import org.eclipse.ui.statushandlers.StatusManager;
+
+/**
+ * @since 3.4
+ *
+ */
+public class RefreshArtifactRepositoriesOperation extends RepositoryOperation {
+
+ /**
+ * @param label
+ * @param locations
+ */
+ public RefreshArtifactRepositoriesOperation(String label, URI[] locations) {
+ super(label, locations);
+ }
+
+ public RefreshArtifactRepositoriesOperation(String label, int flags) {
+ super(label, new URI[0]);
+ try {
+ this.locations = ProvisioningUtil.getArtifactRepositories(flags);
+ } catch (ProvisionException e) {
+ ProvUI.handleException(e, null, StatusManager.LOG);
+ }
+ }
+
+ protected IStatus doBatchedExecute(IProgressMonitor monitor) throws ProvisionException {
+ ProvisioningUtil.refreshArtifactRepositories(locations, monitor);
+ return Status.OK_STATUS;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RefreshMetadataRepositoriesOperation.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RefreshMetadataRepositoriesOperation.java
new file mode 100644
index 000000000..d338d2c8d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RefreshMetadataRepositoriesOperation.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.equinox.internal.p2.ui.admin;
+
+import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
+import org.eclipse.equinox.internal.provisional.p2.ui.operations.RepositoryOperation;
+
+import java.net.URI;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
+import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
+import org.eclipse.ui.statushandlers.StatusManager;
+
+/**
+ * @since 3.4
+ *
+ */
+public class RefreshMetadataRepositoriesOperation extends RepositoryOperation {
+
+ /**
+ * @param label
+ * @param locations
+ */
+ public RefreshMetadataRepositoriesOperation(String label, URI[] locations) {
+ super(label, locations);
+ }
+
+ public RefreshMetadataRepositoriesOperation(String label, int flags) {
+ super(label, new URI[0]);
+ try {
+ this.locations = ProvisioningUtil.getMetadataRepositories(flags);
+ } catch (ProvisionException e) {
+ ProvUI.handleException(e, null, StatusManager.LOG);
+ }
+ }
+
+ protected IStatus doBatchedExecute(IProgressMonitor monitor) throws ProvisionException {
+ // Clear the not found cache so that repos not found are reported again.
+ ProvUI.clearRepositoriesNotFound();
+ ProvisioningUtil.refreshMetadataRepositories(locations, monitor);
+ return Status.OK_STATUS;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RemoveArtifactRepositoryOperation.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RemoveArtifactRepositoryOperation.java
new file mode 100644
index 000000000..991876bf9
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RemoveArtifactRepositoryOperation.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui.admin;
+
+import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
+import org.eclipse.equinox.internal.provisional.p2.ui.operations.RepositoryOperation;
+
+import java.net.URI;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
+
+/**
+ * Operation which removes the artifact repository with the given URL.
+ *
+ * @since 3.4
+ */
+public class RemoveArtifactRepositoryOperation extends RepositoryOperation {
+
+ public RemoveArtifactRepositoryOperation(String label, URI[] repoLocations) {
+ super(label, repoLocations);
+ }
+
+ protected IStatus doBatchedExecute(IProgressMonitor monitor) throws ProvisionException {
+ SubMonitor mon = SubMonitor.convert(monitor, locations.length);
+ for (int i = 0; i < locations.length; i++) {
+ ProvisioningUtil.removeArtifactRepository(locations[i]);
+ mon.worked(1);
+ }
+ return okStatus();
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RemoveMetadataRepositoryOperation.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RemoveMetadataRepositoryOperation.java
new file mode 100644
index 000000000..2bf5322f0
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/RemoveMetadataRepositoryOperation.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui.admin;
+
+import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
+import org.eclipse.equinox.internal.provisional.p2.ui.operations.RepositoryOperation;
+
+import java.net.URI;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
+
+/**
+ * Operation that removes the metadata repository with the given URL. *
+ *
+ * @since 3.4
+ */
+public class RemoveMetadataRepositoryOperation extends RepositoryOperation {
+
+ public RemoveMetadataRepositoryOperation(String label, URI[] repoLocations) {
+ super(label, repoLocations);
+ }
+
+ protected IStatus doBatchedExecute(IProgressMonitor monitor) throws ProvisionException {
+ SubMonitor mon = SubMonitor.convert(monitor, locations.length);
+ for (int i = 0; i < locations.length; i++) {
+ ProvisioningUtil.removeMetadataRepository(locations[i]);
+ mon.worked(1);
+ }
+ return okStatus();
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/AddArtifactRepositoryDialog.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/AddArtifactRepositoryDialog.java
index 58637e7ae..7d19e1312 100644
--- a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/AddArtifactRepositoryDialog.java
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/AddArtifactRepositoryDialog.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.admin.dialogs;
+import org.eclipse.equinox.internal.p2.ui.admin.AddArtifactRepositoryOperation;
+
import java.net.URI;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.ui.admin.ProvAdminUIActivator;
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/AddMetadataRepositoryDialog.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/AddMetadataRepositoryDialog.java
index 7dc22d60c..ad3352be1 100644
--- a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/AddMetadataRepositoryDialog.java
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/AddMetadataRepositoryDialog.java
@@ -10,10 +10,11 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.admin.dialogs;
+import org.eclipse.equinox.internal.p2.ui.admin.AddMetadataRepositoryOperation;
+
import java.net.URI;
import org.eclipse.equinox.internal.p2.ui.admin.ProvAdminUIMessages;
import org.eclipse.equinox.internal.provisional.p2.ui.dialogs.AddRepositoryDialog;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.AddMetadataRepositoryOperation;
import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningOperation;
import org.eclipse.swt.widgets.Shell;

Back to the top