Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

Commit

Permalink
Add installation of one p2 site at once, fixes #2140
Browse files Browse the repository at this point in the history
Signed-off-by: Ondrej Dockal <[email protected]>
  • Loading branch information
odockal committed Oct 27, 2021
1 parent fe3d3c9 commit 738e264
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/org.eclipse.reddeer.integration.test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
</parent>

<properties>
<customArgLine>-Dupdate.site=${update.site}</customArgLine>
<customArgLine>-Dupdate.site=${update.site} -Dp2.only=${p2.only}</customArgLine>
<update.site></update.site>
<p2.only></p2.only>
<eclipseProfile>epp.package.jee</eclipseProfile>
<testProduct>org.eclipse.platform.ide</testProduct>
<skipITests>true</skipITests>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@

import org.eclipse.reddeer.integration.test.installation.common.dialog.InstallNewSoftwareDialog;
import org.eclipse.reddeer.integration.test.installation.common.page.AvailableSoftwarePage;
import org.eclipse.reddeer.integration.test.installation.common.preferences.AvailableSoftwareSitesPreferencePage;
import org.eclipse.reddeer.integration.test.installation.common.util.InstallationOperator;
import org.eclipse.reddeer.jface.preference.PreferencePage;
import org.eclipse.reddeer.junit.runner.RedDeerSuite;
import org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ErrorCollector;
Expand All @@ -30,9 +34,24 @@
public class InstallSoftwareFromUpdateSiteTest {

private static final String UPDATE_SITE = System.getProperty("update.site");
private static final String P2_ONLY_PROP = "p2.only";

@Rule
public ErrorCollector collector = new ErrorCollector();

@BeforeClass
public static void prepareTestEnv() {
if(Boolean.getBoolean(P2_ONLY_PROP)) {
System.out.println("System prop. p2.only: " + Boolean.getBoolean(P2_ONLY_PROP));
WorkbenchPreferenceDialog dialog = new WorkbenchPreferenceDialog();
dialog.open();
AvailableSoftwareSitesPreferencePage page = new AvailableSoftwareSitesPreferencePage(dialog);
dialog.select(page);
page.getItems().stream().forEach(item -> System.out.println(item.getText()));
page.toggleAllItems(false);
dialog.ok();
}
}

@Test
public void testInstallFromUpdateSite() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*******************************************************************************
* Copyright (c) 2017 Red Hat, Inc and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Red Hat, Inc - initial API and implementation
*******************************************************************************/
package org.eclipse.reddeer.integration.test.installation.common.preferences;

import java.util.List;

import org.eclipse.reddeer.core.reference.ReferencedComposite;
import org.eclipse.reddeer.jface.preference.PreferencePage;
import org.eclipse.reddeer.swt.api.TableItem;
import org.eclipse.reddeer.swt.impl.table.DefaultTable;

/**
* Represents a Install/Update -> Available Update Sites preference page.
*
* @author Ondrej Dockal
*/
public class AvailableSoftwareSitesPreferencePage extends PreferencePage {

public AvailableSoftwareSitesPreferencePage(ReferencedComposite referencedComposite) {
super(referencedComposite, new String[] {"Install/Update", "Available Software Sites"});
}

public List<TableItem> getItems() {
return new DefaultTable().getItems();
}

public void toggleAllItems(boolean toggle) {
for(TableItem item: getItems()) {
item.setChecked(toggle);
}
}

}

0 comments on commit 738e264

Please sign in to comment.